Changeset 223

Show
Ignore:
Timestamp:
02/28/06 08:49:07
Author:
douglm
Message:

Changes to get the calendar running on mysql (and perhaps other dbs)

Remap public-user for id 0 to id 1 during restore

Minor schema changes.

Change timezone schema to use text rather than string

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/build.xml

    r218 r223  
    667667 
    668668    <path id="schema.cp"> 
     669      <!-- 
    669670      <fileset dir="${org.bedework.default.lib}"> 
    670671         <include name="**/*.jar"/> 
    671672      </fileset> 
     673      --> 
    672674      <!-- 
    673675      <fileset dir="${org.bedework.temp.jars}"> 
  • trunk/calendar3/calCore/resources/hbms/Calendar.hbm.xml

    r2 r223  
    3838 
    3939    <property name="name" column="name" type="text" not-null="true"/> 
     40 
     41    <!-- I wanted to specify unique="true" on this but mysql complains. 
     42      --> 
    4043    <property name="path" column="path" type="text" not-null="true" 
    41               index="calpath" unique="true" lazy="false" /> 
     44              index="calpath" lazy="false" /> 
     45 
    4246    <property name="summary" column="summary" type="text"/> 
    4347    <property name="description" column="description" type="text"/> 
  • trunk/calendar3/calCore/resources/hbms/Event.hbm.xml

    r207 r223  
    120120    <property name="name" column="eventname" type="text"/> 
    121121 
    122     <!-- (ownerid +) calendarid + guid + sequence + recurrence-id is a unique key. --> 
    123     <property name="guid" type="text" unique-key="event-key" /> 
    124  
    125     <property name="sequence" type="integer" unique-key="event-key" /> 
     122    <!-- (ownerid +) calendarid + guid + recurrence-id is a unique key. --> 
     123    <property name="guid" type="string" length="500" unique-key="event-key" /> 
     124 
     125    <property name="sequence" type="integer" /> 
    126126 
    127127    <property name="transparency" column="transparency" type="text"/> 
  • trunk/calendar3/calCore/resources/hbms/EventAnnotation.hbm.xml

    r2 r223  
    1010 
    1111     This definition differs from The event definition only in that all 
    12      files (except the index and sequence) may be null and the event does 
     12     fields (except the index and sequence) may be null and the event does 
    1313     not have a reference to another event. 
    1414     =================================================================== --> 
     
    9393                 class="org.bedework.calfacade.BwCalendar" 
    9494                 column="calendarid" 
    95                  index="idx_eventann_calendar" /> 
     95                 index="idx_eventann_calendar" unique-key="eventann-key" /> 
    9696 
    9797    <property name="dtstamp" column="dtstamp" type="string" /> 
     
    121121    <property name="name" column="eventname" type="text"/> 
    122122 
    123     <!-- guid + sequence + recurrence-id is a unique key. --> 
    124     <property name="guid" type="text" unique-key="eventann-key" /> 
    125  
    126     <property name="sequence" type="integer" unique-key="eventann-key" /> 
     123    <!-- calendar + guid + recurrence-id is a unique key. --> 
     124    <property name="guid" type="string" length="500" unique-key="eventann-key" /> 
     125 
     126    <property name="sequence" type="integer" /> 
    127127 
    128128    <property name="transparency" column="transparency" type="text"/> 
  • trunk/calendar3/calCore/resources/hbms/TimeZone.hbm.xml

    r68 r223  
    2929    </property> 
    3030 
    31     <property name="vtimezone" column="vtimezone" type="string"/> 
     31    <property name="vtimezone" column="vtimezone" type="text"/> 
    3232    <property name="jtzid" column="jtzid" type="string"/> 
    3333  </class> 
  • trunk/calendar3/docs/todo.txt

    r207 r223  
    11Todo 
    22 
     3-------------------------------------------------------------------------------- 
     4MySql 
     5 
     6Have to edit schema then source it 
     7Map user 0 on to user 1. 
     8??? 
     9Add driver jar to tomcat common/lib 
     10Need to change vtimezone def to text 
    311-------------------------------------------------------------------------------- 
    412Remove references to getEvent(id) 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java

    r75 r223  
    106106  public boolean debug; 
    107107 
     108  public static int mapUser0 = 1; 
     109   
    108110  /** */ 
    109111  public boolean debugEntity; 
     
    386388     */ 
    387389    public void put(BwUser val) { 
    388       put(new Integer(val.getId()), val); 
     390      int id = val.getId(); 
     391      if (id ==0) { 
     392        id = mapUser0; 
     393        val.setId(id); 
     394      } 
     395       
     396      Integer keyid = new Integer(id); 
     397      if (get(keyid) != null) { 
     398        throw new RuntimeException("User already in table with id " + id); 
     399      } 
     400      put(keyid, val); 
    389401      nameMap.put(val.getAccount(), val); 
    390402    } 
     
    395407     */ 
    396408    public BwUser get(int id) { 
     409      if (id ==0) { 
     410        id = mapUser0; 
     411      } 
    397412      return (BwUser)get(new Integer(id)); 
    398413    } 
     
    669684      publicUser.setSponsorAccess(getDefaultPublicAccess()); 
    670685 
    671       publicUser.setId(0); 
     686      // Reserved id 1 for this user. 
     687      publicUser.setId(1); 
    672688 
    673689      if (rintf != null) { 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/TimeZoneRule.java

    r59 r223  
    8484 
    8585    if (cl.size() != 1) { 
     86      error("Exception restoring " + entity); 
    8687      throw new CalFacadeException(CalFacadeException.timezonesReadError, 
    8788                                   cl.size() + " components in Calendar"); 
     
    9091    Object o = cl.get(0); 
    9192    if (!(o instanceof VTimeZone)) { 
     93      error("Exception restoring " + entity); 
    9294      throw new CalFacadeException(CalFacadeException.timezonesReadError, 
    9395                                   "component in Calendar not VTimeZone"); 
     
    98100      globals.getTzcache().saveTimeZone(entity.getTzid(), (VTimeZone)o); 
    99101    } catch (Throwable t) { 
     102      error("Exception restoring " + entity); 
    100103      throw new Exception(t); 
    101104    }