Changeset 75

Show
Ignore:
Timestamp:
02/03/06 11:21:56
Author:
douglm
Message:

Some fixes to the conversion from 2.3

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/config/configs/democal.properties

    r64 r75  
    239239 
    240240org.bedework.restore.arg.dumpfile=${calendar.dir}/dumprestore/initcaldata.xml 
    241 org.bedework.restore.arg.fixowner= 
    242241org.bedework.restore.arg.debug=-debug 
    243242org.bedework.restore.arg.from2p3px= 
  • trunk/calendar3/docs/todo.txt

    r74 r75  
    44-------------------------------------------------------------------------------- 
    55-------------------------------------------------------------------------------- 
     6Views not sorted in selection list 
    67-------------------------------------------------------------------------------- 
    78Try a change and see if we get mailed. 
  • trunk/calendar3/dumprestore/build.xml

    r64 r75  
    219219      <arg value="${org.bedework.restore.arg.dumpfile}" /> 
    220220      <arg value="${org.bedework.restore.arg.from2p3px}" /> 
    221       <arg line="${org.bedework.restore.arg.fixowner}" /> 
    222221      <arg line="${org.bedework.restore.arg.defaultpubliccal}" /> 
    223222      <arg line="${org.bedework.restore.arg.timezones}" /> 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/Restore.java

    r64 r75  
    103103  private RestoreGlobals globals = new RestoreGlobals(); 
    104104 
    105   private BwView curView; 
    106  
    107105  private Digester digester; 
    108106 
     
    187185      prefs.setOwner(o); 
    188186 
     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 
    189197      if (globals.publicUser.equals(o)) { 
    190198        /* Subscribe to all top level collections 
     
    195203        while (calit.hasNext()) { 
    196204          BwCalendar cal = (BwCalendar)calit.next(); 
    197           addSubscription(prefs, globals.publicUser, cal, true); 
     205          addSubscription(prefs, curView, o, cal, true, false, true); 
    198206        } 
    199207      } else { 
     
    203211 
    204212        // 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); 
    209214 
    210215        // Add default subscription for trash calendar. 
    211216 
    212217        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); 
    227219 
    228220        Collection s = globals.subscriptionsTbl.getCalendarids(o); 
     
    237229             * Make up a subscription. 
    238230             */ 
    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); 
    243233          } 
    244234        } 
     
    254244   * 
    255245   * @param p 
     246   * @param view 
    256247   * @param user     BwUser object 
    257248   * @param cal      BwCalendar object 
    258    * @param toplevel 
     249   * @param publicCalendar 
    259250   * @throws Throwable 
    260251   */ 
    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 { 
    263256    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); 
    265259    sub.setOwner(user); 
    266260    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); 
    277272    } 
    278273  } 
     
    303298        globals.defaultPublicCalPath = args[i]; 
    304299        trace("Setting null event calendars to " + args[i]); 
    305       } else if (argpar("-fixOwner", args, i)) { 
    306         i++; 
    307         globals.fixOwnerAccount = args[i]; 
    308300      } else if (args[i].equals("-from2p3px")) { 
    309301        globals.from2p3px = true; 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java

    r64 r75  
    166166  public HashMap filterToCal = new HashMap(); 
    167167 
    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  
    174168  /** For each of these we update events to have the appropriate calendar id. 
    175169   * Any event which already has a calendar id turned up in two calendars. 
     
    685679 
    686680    return publicUser; 
    687   } 
    688  
    689   /** Get the account used to fix creators and owners of entities 
    690    * 
    691    * @return BwUser account 
    692    * @throws Throwable if account name not defined 
    693    */ 
    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 it 
    709       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; 
    724681  } 
    725682 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/EntityRule.java

    r49 r75  
    5555 
    5656import org.bedework.calfacade.base.BwShareableDbentity; 
    57 import org.bedework.calfacade.BwUser; 
    5857import org.bedework.dumprestore.restore.RestoreGlobals; 
    59  
    6058 
    6159import org.xml.sax.Attributes; 
    6260 
    6361/** 
    64  * @author Mike Douglass   douglm@rpi.edu 
     62 * @author Mike Douglass   douglm @ rpi.edu 
    6563 * @version 1.0 
    6664 */ 
     
    112110      if (entity.getCreator() == null) { 
    113111        warn(name + " " + entity.getId() + " has no creator, set to " + 
    114             globals.getFixOwner().getAccount()); 
     112            globals.getPublicUser().getAccount()); 
    115113 
    116         entity.setCreator(globals.getFixOwner()); 
     114        entity.setCreator(globals.getPublicUser()); 
    117115      } 
    118116 
    119117      if (entity.getOwner() == null) { 
    120         BwUser owner; 
     118        warn(name + " " + entity.getId() + " has no owner, set to " + 
     119            globals.getPublicUser().getAccount()); 
    121120 
    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"); 
    126125        } 
    127         warn(name + " " + entity.getId() + " has no owner, set to " + 
    128             owner.getAccount()); 
    129  
    130         entity.setOwner(owner); 
    131126      } 
    132127    } catch (Throwable t) { 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/FilterRule.java

    r50 r75  
    168168        } 
    169169 
    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()); 
    176171        entity.setPublick(true); 
    177172      }