Changeset 426

Show
Ignore:
Timestamp:
05/01/06 10:16:14
Author:
douglm
Message:

Fixed comp-filter and eg11 test

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavComponentNode.java

    r417 r426  
    6767import edu.rpi.sss.util.xml.QName; 
    6868 
    69  
    7069import net.fortuna.ical4j.model.Calendar; 
    7170import net.fortuna.ical4j.model.Component; 
    7271import net.fortuna.ical4j.model.component.VEvent; 
    7372 
     73import java.util.ArrayList; 
    7474import java.util.Collection; 
    7575import java.util.Iterator; 
    76 import java.util.Vector; 
    7776 
    7877/** Class to represent an entity such as events in caldav. 
     
    223222  public void addEvent(BwEvent val) { 
    224223    if (events == null) { 
    225       events = new Vector(); 
    226     } 
    227     events.add(val); 
     224      events = new ArrayList(); 
     225    } 
     226 
     227    EventInfo ei = new EventInfo(val); 
     228 
     229    ei.setRecurrenceId(val.getRecurrence().getRecurrenceId()); 
     230    events.add(ei); 
    228231  } 
    229232 
     
    268271  public Collection getProperties(String ns) throws WebdavIntfException { 
    269272    init(true); 
    270     Vector v = new Vector(); 
     273    ArrayList al = new ArrayList(); 
    271274 
    272275    getVevent(); // init comp 
     
    275278    } 
    276279 
    277     addProp(v, ICalTags.summary, name); 
    278     addProp(v, ICalTags.dtstart, comp.getDtstart()); 
    279     addProp(v, ICalTags.dtend, comp.getDtend()); 
    280     addProp(v, ICalTags.duration, comp.getDuration()); 
    281     addProp(v, ICalTags.transp, comp.getTransp()); 
    282     addProp(v, ICalTags.due, comp.getDue()); 
     280    addProp(al, ICalTags.summary, name); 
     281    addProp(al, ICalTags.dtstart, comp.getDtstart()); 
     282    addProp(al, ICalTags.dtend, comp.getDtend()); 
     283    addProp(al, ICalTags.duration, comp.getDuration()); 
     284    addProp(al, ICalTags.transp, comp.getTransp()); 
     285    addProp(al, ICalTags.due, comp.getDue()); 
    283286//    addProp(v, ICalTags.completed,        | date-time from RFC2518 
    284     addProp(v, ICalTags.status, comp.getStatus()); 
     287    addProp(al, ICalTags.status, comp.getStatus()); 
    285288//    addProp(v, ICalTags.priority,         | integer 
    286289//    addProp(v, ICalTags.percentComplete, | integer 
    287     addProp(v, ICalTags.uid, comp.getUid()); 
    288     addProp(v, ICalTags.sequence, comp.getSequence()); 
     290    addProp(al, ICalTags.uid, comp.getUid()); 
     291    addProp(al, ICalTags.sequence, comp.getSequence()); 
    289292//    addProp(v, ICalTags.recurrenceId,    | date-time from RFC2518 
    290293//    addProp(v, ICalTags.trigger,          | see below TODO 
    291294 
    292295// FIXME FIX FIX 
    293     addProp(v, ICalTags.hasRecurrence, "0"); 
    294     addProp(v, ICalTags.hasAlarm, "0"); 
    295     addProp(v, ICalTags.hasAttachment, "0"); 
    296  
    297     return v
     296    addProp(al, ICalTags.hasRecurrence, "0"); 
     297    addProp(al, ICalTags.hasAlarm, "0"); 
     298    addProp(al, ICalTags.hasAttachment, "0"); 
     299 
     300    return al
    298301  } 
    299302 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/filter/Filter.java

    r423 r426  
    9999 *        if it matches the filter, which is to say: 
    100100 * 
    101  *    ("no is-defined element" OR "is-defined matches") AND 
    102  *    ("no time-range element" OR "time-range matches") AND 
    103  *    ("no sub-component filter" OR "all sub-component filters match") AND 
    104  *    ("no property filter elements" OR "all property filters match") 
    105  * 
    106  * 
    107  *    <!ELEMENT comp-filter (is-defined | time-range)? 
    108  *                          comp-filter* prop-filter*> 
     101 *       A component of the type specified by the "name" attribute 
     102 *       exists, and the CALDAV:comp-filter is empty, OR 
     103 * 
     104 *       it contains at least one recurrence instance scheduled to overlap a 
     105 *       given time range if a CALDAV:time-range XML element is specified, and 
     106 *       that any CALDAV:prop-filter and CALDAV:comp-filter child elements 
     107 *       also match. 
     108 * 
     109 * 
     110 *    <!ELEMENT comp-filter (is-not-defined | (time-range?, 
     111 *                              prop-filter*, comp-filter*))> 
    109112 * 
    110113 *    <!ATTLIST comp-filter name CDATA #REQUIRED> 
     
    119122 *        Limits the search to specific properties. 
    120123 *    Description: 
    121  *        The "name" attribute MUST contain an iCalendar property name (e.g., "ATTENDEE"). When the 'prop-filter' executes, a property matches if: 
    122  * 
    123  *    ("no is-defined element" OR "is-defined matches") AND 
    124  *    ("no time-range element" OR "time-range matches") AND 
    125  *    ("no text match element" OR "text-match matches") AND 
    126  *    ("no parameter filter elements" OR "all parameter filters match") 
    127  * 
    128  *    <!ELEMENT prop-filter (is-defined | time-range | text-match)? 
    129  *                            param-filter*> 
     124 *        The "name" attribute MUST contain an iCalendar property name 
     125 *        (e.g., "ATTENDEE"). When the 'prop-filter' executes, a property matches if: 
     126 * 
     127 *       A property of the type specified by the "name" attribute 
     128 *       exists, and the CALDAV:prop-filter is empty, OR it matches the 
     129 *       CALDAV:time-range XML element or CALDAV:text-match conditions 
     130 *       if specified, and that any CALDAV:param-filter child elements 
     131 *       also match. 
     132 * 
     133 *    or: 
     134 * 
     135 *       A property of the type specified by the "name" attribute does 
     136 *       not exist, and the CALDAV:is-not-defined element is specified. 
     137 * 
     138 *    <!ELEMENT prop-filter ((is-not-defined | 
     139 *                              ((time-range | text-match)?, 
     140 *                               param-filter*))> 
    130141 * 
    131142 *    <!ATTLIST prop-filter name CDATA #REQUIRED> 
     
    492503 
    493504  /** The given node must be a comp-filter element 
    494    *    <!ELEMENT comp-filter (is-not-defined | time-range)? 
    495    *                          comp-filter* prop-filter*
     505   *    <!ELEMENT comp-filter (is-not-defined | (time-range?, 
     506   *                            prop-filter*, comp-filter*))
    496507   * 
    497508   *    <!ATTLIST comp-filter name CDATA #REQUIRED> 
     
    511522    Element[] children = getChildren(nd); 
    512523 
     524    if (children.length == 0) { 
     525      // Empty 
     526      return cf; 
     527    } 
     528 
     529    if ((children.length == 1) && 
     530        MethodBase.nodeMatches(children[0], CaldavTags.isNotDefined)) { 
     531      cf.setIsNotDefined(true); 
     532      return cf; 
     533    } 
     534 
     535    /* (time-range?, prop-filter*, comp-filter*) */ 
     536 
    513537    try { 
    514538      for (int i = 0; i < children.length; i++) { 
     
    521545        } 
    522546 
    523         if (MethodBase.nodeMatches(curnode, CaldavTags.isNotDefined)) { 
    524           if (cf.getTimeRange() != null) { 
    525             throw new WebdavBadRequest(); 
    526           } 
    527  
    528           cf.setIsNotDefined(true); 
    529         } else if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { 
    530           if (cf.getIsNotDefined()) { 
    531             throw new WebdavBadRequest(); 
    532           } 
    533  
     547        if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { 
    534548          cf.setTimeRange(CalDavParseUtil.parseTimeRange(curnode, 
    535549              intf.getSvci().getTimezones())); 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/filter/PropFilter.java

    r423 r426  
    253253    } else if (timeRange != null) { 
    254254      timeRange.dump(log, indent + "  "); 
    255     } else
     255    } else if (match != null)
    256256      match.dump(log, indent + "  "); 
    257257    } 
  • trunk/calendar3/test/caldavTestData/eg/eg11.test

    r2 r426  
    2121    <C:comp-filter name="VCALENDAR"> 
    2222      <C:comp-filter name="VEVENT"> 
    23         <C:prop-filter name="ORGANIZER"> 
    24           <C:is-defined/> 
    25         </C:prop-filter> 
     23        <C:prop-filter name="ORGANIZER"/> 
    2624      </C:comp-filter> 
    2725    </C:comp-filter>