Changeset 510

Show
Ignore:
Timestamp:
05/29/06 23:12:48
Author:
douglm
Message:

Change event date selection expression

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java

    r507 r510  
    10571057        GetPeriodsPars gpp = new GetPeriodsPars(); 
    10581058 
    1059         gpp.events = events; 
     1059        gpp.periods = events; 
    10601060        gpp.startDt = start; 
    10611061        gpp.dur = granularity; 
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java

    r507 r510  
    13031303    } 
    13041304 
    1305     /** Note that the comparisons below are required to ensure that the 
     1305    /* Note that the comparisons below are required to ensure that the 
    13061306     *  start date is inclusive and the end date is exclusive. 
    13071307     * From CALDAV: 
     
    13111311     * (DTSTART <= start AND DTSTART+DURATION > start) OR 
    13121312     * (DTSTART >= start AND DTSTART < end) OR 
    1313      * (DTEND   > start AND DTEND <= end) 
    1314      * 
    1315      * XXX This is wrong??? Last should be 
    1316      * XXX (DTEND   > start AND DTEND < end) 
     1313     * (DTEND   > start AND DTEND < end) 
    13171314     * 
    13181315     *  case 1 has the event starting between the dates. 
     
    13351332    } 
    13361333 
     1334    /* 
    13371335    sb.append("((("); 
    13381336 
     
    13481346 
    13491347    // case 3 
    1350     /* 
    1351     sb.append(endField); 
    1352     sb.append(" > :fromDate) and ("); 
    1353     sb.append(endField); 
    1354     sb.append(" <= :toDate)))"); 
    1355     */ 
    13561348    sb.append(endField); 
    13571349    sb.append(" > :fromDate) and ("); 
     
    13591351    sb.append(" < :toDate)))"); 
    13601352 
    1361     /
     1353    /
    13621354    (((ev.dtstart.datePart <= :fromDate) and (ev.dtend.datePart > :fromDate)) or 
    13631355     ((ev.dtstart.datePart >= :fromDate) and (ev.dtstart.datePart < :toDate)) or 
     
    13651357     ((ev.dtend.datePart >= :fromDate) and (ev.dtend.datePart < :toDate))) 
    13661358    */ 
     1359    sb.append("(("); 
     1360    sb.append(startField); 
     1361    sb.append(" < :toDate) and (("); 
     1362 
     1363    sb.append(endField); 
     1364    sb.append(" > :fromDate) or (("); 
     1365 
     1366    sb.append(startField); 
     1367    sb.append("="); 
     1368    sb.append(endField); 
     1369    sb.append(") and ("); 
     1370    sb.append(endField); 
     1371    sb.append(" >= :fromDate))))"); 
     1372 
     1373    /* 
     1374    ((start < to) and ((end > from) or 
     1375        ((start = end) and (end >= from)))) 
     1376        */ 
    13671377    return true; 
    13681378  } 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeUtil.java

    r507 r510  
    6060import net.fortuna.ical4j.model.Parameter; 
    6161import net.fortuna.ical4j.model.ParameterList; 
     62import net.fortuna.ical4j.model.Period; 
    6263import net.fortuna.ical4j.model.Property; 
    6364import net.fortuna.ical4j.model.property.DateProperty; 
     
    630631  } 
    631632 
    632   /** This class defines the events and the period of interest and can be passed 
    633    * repeatedly to getPeriodsEvents. 
     633  /** This class defines the entities which occupy time and the period of 
     634   * interest and can be passed repeatedly to getPeriodsEvents. 
    634635   * 
    635636   * <p>The end datetime will be updated ready for the next call. If endDt is 
     
    637638   */ 
    638639  public static class GetPeriodsPars { 
    639     /** Event Info objects to extract from */ 
    640     public Collection events; 
     640    /** Event Info or EventPeriod or Period objects to extract from */ 
     641    public Collection periods; 
    641642    /** Start of period - updated at each call from endDt */ 
    642643    public BwDateTime startDt; 
     
    673674 
    674675    EntityRange er = new EntityRange(); 
    675     Iterator it = pars.events.iterator(); 
     676    Iterator it = pars.periods.iterator(); 
    676677    while (it.hasNext()) { 
    677678      er.setEntity(it.next()); 
    678679 
    679       /* Event is within range if: 
     680      /* Period is within range if: 
    680681         1.   (((evStart <= :start) and (evEnd > :start)) or 
    681682         2.    ((evStart >= :start) and (evStart < :end)) or 
     
    758759      } 
    759760 
     761      if (o instanceof Period) { 
     762        Period p = (Period)o; 
     763 
     764        start = String.valueOf(p.getStart()); 
     765        start = String.valueOf(p.getEnd()); 
     766 
     767        return; 
     768      } 
     769 
    760770      start = null; 
    761771      end = null; 
  • trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java

    r507 r510  
    11121112        GetPeriodsPars gpp = new GetPeriodsPars(); 
    11131113 
    1114         gpp.events = events; 
     1114        gpp.periods = events; 
    11151115        gpp.startDt = start; 
    11161116        gpp.dur = granularity;