Changeset 544

Show
Ignore:
Timestamp:
06/07/06 11:46:00
Author:
douglm
Message:

Changes for 3.0 to 3.1 conversion

Files:

Legend:

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

    r464 r544  
    205205    if (entity.getCalendar() == null) { 
    206206      // Sould check validity here. Only valid for calendar roots. 
    207       taggedVal("calendar", ""); 
     207      taggedVal("calendar-path", ""); 
    208208    } else { 
    209       taggedVal("calendar", entity.getCalendar().getPath()); 
     209      taggedVal("calendar-path", entity.getCalendar().getPath()); 
    210210    } 
    211211  } 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/Restore.java

    r519 r544  
    296296      } else if (args[i].equals("-initSyspars")) { 
    297297        // done earlier 
     298      } else if (args[i].equals("-skipspecialcals")) { 
     299        globals.skipSpecialCals = true; 
     300      } else if (args[i].equals("-fixcaltype")) { 
     301        globals.fixCaltype = true; 
    298302      } else if (argpar("-f", args, i)) { 
    299303        i++; 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java

    r519 r544  
    9595   */ 
    9696  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; 
    97107 
    98108  /** Set false at start of entity, set true on entity error 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/CalendarRule.java

    r463 r544  
    5555 
    5656import org.bedework.calfacade.BwCalendar; 
     57import org.bedework.calfacade.BwSystem; 
    5758import org.bedework.dumprestore.restore.RestoreGlobals; 
    5859 
     
    7273  public void end(String ns, String name) throws Exception { 
    7374    BwCalendar entity = (BwCalendar)pop(); 
     75    boolean special = false; 
     76 
    7477    globals.calendars++; 
    7578 
    7679    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    } 
    77123 
    78124    try { 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/EntityFieldRule.java

    r534 r544  
    175175    } 
    176176 
    177     if (name.equals("calendar")) { 
     177    if (name.equals("calendar-path")) { 
    178178      String path = stringFld(); 
    179179 
     
    181181        entity.setCalendar(calendarFld()); 
    182182      } // Otherwise assume root calendar 
     183      return true; 
     184    } 
     185 
     186    if (name.equals("calendar")) { 
     187      // 3-0 tag - ignore 
    183188      return true; 
    184189    }