Changeset 544
- Timestamp:
- 06/07/06 11:46:00
- Files:
-
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/dumpling/Dumpling.java (modified) (1 diff)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/Restore.java (modified) (1 diff)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java (modified) (1 diff)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/CalendarRule.java (modified) (2 diffs)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/EntityFieldRule.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/dumpling/Dumpling.java
r464 r544 205 205 if (entity.getCalendar() == null) { 206 206 // Sould check validity here. Only valid for calendar roots. 207 taggedVal("calendar ", "");207 taggedVal("calendar-path", ""); 208 208 } else { 209 taggedVal("calendar ", entity.getCalendar().getPath());209 taggedVal("calendar-path", entity.getCalendar().getPath()); 210 210 } 211 211 } trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/Restore.java
r519 r544 296 296 } else if (args[i].equals("-initSyspars")) { 297 297 // done earlier 298 } else if (args[i].equals("-skipspecialcals")) { 299 globals.skipSpecialCals = true; 300 } else if (args[i].equals("-fixcaltype")) { 301 globals.fixCaltype = true; 298 302 } else if (argpar("-f", args, i)) { 299 303 i++; trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java
r519 r544 95 95 */ 96 96 public boolean inOwnerKey; 97 98 /** True if we skip creation of special calendars. This is for the conversion 99 * from 3.0 which may have a lot of empty special calendars created 100 */ 101 public boolean skipSpecialCals; 102 103 /** True if we fix calendar type of special calendars. This is for the conversion 104 * from 3.0 105 */ 106 public boolean fixCaltype; 97 107 98 108 /** Set false at start of entity, set true on entity error trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/CalendarRule.java
r463 r544 55 55 56 56 import org.bedework.calfacade.BwCalendar; 57 import org.bedework.calfacade.BwSystem; 57 58 import org.bedework.dumprestore.restore.RestoreGlobals; 58 59 … … 72 73 public void end(String ns, String name) throws Exception { 73 74 BwCalendar entity = (BwCalendar)pop(); 75 boolean special = false; 76 74 77 globals.calendars++; 75 78 76 79 fixSharableEntity(entity, "Calendar"); 80 81 if ((globals.fixCaltype || globals.skipSpecialCals) && 82 entity.getCalType() == BwCalendar.calTypeFolder) { 83 // might need to fix if from 3.0 84 BwSystem sys = globals.syspars; 85 String calpath = entity.getPath(); 86 String[] pes = calpath.split("/"); 87 int pathLength = pes.length - 1; // First element is empty string 88 89 if ((pathLength == 3) && 90 sys.getUserCalendarRoot().equals(pes[1])) { 91 String calname = pes[3]; 92 93 if (!calname.equals(entity.getName())) { 94 throw new Exception("Got path wrong - len = " + pathLength + 95 " path = " + calpath + 96 " calname = " + calname); 97 } 98 99 if (calname.equals(sys.getDefaultTrashCalendar())) { 100 entity.setCalType(BwCalendar.calTypeTrash); 101 special = true; 102 } else if (calname.equals(sys.getDeletedCalendar())) { 103 entity.setCalType(BwCalendar.calTypeDeleted); 104 special = true; 105 } else if (calname.equals(sys.getBusyCalendar())) { 106 entity.setCalType(BwCalendar.calTypeBusy); 107 special = true; 108 } else if (calname.equals(sys.getUserInbox())) { 109 entity.setCalType(BwCalendar.calTypeInbox); 110 special = true; 111 } else if (calname.equals(sys.getUserOutbox())) { 112 entity.setCalType(BwCalendar.calTypeOutbox); 113 special = true; 114 } else if (entity.getCalendarCollection()) { 115 entity.setCalType(BwCalendar.calTypeCollection); 116 } 117 } 118 } 119 120 if (special && globals.skipSpecialCals) { 121 return; 122 } 77 123 78 124 try { trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/EntityFieldRule.java
r534 r544 175 175 } 176 176 177 if (name.equals("calendar ")) {177 if (name.equals("calendar-path")) { 178 178 String path = stringFld(); 179 179 … … 181 181 entity.setCalendar(calendarFld()); 182 182 } // Otherwise assume root calendar 183 return true; 184 } 185 186 if (name.equals("calendar")) { 187 // 3-0 tag - ignore 183 188 return true; 184 189 }
