[Bedework-commit] calendarapi r234 - in trunk:
calCore/src/org/bedework/calcore/hibernate
calFacade/src/org/bedework/calfacade calsvc/src/org/bedework/calsvc
icalendar/src/org/bedework/icalendar
svnadmin at bedework.org
svnadmin at bedework.org
Mon Mar 19 13:11:18 EDT 2007
Author: douglm
Date: 2007-03-19 13:11:17 -0400 (Mon, 19 Mar 2007)
New Revision: 234
Modified:
trunk/calCore/src/org/bedework/calcore/hibernate/Events.java
trunk/calFacade/src/org/bedework/calfacade/BwEventProxy.java
trunk/calsvc/src/org/bedework/calsvc/CalSvc.java
trunk/icalendar/src/org/bedework/icalendar/BwEventUtil.java
trunk/icalendar/src/org/bedework/icalendar/IcalTranslator.java
trunk/icalendar/src/org/bedework/icalendar/VEventUtil.java
Log:
Further CalDAV fixes. Ensure recurrence override is in same calendar as Master other wise searches don't work correctly.
Modified: trunk/calCore/src/org/bedework/calcore/hibernate/Events.java
===================================================================
--- trunk/calCore/src/org/bedework/calcore/hibernate/Events.java 2007-03-16 18:03:09 UTC (rev 233)
+++ trunk/calCore/src/org/bedework/calcore/hibernate/Events.java 2007-03-19 17:11:17 UTC (rev 234)
@@ -27,7 +27,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* **********************************************************************
- Copyright 2005 Rensselaer Polytechnic Institute. All worldwide rights reserved.
+ Copyright 2007 Rensselaer Polytechnic Institute. All worldwide rights reserved.
Redistribution and use of this distribution in source and binary forms,
with or without modification, are permitted provided that:
@@ -289,7 +289,7 @@
*
* Some points to remind ourselves. We have to fetch overides and instances
* because the master may be out of the range of a date limited query - usually
- * is, but we need th emaster to construct a proxy.
+ * is, but we need the master to construct a proxy.
*
* We could probably just use the overrides and instances obtained in
* steps 2 and 3 except for the CalDAV complications which allow a different
@@ -325,7 +325,7 @@
/* If there were any date limits we need to get any overrides or instances
* that fall in the range and add the unique masters to the Collection
*/
- if ((startDate != null) || (endDate != null)) {
+ if ((startDate != null) || (endDate != null) || (filter != null)) {
Collection<BwEvent> masters = new TreeSet<BwEvent>();
eqr = eventsQuery(calendar, filter, startDate, endDate, currentMode,
Modified: trunk/calFacade/src/org/bedework/calfacade/BwEventProxy.java
===================================================================
--- trunk/calFacade/src/org/bedework/calfacade/BwEventProxy.java 2007-03-16 18:03:09 UTC (rev 233)
+++ trunk/calFacade/src/org/bedework/calfacade/BwEventProxy.java 2007-03-19 17:11:17 UTC (rev 234)
@@ -1626,16 +1626,18 @@
*
* @param ev BwEvent object to annotate
* @param owner
+ * @param forInstance true if this is an overrride or a recurrence instance
* @return BwEventProxy object
* @throws CalFacadeException
*/
- public static BwEventProxy makeAnnotation(BwEvent ev, BwUser owner)
+ public static BwEventProxy makeAnnotation(BwEvent ev, BwUser owner,
+ boolean forInstance)
throws CalFacadeException {
- BwEventAnnotation override = new BwEventAnnotation();
+ BwEventAnnotation ann = new BwEventAnnotation();
- initAnnotation(override, ev, owner);
+ initAnnotation(ann, ev, owner, forInstance);
- return new BwEventProxy(override);
+ return new BwEventProxy(ann);
}
/** Initialise an annotation object from the given event.
@@ -1643,10 +1645,12 @@
* @param ann The annotation object
* @param ev BwEvent object to annotate
* @param owner if null event owner is used
+ * @param forInstance true if this is an overrride or a recurrence instance
* @throws CalFacadeException
*/
public static void initAnnotation(BwEventAnnotation ann,
- BwEvent ev, BwUser owner)
+ BwEvent ev, BwUser owner,
+ boolean forInstance)
throws CalFacadeException {
ann.setTarget(ev);
@@ -1664,8 +1668,13 @@
ann.setCreator(ev.getCreator());
ann.setUid(ev.getUid());
ann.setName(ev.getName());
- ann.setOverride(false);
+ ann.setOverride(forInstance);
+ if (forInstance) {
+ // Same calendar as master
+ ann.setCalendar(ev.getCalendar());
+ }
+
if (owner != null) {
ann.setOwner(owner);
} else {
Modified: trunk/calsvc/src/org/bedework/calsvc/CalSvc.java
===================================================================
--- trunk/calsvc/src/org/bedework/calsvc/CalSvc.java 2007-03-16 18:03:09 UTC (rev 233)
+++ trunk/calsvc/src/org/bedework/calsvc/CalSvc.java 2007-03-19 17:11:17 UTC (rev 234)
@@ -168,7 +168,7 @@
/* Has to be transient otherwise the session is not serializable.
* However, we need the inder object to retrieve the search result.
*
- * Reimplement with a saerializable object which allows us to redo the query
+ * Reimplement with a serializable object which allows us to redo the query
* if we lose the indexer.
*/
transient private BwIndexLuceneImpl searchIndexer;
@@ -2350,7 +2350,8 @@
// Need to annotate it as deleted
- BwEventProxy proxy = BwEventProxy.makeAnnotation(event, event.getOwner());
+ BwEventProxy proxy = BwEventProxy.makeAnnotation(event, event.getOwner(),
+ false);
// Where does the ref go? Not in the same calendar - we have no access
@@ -3145,7 +3146,14 @@
}
event.setCalendar(cal);
+ /* All Overrides go in same calendar */
+ if (overrides != null) {
+ for (BwEventProxy ovei: overrides) {
+ ovei.getRef().setCalendar(cal);
+ }
+ }
+
event.setDtstamps();
assignGuid(event);
Modified: trunk/icalendar/src/org/bedework/icalendar/BwEventUtil.java
===================================================================
--- trunk/icalendar/src/org/bedework/icalendar/BwEventUtil.java 2007-03-16 18:03:09 UTC (rev 233)
+++ trunk/icalendar/src/org/bedework/icalendar/BwEventUtil.java 2007-03-19 17:11:17 UTC (rev 234)
@@ -868,7 +868,7 @@
}
oei = new EventInfo();
- BwEventProxy proxy = BwEventProxy.makeAnnotation(ei.getEvent(), null);
+ BwEventProxy proxy = BwEventProxy.makeAnnotation(ei.getEvent(), null, true);
proxy.setRecurring(new Boolean(false));
oei.setEvent(proxy);
proxy.setRecurrenceId(rid);
Modified: trunk/icalendar/src/org/bedework/icalendar/IcalTranslator.java
===================================================================
--- trunk/icalendar/src/org/bedework/icalendar/IcalTranslator.java 2007-03-16 18:03:09 UTC (rev 233)
+++ trunk/icalendar/src/org/bedework/icalendar/IcalTranslator.java 2007-03-19 17:11:17 UTC (rev 234)
@@ -353,7 +353,7 @@
addIcalTimezones(cal, ev, added);
/* Add it to the calendar */
- cal.getComponents().add(VEventUtil.toIcalComponent(ev,
+ cal.getComponents().add(VEventUtil.toIcalComponent(ev, false,
cb.getTimezones(),
uriGen));
@@ -363,7 +363,7 @@
for (EventInfo oei: val.getOverrides()) {
ev = oei.getEvent();
- cal.getComponents().add(VEventUtil.toIcalComponent(ev,
+ cal.getComponents().add(VEventUtil.toIcalComponent(ev, true,
cb.getTimezones(),
uriGen));
}
Modified: trunk/icalendar/src/org/bedework/icalendar/VEventUtil.java
===================================================================
--- trunk/icalendar/src/org/bedework/icalendar/VEventUtil.java 2007-03-16 18:03:09 UTC (rev 233)
+++ trunk/icalendar/src/org/bedework/icalendar/VEventUtil.java 2007-03-19 17:11:17 UTC (rev 234)
@@ -128,12 +128,14 @@
* VEvent, VTodo or VJournal.
*
* @param val
+ * @param isOverride - true if event object is an override
* @param timezones
* @param uriGen
* @return CalendarComponent
* @throws CalFacadeException
*/
public static CalendarComponent toIcalComponent(BwEvent val,
+ boolean isOverride,
CalTimezones timezones,
URIgen uriGen) throws CalFacadeException {
if (val == null) {
@@ -401,7 +403,7 @@
pl.add(new Url(new URI(strval)));
}
- if (val.getRecurring().booleanValue()) {
+ if (!isOverride && val.getRecurring().booleanValue()) {
doRecurring(val, pl, timezones);
}
More information about the Bedework-commit
mailing list