[Bedework-commit] r556 - in trunk/calendar3: calCore/resources/hbms dumprestore/src/org/bedework/dumprestore/dump/dumpling dumprestore/src/org/bedework/dumprestore/restore dumprestore/src/org/bedework/dumprestore/restore/rules

svnadmin at bedework.org svnadmin at bedework.org
Thu Jun 8 15:42:16 EDT 2006


Author: douglm
Date: 2006-06-08 15:42:16 -0400 (Thu, 08 Jun 2006)
New Revision: 556

Added:
   trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/CalendarIdMap.java
Modified:
   trunk/calendar3/calCore/resources/hbms/Subscription.hbm.xml
   trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/dumpling/DumpUserPrefs.java
   trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java
   trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/CalendarRule.java
   trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/EntityFieldRule.java
   trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/UserPrefsFieldRule.java
Log:
Add missing subscription fields to schema
Default user calendar was not being restored.


Modified: trunk/calendar3/calCore/resources/hbms/Subscription.hbm.xml
===================================================================
--- trunk/calendar3/calCore/resources/hbms/Subscription.hbm.xml	2006-06-08 19:16:00 UTC (rev 555)
+++ trunk/calendar3/calCore/resources/hbms/Subscription.hbm.xml	2006-06-08 19:42:16 UTC (rev 556)
@@ -35,9 +35,14 @@
     <property name="display" type="true_false"
               column="display" not-null="true" />
 
+    <property name="style" column="bwsubstyle" type="text" />
+
     <property name="internalSubscription" type="true_false"
               column="internal_Subscription" not-null="true" />
 
+    <property name="emailNotifications" type="true_false"
+              column="email_notifications" not-null="true" />
+
     <property name="calendarDeleted" type="true_false"
               column="calendar_deleted" not-null="true" />
 

Modified: trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/dumpling/DumpUserPrefs.java
===================================================================
--- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/dumpling/DumpUserPrefs.java	2006-06-08 19:16:00 UTC (rev 555)
+++ trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/dumpling/DumpUserPrefs.java	2006-06-08 19:42:16 UTC (rev 556)
@@ -147,7 +147,7 @@
 
     taggedVal("email", p.getEmail());
     if (p.getDefaultCalendar() != null) {
-      taggedVal("defaultCalendar", p.getDefaultCalendar().getPath());
+      taggedVal("default-calendar-path", p.getDefaultCalendar().getPath());
     }
     taggedVal("skinName", p.getSkinName());
     taggedVal("skinStyle", p.getSkinStyle());

Added: trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/CalendarIdMap.java
===================================================================
--- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/CalendarIdMap.java	                        (rev 0)
+++ trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/CalendarIdMap.java	2006-06-08 19:42:16 UTC (rev 556)
@@ -0,0 +1,87 @@
+/*
+ Copyright (c) 2000-2005 University of Washington.  All rights reserved.
+
+ Redistribution and use of this distribution in source and binary forms,
+ with or without modification, are permitted provided that:
+
+   The above copyright notice and this permission notice appear in
+   all copies and supporting documentation;
+
+   The name, identifiers, and trademarks of the University of Washington
+   are not used in advertising or publicity without the express prior
+   written permission of the University of Washington;
+
+   Recipients acknowledge that this distribution is made available as a
+   research courtesy, "as is", potentially with defects, without
+   any obligation on the part of the University of Washington to
+   provide support, services, or repair;
+
+   THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR
+   IMPLIED, WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION
+   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+   PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF
+   WASHINGTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+   DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+   PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT (INCLUDING
+   NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION WITH
+   THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* **********************************************************************
+    Copyright 2005 Rensselaer Polytechnic Institute. All worldwide rights reserved.
+
+    Redistribution and use of this distribution in source and binary forms,
+    with or without modification, are permitted provided that:
+       The above copyright notice and this permission notice appear in all
+        copies and supporting documentation;
+
+        The name, identifiers, and trademarks of Rensselaer Polytechnic
+        Institute are not used in advertising or publicity without the
+        express prior written permission of Rensselaer Polytechnic Institute;
+
+    DISCLAIMER: The software is distributed" AS IS" without any express or
+    implied warranty, including but not limited to, any implied warranties
+    of merchantability or fitness for a particular purpose or any warrant)'
+    of non-infringement of any current or pending patent rights. The authors
+    of the software make no representations about the suitability of this
+    software for any particular purpose. The entire risk as to the quality
+    and performance of the software is with the user. Should the software
+    prove defective, the user assumes the cost of all necessary servicing,
+    repair or correction. In particular, neither Rensselaer Polytechnic
+    Institute, nor the authors of the software are liable for any indirect,
+    special, consequential, or incidental damages related to the software,
+    to the maximum extent the law permits.
+*/
+package org.bedework.dumprestore.restore;
+
+import org.bedework.calfacade.BwCalendar;
+import java.util.HashMap;
+
+/** Maps a numeric id to a path
+ *
+ * @author Mike Douglass   douglm at rpi.edu
+ * @version 1.0
+ */
+public class CalendarIdMap extends HashMap {
+  /**
+   * @param val
+   */
+  public void put(BwCalendar val) {
+    Integer key = new Integer(val.getId());
+
+    String path = (String)get(key);
+
+    if (path != null) {
+      throw new RuntimeException("Calendar " +
+          path + " already in table with key " + key);
+    }
+    put(key, val.getPath());
+  }
+
+  /**
+   * @param key  Integer
+   * @return String path
+   */
+  public String getPath(Integer key) {
+    return (String)get(key);
+  }
+}

Modified: trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java
===================================================================
--- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java	2006-06-08 19:16:00 UTC (rev 555)
+++ trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java	2006-06-08 19:42:16 UTC (rev 556)
@@ -230,6 +230,10 @@
   /** Users we preserve */
   public HashMap onlyUsersMap = new HashMap();
 
+  // 3.0
+  /** Map ids onto paths */
+  public CalendarIdMap calmap = new CalendarIdMap();
+
   /**
    */
   public static class EventKeyMap extends HashMap {

Modified: trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/CalendarRule.java
===================================================================
--- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/CalendarRule.java	2006-06-08 19:16:00 UTC (rev 555)
+++ trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/CalendarRule.java	2006-06-08 19:42:16 UTC (rev 556)
@@ -123,6 +123,9 @@
       return;
     }
 
+    // 3.0
+    globals.calmap.put(entity);
+
     try {
       if (globals.rintf != null) {
         /* If the parent is null then this should be one of the root calendars,

Modified: trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/EntityFieldRule.java
===================================================================
--- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/EntityFieldRule.java	2006-06-08 19:16:00 UTC (rev 555)
+++ trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/EntityFieldRule.java	2006-06-08 19:42:16 UTC (rev 556)
@@ -439,6 +439,27 @@
     }
   }
 
+  // 3.0
+  protected BwCalendar calendarIdFld() throws Exception {
+    if (fldval == null) {
+      throw new Exception("No value for " + tagName);
+    }
+
+    try {
+      Integer key = Integer.valueOf(fldval);
+      String path = globals.calmap.getPath(key);
+      if (globals.config.getDebug()) {
+        trace("key = " + key + " path = '" + path + "'");
+      }
+      return globals.rintf.getCalendar(path);
+    } catch (Throwable t) {
+      if (t instanceof Exception) {
+        throw (Exception)t;
+      }
+      throw new Exception(t);
+    }
+  }
+
   protected BwCalendar calendarFld() throws Exception {
     if (fldval == null) {
       throw new Exception("No value for " + tagName);

Modified: trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/UserPrefsFieldRule.java
===================================================================
--- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/UserPrefsFieldRule.java	2006-06-08 19:16:00 UTC (rev 555)
+++ trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/UserPrefsFieldRule.java	2006-06-08 19:42:16 UTC (rev 556)
@@ -78,7 +78,7 @@
 
     if (name.equals("email")) {
       p.setEmail(stringFld());
-    } else if (name.equals("defaultCalendar")) {
+    } else if (name.equals("default-calendar-path")) {
       p.setDefaultCalendar(calendarFld());
     } else if (name.equals("skinName")) {
       p.setSkinName(stringFld());
@@ -99,6 +99,10 @@
     } else if (name.equals("userMode")) {
       p.setUserMode(intFld());
 
+      // 3.0
+    } else if (name.equals("default-calendar")) {
+      p.setDefaultCalendar(calendarIdFld());
+
     // subscription fields
 
     } else if (name.equals("subscription")) {



More information about the Bedework-commit mailing list