Changeset 534

Show
Ignore:
Timestamp:
06/05/06 15:39:07
Author:
douglm
Message:

Dump/restore of calendar suite entities

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/Defs.java

    r218 r534  
    122122  /** */ 
    123123  public static final String sectionDbLastmods = "dblastmods"; 
     124  /** */ 
     125  public static final String sectionCalSuites = "cal-suites"; 
    124126 
    125127  /* ==================================================================== 
     
    185187  public static final String objectUserPrefs = "user-prefs"; 
    186188  /** */ 
     189  public static final String objectCalSuite = "cal-suite"; 
     190  /** */ 
    187191  public static final String objectDbLastmod = "dblastmod"; 
    188192} 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/DumpIntf.java

    r218 r534  
    6262 * <li>BwAdminGroup</li> 
    6363 * <li>BwPreferences + BwSubscription + BwView</li> 
     64 * <li>BwCalSuite</li> 
    6465 * 
    6566 * <li>BwFilter</li> 
     
    124125  public Iterator getCalendars() throws Throwable; 
    125126 
     127  /** Will return an Iterator returning BwCalSuite objects. 
     128   * 
     129   * @return Iterator over entities 
     130   * @throws Throwable 
     131   */ 
     132  public Iterator getCalSuites() throws Throwable; 
     133 
    126134  /** Will return an Iterator returning Category objects. 
    127135   * 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/HibDump.java

    r241 r534  
    4343import org.bedework.calfacade.filter.BwFilter; 
    4444import org.bedework.calfacade.svc.BwAdminGroup; 
     45import org.bedework.calfacade.svc.BwCalSuite; 
    4546import org.bedework.calfacade.svc.BwPreferences; 
    4647import org.bedework.calfacade.svc.BwSubscription; 
     
    131132  } 
    132133 
     134  public Iterator getCalSuites() throws Throwable { 
     135    return getObjects(BwCalSuite.class.getName()); 
     136  } 
     137 
    133138  public Iterator getCategories() throws Throwable { 
    134139    return getObjects(BwCategory.class.getName()); 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/dumpling/DumpAll.java

    r243 r534  
    143143    di.close(); 
    144144 
     145    info("Dumping calendar suites."); 
     146    di.open(); 
     147    new DumpCalSuites(globals).dumpSection(di.getCalSuites()); 
     148    di.close(); 
     149 
    145150    /* 
    146151    info("Dumping lastmods."); 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/dumpling/DumpEvents.java

    r463 r534  
    6464    } 
    6565 
     66    long ct = 0; 
     67 
    6668    while (it.hasNext()) { 
    6769      dumpEvent((BwEvent)it.next()); 
     70      ct++; 
     71 
     72      if ((ct % 100) == 0) { 
     73        info("        ... " + ct); 
     74      } 
    6875    } 
    6976 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/HibRestore.java

    r463 r534  
    7575import org.bedework.calfacade.svc.BwAdminGroupEntry; 
    7676import org.bedework.calfacade.svc.BwAuthUser; 
     77import org.bedework.calfacade.svc.BwCalSuite; 
    7778import org.bedework.calfacade.svc.BwPreferences; 
    7879import org.bedework.calfacade.svc.BwSubscription; 
     
    292293  } 
    293294 
     295  public BwAdminGroup getAdminGroup(String name) throws Throwable { 
     296    openHibSess(); 
     297 
     298    Query q = hibSess.createQuery("from org.bedework.calfacade.svc.BwAdminGroup ag" + 
     299        " where ag.name=:name"); 
     300    q.setString("name", name); 
     301    return (BwAdminGroup)q.uniqueResult(); 
     302  } 
     303 
    294304  /* (non-Javadoc) 
    295305   * @see org.bedework.dumprestore.restore.RestoreIntf#restoreAuthUser(org.bedework.calfacade.svc.BwAuthUser) 
     
    321331 
    322332    openHibSess(); 
    323  
    324333    hibSave(o); 
    325  
    326334    closeHibSess(); 
    327335  } 
     
    356364    closeSess(); 
    357365  } 
     366 
     367  public void restoreCalSuite(BwCalSuite o) throws Throwable { 
     368    openHibSess(); 
     369    hibSave(o); 
     370    closeHibSess(); 
     371  } 
     372 
    358373 
    359374  /* (non-Javadoc) 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreIntf.java

    r463 r534  
    6969import org.bedework.calfacade.svc.BwAdminGroup; 
    7070import org.bedework.calfacade.svc.BwAuthUser; 
     71import org.bedework.calfacade.svc.BwCalSuite; 
    7172import org.bedework.calfacade.svc.BwPreferences; 
    7273import org.bedework.dumprestore.BwDbLastmod; 
     
    153154  public void restoreAdminGroup(BwAdminGroup o) throws Throwable; 
    154155 
     156  /** Get an admin group given it's name. 
     157   * 
     158   * @param name     String name of the group 
     159   * @return BwAdminGroup 
     160   * @throws Throwable 
     161   */ 
     162  public BwAdminGroup getAdminGroup(String name) throws Throwable; 
     163 
    155164  /** Restore an auth user and preferences 
    156165   * 
     
    180189   */ 
    181190  public void restoreCategory(BwCategory o) throws Throwable; 
     191 
     192  /** Restore calendar suite 
     193   * 
     194   * @param o   Object to restore 
     195   * @throws Throwable 
     196   */ 
     197  public void restoreCalSuite(BwCalSuite o) throws Throwable; 
    182198 
    183199  /** Restore location 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/EntityFieldRule.java

    r464 r534  
    6868import org.bedework.calfacade.base.BwShareableDbentity; 
    6969import org.bedework.calfacade.filter.BwFilter; 
     70import org.bedework.calfacade.svc.BwAdminGroup; 
    7071import org.bedework.dumprestore.restore.RestoreGlobals; 
    7172 
     
    419420  } 
    420421 
     422  protected BwAdminGroup adminGroupFld() throws Exception { 
     423    if (fldval == null) { 
     424      throw new Exception("No value for " + tagName); 
     425    } 
     426 
     427    try { 
     428      return globals.rintf.getAdminGroup(fldval); 
     429    } catch (Throwable t) { 
     430      if (t instanceof Exception) { 
     431        throw (Exception)t; 
     432      } 
     433      throw new Exception(t); 
     434    } 
     435  } 
     436 
    421437  protected BwCalendar calendarFld() throws Exception { 
    422438    if (fldval == null) { 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/EntityRule.java

    r463 r534  
    7878import org.bedework.calfacade.svc.BwAdminGroup; 
    7979import org.bedework.calfacade.svc.BwAuthUser; 
     80import org.bedework.calfacade.svc.BwCalSuite; 
    8081import org.bedework.calfacade.svc.BwPreferences; 
    8182import org.bedework.dumprestore.BwDbLastmod; 
     
    112113    classes.put("timezone", BwTimeZone.class.getName()); 
    113114    classes.put("calendar", BwCalendar.class.getName()); 
     115    classes.put("cal-suite", BwCalSuite.class.getName()); 
    114116    classes.put("location", BwLocation.class.getName()); 
    115117    classes.put("sponsor", BwSponsor.class.getName()); 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/RestoreRuleSet.java

    r464 r534  
    9292    d.addRule("caldata/calendars/calendar/*", new CalendarFieldRule(globals)); 
    9393 
     94    d.addRule("caldata/cal-suites/cal-suite", new CalSuiteRule(globals)); 
     95    d.addRule("caldata/cal-suites/cal-suite/*", new CalSuiteFieldRule(globals)); 
     96 
    9497    d.addRule("caldata/locations/location", new LocationRule(globals)); 
    9598    d.addRule("caldata/locations/location/*", new LocationFieldRule(globals));