Changeset 119
- Timestamp:
- 02/08/06 10:00:04
- Files:
-
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java (modified) (1 diff)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/BwEvent.java (modified) (1 diff)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/BwSubscription.java (modified) (1 diff)
- trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavCalNode.java (modified) (1 diff)
- trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/calquery/FreeBusyQuery.java (modified) (1 diff)
- trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/filter/Filter.java (modified) (2 diffs)
- trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java (modified) (2 diffs)
- trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java (modified) (2 diffs)
- trunk/calendar3/webclient/src/org/bedework/webclient/BwFreeBusyAction.java (modified) (1 diff)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/misc/ExportAction.java (modified) (1 diff)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/misc/SetSelectionAction.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java
r99 r119 855 855 sess.createQuery(sb.toString()); 856 856 857 /* XXX Limit result set size - pagination allows something like: 858 query.setFirstResult(0); 859 query.setMaxResults(10); 860 */ 861 857 862 if (startDate != null) { 858 863 sess.setString("fromDate", startDate.getDate()); trunk/calendar3/calFacade/src/org/bedework/calfacade/BwEvent.java
r2 r119 226 226 private BwOrganizer organizer; 227 227 228 /** */ 229 public final static String transparencyOpaque = "OPAQUE"; 230 /** */ 231 public final static String transparencyTransparent = "TRANSPARENT"; 228 232 /** Transparency is used in free/busy time calculation 233 * transp = "TRANSP" tranparam ":" transvalue CRLF 234 235 tranparam = *(";" xparam) 236 237 transvalue = "OPAQUE" ;Blocks or opaque on busy time searches. 238 / "TRANSPARENT" ;Transparent on busy time searches. 239 ;Default value is OPAQUE 229 240 */ 230 241 private String transparency; trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/BwSubscription.java
r54 r119 267 267 * ==================================================================== */ 268 268 269 /** Make a subscription to the calendar object defaulting most fields 270 * 271 * @param val BwCalendar the calendar to subscribe to 272 * @return BwSubscription a new subscription object 273 */ 274 public static BwSubscription makeSubscription(BwCalendar val) { 275 BwSubscription sub = new BwSubscription(); 276 277 sub.setName(val.getName()); 278 sub.setUri(CalFacadeDefs.bwUriPrefix + val.getPath()); 279 sub.setDisplay(true); 280 sub.setAffectsFreeBusy(true); 281 sub.setInternalSubscription(true); 282 sub.setCalendar(val); 283 sub.setInternalSubscription(true); 284 sub.setEmailNotifications(false); 285 286 return sub; 287 } 288 269 289 /** Make a subscription to the calendar object 270 290 * trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavCalNode.java
r2 r119 133 133 } 134 134 135 BwSubscription sub = new BwSubscription(); 136 sub.setName(cal.getName()); 137 sub.setDisplay(true); 138 sub.setInternalSubscription(true); 139 sub.setCalendar(cal); 135 BwSubscription sub = BwSubscription.makeSubscription(cal); 140 136 141 137 Collection events = svci.getEvents(sub, CalFacadeDefs.retrieveRecurExpanded); trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/calquery/FreeBusyQuery.java
r2 r119 146 146 147 147 try { 148 BwFreeBusy fb = svci.getFreeBusy(n ew BwUser(user),148 BwFreeBusy fb = svci.getFreeBusy(null, new BwUser(user), 149 149 tr.getStart(), tr.getEnd()); 150 150 trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/filter/Filter.java
r2 r119 54 54 55 55 package edu.rpi.cct.uwcal.caldav.filter; 56 import org.bedework.calfacade.BwCalendar;57 56 import org.bedework.calfacade.svc.BwSubscription; 58 57 import org.bedework.calsvci.CalSvcI; … … 322 321 323 322 try { 324 BwSubscription sub = new BwSubscription(); 325 BwCalendar cal = wdnode.getCDURI().getCal(); 326 sub.setName(cal.getName()); 327 sub.setDisplay(true); 328 sub.setInternalSubscription(true); 329 sub.setCalendar(cal); 323 BwSubscription sub = BwSubscription.makeSubscription(wdnode.getCDURI().getCal()); 330 324 331 325 if (eventq.trange == null) { trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java
r111 r119 959 959 * ==================================================================== */ 960 960 961 public BwFreeBusy getFreeBusy(BwPrincipal who, BwDateTime start, BwDateTime end) 961 public BwFreeBusy getFreeBusy(BwCalendar cal, BwPrincipal who, 962 BwDateTime start, BwDateTime end) 962 963 throws CalFacadeException { 963 964 if (!(who instanceof BwUser)) { … … 970 971 } 971 972 973 BwUser u = (BwUser)who; 974 Collection subs; 975 976 if (cal != null) { 977 BwSubscription sub = BwSubscription.makeSubscription(cal); 978 979 subs = new Vector(); 980 subs.add(sub); 981 } else if (!currentUser().equals(who)) { 982 subs = getSubscriptions(); 983 } else { 984 subs = dbi.fetchPreferences(u).getSubscriptions(); 985 } 986 972 987 BwFreeBusy fb = new BwFreeBusy(who, start, end); 973 988 974 Collection evs = getEvents(null, null, start, end, CalFacadeDefs.retrieveRecurExpanded); 975 976 try { 977 /* For the moment just build a single FreeBusyComponentVO 978 */ 979 BwFreeBusyComponent fbc = new BwFreeBusyComponent(); 980 981 Iterator it = evs.iterator(); 982 983 TreeSet eventPeriods = new TreeSet(); 984 985 while (it.hasNext()) { 986 EventInfo ei = (EventInfo)it.next(); 987 BwEvent ev = ei.getEvent(); 988 989 // Ignore if times were specified and this event is outside the times 990 991 BwDateTime estart = ev.getDtstart(); 992 BwDateTime eend = ev.getDtend(); 993 994 /* Don't report out of the requested period */ 995 996 String dstart; 997 String dend; 998 999 if (estart.before(start)) { 1000 dstart = start.getDtval(); 1001 } else { 1002 dstart = estart.getDtval(); 989 Iterator subit = subs.iterator(); 990 while (subit.hasNext()) { 991 BwSubscription sub = (BwSubscription)subit.next(); 992 993 if (!sub.getAffectsFreeBusy()) { 994 continue; 995 } 996 997 Collection evs = getEvents(sub, null, start, end, CalFacadeDefs.retrieveRecurExpanded); 998 999 try { 1000 /* For the moment just build a single FreeBusyComponentVO 1001 */ 1002 BwFreeBusyComponent fbc = new BwFreeBusyComponent(); 1003 1004 Iterator it = evs.iterator(); 1005 1006 TreeSet eventPeriods = new TreeSet(); 1007 1008 while (it.hasNext()) { 1009 EventInfo ei = (EventInfo)it.next(); 1010 BwEvent ev = ei.getEvent(); 1011 1012 // XXX Need to add sub.ignoreTransparency 1013 if (BwEvent.transparencyTransparent.equals(ev.getTransparency())) { 1014 continue; 1015 } 1016 1017 // Ignore if times were specified and this event is outside the times 1018 1019 BwDateTime estart = ev.getDtstart(); 1020 BwDateTime eend = ev.getDtend(); 1021 1022 /* Don't report out of the requested period */ 1023 1024 String dstart; 1025 String dend; 1026 1027 if (estart.before(start)) { 1028 dstart = start.getDtval(); 1029 } else { 1030 dstart = estart.getDtval(); 1031 } 1032 1033 if (eend.after(end)) { 1034 dend = end.getDtval(); 1035 } else { 1036 dend = eend.getDtval(); 1037 } 1038 1039 eventPeriods.add(new EventPeriod(new DateTime(dstart), 1040 new DateTime(dend))); 1003 1041 } 1004 1042 1005 if (eend.after(end)) { 1006 dend = end.getDtval(); 1007 } else { 1008 dend = eend.getDtval(); 1043 /* iterate through the sorted periods combining them where they are 1044 adjacent or overlap */ 1045 1046 Period p = null; 1047 1048 it = eventPeriods.iterator(); 1049 while (it.hasNext()) { 1050 EventPeriod ep = (EventPeriod)it.next(); 1051 1052 if (p == null) { 1053 p = new Period(ep.start, ep.end); 1054 } else if (ep.start.after(p.getEnd())) { 1055 // Non adjacent periods 1056 fbc.addPeriod(p); 1057 p = new Period(ep.start, ep.end); 1058 } else if (ep.end.after(p.getEnd())) { 1059 // Extend the current period 1060 p = new Period(p.getStart(), ep.end); 1061 } // else it falls within the existing period 1009 1062 } 1010 1063 1011 eventPeriods.add(new EventPeriod(new DateTime(dstart), 1012 new DateTime(dend))); 1013 } 1014 1015 /* iterate through the sorted periods combining them where they are 1016 adjacent or overlap */ 1017 1018 Period p = null; 1019 1020 it = eventPeriods.iterator(); 1021 while (it.hasNext()) { 1022 EventPeriod ep = (EventPeriod)it.next(); 1023 1024 if (p == null) { 1025 p = new Period(ep.start, ep.end); 1026 } else if (ep.start.after(p.getEnd())) { 1027 // Non adjacent periods 1064 if (p != null) { 1028 1065 fbc.addPeriod(p); 1029 p = new Period(ep.start, ep.end); 1030 } else if (ep.end.after(p.getEnd())) { 1031 // Extend the current period 1032 p = new Period(p.getStart(), ep.end); 1033 } // else it falls within the existing period 1034 } 1035 1036 if (p != null) { 1037 fbc.addPeriod(p); 1038 } 1039 1040 fb.addTime(fbc); 1041 } catch (Throwable t) { 1042 throw new CalFacadeException(t); 1066 } 1067 1068 fb.addTime(fbc); 1069 } catch (Throwable t) { 1070 throw new CalFacadeException(t); 1071 } 1043 1072 } 1044 1073 trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java
r111 r119 756 756 /** Get the free busy for the given principal. 757 757 * 758 * @param cal Calendar to provide free-busy for. Null for default 759 * collection (as specified by user). 758 760 * @param who 759 761 * @param start … … 762 764 * @throws CalFacadeException 763 765 */ 764 public abstract BwFreeBusy getFreeBusy(Bw Principal who, BwDateTime start,765 BwDateTime end)766 public abstract BwFreeBusy getFreeBusy(BwCalendar cal, BwPrincipal who, 767 BwDateTime start, BwDateTime end) 766 768 throws CalFacadeException; 767 769 trunk/calendar3/webclient/src/org/bedework/webclient/BwFreeBusyAction.java
r55 r119 164 164 " end = " + start.getTime()); 165 165 } 166 BwFreeBusy fb1 = svci.getFreeBusy( user,166 BwFreeBusy fb1 = svci.getFreeBusy(null, user, 167 167 CalFacadeUtil.getDateTime(sdt, false, true, 168 168 svci.getTimezones()), trunk/calendar3/webcommon/src/org/bedework/webcommon/misc/ExportAction.java
r85 r119 126 126 } 127 127 128 sub = new BwSubscription(); 129 sub.setName(cal.getName()); 130 sub.setDisplay(true); 131 sub.setInternalSubscription(true); 132 sub.setCalendar(cal); 128 sub = BwSubscription.makeSubscription(cal); 133 129 } else if (subid >= 0) { 134 130 sub = svci.getSubscription(subid); trunk/calendar3/webcommon/src/org/bedework/webcommon/misc/SetSelectionAction.java
r111 r119 117 117 } 118 118 119 BwSubscription sub = new BwSubscription(); 120 sub.setName(url); 121 sub.setDisplay(true); 122 sub.setInternalSubscription(true); 123 sub.setCalendar(cal); 119 BwSubscription sub = BwSubscription.makeSubscription(cal); 124 120 125 121 Collection c = new Vector();
