[Bedework-commit] dumprestore r210 - in
trunk/src/org/bedework/dumprestore/dump: . dumpling
svnadmin at bedework.org
svnadmin at bedework.org
Wed Jun 11 11:12:12 EDT 2008
Author: douglm
Date: 2008-06-11 11:12:11 -0400 (Wed, 11 Jun 2008)
New Revision: 210
Modified:
trunk/src/org/bedework/dumprestore/dump/DumpIntf.java
trunk/src/org/bedework/dumprestore/dump/HibDump.java
trunk/src/org/bedework/dumprestore/dump/dumpling/DumpCalendars.java
Log:
Fix the calendars empty check. Add some code to the dump restore which could be used if we want to handle all the children fetches ourselves.
Add a further test to ensure we really do havea correct empty check.
Modified: trunk/src/org/bedework/dumprestore/dump/DumpIntf.java
===================================================================
--- trunk/src/org/bedework/dumprestore/dump/DumpIntf.java 2008-06-04 20:45:57 UTC (rev 209)
+++ trunk/src/org/bedework/dumprestore/dump/DumpIntf.java 2008-06-11 15:12:11 UTC (rev 210)
@@ -28,8 +28,10 @@
*/
package org.bedework.dumprestore.dump;
+import org.bedework.calfacade.BwCalendar;
import org.bedework.calfacade.svc.EventInfo;
+import java.util.Collection;
import java.util.Iterator;
/** Interface which defines the dataabse functions needed to dump the
@@ -111,13 +113,20 @@
*/
public Iterator getAuthUsers() throws Throwable;
- /** Will return an Iterator returning BwCalendar objects.
+ /** Will return an Iterator returning the top level BwCalendar objects.
*
* @return Iterator over entities
* @throws Throwable
*/
public Iterator getCalendars() throws Throwable;
+ /**
+ * @param val
+ * @return Children of val
+ * @throws Throwable
+ */
+ public Collection<BwCalendar> getChildren(BwCalendar val) throws Throwable;
+
/** Will return an Iterator returning BwCalSuite objects.
*
* @return Iterator over entities
Modified: trunk/src/org/bedework/dumprestore/dump/HibDump.java
===================================================================
--- trunk/src/org/bedework/dumprestore/dump/HibDump.java 2008-06-04 20:45:57 UTC (rev 209)
+++ trunk/src/org/bedework/dumprestore/dump/HibDump.java 2008-06-11 15:12:11 UTC (rev 210)
@@ -28,6 +28,7 @@
*/
package org.bedework.dumprestore.dump;
+import org.bedework.calfacade.BwCalendar;
import org.bedework.calfacade.BwCategory;
import org.bedework.calfacade.BwEvent;
import org.bedework.calfacade.BwEventAnnotation;
@@ -131,6 +132,14 @@
return sess.getList().iterator();
}
+ public Collection<BwCalendar> getChildren(BwCalendar val) throws Throwable {
+ sess.createQuery("from org.bedework.calfacade.BwCalendar c where " +
+ "c.calendar=:cal");
+ sess.setEntity("cal", val);
+
+ return (Collection<BwCalendar>)sess.getList();
+ }
+
public Iterator getCalSuites() throws Throwable {
return getObjects(BwCalSuite.class.getName());
}
Modified: trunk/src/org/bedework/dumprestore/dump/dumpling/DumpCalendars.java
===================================================================
--- trunk/src/org/bedework/dumprestore/dump/dumpling/DumpCalendars.java 2008-06-04 20:45:57 UTC (rev 209)
+++ trunk/src/org/bedework/dumprestore/dump/dumpling/DumpCalendars.java 2008-06-11 15:12:11 UTC (rev 210)
@@ -86,11 +86,19 @@
tagEnd(objectCalendar);
- Collection<BwCalendar> cals = val.getChildren();
+ /* This approach if we want to do fetches ourselves
+ Collection<BwCalendar> cals = this.globals.di.getChildren(val);
if ((cals != null) && !cals.isEmpty()) {
for (BwCalendar cal: cals) {
dumpCalendar(cal);
}
+ } */
+
+ Collection<BwCalendar> cals = val.getChildren();
+ if (cals != null) {
+ for (BwCalendar cal: cals) {
+ dumpCalendar(cal);
+ }
}
globals.calendars++;
More information about the Bedework-commit
mailing list