Changeset 75
- Timestamp:
- 02/03/06 11:21:56
- Files:
-
- trunk/calendar3/config/configs/democal.properties (modified) (1 diff)
- trunk/calendar3/docs/todo.txt (modified) (1 diff)
- trunk/calendar3/dumprestore/build.xml (modified) (1 diff)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/Restore.java (modified) (7 diffs)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java (modified) (2 diffs)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/EntityRule.java (modified) (2 diffs)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/FilterRule.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/config/configs/democal.properties
r64 r75 239 239 240 240 org.bedework.restore.arg.dumpfile=${calendar.dir}/dumprestore/initcaldata.xml 241 org.bedework.restore.arg.fixowner=242 241 org.bedework.restore.arg.debug=-debug 243 242 org.bedework.restore.arg.from2p3px= trunk/calendar3/docs/todo.txt
r74 r75 4 4 -------------------------------------------------------------------------------- 5 5 -------------------------------------------------------------------------------- 6 Views not sorted in selection list 6 7 -------------------------------------------------------------------------------- 7 8 Try a change and see if we get mailed. trunk/calendar3/dumprestore/build.xml
r64 r75 219 219 <arg value="${org.bedework.restore.arg.dumpfile}" /> 220 220 <arg value="${org.bedework.restore.arg.from2p3px}" /> 221 <arg line="${org.bedework.restore.arg.fixowner}" />222 221 <arg line="${org.bedework.restore.arg.defaultpubliccal}" /> 223 222 <arg line="${org.bedework.restore.arg.timezones}" /> trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/Restore.java
r64 r75 103 103 private RestoreGlobals globals = new RestoreGlobals(); 104 104 105 private BwView curView;106 107 105 private Digester digester; 108 106 … … 187 185 prefs.setOwner(o); 188 186 187 // Create the default view 188 189 BwView curView = new BwView(); 190 191 curView.setName(globals.syspars.getDefaultUserViewName()); // XXX 192 curView.setOwner(o); 193 194 prefs.addView(curView); 195 prefs.setPreferredView(curView.getName()); 196 189 197 if (globals.publicUser.equals(o)) { 190 198 /* Subscribe to all top level collections … … 195 203 while (calit.hasNext()) { 196 204 BwCalendar cal = (BwCalendar)calit.next(); 197 addSubscription(prefs, globals.publicUser, cal, true);205 addSubscription(prefs, curView, o, cal, true, false, true); 198 206 } 199 207 } else { … … 203 211 204 212 // Add default subscription for default calendar. 205 BwSubscription defSub = BwSubscription.makeSubscription(cal, 206 cal.getName(), true, true, false); 207 defSub.setOwner(o); 208 prefs.addSubscription(defSub); 213 addSubscription(prefs, curView, o, cal, true, true, false); 209 214 210 215 // Add default subscription for trash calendar. 211 216 212 217 cal = (BwCalendar)globals.trashCalendars.get(new Integer(o.getId())); 213 BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), 214 false, false, false); 215 sub.setOwner(o); 216 prefs.addSubscription(sub); 217 218 // Add a default view for the default calendar subscription 219 220 curView = new BwView(); 221 222 curView.setName(globals.syspars.getDefaultUserViewName()); 223 curView.addSubscription(defSub); 224 curView.setOwner(o); 225 226 prefs.addView(curView); 218 addSubscription(prefs, null, o, cal, false, false, false); 227 219 228 220 Collection s = globals.subscriptionsTbl.getCalendarids(o); … … 237 229 * Make up a subscription. 238 230 */ 239 Integer calid = (Integer)subit.next(); 240 241 cal = (BwCalendar)globals.filterToCal.get(calid); 242 addSubscription(prefs, o, cal, true); 231 cal = (BwCalendar)globals.filterToCal.get((Integer)subit.next()); 232 addSubscription(prefs, curView, o, cal, true, false, false); 243 233 } 244 234 } … … 254 244 * 255 245 * @param p 246 * @param view 256 247 * @param user BwUser object 257 248 * @param cal BwCalendar object 258 * @param toplevel249 * @param publicCalendar 259 250 * @throws Throwable 260 251 */ 261 public void addSubscription(BwPreferences p, BwUser user, BwCalendar cal, 262 boolean toplevel) throws Throwable { 252 private void addSubscription(BwPreferences p, BwView view, BwUser user, 253 BwCalendar cal, boolean display, 254 boolean freeBusy, 255 boolean publicCalendar) throws Throwable { 263 256 globals.subscriptions++; 264 BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, false, false); 257 BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), 258 display, freeBusy, false); 265 259 sub.setOwner(user); 266 260 p.addSubscription(sub); 267 if (curView == null) { 268 // One-shot. 269 curView = new BwView(); 270 curView.setName(cal.getName()); 271 curView.setOwner(user); 272 curView.addSubscription(sub); 273 p.addView(curView); 274 curView = null; 275 } else { 276 curView.addSubscription(sub); 261 if (view != null) { 262 view.addSubscription(sub); 263 } 264 265 if (publicCalendar) { 266 // Also add a single subscription 267 BwView v = new BwView(); 268 v.setName(cal.getName()); 269 v.setOwner(user); 270 v.addSubscription(sub); 271 p.addView(v); 277 272 } 278 273 } … … 303 298 globals.defaultPublicCalPath = args[i]; 304 299 trace("Setting null event calendars to " + args[i]); 305 } else if (argpar("-fixOwner", args, i)) {306 i++;307 globals.fixOwnerAccount = args[i];308 300 } else if (args[i].equals("-from2p3px")) { 309 301 globals.from2p3px = true; trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java
r64 r75 166 166 public HashMap filterToCal = new HashMap(); 167 167 168 /** Account name used to fix missing or changed owners */169 public String fixOwnerAccount;170 171 /** Account used to fix missing or changed owners */172 public BwUser fixOwner;173 174 168 /** For each of these we update events to have the appropriate calendar id. 175 169 * Any event which already has a calendar id turned up in two calendars. … … 685 679 686 680 return publicUser; 687 }688 689 /** Get the account used to fix creators and owners of entities690 *691 * @return BwUser account692 * @throws Throwable if account name not defined693 */694 public BwUser getFixOwner() throws Throwable {695 if (fixOwner != null) {696 return fixOwner;697 }698 699 /* See if it's in the user map first. */700 701 if (fixOwnerAccount == null) {702 throw new Exception("fixOwnerAccount must be defined");703 }704 705 fixOwner = usersTbl.get(fixOwnerAccount);706 707 if (fixOwner == null) {708 // Create it709 fixOwner = new BwUser(fixOwnerAccount);710 fixOwner.setCategoryAccess(getDefaultPersonalAccess());711 fixOwner.setLocationAccess(getDefaultPersonalAccess());712 fixOwner.setSponsorAccess(getDefaultPersonalAccess());713 714 fixOwner.setId(1);715 716 if (rintf != null) {717 rintf.restoreUser(fixOwner);718 }719 720 usersTbl.put(fixOwner);721 }722 723 return fixOwner;724 681 } 725 682 trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/EntityRule.java
r49 r75 55 55 56 56 import org.bedework.calfacade.base.BwShareableDbentity; 57 import org.bedework.calfacade.BwUser;58 57 import org.bedework.dumprestore.restore.RestoreGlobals; 59 60 58 61 59 import org.xml.sax.Attributes; 62 60 63 61 /** 64 * @author Mike Douglass douglm @rpi.edu62 * @author Mike Douglass douglm @ rpi.edu 65 63 * @version 1.0 66 64 */ … … 112 110 if (entity.getCreator() == null) { 113 111 warn(name + " " + entity.getId() + " has no creator, set to " + 114 globals.get FixOwner().getAccount());112 globals.getPublicUser().getAccount()); 115 113 116 entity.setCreator(globals.get FixOwner());114 entity.setCreator(globals.getPublicUser()); 117 115 } 118 116 119 117 if (entity.getOwner() == null) { 120 BwUser owner; 118 warn(name + " " + entity.getId() + " has no owner, set to " + 119 globals.getPublicUser().getAccount()); 121 120 122 if (entity.getPublick()) {123 owner = globals.getPublicUser(); 124 } else{125 owner = globals.getFixOwner();121 entity.setOwner(globals.getPublicUser()); 122 123 if (!entity.getPublick()) { 124 warn(name + " " + entity.getId() + " is NOT public"); 126 125 } 127 warn(name + " " + entity.getId() + " has no owner, set to " +128 owner.getAccount());129 130 entity.setOwner(owner);131 126 } 132 127 } catch (Throwable t) { trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/FilterRule.java
r50 r75 168 168 } 169 169 170 BwUser filterOwner = globals.getFixOwner(); 171 if (filterOwner == null) { 172 error("Filter owner " + globals.fixOwner + 173 " does not exist"); 174 } 175 entity.setOwner(filterOwner); 170 entity.setOwner(globals.getPublicUser()); 176 171 entity.setPublick(true); 177 172 }
