Changeset 656

Show
Ignore:
Timestamp:
06/24/06 00:33:26
Author:
douglm
Message:

Eventrefs date/time track master events

Files:

Legend:

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

    r614 r656  
    55 
    66# If you want to override these values you should add your own values to 
    7 # either <home-dir>/uwcal.build.properties or 
    8 #   local.build.properties 
    9  
    10 # This doesn't work too well. org.bedework.appserver.dir wasn't set until after this 
    11 # was executed. I moved the setting but I don't think that's altogether 
    12 # what was intended. I'm assuming the idea was to allow the calendar2 
    13 # build.xml towork in isolation. 
    14  
    15 # Maybe we should just put all the settings in here. 
     7# <home-dir>/bedework.build.properties 
    168 
    179#==================== File and Directory Names ======================== 
  • trunk/calendar3/build.xml

    r594 r656  
    3636      defined, from the following list: 
    3737      * Definitions on the "ant" command line (ant -Ddeploy.home=xyz compile) 
    38       * Definitions from a "uwcal.build.properties" file in the developer's 
     38      * Definitions from a "bedework.build.properties" file in the developer's 
    3939        home directory 
    40       * Definitions from a "local.build.properties" file in the top level 
    41         source directory 
    4240      * Definitions from a "build.properties" file in the top level 
    4341        source directory 
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java

    r550 r656  
    455455        updateRecurrences(val); 
    456456      } 
     457 
     458      updateRefs(val); 
     459 
    457460      return; 
    458461    } 
     
    550553       master field. 
    551554     */ 
    552     sb = new StringBuffer(); 
    553  
    554     sb.append("from "); 
    555     sb.append(BwEventAnnotation.class.getName()); 
    556     sb.append(" where target=:target"); 
    557  
    558     sess.createQuery(sb.toString()); 
    559     sess.setEntity("target", val); 
    560  
    561     Collection anns = sess.getList(); 
    562     Iterator it = anns.iterator(); 
     555    Iterator it = getAnnotations(val).iterator(); 
    563556 
    564557    while (it.hasNext()) { 
     
    745738 
    746739    val.setGuid(guid); 
     740  } 
     741 
     742  /* XXX This needs more work, OK until we allow modification of annotations - which 
     743   * could happen anyway through caldav or by synch. 
     744   * 
     745   * If the master changes then either we change the referencing annotations or 
     746   * we let the user know it's changed. At the moment we have no notification 
     747   * mechanism. 
     748   */ 
     749  private void updateRefs(BwEvent val) throws CalFacadeException { 
     750    HibSession sess = getSess(); 
     751    Iterator it = getAnnotations(val).iterator(); 
     752 
     753    while (it.hasNext()) { 
     754      BwEventAnnotation ann = (BwEventAnnotation)it.next(); 
     755      boolean changed = false; 
     756 
     757      if (!val.getDtstart().equals(ann.getDtstart())) { 
     758        ann.setDtstart(val.getDtstart()); 
     759        changed = true; 
     760      } 
     761 
     762      if (!val.getDtend().equals(ann.getDtend())) { 
     763        ann.setDtend(val.getDtend()); 
     764        changed = true; 
     765      } 
     766 
     767      if (!val.getDuration().equals(ann.getDuration())) { 
     768        ann.setDuration(val.getDuration()); 
     769        changed = true; 
     770      } 
     771 
     772      if (val.getEndType() != ann.getEndType()) { 
     773        ann.setEndType(val.getEndType()); 
     774        changed = true; 
     775      } 
     776 
     777      if (changed) { 
     778        sess.update(ann); 
     779      } 
     780    } 
    747781  } 
    748782 
     
    848882      } 
    849883    } 
     884  } 
     885 
     886  private Collection getAnnotations(BwEvent val) throws CalFacadeException { 
     887    HibSession sess = getSess(); 
     888    StringBuffer sb = new StringBuffer(); 
     889 
     890    sb.append("from "); 
     891    sb.append(BwEventAnnotation.class.getName()); 
     892    sb.append(" where target=:target"); 
     893 
     894    sess.createQuery(sb.toString()); 
     895    sess.setEntity("target", val); 
     896 
     897    return sess.getList(); 
    850898  } 
    851899 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/BwEvent.java

    r532 r656  
    11821182    /* If the guids are the same it's the same event for non recurring. 
    11831183       For recurring events the recurrence id must also be equal. 
    1184      * / 
    1185     int res = e1.getGuid().compareTo(e2.getGuid()); 
    1186     if (res == 0) { 
    1187       if (!e1.getRecurring()) { 
    1188         return 0; 
    1189       } 
    1190  
    1191       /* Recurring - only the same if the recurrence id is equal * / 
    1192       return CalFacadeUtil.cmpObjval(e1.getRecurrence().getRecurrenceId(), 
    1193                                      e2.getRecurrence().getRecurrenceId()); 
    1194     } 
    1195  
    1196     res = e1.getDtstart().compareTo(e2.getDtstart()); 
    1197     if (res != 0) { 
    1198       return res; 
    1199     } 
    1200  
    1201     res = e1.getDtend().compareTo(e2.getDtend()); 
    1202     if (res != 0) { 
    1203       return res; 
    1204     } 
    1205  
    1206     /* Dates are the same - try summary. * / 
    1207  
    1208     res = e1.getSummary().compareTo(e2.getSummary()); 
    1209     if (res != 0) { 
    1210       return res; 
    1211     } 
    1212  
    1213     // Just use guid 
    1214     return e1.getGuid().compareTo(e2.getGuid()); 
    1215     */ 
    1216     /* If the guids are the same it's the same event for non recurring. 
    1217        For recurring events the recurrence id must also be equal. 
    12181184     */ 
    12191185    int res = e1.getGuid().compareTo(e2.getGuid());