Changeset 48

Show
Ignore:
Timestamp:
01/28/06 23:54:51
Author:
douglm
Message:

Worked on getting dump ready. As a result realised some schema changes were required - all small.

Moved dumprestore out of the tools component into its own component calendar3/dumprestore

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/.classpath

    r18 r48  
    22<classpath> 
    33        <classpathentry kind="src" path="access/src"/> 
    4         <classpathentry kind="src" path="caldavClientApi/src"/> 
    5         <classpathentry kind="src" path="http/src"/> 
    6         <classpathentry kind="src" path="logging/src"/> 
    7         <classpathentry kind="src" path="icalendar/src"/> 
    8         <classpathentry kind="src" path="calsvc/src"/> 
    9         <classpathentry kind="src" path="mail/src"/> 
    104        <classpathentry kind="src" path="appcommon/src"/> 
    115        <classpathentry kind="src" path="calCore/src"/> 
    126        <classpathentry kind="src" path="caldav/src"/> 
     7        <classpathentry kind="src" path="caldavClientApi/src"/> 
    138        <classpathentry kind="src" path="calEnv/src"/> 
    149        <classpathentry kind="src" path="calFacade/src"/> 
     10        <classpathentry kind="src" path="calsvc/src"/> 
    1511        <classpathentry kind="src" path="calsvci/src"/> 
    1612        <classpathentry kind="src" path="common/src"/> 
    1713        <classpathentry kind="src" path="config/src"/> 
     14        <classpathentry kind="src" path="dumprestore/src"/> 
     15        <classpathentry kind="src" path="http/src"/> 
     16        <classpathentry kind="src" path="icalendar/src"/> 
    1817        <classpathentry kind="src" path="locale/src"/> 
     18        <classpathentry kind="src" path="logging/src"/> 
     19        <classpathentry kind="src" path="mail/src"/> 
    1920        <classpathentry kind="src" path="synchml/src"/> 
    2021        <classpathentry kind="src" path="test/src"/> 
  • trunk/calendar3/bldfiles/defjars.properties

    r18 r48  
    124124org.bedework.config.jar=${org.bedework.temp.jars}/${org.bedework.config.jar.name} 
    125125 
     126org.bedework.dumprestore.jar.name=bwdumprestore-${product.version}.jar 
     127org.bedework.dumprestore.jar=${org.bedework.temp.jars}/${org.bedework.dumprestore.jar.name} 
     128 
    126129org.bedework.http.jar.name=bwhttp-${product.version}.jar 
    127130org.bedework.http.jar=${org.bedework.temp.jars}/${org.bedework.http.jar.name} 
  • trunk/calendar3/bldfiles/globalDefs.xml

    r2 r48  
    66     =================================================================== --> 
    77 
    8 <project name="uwcalGlobalDefs" default="bld.all"> 
     8<project name="uwcalGlobalDefs" default="globalDefs"> 
    99  <property environment="env"/> 
    1010 
     
    7070    <property name="org.bedework.core.base" location="${calendar.dir}/calCore" /> 
    7171    <property name="org.bedework.deployment.base" location="${calendar.dir}/deployment" /> 
     72    <property name="org.bedework.dumprestore.base" location="${calendar.dir}/dumprestore" /> 
    7273    <property name="org.bedework.http.base" location="${calendar.dir}/http" /> 
    7374    <property name="org.bedework.ical.base" location="${calendar.dir}/icalendar" /> 
  • trunk/calendar3/build.xml

    r2 r48  
    9797                   bld.synchml,bld.caldav, 
    9898                   bld.timers,build.tools, 
     99                   bld.dumprestore, 
    99100                   bld.test,bld.config" 
    100101          description="Build war and ear files"> 
     
    235236                         ${org.bedework.common.base}/src: 
    236237                         ${org.bedework.config.base}/src: 
     238                         ${org.bedework.dumprestore.base}/src: 
    237239                         ${org.bedework.http.base}/src: 
    238240                         ${org.bedework.ical.base}/src: 
     
    530532  </target> 
    531533 
     534  <target name="bld.dumprestore" 
     535          depends="init,bld.appcommon" 
     536          description="Build calendar dumprestore suite"> 
     537    <ant antfile="${org.bedework.dumprestore.base}/build.xml" inheritrefs="true" 
     538         target="build" /> 
     539  </target> 
     540 
    532541  <!-- ======================== tools Targets ======================== 
    533542       This builds the tools 
     
    545554 
    546555  <target name="dumpdb" depends="init"> 
    547     <ant antfile="${org.bedework.tools.base}/build.xml" inheritrefs="true" 
     556    <ant antfile="${org.bedework.dumprestore.base}/build.xml" inheritrefs="true" 
    548557           target="dumpdb" /> 
    549558  </target> 
    550559 
    551560  <target name="restoredb" depends="init"> 
    552     <ant antfile="${org.bedework.tools.base}/build.xml" inheritrefs="true" 
     561    <ant antfile="${org.bedework.dumprestore.base}/build.xml" inheritrefs="true" 
    553562           target="restoredb" /> 
    554563  </target> 
    555564 
    556565  <target name="initdb" depends="init"> 
    557     <ant antfile="${org.bedework.tools.base}/build.xml" inheritrefs="true" 
     566    <ant antfile="${org.bedework.dumprestore.base}/build.xml" inheritrefs="true" 
    558567           target="initdb" /> 
    559568  </target> 
  • trunk/calendar3/calCore/resources/hbms/Alarm.hbm.xml

    r2 r48  
    5858    </discriminator> 
    5959 
    60     <version name="sequence" column="sequence" type="long" /> 
     60    <version name="seq" column="sequence" type="integer" /> 
    6161 
    6262    <property name="alarmType" column="alarm_type" type="integer" /> 
    6363 
    6464    <!-- 
    65     <many-to-one name="user" insert="false" update="false" 
     65    <many-to-one name="owner" insert="false" update="false" 
    6666                 class="org.bedework.calfacade.BwUser" > 
    67       <column name="userid"/> 
     67      <column name="ownerid"/> 
    6868    </many-to-one> 
    6969    --> 
    7070 
    71     <many-to-one name="user" 
     71    <many-to-one name="owner" 
    7272                 class="org.bedework.calfacade.BwUser" 
    7373                 unique="true" > 
    74       <column name="userid" not-null="true" index="valarms_user" /> 
     74      <column name="ownerid" not-null="true" index="valarms_user" /> 
    7575    </many-to-one> 
    7676 
     
    125125  <query name="getAlarms"><![CDATA[ 
    126126    from org.bedework.calfacade.BwAlarm as al 
    127       where al.event = :ev and al.user=:user 
     127      where al.event = :ev and al.owner=:user 
    128128  ]]></query> 
    129129 
    130130  <query name="getUnexpiredAlarmsUser"><![CDATA[ 
    131131    from org.bedework.calfacade.BwAlarm as al 
    132       where al.expired = false and al.user=:user 
     132      where al.expired = false and al.owner=:user 
    133133  ]]></query> 
    134134 
     
    142142  <query name="getUnexpiredAlarmsUserTime"><![CDATA[ 
    143143    from org.bedework.calfacade.BwAlarm as al 
    144       where al.expired = false and al.user=:user and 
     144      where al.expired = false and al.owner=:user and 
    145145            al.triggerTime <= :tt 
    146146  ]]></query> 
  • trunk/calendar3/calCore/resources/hbms/Event.hbm.xml

    r2 r48  
    144144    <set name="attendees" table="event_attendees" 
    145145         cascade="all-delete-orphan" > 
    146       <key column="attendeeid"/> 
     146      <key column="eventid"/> 
    147147      <many-to-many class="org.bedework.calfacade.BwAttendee" /> 
    148148    </set> 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/BwAlarm.java

    r2 r48  
    5454package org.bedework.calfacade; 
    5555 
     56import org.bedework.calfacade.base.BwOwnedDbentity; 
    5657import org.bedework.calfacade.ifs.Attendees; 
    5758import org.bedework.calfacade.ifs.AttendeesI; 
     
    7172 *  @author Mike Douglass   douglm@rpi.edu 
    7273 */ 
    73 public abstract class BwAlarm implements AttendeesI, Comparable, Serializable { 
     74public abstract class BwAlarm extends BwOwnedDbentity implements AttendeesI, Comparable, Serializable { 
    7475  /** audio */ 
    7576  public final static int alarmTypeAudio = 0; 
     
    9394  protected int alarmType; 
    9495 
    95   protected int id = CalFacadeDefs.unsavedItemKey; 
    96  
    97   protected int userid; 
    98  
    99   /** The user */ 
    100   protected BwUser user; 
    101  
    10296  protected String trigger; 
    10397  protected boolean triggerStart; 
     
    118112  protected Attendees attendeesHelper; 
    119113 
    120   protected long sequence; 
    121  
    122114  /* ------------------------- Non-db fields ---------------------------- */ 
    123115 
     
    134126  /** Constructor for all fields (for db retrieval) 
    135127   * 
     128   * @param owner         Owner of alarm 
    136129   * @param alarmType     type of alarm 
    137    * @param user          Owner of alarm 
    138130   * @param trigger       This specifies the time for the alarm in rfc format 
    139131   * @param triggerStart  true if we trigger off the start 
     
    151143   * @param summary       String summary (email) 
    152144   * @param attendees     Collection of attendees 
    153    * @param sequence      long sequence value 
    154    */ 
    155   public BwAlarm(int alarmType, 
    156                   BwUser user, 
    157                   String trigger, 
    158                   boolean triggerStart, 
    159                   boolean triggerDateTime, 
    160                   String duration, 
    161                   int repeat, 
    162                   long triggerTime, 
    163                   long previousTrigger, 
    164                   int repeatCount, 
    165                   boolean expired, 
    166                   String attach, 
    167                   String description, 
    168                   String summary, 
    169                   Collection attendees, 
    170                   long sequence) { 
     145   */ 
     146  public BwAlarm(BwUser owner, 
     147                 int alarmType, 
     148                 String trigger, 
     149                 boolean triggerStart, 
     150                 boolean triggerDateTime, 
     151                 String duration, 
     152                 int repeat, 
     153                 long triggerTime, 
     154                 long previousTrigger, 
     155                 int repeatCount, 
     156                 boolean expired, 
     157                 String attach, 
     158                 String description, 
     159                 String summary, 
     160                 Collection attendees) { 
     161    super(owner, false); 
    171162    this.alarmType = alarmType; 
    172     this.user = user; 
    173     if (user != null) { 
    174       this.userid = user.getId(); 
    175     } 
    176163    this.trigger = trigger; 
    177164    this.triggerStart = triggerStart; 
     
    187174    this.summary = summary; 
    188175    setAttendees(attendees); 
    189  
    190     this.sequence = sequence; 
    191176  } 
    192177 
     
    209194  public int getAlarmType() { 
    210195    return alarmType; 
    211   } 
    212  
    213   /** Set the id for this alarm 
    214    * 
    215    * @param val   alarm id 
    216    */ 
    217   public void setId(int val) { 
    218     id = val; 
    219   } 
    220  
    221   /** Get the alarm's id 
    222    * 
    223    * @return int    the alarm's unique id 
    224    */ 
    225   public int getId() { 
    226     return id; 
    227   } 
    228  
    229   /**    Set the userid 
    230    * 
    231    * @param val   userid 
    232    */ 
    233   public void setUserid(int val) { 
    234     userid = val; 
    235   } 
    236  
    237   /** Get the user id 
    238    * 
    239    * @return int    the userid 
    240    */ 
    241   public int getUserid() { 
    242     return userid; 
    243   } 
    244  
    245   /** set the user 
    246    * 
    247    * @param val  UserVO user 
    248    */ 
    249   public void setUser(BwUser val) { 
    250     user = val; 
    251     if (user == null) { 
    252       userid = CalFacadeDefs.unsavedItemKey; 
    253     } else { 
    254       userid = user.getId(); 
    255     } 
    256   } 
    257  
    258   /** Get the user 
    259    * 
    260    * @return UserVO     user, userVO 
    261    */ 
    262   public BwUser getUser() { 
    263     return user; 
    264196  } 
    265197 
     
    601533  } 
    602534 
    603   /** Set sequence value 
    604    * 
    605    * @param val 
    606    */ 
    607   public void setSequence(long val) { 
    608     sequence = val; 
    609   } 
    610  
    611   /** 
    612    * @return long sequence value 
    613    */ 
    614   public long getSequence() { 
    615     return sequence; 
    616   } 
    617  
    618535  /* ==================================================================== 
    619536   *                   Mappng methods 
     
    719636--------------------------------------------------------*/ 
    720637 
    721   /* ==================================================================== 
    722    *                      Object methods 
    723    * ==================================================================== */ 
    724  
    725   public int compareTo(Object o)  { 
    726     if (!(o instanceof BwAlarm)) { 
    727       throw new ClassCastException(); 
    728     } 
    729  
    730     if (equals(o)) { 
    731       return 0; 
    732     } 
    733  
    734     BwAlarm that = (BwAlarm)o; 
    735  
    736     try { 
    737       if (that.getTriggerTime() > getTriggerTime()) { 
    738         return -1; 
    739       } 
    740  
    741       return 1; 
    742     } catch (Throwable t) { 
    743       throw new RuntimeException(t); 
    744     } 
    745   } 
    746  
    747   public int hashCode() { 
    748     int hc = 31 * alarmType; 
    749  
    750     if (user != null) { 
    751       hc *= user.hashCode(); 
    752     } 
    753  
    754     hc *= trigger.hashCode(); 
    755     if (triggerStart) { 
    756       hc *= 2; 
    757     } 
    758  
    759     if (duration != null) { 
    760       hc *= duration.hashCode(); 
    761       hc *= (repeat + 1); 
    762     } 
    763  
    764     return hc; 
    765   } 
    766  
    767   /* We consider two alarms equal if their user, times and 
    768    * durations match. 
    769    */ 
    770   public boolean equals(Object obj) { 
    771     if (obj == this) { 
    772       return true; 
    773     } 
    774  
    775     if (!(obj instanceof BwAlarm)) { 
    776       return false; 
    777     } 
    778  
    779     BwAlarm that = (BwAlarm)obj; 
    780  
    781     if (that.alarmType != alarmType) { 
    782       return false; 
    783     } 
    784  
    785     if (!eqObj(user, that.user)) { 
    786       return false; 
    787     } 
    788  
    789     if (!eqObj(trigger, that.trigger)) { 
    790       return false; 
    791     } 
    792  
    793     if (that.triggerStart != triggerStart) { 
    794       return false; 
    795     } 
    796  
    797     if (duration != null) { 
    798       if (!eqObj(duration, that.duration)) { 
    799         return false; 
    800       } 
    801  
    802       if (that.repeat != repeat) { 
    803         return false; 
    804       } 
    805     } 
    806  
    807     return true; 
    808   } 
    809  
    810   /** Compare two possibly null obects 
    811    * 
    812    * @param o1 
    813    * @param o2 
    814    * @return boolean true for equal 
    815    */ 
    816   public boolean eqObj(Object o1, Object o2) { 
    817     if (o1 == null) { 
    818       return o2 == null; 
    819     } 
    820  
    821     if (o2 == null) { 
    822       return false; 
    823     } 
    824  
    825     return o1.equals(o2); 
    826   } 
    827  
    828   public String toString() { 
    829     StringBuffer sb = new StringBuffer(); 
    830  
    831     sb.append("ValarmVO{id="); 
    832     sb.append(id); 
    833  
     638  protected void toStringSegment(StringBuffer sb) { 
     639    super.toStringSegment(sb); 
    834640    sb.append(", type="); 
    835     sb.append(alarmTypes[alarmType]); 
    836  
    837     sb.append(", owner="); 
    838  
    839     if (user == null) { 
    840       sb.append("**********null************"); 
    841     } else { 
    842       sb.append(user.getAccount()); 
    843     } 
     641    sb.append(alarmTypes[getAlarmType()]); 
    844642 
    845643    sb.append(", trigger("); 
    846     if (triggerStart) { 
     644    if (getTriggerStart()) { 
    847645      sb.append("START)="); 
    848646    } else { 
    849647      sb.append("END)="); 
    850648    } 
    851     sb.append(trigger); 
    852  
    853     if (duration != null) { 
     649    sb.append(getTrigger()); 
     650 
     651    if (getDuration() != null) { 
    854652      sb.append(", duration="); 
    855       sb.append(duration); 
     653      sb.append(getDuration()); 
    856654      sb.append(", repeat="); 
    857       sb.append(repeat); 
    858     } 
    859  
    860     if (alarmType == alarmTypeAudio) { 
    861       if (attach != null) { 
     655      sb.append(getRepeat()); 
     656    } 
     657 
     658    if (getAlarmType() == alarmTypeAudio) { 
     659      if (getAttach() != null) { 
    862660        sb.append(", attach="); 
    863         sb.append(attach); 
    864       } 
    865     } else if (alarmType == alarmTypeDisplay) { 
     661        sb.append(getAttach()); 
     662      } 
     663    } else if (getAlarmType() == alarmTypeDisplay) { 
    866664      sb.append(", description="); 
    867       sb.append(description); 
    868     } else if (alarmType == alarmTypeEmail) { 
     665      sb.append(getDescription()); 
     666    } else if (getAlarmType() == alarmTypeEmail) { 
    869667      sb.append(", description="); 
    870       sb.append(description); 
     668      sb.append(getDescription()); 
    871669      sb.append(", summary="); 
    872       sb.append(summary); 
     670      sb.append(getSummary()); 
    873671      sb.append(", attendees=["); 
    874672      Iterator it = iterateAttendees(); 
     
    879677      if (attach != null) { 
    880678        sb.append(", attach="); 
    881         sb.append(attach); 
    882       } 
    883     } else if (alarmType == alarmTypeProcedure) { 
     679        sb.append(getAttach()); 
     680      } 
     681    } else if (getAlarmType() == alarmTypeProcedure) { 
    884682      sb.append(", attach="); 
    885       sb.append(attach); 
     683      sb.append(getAttach()); 
    886684      if (description != null) { 
    887685        sb.append(", description="); 
    888         sb.append(description); 
    889       } 
    890     } 
    891  
    892     sb.append(", sequence="); 
    893     sb.append(sequence); 
     686        sb.append(getDescription()); 
     687      } 
     688    } 
     689  } 
     690 
     691  /* ==================================================================== 
     692   *                      Object methods 
     693   * ==================================================================== */ 
     694 
     695  public int compareTo(Object o)  { 
     696    if (!(o instanceof BwAlarm)) { 
     697      throw new ClassCastException(); 
     698    } 
     699 
     700    if (equals(o)) { 
     701      return 0; 
     702    } 
     703 
     704    BwAlarm that = (BwAlarm)o; 
     705 
     706    try { 
     707      if (that.getTriggerTime() > getTriggerTime()) { 
     708        return -1; 
     709      } 
     710 
     711      return 1; 
     712    } catch (Throwable t) { 
     713      throw new RuntimeException(t); 
     714    } 
     715  } 
     716 
     717  public int hashCode() { 
     718    int hc = 31 * alarmType; 
     719 
     720    if (getOwner() != null) { 
     721      hc *= getOwner().hashCode(); 
     722    } 
     723 
     724    hc *= trigger.hashCode(); 
     725    if (triggerStart) { 
     726      hc *= 2; 
     727    } 
     728 
     729    if (duration != null) { 
     730      hc *= duration.hashCode(); 
     731      hc *= (repeat + 1); 
     732    } 
     733 
     734    return hc; 
     735  } 
     736 
     737  /* We consider two alarms equal if their user, times and 
     738   * durations match. 
     739   */ 
     740  public boolean equals(Object obj) { 
     741    if (obj == this) { 
     742      return true; 
     743    } 
     744 
     745    if (!(obj instanceof BwAlarm)) { 
     746      return false; 
     747    } 
     748 
     749    BwAlarm that = (BwAlarm)obj; 
     750 
     751    if (that.getAlarmType() != getAlarmType()) { 
     752      return false; 
     753    } 
     754 
     755    if (!eqObj(getOwner(), that.getOwner())) { 
     756      return false; 
     757    } 
     758 
     759    if (!eqObj(getTrigger(), that.getTrigger())) { 
     760      return false; 
     761    } 
     762 
     763    if (that.getTriggerStart() != getTriggerStart()) { 
     764      return false; 
     765    } 
     766 
     767    if (duration != null) { 
     768      if (!eqObj(getDuration(), that.getDuration())) { 
     769        return false; 
     770      } 
     771 
     772      if (that.getRepeat() != getRepeat()) { 
     773        return false; 
     774      } 
     775    } 
     776 
     777    return true; 
     778  } 
     779 
     780  /** Compare two possibly null obects 
     781   * 
     782   * @param o1 
     783   * @param o2 
     784   * @return boolean true for equal 
     785   */ 
     786  public boolean eqObj(Object o1, Object o2) { 
     787    if (o1 == null) { 
     788      return o2 == null; 
     789    } 
     790 
     791    if (o2 == null) { 
     792      return false; 
     793    } 
     794 
     795    return o1.equals(o2); 
     796  } 
     797 
     798  public String toString() { 
     799    StringBuffer sb = new StringBuffer("BwAlarm{"); 
     800 
     801    toStringSegment(sb); 
    894802    sb.append("}"); 
    895803 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/BwEventAlarm.java

    r2 r48  
    8383   * 
    8484   * @param event         EventVO for this alarm - if non-null todo == null 
     85   * @param owner         Owner of alarm 
    8586   * @param alarmType     type of alarm 
    86    * @param user          Owner of alarm 
    8787   * @param trigger       This specifies the time for the alarm in rfc format 
    8888   * @param triggerStart  true if we trigger off the start 
     
    100100   * @param summary       String summary (email) 
    101101   * @param attendees     Collection of attendees 
    102    * @param sequence      long sequence value 
    103102   */ 
    104103  public BwEventAlarm(BwEvent event, 
     104                      BwUser owner, 
    105105                      int alarmType, 
    106                       BwUser user, 
    107106                      String trigger, 
    108107                      boolean triggerStart, 
     
    117116                      String description, 
    118117                      String summary, 
    119                       Collection attendees, 
    120                       long sequence) { 
    121     super(alarmType, user, trigger, triggerStart, triggerDateTime, 
     118                      Collection attendees) { 
     119    super(owner, alarmType, trigger, triggerStart, triggerDateTime, 
    122120          duration, repeat, triggerTime, previousTrigger, 
    123121          repeatCount, expired, attach, description, 
    124           summary, attendees, sequence); 
     122          summary, attendees); 
    125123    setEvent(event); 
    126124  } 
     
    129127   * 
    130128   * @param event 
    131    * @param user 
     129   * @param owner 
    132130   * @param trigger 
    133131   * @param triggerStart 
     
    139137   */ 
    140138  public static BwEventAlarm audioAlarm(BwEvent event, 
    141                                         BwUser user, 
     139                                        BwUser owner, 
    142140                                        String trigger, 
    143141                                        boolean triggerStart, 
     
    146144                                        int repeat, 
    147145                                        String attach) { 
    148     return new BwEventAlarm(event, alarmTypeAudio, user
     146    return new BwEventAlarm(event, owner, alarmTypeAudio
    149147                            trigger, triggerStart, triggerDateTime, 
    150148                            duration, repeat, 
    151149                            0, 0, 0, false, 
    152150                            attach, 
    153                             null, null, null, 0); 
     151                            null, null, null); 
    154152  } 
    155153 
     
    157155   * 
    158156   * @param event 
    159    * @param user 
     157   * @param owner 
    160158   * @param trigger 
    161159   * @param triggerStart 
     
    167165   */ 
    168166  public static BwEventAlarm displayAlarm(BwEvent event, 
    169                                           BwUser user, 
     167                                          BwUser owner, 
    170168                                          String trigger, 
    171169                                          boolean triggerStart, 
     
    174172                                          int repeat, 
    175173                                          String description) { 
    176     return new BwEventAlarm(event, alarmTypeDisplay, user
     174    return new BwEventAlarm(event, owner, alarmTypeDisplay
    177175                            trigger, triggerStart, triggerDateTime, 
    178176                            duration, repeat, 
    179177                            0, 0, 0, false, 
    180                             null, description, null, null, 0); 
     178                            null, description, null, null); 
    181179  } 
    182180 
     
    184182   * 
    185183   * @param event 
    186    * @param user 
     184   * @param owner 
    187185   * @param trigger 
    188186   * @param triggerStart 
     
    197195   */ 
    198196  public static BwEventAlarm emailAlarm(BwEvent event, 
    199                                         BwUser user, 
     197                                        BwUser owner, 
    200198                                        String trigger, 
    201199                                        boolean triggerStart, 
     
    207205                                        String summary, 
    208206                                        Collection attendees) { 
    209     return new BwEventAlarm(event, alarmTypeEmail, user
     207    return new BwEventAlarm(event, owner, alarmTypeEmail
    210208                            trigger, triggerStart, triggerDateTime, 
    211209                            duration, repeat, 
    212210                            0, 0, 0, false, 
    213211                            attach, 
    214                             description, summary, attendees, 0); 
     212                            description, summary, attendees); 
    215213  } 
    216214 
     
    218216   * 
    219217   * @param event 
    220    * @param user 
     218   * @param owner 
    221219   * @param trigger 
    222220   * @param triggerStart 
     
    229227   */ 
    230228  public static BwEventAlarm procedureAlarm(BwEvent event, 
    231                                             BwUser user, 
     229                                            BwUser owner, 
    232230                                            String trigger, 
    233231                                            boolean triggerStart, 
     
    237235                                            String attach, 
    238236                                            String description) { 
    239     return new BwEventAlarm(event, alarmTypeProcedure, user
     237    return new BwEventAlarm(event, owner, alarmTypeProcedure
    240238                            trigger, triggerStart, triggerDateTime, 
    241239                            duration, repeat, 
    242240                            0, 0, 0, false, 
    243241                            attach, 
    244                             description, null, null, 0); 
     242                            description, null, null); 
    245243  } 
    246244 
     
    363361 
    364362  public String toString() { 
    365     StringBuffer sb = new StringBuffer(); 
    366  
    367     sb.append("BwEventAlarm{"); 
     363    StringBuffer sb = new StringBuffer("BwEventAlarm{"); 
     364 
     365    toStringSegment(sb); 
    368366 
    369367    if (event != null) { 
     
    372370    } 
    373371 
    374     sb.append(", "); 
    375  
    376     sb.append(super.toString()); 
    377372    sb.append("}"); 
    378373 
     
    383378    try { 
    384379      BwEventAlarm a = new BwEventAlarm(null,  //event 
     380                                        null, // user 
    385381                                        getAlarmType(), 
    386                                         null, // user 
    387382                                        getTrigger(), 
    388383                                        getTriggerStart(), 
     
    397392                                        getDescription(), 
    398393                                        getSummary(), 
    399                                         cloneAttendees(), 
    400                                         getSequence() 
    401                                         ); 
     394                                        cloneAttendees()); 
    402395 
    403396      // Don't clone event , they are cloning us 
    404397 
    405       if (getUser() != null) { 
    406         a.setUser((BwUser)getUser().clone()); 
     398      if (getOwner() != null) { 
     399        a.setOwner((BwUser)getOwner().clone()); 
    407400      } 
    408401 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/BwRecurrence.java

    r2 r48  
    8282  private Collection exrules; 
    8383 
    84   /** Collection of DateTimeVO rdate values 
     84  /** Collection of BwDateTime rdate values 
    8585   */ 
    8686  private Collection rdates; 
    8787 
    88   /** Collection of DateTimeVO exdate values 
     88  /** Collection of BwDateTime exdate values 
    8989   */ 
    9090  private Collection exdates; 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/BwTimeZone.java

    r2 r48  
    5454package org.bedework.calfacade; 
    5555 
    56 import java.io.Serializable
     56import org.bedework.calfacade.base.BwOwnedDbentity
    5757 
    5858/** Represents a stored timezone. This whole area is somewhat problematical, 
     
    7070 *  @version 1.0 
    7171 */ 
    72 public class BwTimeZone implements Serializable { 
    73   private int id = CalFacadeDefs.unsavedItemKey; 
    74  
     72public class BwTimeZone extends BwOwnedDbentity { 
    7573  /** This is the timezone id this is known by. 
    7674   */ 
    7775  private String tzid; 
    78  
    79   /* * We store timezones in CalendarVO objects. 
    80    * / 
    81   private CalendarVO calendar; 
    82   */ 
    83  
    84   /** User who owns this timezone */ 
    85   private BwUser owner; 
    86  
    87   private boolean publick; 
    8876 
    8977  private String vtimezone; // rfc2554 representation 
     
    9886   */ 
    9987  public BwTimeZone() { 
    100   } 
    101  
    102   /** Set the id for this timezone 
    103    * 
    104    * @param val   alarm id 
    105    */ 
    106   public void setId(int val) { 
    107     id = val; 
    108   } 
    109  
    110   /** Get the timezone's id 
    111    * 
    112    * @return int    the timezone's unique id 
    113    */ 
    114   public int getId() { 
    115     return id; 
    11688  } 
    11789 
     
    130102  public String getTzid() { 
    131103    return tzid; 
    132   } 
    133  
    134   /* * Set the timezone's calendar 
    135    * 
    136    * @param val    CalendarVO timezone's calendar 
    137    * / 
    138   public void setCalendar(CalendarVO val) { 
    139     calendar = val; 
    140   } 
    141  
    142   /* * Get the timezone's calendar 
    143    * 
    144    * @return CalendarVO   the timezone's calendar 
    145    * / 
    146   public CalendarVO getCalendar() { 
    147     return calendar; 
    148   }*/ 
    149  
    150   /** Set the timezone public flag 
    151    * 
    152    *  @param val    true if the timezone is public 
    153    */ 
    154   public void setPublick(boolean val) { 
    155     publick = val; 
    156   } 
    157  
    158   /** 
    159    * @return boolean true for public 
    160    */ 
    161   public boolean getPublick() { 
    162     return publick; 
    163   } 
    164  
    165   /** 
    166    * @param  val      UserVO timezone owner 
    167    */ 
    168   public void setOwner(BwUser val) { 
    169     owner = val; 
    170   } 
    171  
    172   /** 
    173    * @return UserVO     timezone's owner 
    174    */ 
    175   public BwUser getOwner() { 
    176     return owner; 
    177104  } 
    178105 
     
    258185 
    259186  public String toString() { 
    260     StringBuffer sb = new StringBuffer(); 
     187    StringBuffer sb = new StringBuffer("TimeZoneVO{"); 
    261188 
    262     sb.append("TimeZoneVO{id="); 
    263     sb.append(id); 
     189    super.toStringSegment(sb); 
    264190    sb.append(", tzid="); 
    265191    sb.append(tzid); 
    266     sb.append(", publick="); 
    267     sb.append(getPublick()); 
    268     sb.append(", owner="); 
    269     sb.append(owner); 
    270192    sb.append(", jtzid="); 
    271193    sb.append(jtzid); 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/BwTodo.java

    r2 r48  
    5454package org.bedework.calfacade; 
    5555 
    56 import java.io.Serializable
     56import org.bedework.calfacade.base.BwShareableContainedDbentity
    5757 
    5858/** This will be populated with the Vtodo fields. 
     
    6060 *  @author Mike Douglass   douglm@rpi.edu 
    6161 */ 
    62 public class BwTodo implements Serializable { 
    63   private int id = CalFacadeDefs.unsavedItemKey; 
     62public class BwTodo extends BwShareableContainedDbentity { 
    6463 
    6564  private BwDateTime dtstart; 
     
    6867   *                      Bean methods 
    6968   * ==================================================================== */ 
    70  
    71   /** 
    72     Set the id for this event 
    73     @param val Event id 
    74    */ 
    75   public void setId(int val) { 
    76     id = val; 
    77   } 
    78  
    79   /** Get the event's unique id 
    80    * 
    81    * @return int    the event's unique id 
    82    */ 
    83   public int getId() { 
    84     return id; 
    85   } 
    8669 
    8770  /** Set the event's start 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/BwTodoAlarm.java

    r2 r48  
    8383   * 
    8484   * @param todo          TodoVO for this alarm - if non-null event == null 
     85   * @param owner         Owner of alarm 
    8586   * @param alarmType     type of alarm 
    86    * @param user          Owner of alarm 
    8787   * @param trigger       This specifies the time for the alarm in rfc format 
    8888   * @param triggerStart  true if we trigger off the start 
     
    100100   * @param summary       String summary (email) 
    101101   * @param attendees     Collection of attendees 
    102    * @param sequence      long sequence value 
    103102   */ 
    104103  public BwTodoAlarm(BwTodo todo, 
     104                     BwUser owner, 
    105105                     int alarmType, 
    106                      BwUser user, 
    107106                     String trigger, 
    108107                     boolean triggerStart, 
     
    117116                     String description, 
    118117                     String summary, 
    119                      Collection attendees, 
    120                      long sequence) { 
    121     super(alarmType, user, trigger, triggerStart, triggerDateTime, 
     118                     Collection attendees) { 
     119    super(owner, alarmType, trigger, triggerStart, triggerDateTime, 
    122120          duration, repeat, triggerTime, previousTrigger, 
    123121          repeatCount, expired, attach, description, 
    124           summary, attendees, sequence); 
     122          summary, attendees); 
    125123    this.todo = todo; 
    126124  } 
     
    129127  * 
    130128   * @param todo 
    131    * @param user 
     129   * @param owner 
    132130   * @param trigger 
    133131   * @param triggerStart 
     
    139137   */ 
    140138  public static BwTodoAlarm audioAlarm(BwTodo todo, 
    141                                        BwUser user, 
     139                                       BwUser owner, 
    142140                                       String trigger, 
    143141                                       boolean triggerStart, 
     
    146144                                       int repeat, 
    147145                                       String attach) { 
    148     return new BwTodoAlarm(todo, alarmTypeAudio, user
     146    return new BwTodoAlarm(todo, owner, alarmTypeAudio
    149147                           trigger, triggerStart, triggerDateTime, 
    150148                           duration, repeat, 
    151149                           0, 0, 0, false, 
    152150                           attach, 
    153                            null, null, null, 0); 
     151                           null, null, null); 
    154152  } 
    155153 
     
    157155  * 
    158156   * @param todo 
    159    * @param user 
     157   * @param owner 
    160158   * @param trigger 
    161159   * @param triggerStart 
     
    167165   */ 
    168166  public static BwTodoAlarm displayAlarm(BwTodo todo, 
    169                                          BwUser user, 
     167                                         BwUser owner, 
    170168                                         String trigger, 
    171169                                         boolean triggerStart, 
     
    174172                                         int repeat, 
    175173                                         String description) { 
    176     return new BwTodoAlarm(todo, alarmTypeDisplay, user
     174    return new BwTodoAlarm(todo, owner, alarmTypeDisplay
    177175                           trigger, triggerStart, triggerDateTime, 
    178176                           duration, repeat, 
    179177                           0, 0, 0, false, 
    180                            null, description, null, null, 0); 
     178                           null, description, null, null); 
    181179  } 
    182180 
     
    184182  * 
    185183   * @param todo 
    186    * @param user 
     184   * @param owner 
    187185   * @param trigger 
    188186   * @param triggerStart 
     
    197195   */ 
    198196  public static BwTodoAlarm emailAlarm(BwTodo todo, 
    199                                        BwUser user, 
     197                                       BwUser owner, 
    200198                                       String trigger, 
    201199                                       boolean triggerStart, 
     
    207205                                       String summary, 
    208206                                       Collection attendees) { 
    209     return new BwTodoAlarm(todo, alarmTypeEmail, user
     207    return new BwTodoAlarm(todo, owner, alarmTypeEmail
    210208                           trigger, triggerStart, triggerDateTime, 
    211209                           duration, repeat, 
    212210                           0, 0, 0, false, 
    213211                           attach, 
    214                            description, summary, attendees, 0); 
     212                           description, summary, attendees); 
    215213  } 
    216214 
     
    218216  * 
    219217   * @param todo 
    220    * @param user 
     218   * @param owner 
    221219   * @param trigger 
    222220   * @param triggerStart 
     
    229227   */ 
    230228  public static BwTodoAlarm procedureAlarm(BwTodo todo, 
    231                                            BwUser user, 
     229                                           BwUser owner, 
    232230                                           String trigger, 
    233231                                           boolean triggerStart, 
     
    237235                                           String attach, 
    238236                                           String description) { 
    239     return new BwTodoAlarm(todo, alarmTypeProcedure, user
     237    return new BwTodoAlarm(todo, owner, alarmTypeProcedure
    240238                           trigger, triggerStart, triggerDateTime, 
    241239                           duration, repeat, 
    242240                           0, 0, 0, false, 
    243241                           attach, 
    244                            description, null, null, 0); 
     242                           description, null, null); 
    245243  } 
    246244 
     
    349347 
    350348  public String toString() { 
    351     StringBuffer sb = new StringBuffer(); 
    352  
    353     sb.append("TodoAlarmVO{"); 
     349    StringBuffer sb = new StringBuffer("BwTodoAlarm{"); 
     350 
     351    toStringSegment(sb); 
    354352 
    355353    if (todo != null) { 
     
    358356    } 
    359357 
    360     sb.append(", "); 
    361  
    362     sb.append(super.toString()); 
    363358    sb.append("}"); 
    364359 
     
    367362 
    368363  public Object clone() { 
    369     BwTodoAlarm a = new BwTodoAlarm(null,  //todo 
    370                                     alarmType, 
    371                                     null, // user 
    372                                     trigger, 
    373                                     triggerStart, 
    374                                     triggerDateTime, 
    375                                     duration, 
    376                                     repeat, 
    377                                     triggerTime, 
    378                                     previousTrigger, 
    379                                     repeatCount, 
    380                                     expired, 
    381                                     attach, 
    382                                     description, 
    383                                     summary, 
    384                                     cloneAttendees(), 
    385                                     sequence 
    386                                     ); 
    387  
    388     // Don't clone event or todo, they are cloning us 
    389  
    390     if (user != null) { 
    391       a.setUser((BwUser)user.clone()); 
    392     } 
    393  
    394     return a; 
     364    try { 
     365      BwTodoAlarm a = new BwTodoAlarm(null,  //todo 
     366                                      null, // user 
     367                                      getAlarmType(), 
     368                                      getTrigger(), 
     369                                      getTriggerStart(), 
     370                                      getTriggerDateTime(), 
     371                                      getDuration(), 
     372                                      getRepeat(), 
     373                                      getTriggerTime(), 
     374                                      getPreviousTrigger(), 
     375                                      getRepeatCount(), 
     376                                      getExpired(), 
     377                                      getAttach(), 
     378                                      getDescription(), 
     379                                      getSummary(), 
     380                                      cloneAttendees()); 
     381 
     382      // Don't clone event or todo, they are cloning us 
     383 
     384      if (getOwner() != null) { 
     385        a.setOwner((BwUser)getOwner().clone()); 
     386      } 
     387 
     388      return a; 
     389    } catch (Throwable t) { 
     390      throw new RuntimeException(t); 
     391    } 
    395392  } 
    396393} 
  • trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java

    r47 r48  
    16051605    // Do some sort of validation here. 
    16061606    alarm.setEvent(event); 
    1607     alarm.setUser(getUser()); 
     1607    alarm.setOwner(getUser()); 
    16081608    getCal().addAlarm(alarm); 
    16091609  } 
  • trunk/calendar3/docs/todo.txt

    r47 r48  
    22 
    33-------------------------------------------------------------------------------- 
     4-------------------------------------------------------------------------------- 
     5maxDescriptionLength out of BwEvent - into syspars? 
    46-------------------------------------------------------------------------------- 
    57Check all day events are correct in all clients. 
  • trunk/calendar3/dumprestore/build.xml

    r43 r48  
    22 
    33<!-- ============= Calendar db interface test classes ================== 
    4      This is the build.xml for the uwcal calendar dbi test.
     4     This is the build.xml for the bedework calendar dump restore
    55 
    66     Authors: Mike Douglass   douglm@rpi.edu 
     
    88 
    99<project name="cal.db.dumprestore" default="init" > 
    10   <property name="base.name" value="tools.dumprestore"/> 
     10  <property name="base.name" value="dumprestore"/> 
    1111 
    1212  <target name="init"> 
    1313    <dirname property="this.dir" file="${ant.file}"/> 
    1414    <property name="source.home" location="${this.dir}/src"/> 
     15 
     16    <property name="dump.class" value="org.bedework.dumprestore.dump.Dump" /> 
     17    <property name="restore.class" value="org.bedework.dumprestore.restore.Restore" /> 
    1518 
    1619    <property name="org.bedework.dump.jdbcdriver.jar" 
     
    5356      <!-- add any properties we might want --> 
    5457      <pathelement location="${dumprestore.run.resources}" /> 
    55       <pathelement location="${org.bedework.tools.base}/properties" /> 
     58      <pathelement location="${org.bedework.dumprestore.base}/properties" /> 
    5659 
    5760      <!-- add the mapping file from appsuite --> 
     
    8689      <!-- add any properties we might want --> 
    8790      <pathelement location="${dumprestore.run.resources}" /> 
    88       <pathelement location="${org.bedework.tools.base}/properties" /> 
     91      <pathelement location="${org.bedework.dumprestore.base}/properties" /> 
    8992 
    9093      <!-- add the mapping file from appsuite --> 
     
    9497          location="${dumprestore.run.base}/resources/hibernate.properties"/> 
    9598    </path> 
     99  </target> 
     100 
     101  <target name="build" 
     102          depends="init" 
     103          description="Build calendar dumprestore jars"> 
     104    <!-- ==================== Sources and classes ====================== --> 
     105 
     106    <fileset id="base.java.sources" dir="${source.home}" > 
     107      <include name="org/bedework/dumprestore/**/*.java"/> 
     108    </fileset> 
     109 
     110    <patternset id="base.class.patternset"> 
     111      <include name="org/bedework/dumprestore/**/*.class"/> 
     112    </patternset> 
     113 
     114    <!-- ==================== Compilation Classpath ==================== --> 
     115 
     116    <path id="compile.classpath"> 
     117      <pathelement location="${log4j.jar}"/> 
     118      <pathelement location="${ical4j.jar}"/> 
     119      <pathelement location="${digester.jar}"/> 
     120      <pathelement location="${hibernate.jar}"/> 
     121      <pathelement location="${org.bedework.calfacadeshared.jar}"/> 
     122      <pathelement location="${org.bedework.calsvci.jar}"/> 
     123      <pathelement location="${org.bedework.calcore.jar}"/> 
     124      <pathelement location="${org.bedework.access.jar}"/> 
     125      <pathelement location="${org.bedework.appcommon.jar}"/> 
     126    </path> 
     127 
     128    <!-- ==================== Build Target ============================= --> 
     129 
     130    <property name="build.jar.file" location="${org.bedework.dumprestore.jar}" /> 
     131 
     132    <ant antfile="${buildjar}" inheritRefs="true" target="build" /> 
    96133  </target> 
    97134 
     
    105142    <!-- Load the properties from the properties directory --> 
    106143    <property name="cal.dumprestore.properties" 
    107               location="${org.bedework.tools.base}/properties/dumprestore.properties"/> 
     144              location="${org.bedework.dumprestore.base}/properties/dumprestore.properties"/> 
    108145    <echo message="Using db properties in ${cal.dumprestore.properties}" /> 
    109146 
     
    127164    <echo message="dumping to ${org.bedework.dump.arg.dumpfile}" /> 
    128165 
    129     <java      classname="${dump.class}" 
     166    <java  classname="${dump.class}" 
    130167          fork="true" 
    131168          failonerror="true"> 
     
    148185    <!-- Load the properties from the properties directory --> 
    149186    <property name="cal.dumprestore.properties" 
    150               location="${org.bedework.tools.base}/properties/dumprestore.properties"/> 
     187              location="${org.bedework.dumprestore.base}/properties/dumprestore.properties"/> 
    151188    <echo message="Using db properties in ${cal.dumprestore.properties}" /> 
    152189 
     
    192229    <echo message="restoring from ${org.bedework.restore.arg.dumpfile}" /> 
    193230 
    194     <java      classname="${restore.class}" 
     231    <java  classname="${restore.class}" 
    195232          fork="true" 
    196233          failonerror="true"> 
     
    252289          description="Run bedework db restore app to initialise db"> 
    253290    <property name="org.bedework.restore.arg.dumpfile" 
    254               location="${org.bedework.tools.base}/resources/initbedework.xml"/> 
     291              location="${org.bedework.dumprestore.base}/resources/initbedework.xml"/> 
    255292    <antcall target="restoredb" inheritrefs="true" /> 
    256293  </target> 
  • trunk/calendar3/test/src/org/bedework/tests/calsvc/CalSvcAlarmsTest.java

    r2 r48  
    303303      BwEventAlarm alarm = (BwEventAlarm)it.next(); 
    304304 
    305       BwUser auser = alarm.getUser(); 
     305      BwUser auser = alarm.getOwner(); 
    306306      assertNotNull("Expecting non-null alarm for user " + user, auser); 
    307307 
  • trunk/calendar3/tools/build.xml

    r18 r48  
    6262       ================================================================= --> 
    6363 
    64   <target name="dumpdb" 
    65           depends="build" 
    66           description="Run calendar db dump app"> 
    67       <ant antfile="${org.bedework.tools.base}/dumprestore/build.xml" inheritrefs="true" 
    68            target="dumpdb" > 
    69         <property name="dump.class" value="org.bedework.tools.dumprestore.dump.Dump" /> 
    70       </ant> 
    71   </target> 
    72  
    73   <target name="restoredb" 
    74           depends="build" 
    75           description="Run calendar db restore app"> 
    76       <ant antfile="${org.bedework.tools.base}/dumprestore/build.xml" inheritrefs="true" 
    77            target="restoredb" > 
    78         <property name="restore.class" value="org.bedework.tools.dumprestore.restore.Restore" /> 
    79       </ant> 
    80   </target> 
    81  
    82   <target name="initdb" 
    83           depends="build" 
    84           description="Run calendar db restore app to init db"> 
    85       <ant antfile="${org.bedework.tools.base}/dumprestore/build.xml" inheritrefs="true" 
    86            target="initdb" > 
    87         <property name="restore.class" value="org.bedework.tools.dumprestore.restore.Restore" /> 
    88       </ant> 
    89   </target> 
    90  
    9164  <target name="tzconvert" 
    9265          depends="build"