[Bedework-commit] r356 - in trunk/calendar3: calCore/src/org/bedework/calcore/hibernate calFacade/src/org/bedework/calfacade calFacade/src/org/bedework/calfacade/base calFacade/src/org/bedework/calfacade/ifs calFacade/src/org/bedework/calfacade/svc calsvc/src/org/bedework/calsvc calsvci/src/org/bedework/calsvci synchml/src/edu/rpi/cct/uwcal/synchml/common webclient/src/org/bedework/webclient webclient/war/WEB-INF webcommon/src/org/bedework/webcommon

svnadmin at bedework.org svnadmin at bedework.org
Mon Apr 10 00:27:42 EDT 2006


Author: douglm
Date: 2006-04-10 00:26:24 -0400 (Mon, 10 Apr 2006)
New Revision: 356

Modified:
   trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java
   trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java
   trunk/calendar3/calFacade/src/org/bedework/calfacade/BwEvent.java
   trunk/calendar3/calFacade/src/org/bedework/calfacade/BwEventProxy.java
   trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeDefs.java
   trunk/calendar3/calFacade/src/org/bedework/calfacade/CoreEventInfo.java
   trunk/calendar3/calFacade/src/org/bedework/calfacade/base/CalintfBase.java
   trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/Calintf.java
   trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/EventsI.java
   trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/EventInfo.java
   trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java
   trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java
   trunk/calendar3/synchml/src/edu/rpi/cct/uwcal/synchml/common/Synchml.java
   trunk/calendar3/webclient/src/org/bedework/webclient/BwDelEventAction.java
   trunk/calendar3/webclient/war/WEB-INF/struts-config.xml
   trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java
Log:
Deletions mostly working.

New svci method markDeleted which marks events as deleted and moves them into the owners trash

For events to which the user has no access, e.g. public events, an annotation is added which is 
marked as deleted and is also stored in the trash

Further work:
Need to handle recurrence instances.
Need a way to really delete events
Need to ensure empty trash doesn't remove the annotations. 

Modified: trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java
===================================================================
--- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java	2006-04-09 01:42:46 UTC (rev 355)
+++ trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java	2006-04-10 04:26:24 UTC (rev 356)
@@ -54,6 +54,7 @@
 package org.bedework.calcore.hibernate;
 
 import edu.rpi.cct.uwcal.access.PrivilegeDefs;
+import edu.rpi.cct.uwcal.access.Acl.CurrentAccess;
 
 import org.bedework.calenv.CalEnv;
 import org.bedework.calfacade.BwAlarm;
@@ -299,15 +300,15 @@
 
     calendars = new Calendars(this, access, currentMode, debug);
 
-    categories = new EventProperties(this, access, currentMode, 
+    categories = new EventProperties(this, access, currentMode,
                                      "word", BwCategory.class.getName(),
                                      "getCategoryRefs",
                                      -1, debug);
-    locations = new EventProperties(this, access, currentMode, 
+    locations = new EventProperties(this, access, currentMode,
                                     "address", BwLocation.class.getName(),
                                     "getLocationRefs",
                                      CalFacadeDefs.maxReservedLocationId, debug);
-    sponsors = new EventProperties(this, access, currentMode, 
+    sponsors = new EventProperties(this, access, currentMode,
                                    "name", BwSponsor.class.getName(),
                                    "getSponsorRefs",
                                    CalFacadeDefs.maxReservedSponsorId, debug);
@@ -324,7 +325,7 @@
   public void setSuperUser(boolean val) {
     access.setSuperUser(val);
   }
-  
+
   public boolean getSuperUser() {
     return access.getSuperUser();
   }
@@ -333,15 +334,15 @@
     if (stats == null) {
       return null;
     }
-    
+
     BwRWStats rwstats = (BwRWStats)stats;
-    
+
     if (timezones != null) {
       rwstats.setDateCacheHits(timezones.getDateCacheHits());
       rwstats.setDateCacheMisses(timezones.getDateCacheMisses());
       rwstats.setDatesCached(timezones.getDatesCached());
     }
-    
+
     return stats;
   }
 
@@ -349,11 +350,11 @@
     if (!enable && (dbStats == null)) {
       return;
     }
-    
+
     if (dbStats == null) {
       dbStats = sessFactory.getStatistics();
     }
-    
+
     dbStats.setStatisticsEnabled(enable);
   }
 
@@ -361,14 +362,14 @@
     if (dbStats == null) {
       return false;
     }
-    
+
     return dbStats.isStatisticsEnabled();
   }
-  
+
   public void dumpDbStats() throws CalFacadeException {
     DbStatistics.dumpStats(dbStats);
   }
-  
+
   public Collection getDbStats() throws CalFacadeException {
     return DbStatistics.getStats(dbStats);
   }
@@ -688,13 +689,18 @@
    *                   Access
    * ==================================================================== */
 
-  public void changeAccess(BwShareableDbentity ent, 
+  public void changeAccess(BwShareableDbentity ent,
                            Collection aces) throws CalFacadeException {
     checkOpen();
     access.changeAccess(ent, aces);
     sess.saveOrUpdate(ent);
   }
 
+  public CurrentAccess checkAccess(BwShareableDbentity ent, int desiredAccess,
+                                   boolean returnResult) throws CalFacadeException {
+    return access.checkAccess(ent, desiredAccess, returnResult);
+  }
+
   /* ====================================================================
    *                   Timezones
    * ==================================================================== */
@@ -1098,6 +1104,10 @@
     return events.getEventsByName(cal, val);
   }
 
+  public Collection getDeletedProxies() throws CalFacadeException {
+    return events.getDeletedProxies(this.getTrashCalendar(user));
+  }
+
   /* ====================================================================
    *                   Synchronization
    * ==================================================================== */

Modified: trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java
===================================================================
--- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java	2006-04-09 01:42:46 UTC (rev 355)
+++ trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java	2006-04-10 04:26:24 UTC (rev 356)
@@ -106,7 +106,7 @@
    * @param user
    * @param debug
    */
-  public Events(Calintf cal, AccessUtil access, 
+  public Events(Calintf cal, AccessUtil access,
                 int currentMode, boolean debug) {
     super(cal, access, currentMode, debug);
   }
@@ -117,14 +117,14 @@
     BwEvent master = null;
     TreeSet ts = new TreeSet();
     HibSession sess = getSess();
-    
+
     /* This (seems) to work as follows:
-     * 
+     *
      * First try to retrieve the event from the events table.
-     * 
+     *
      * If not there try the annotations table. If it's there, it's a reference
      * to an event owned by somebody else. Otherwise we drew a blank.
-     * 
+     *
      * If we want the recurrences and the event is recurring we go on to try to
      * retrieve the rest.
      */
@@ -137,6 +137,7 @@
 
       cei = postGetEvent((BwEvent)sess.getUnique(), privRead, noAccessReturnsNull);
 
+      // XXX Don't want annotations in the trash
       if (cei == null) {
         /* Look for an annotation to that event by the current user.
          */
@@ -148,11 +149,11 @@
           cei.setEvent(new BwEventProxy((BwEventAnnotation)cei.getEvent()));
         }
       }
-      
+
       if (cei == null) {
         return ts;
       }
-      
+
       master = cei.getEvent();
 
       ts.add(cei);
@@ -278,6 +279,42 @@
     return ts;
   }
 
+  /** XXX temp I think
+   * Retrieve event proxies in the trash - they will be used to remove events
+   * from result sets.
+   *
+   * @return Collection of CoreEventInfo objects
+   */
+  public Collection getDeletedProxies() throws CalFacadeException {
+    // Calintf supplies the calendar
+    return null;
+  }
+
+  /** XXX temp I think
+   * Retrieve event proxies in the trash - they will be used to remove events
+   * from result sets.
+   *
+   * @param cal         Trash calendar object
+   * @return Collection of CoreEventInfo objects
+   */
+  public Collection getDeletedProxies(BwCalendar cal) throws CalFacadeException {
+    HibSession sess = getSess();
+    StringBuffer sb = new StringBuffer();
+
+    sb.append("from ");
+    sb.append(BwEventAnnotation.class.getName());
+    sb.append(" ev");
+    sb.append(" where ev.calendar=:calendar");
+    sb.append(" and ev.deleted=true");
+
+    sess.createQuery(sb.toString());
+    sess.setEntity("calendar", cal);
+
+    Collection evs = sess.getList();
+
+    return postGetEvents(evs, privRead, noAccessReturnsNull);
+  }
+
   public CoreEventInfo getEvent(int id) throws CalFacadeException {
     HibSession sess = getSess();
     Criteria cr = sess.createCriteria(BwEventObj.class);
@@ -289,7 +326,7 @@
     return postGetEvent(ev, privRead, noAccessReturnsNull);
   }
 
-  public void addEvent(BwEvent val, 
+  public void addEvent(BwEvent val,
                        Collection overrides) throws CalFacadeException {
     RecuridTable recurids = null;
     HibSession sess = getSess();
@@ -320,7 +357,7 @@
     if (ct.intValue() > 0) {
       throw new CalFacadeException(CalFacadeException.duplicateGuid);
     }
-    
+
     if (val.getOrganizer() != null) {
       sess.saveOrUpdate(val.getOrganizer());
     }
@@ -568,6 +605,8 @@
 
     Filters flt = new Filters(filter, sb, qevName, debug);
 
+    // XXX we should do the following for both events and annotations
+
     /* SEG:   from Events ev where */
     sb.append("from ");
     sb.append(BwEvent.class.getName());
@@ -807,7 +846,7 @@
     }
   }
 
-  private void eventQuery(Class cl, BwCalendar calendar, String guid, String rid, 
+  private void eventQuery(Class cl, BwCalendar calendar, String guid, String rid,
                           boolean masterOnly) throws CalFacadeException {
     HibSession sess = getSess();
     StringBuffer sb = new StringBuffer();
@@ -1090,7 +1129,7 @@
       if (checked != null) {
         checked.setChecked(mstr, ca);
       }
-      
+
       if (!ca.accessAllowed) {
         return null;
       }
@@ -1209,7 +1248,7 @@
      * (DTSTART <= start AND DTSTART+DURATION > start) OR
      * (DTSTART >= start AND DTSTART < end) OR
      * (DTEND   > start AND DTEND <= end)
-     * 
+     *
      * XXX This is wrong??? Last should be
      * XXX (DTEND   > start AND DTEND < end)
      *
@@ -1281,9 +1320,9 @@
     Iterator it = evs.iterator();
 
     while (it.hasNext()) {
-      CoreEventInfo cei = postGetEvent((BwEvent)it.next(), 
+      CoreEventInfo cei = postGetEvent((BwEvent)it.next(),
                                        desiredAccess, nullForNoAccess);
-      
+
       if (cei != null) {
         outevs.add(cei);
       }
@@ -1301,7 +1340,7 @@
     }
 
     CurrentAccess ca = access.checkAccess(ev, desiredAccess, nullForNoAccess);
-    
+
     if (!ca.accessAllowed) {
       return null;
     }
@@ -1312,8 +1351,11 @@
     }
     */
 
+    if (ev instanceof BwEventAnnotation) {
+      ev = new BwEventProxy((BwEventAnnotation)ev);
+    }
     CoreEventInfo cei = new CoreEventInfo(ev, ca);
-    
+
     return cei;
   }
 

Modified: trunk/calendar3/calFacade/src/org/bedework/calfacade/BwEvent.java
===================================================================
--- trunk/calendar3/calFacade/src/org/bedework/calfacade/BwEvent.java	2006-04-09 01:42:46 UTC (rev 355)
+++ trunk/calendar3/calFacade/src/org/bedework/calfacade/BwEvent.java	2006-04-10 04:26:24 UTC (rev 356)
@@ -1128,14 +1128,14 @@
 
     /* If the guids are the same it's the same event for non recurring.
        For recurring events the recurrence id must also be equal.
-     */
+     * /
     int res = e1.getGuid().compareTo(e2.getGuid());
     if (res == 0) {
       if (!e1.getRecurring()) {
         return 0;
       }
 
-      /* Recurring - only the same if the recurrence id is equal */
+      /* Recurring - only the same if the recurrence id is equal * /
       return CalFacadeUtil.cmpObjval(e1.getRecurrence().getRecurrenceId(),
                                      e2.getRecurrence().getRecurrenceId());
     }
@@ -1150,7 +1150,7 @@
       return res;
     }
 
-    /* Dates are the same - try summary. */
+    /* Dates are the same - try summary. * /
 
     res = e1.getSummary().compareTo(e2.getSummary());
     if (res != 0) {
@@ -1159,6 +1159,22 @@
 
     // Just use guid
     return e1.getGuid().compareTo(e2.getGuid());
+    */
+    /* If the guids are the same it's the same event for non recurring.
+       For recurring events the recurrence id must also be equal.
+     */
+    int res = e1.getGuid().compareTo(e2.getGuid());
+    if ((res == 0) && (!e1.getRecurring())) {
+      return 0;
+    }
+
+    if (!e2.getRecurring()) {
+      return 1;
+    }
+
+    /* Both recurring - only the same if the recurrence id is equal */
+    return CalFacadeUtil.cmpObjval(e1.getRecurrence().getRecurrenceId(),
+                                   e2.getRecurrence().getRecurrenceId());
   }
 
   public int compareTo(Object o2) {

Modified: trunk/calendar3/calFacade/src/org/bedework/calfacade/BwEventProxy.java
===================================================================
--- trunk/calendar3/calFacade/src/org/bedework/calfacade/BwEventProxy.java	2006-04-09 01:42:46 UTC (rev 355)
+++ trunk/calendar3/calFacade/src/org/bedework/calfacade/BwEventProxy.java	2006-04-10 04:26:24 UTC (rev 356)
@@ -242,6 +242,27 @@
     return getTarget().getAccess();
   }
 
+  /** Set the event's calendar
+   *
+   * @param val    BwCalendar event's calendar
+   */
+  public void setCalendar(BwCalendar val) {
+    ref.setCalendar(val);
+  }
+
+  /** Get the event's calendar
+   *
+   * @return CalendarVO   the event's calendar
+   */
+  public BwCalendar getCalendar() {
+    BwCalendar val = ref.getCalendar();
+    if (val != null) {
+      return val;
+    }
+
+    return getTarget().getCalendar();
+  }
+
   /* (non-Javadoc)
    * @see org.bedework.calfacade.BwEvent#setName(java.lang.String)
    */
@@ -400,6 +421,25 @@
     return getTarget().getLink();
   }
 
+  /** Set the event deleted flag
+   *
+   *  @param val    boolean true if the event is deleted
+   */
+  public void setDeleted(boolean val) {
+    ref.setDeleted(val);
+  }
+
+  /** Get the event deleted flag
+   *
+   *  @return boolean    true if the event is deleted
+   */
+  public boolean getDeleted() {
+    if (getTarget().getDeleted()) {
+      return true;
+    }
+    return ref.getDeleted();
+  }
+
   /* (non-Javadoc)
    * @see org.bedework.calfacade.BwEvent#setStatus(char)
    */
@@ -470,27 +510,6 @@
     return getTarget().getOrganizerId();
   }
 
-  /** Set the event's calendar
-   *
-   * @param val    CalendarVO event's calendar
-   */
-  public void setCalendar(BwCalendar val) {
-    ref.setCalendar(val);
-  }
-
-  /** Get the event's calendar
-   *
-   * @return CalendarVO   the event's calendar
-   */
-  public BwCalendar getCalendar() {
-    BwCalendar val = ref.getCalendar();
-    if (val != null) {
-      return val;
-    }
-
-    return getTarget().getCalendar();
-  }
-
   public void setDtstamp(String val) {
     ref.setDtstamp(val);
   }
@@ -788,6 +807,17 @@
   }
 
   /* (non-Javadoc)
+   * @see org.bedework.calfacade.ifs.AttendeesI#copyAttendees()
+   */
+  public Collection copyAttendees() {
+    if (ref.getAttendeesChanged()) {
+      return ref.copyAttendees();
+    }
+
+    return getTarget().copyAttendees();
+  }
+
+  /* (non-Javadoc)
    * @see org.bedework.calfacade.AttendeesI#cloneAttendees()
    */
   public Collection cloneAttendees() {
@@ -860,6 +890,7 @@
     override.setDuration(BwDateTime.makeDuration(start, end).toString());
     override.setEndType(ev.getEndType());
     override.setCreator(ev.getCreator());
+    override.setGuid(ev.getGuid());
 
     if (owner != null) {
       override.setOwner(owner);

Modified: trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeDefs.java
===================================================================
--- trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeDefs.java	2006-04-09 01:42:46 UTC (rev 355)
+++ trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeDefs.java	2006-04-10 04:26:24 UTC (rev 356)
@@ -78,7 +78,8 @@
    */
   public static final int unsavedItemKey = -1;
 
-  /** Values which define how to retrieve recurring events. We have the
+  /** ENUM
+   * Values which define how to retrieve recurring events. We have the
    * following choices (derived from caldav)
    *
    * <p>expand - return as if all instances within the time range are

Modified: trunk/calendar3/calFacade/src/org/bedework/calfacade/CoreEventInfo.java
===================================================================
--- trunk/calendar3/calFacade/src/org/bedework/calfacade/CoreEventInfo.java	2006-04-09 01:42:46 UTC (rev 355)
+++ trunk/calendar3/calFacade/src/org/bedework/calfacade/CoreEventInfo.java	2006-04-10 04:26:24 UTC (rev 356)
@@ -67,26 +67,26 @@
  */
 public class CoreEventInfo implements Comparable, Comparator, Serializable {
   protected BwEvent event;
-  
+
   /* This object contains information giving the current users access rights to
    * the entity.
    */
   private CurrentAccess currentAccess;
 
   /** Constructor
-   * 
+   *
    */
   public CoreEventInfo() {
   }
 
   /** Constructor
-   * 
+   *
    */
   public CoreEventInfo(BwEvent event, CurrentAccess currentAccess) {
     this.event = event;
     this.currentAccess = currentAccess;
   }
-  
+
   /**
    * @param val
    */
@@ -100,17 +100,17 @@
   public BwEvent getEvent() {
     return event;
   }
-  
+
   /* Set the current users access rights.
-   * 
+   *
    * @param val  CurrentAccess
    */
   public void setCurrentAccess(CurrentAccess val) {
     currentAccess = val;
   }
-  
+
   /* Get the current users access rights.
-   * 
+   *
    * @return  CurrentAccess
    */
   public CurrentAccess getCurrentAccess() {
@@ -130,7 +130,7 @@
       return 1;
     }
 
-    if (01 == 02) {
+    if (o1 == o2) {
       return 0;
     }
 

Modified: trunk/calendar3/calFacade/src/org/bedework/calfacade/base/CalintfBase.java
===================================================================
--- trunk/calendar3/calFacade/src/org/bedework/calfacade/base/CalintfBase.java	2006-04-09 01:42:46 UTC (rev 355)
+++ trunk/calendar3/calFacade/src/org/bedework/calfacade/base/CalintfBase.java	2006-04-10 04:26:24 UTC (rev 356)
@@ -77,6 +77,8 @@
 import org.bedework.calfacade.ifs.CalintfInfo;
 import org.bedework.calfacade.ifs.Groups;
 
+import edu.rpi.cct.uwcal.access.Acl.CurrentAccess;
+
 import java.sql.Timestamp;
 import java.util.Collection;
 import java.util.TreeSet;
@@ -152,7 +154,7 @@
 
   public void setSuperUser(boolean val) {
   }
-  
+
   public boolean getSuperUser() {
     return false;
   }
@@ -175,7 +177,7 @@
 
   public void dumpDbStats() throws CalFacadeException {
   }
-  
+
   public Collection getDbStats() throws CalFacadeException {
     return null;
   }
@@ -369,12 +371,17 @@
    *                   Access
    * ==================================================================== */
 
-  public void changeAccess(BwShareableDbentity ent, 
+  public void changeAccess(BwShareableDbentity ent,
                            Collection aces) throws CalFacadeException {
     checkOpen();
     throw new CalFacadeUnimplementedException();
   }
 
+  public CurrentAccess checkAccess(BwShareableDbentity ent, int desiredAccess,
+                                   boolean returnResult) throws CalFacadeException {
+    throw new CalFacadeUnimplementedException();
+  }
+
   /* ====================================================================
    *                   Timezones
    * ==================================================================== */
@@ -730,6 +737,10 @@
     return user.equals(val.getCreator());
   }
 
+  public Collection getDeletedProxies() throws CalFacadeException {
+    throw new CalFacadeUnimplementedException();
+  }
+
   /* ====================================================================
    *                       Caldav support
    * Caldav as it stands at the moment requires that we save the arbitary

Modified: trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/Calintf.java
===================================================================
--- trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/Calintf.java	2006-04-09 01:42:46 UTC (rev 355)
+++ trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/Calintf.java	2006-04-10 04:26:24 UTC (rev 356)
@@ -68,6 +68,8 @@
 import org.bedework.calfacade.filter.BwFilter;
 import org.bedework.calfacade.ifs.Groups;
 
+import edu.rpi.cct.uwcal.access.Acl.CurrentAccess;
+
 import java.util.Collection;
 
 import net.fortuna.ical4j.model.component.VTimeZone;
@@ -110,13 +112,13 @@
                       String synchId,
                       boolean debug) throws CalFacadeException;
 
-  /** Called after init to flag this user as a super user. 
+  /** Called after init to flag this user as a super user.
    *
    * @param val       true for a super user
    */
   public void setSuperUser(boolean val);
 
-  /** Called after init to flag this user as a super user. 
+  /** Called after init to flag this user as a super user.
    *
    * @return boolean true if super user
    */
@@ -129,27 +131,27 @@
    */
   public BwStats getStats() throws CalFacadeException;
 
-  /** Enable/disable db statistics 
+  /** Enable/disable db statistics
    *
    * @param enable       boolean true to turn on db statistics collection
    * @throws CalFacadeException if not admin
    */
   public void setDbStatsEnabled(boolean enable) throws CalFacadeException;
 
-  /**  
+  /**
    *
    * @return boolean true if statistics collection enabled
    * @throws CalFacadeException if not admin
    */
   public boolean getDbStatsEnabled() throws CalFacadeException;
 
-  /** Dump db statistics 
+  /** Dump db statistics
    *
    * @throws CalFacadeException if not admin
    */
   public void dumpDbStats() throws CalFacadeException;
 
-  /** Get db statistics 
+  /** Get db statistics
    *
    * @return Collection of BwStats.StatsEntry objects
    * @throws CalFacadeException if not admin
@@ -355,13 +357,26 @@
 
   /** Change the access to the given calendar entity.
    *
-   * @param ent      BwShareableDbentity 
+   * @param ent      BwShareableDbentity
    * @param aces     Collection of ace
    * @throws CalFacadeException
    */
-  public void changeAccess(BwShareableDbentity ent, 
+  public void changeAccess(BwShareableDbentity ent,
                            Collection aces) throws CalFacadeException;
 
+  /** Check the access for the given entity. Returns the current access
+   * or null or optionally throws a no access exception.
+   *
+   * @param ent
+   * @param desiredAccess
+   * @param returnResult
+   * @return CurrentAccess
+   * @throws CalFacadeAccessException if returnResult false and no access
+   * @throws CalFacadeException
+   */
+  public CurrentAccess checkAccess(BwShareableDbentity ent, int desiredAccess,
+                                   boolean returnResult) throws CalFacadeException;
+
   /* ====================================================================
    *                   Timezones
    * ==================================================================== */

Modified: trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/EventsI.java
===================================================================
--- trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/EventsI.java	2006-04-09 01:42:46 UTC (rev 355)
+++ trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/EventsI.java	2006-04-10 04:26:24 UTC (rev 356)
@@ -21,7 +21,7 @@
    *                   Events
    * ==================================================================== */
 
-  /** Return one or more events using the calendar, guid and optionally a 
+  /** Return one or more events using the calendar, guid and optionally a
    * recurrence-id as a key.
    *
    * <p>For non-recurring events, one and only one event should be returned
@@ -52,7 +52,7 @@
    * @param   eventId       int id of the event
    * @return  CoreEventInfo object representing event.
    * @throws CalFacadeException
-   * 
+   *
    * @deprecated - other calendar systems won't support this. Doesn't make sense
    *               for recurring events.
    */
@@ -124,8 +124,8 @@
    *
    * @param calendar     BwCalendar object restricting search or null.
    * @param filter       BwFilter object restricting search or null.
-   * @param startDate    DateTimeVO start - may be null
-   * @param endDate      DateTimeVO end - may be null.
+   * @param startDate    BwDateTime start - may be null
+   * @param endDate      BwDateTime end - may be null.
    * @param recurRetrieval Takes value defined in CalFacadeDefs
    * @return Collection  of CoreEventInfo objects
    * @throws CalFacadeException
@@ -135,6 +135,14 @@
                               int recurRetrieval)
           throws CalFacadeException;
 
+  /** XXX temp I think
+   * Retrieve event proxies in the trash - they will be used to remove events
+   * from result sets.
+   *
+   * @return Collection of CoreEventInfo objects
+   */
+  public Collection getDeletedProxies() throws CalFacadeException;
+
   /* * Return true if this event is editable by the current user
    *
    * @param val                EventVO object to be tested

Modified: trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/EventInfo.java
===================================================================
--- trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/EventInfo.java	2006-04-09 01:42:46 UTC (rev 355)
+++ trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/EventInfo.java	2006-04-10 04:26:24 UTC (rev 356)
@@ -128,7 +128,7 @@
   /** If non-null this event comes from a recurrence
    */
   private String recurrenceId;
-  
+
   /* This object contains information giving the current users access rights to
    * the entity.
    */
@@ -310,17 +310,17 @@
   public String getRecurrenceId() {
     return recurrenceId;
   }
-  
+
   /* Set the current users access rights.
-   * 
+   *
    * @param val  CurrentAccess
    */
   public void setCurrentAccess(CurrentAccess val) {
     currentAccess = val;
   }
-  
+
   /* Get the current users access rights.
-   * 
+   *
    * @return  CurrentAccess
    */
   public CurrentAccess getCurrentAccess() {
@@ -340,7 +340,7 @@
       return 1;
     }
 
-    if (01 == 02) {
+    if (o1 == o2) {
       return 0;
     }
 

Modified: trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java
===================================================================
--- trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java	2006-04-09 01:42:46 UTC (rev 355)
+++ trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java	2006-04-10 04:26:24 UTC (rev 356)
@@ -97,6 +97,8 @@
 import org.bedework.icalendar.URIgen;
 //import org.bedework.mail.MailerIntf;
 
+import edu.rpi.cct.uwcal.access.PrivilegeDefs;
+import edu.rpi.cct.uwcal.access.Acl.CurrentAccess;
 import edu.rpi.cct.uwcal.resources.Resources;
 
 import java.util.ArrayList;
@@ -126,7 +128,7 @@
   private boolean debug;
 
   private boolean open;
-  
+
   private boolean superUser;
 
   //private BwFilter currentFilter;
@@ -309,7 +311,7 @@
   public void setSuperUser(boolean val) {
     superUser = val;
   }
-  
+
   public boolean getSuperUser() {
     return superUser;
   }
@@ -333,21 +335,21 @@
   public boolean getDbStatsEnabled() throws CalFacadeException {
     return getCal().getDbStatsEnabled();
   }
-  
+
   public void dumpDbStats() throws CalFacadeException {
     //if (!pars.getPublicAdmin()) {
     //  throw new CalFacadeAccessException();
     //}
-    
+
     trace(getStats().toString());
     getCal().dumpDbStats();
   }
-  
+
   public Collection getDbStats() throws CalFacadeException {
     //if (!pars.getPublicAdmin()) {
     //  throw new CalFacadeAccessException();
     //}
-    
+
     return getCal().getDbStats();
   }
 
@@ -567,7 +569,7 @@
    *                   Access
    * ==================================================================== */
 
-  public void changeAccess(BwShareableDbentity ent, 
+  public void changeAccess(BwShareableDbentity ent,
                            Collection aces) throws CalFacadeException {
     getCal().changeAccess(ent, aces);
   }
@@ -582,7 +584,7 @@
     if (isPublicAdmin() && !isSuper()) {
       throw new CalFacadeAccessException();
     }
-    
+
     timezones.saveTimeZone(tzid, vtz);
   }
 
@@ -603,7 +605,7 @@
     if (isPublicAdmin() && !isSuper()) {
       throw new CalFacadeAccessException();
     }
-    
+
     timezones.clearPublicTimezones();
   }
 
@@ -697,7 +699,7 @@
         getUserAuth().removeCalendar(null, val);
       }
     }
-    
+
     getCal().updateCalendar(val);
   }
 
@@ -1458,7 +1460,7 @@
     return postProcess(getCal().getEvent(eventId), null, null);
   }
 
-  public Collection getEvent(BwSubscription sub, BwCalendar cal, 
+  public Collection getEvent(BwSubscription sub, BwCalendar cal,
                              String guid, String recurrenceId,
                              int recurRetrieval) throws CalFacadeException {
     return postProcess(getCal().getEvent(cal, guid, recurrenceId, recurRetrieval),
@@ -1523,19 +1525,19 @@
                            sub);
       }
     }
-    
+
     /* Iterate over the subscriptions and merge the results.
-     * 
+     *
      * First we iterate over the subscriptions looking for internal calendars.
      * These we accumulate as children of a single calendar allowing a single
      * query for all calendars.
-     * 
+     *
      * We will then iterate again to handle external calendars. (Not implemented)
      */
     Iterator it = subs.iterator();
     BwCalendar internal = new BwCalendar();
     setupSharableEntity(internal);
-    
+
     // For locating subscriptions from calendar
     HashMap sublookup = new HashMap();
 
@@ -1543,21 +1545,21 @@
       sub = (BwSubscription)it.next();
 
       BwCalendar calendar = getSubCalendar(sub);
-      
+
       if (calendar != null) {
         internal.addChild(calendar);
         putSublookup(sublookup, sub, calendar);
       }
     }
-    
+
     if (internal.getChildren().size() == 0) {
       if (debug) {
         trace("No children for internal calendar");
       }
-      
+
       return ts;
     }
-    
+
     ts.addAll(postProcess(getCal().getEvents(internal, filter,
                           startDate, endDate,
                           recurRetrieval),
@@ -1565,56 +1567,6 @@
 
     return ts;
   }
-  
-  private BwCalendar getSubCalendar(BwSubscription sub) throws CalFacadeException {
-    if (!sub.getInternalSubscription() || sub.getCalendarDeleted()) {
-      return null;
-    }
-    
-    BwCalendar calendar = sub.getCalendar();
-    
-    if (calendar != null) {
-      return calendar;
-    }
-    
-    String path;
-    String uri = sub.getUri();
-    
-    if (uri.startsWith(CalFacadeDefs.bwUriPrefix)) {
-      path = uri.substring(CalFacadeDefs.bwUriPrefix.length());
-    } else {
-      // Shouldn't happen?
-      path = uri;
-    }
-    
-    if (debug) {
-      trace("Search for calendar \"" + path + "\"");
-    }
-    
-    calendar = getCal().getCalendar(path);
-    if (calendar == null) {
-      // Assume deleted
-      sub.setCalendarDeleted(true);
-      updateSubscription(sub);
-    } else {
-      sub.setCalendar(calendar);
-    }
-    
-    return calendar;
-  }
-  
-  private void putSublookup(HashMap sublookup, BwSubscription sub, BwCalendar cal) {
-    if (cal.getCalendarCollection()) {
-      // Leaf node
-      sublookup.put(new Integer(cal.getId()), sub);
-      return;
-    }
-    
-    Iterator it = cal.iterateChildren();
-    while (it.hasNext()) {
-      putSublookup(sublookup, sub, (BwCalendar)it.next());
-    }
-  }
 
   public DelEventResult deleteEvent(BwEvent event,
                                     boolean delUnreffedLoc) throws CalFacadeException {
@@ -1685,7 +1637,7 @@
     if (!cal.getCalendarCollection()) {
       throw new CalFacadeAccessException();
     }
-    
+
     event.setCalendar(cal);
 
     event.setDtstamp(new DtStamp(new DateTime(true)).getValue());
@@ -1717,14 +1669,36 @@
     }
   }
 
-  public boolean deleteSubscribedEvent(BwEvent event) throws CalFacadeException {
-    /*
-    if (!getCal().fromSubscription(event)) {
-      throw new CalFacadeException(
-            "Attempt to hide a non-subscribed event: " + event);
+  /** For an event to which we have write access we simply mark it deleted.
+   *
+   * <p>Otherwise we add an annotation maarking the event as deleted.
+   *
+   * @param event
+   * @throws CalFacadeException
+   */
+  public void markDeleted(BwEvent event) throws CalFacadeException {
+    CurrentAccess ca = getCal().checkAccess(event, PrivilegeDefs.privWrite, true);
+
+    if (ca.accessAllowed) {
+      // Have write access - just set the flag and move it into the owners trash
+      event.setDeleted(true);
+      event.setCalendar(getCal().getTrashCalendar(event.getOwner()));
+      updateEvent(event);
+      return;
     }
-    */
-    throw new CalFacadeException("Unimplemented: ");
+
+    // Need to annotate it as deleted
+
+    BwEventProxy proxy = BwEventProxy.makeAnnotation(event, event.getOwner());
+
+    // Where does the ref go? Not in the same calendar - we have no access
+    // Put it in the trash - but don't delete on empty trash
+
+    BwCalendar cal = getCal().getTrashCalendar(getUser());
+    proxy.setOwner(getUser());
+    proxy.setDeleted(true);
+    proxy.setCalendar(cal);
+    addEvent(cal, proxy, null);
   }
 
   /* ====================================================================
@@ -1928,7 +1902,57 @@
     return mailer;
   }*/
 
-  private EventInfo postProcess(CoreEventInfo cei, BwSubscription sub, 
+  private BwCalendar getSubCalendar(BwSubscription sub) throws CalFacadeException {
+    if (!sub.getInternalSubscription() || sub.getCalendarDeleted()) {
+      return null;
+    }
+
+    BwCalendar calendar = sub.getCalendar();
+
+    if (calendar != null) {
+      return calendar;
+    }
+
+    String path;
+    String uri = sub.getUri();
+
+    if (uri.startsWith(CalFacadeDefs.bwUriPrefix)) {
+      path = uri.substring(CalFacadeDefs.bwUriPrefix.length());
+    } else {
+      // Shouldn't happen?
+      path = uri;
+    }
+
+    if (debug) {
+      trace("Search for calendar \"" + path + "\"");
+    }
+
+    calendar = getCal().getCalendar(path);
+    if (calendar == null) {
+      // Assume deleted
+      sub.setCalendarDeleted(true);
+      updateSubscription(sub);
+    } else {
+      sub.setCalendar(calendar);
+    }
+
+    return calendar;
+  }
+
+  private void putSublookup(HashMap sublookup, BwSubscription sub, BwCalendar cal) {
+    if (cal.getCalendarCollection()) {
+      // Leaf node
+      sublookup.put(new Integer(cal.getId()), sub);
+      return;
+    }
+
+    Iterator it = cal.iterateChildren();
+    while (it.hasNext()) {
+      putSublookup(sublookup, sub, (BwCalendar)it.next());
+    }
+  }
+
+  private EventInfo postProcess(CoreEventInfo cei, BwSubscription sub,
                                 HashMap sublookup)
           throws CalFacadeException {
     if (cei == null) {
@@ -1941,13 +1965,13 @@
      * proxy and return that object.
      */
     BwEvent ev = cei.getEvent();
-    
+
     if (ev instanceof BwEventAnnotation) {
       ev = new BwEventProxy((BwEventAnnotation)ev);
     }
 
     EventInfo ei = new EventInfo(ev);
-    
+
     if (sub != null) {
       ei.setSubscription(sub);
     } else if (sublookup != null) {
@@ -1964,11 +1988,22 @@
           throws CalFacadeException {
     ArrayList al = new ArrayList();
 
+    /* XXX possibly not a great idea. We should probably retrieve the
+     * deleted events at the same time as we retrieve the desired set.
+     *
+     * This way we get too many.
+     */
+    Collection deleted = getCal().getDeletedProxies();
+
     Iterator it = ceis.iterator();
 
     while (it.hasNext()) {
-      EventInfo ei = postProcess((CoreEventInfo)it.next(), sub, null);
-      al.add(ei);
+      CoreEventInfo cei = (CoreEventInfo)it.next();
+
+      if (!deleted.contains(cei)) {
+        EventInfo ei = postProcess(cei, sub, null);
+        al.add(ei);
+      }
     }
 
     return al;
@@ -1978,16 +2013,78 @@
           throws CalFacadeException {
     ArrayList al = new ArrayList();
 
+    /* XXX possibly not a great idea. We should probably retrieve the
+     * deleted events at the same time as we retrieve the desired set.
+     *
+     * This way we get too many.
+     */
+    Collection deleted = getCal().getDeletedProxies();
+
+    //traceDeleted(deleted);
+
     Iterator it = ceis.iterator();
 
     while (it.hasNext()) {
-      EventInfo ei = postProcess((CoreEventInfo)it.next(), null, sublookup);
-      al.add(ei);
+      CoreEventInfo cei = (CoreEventInfo)it.next();
+
+ //     if (!deleted.contains(cei)) {
+      if (!isDeleted(deleted, cei)) {
+        EventInfo ei = postProcess(cei, null, sublookup);
+        al.add(ei);
+      }
     }
 
     return al;
   }
 
+  /* XXX This is here because contains doesn't appear to be working with
+   * CoreEventInfo objects (or their events)
+   *
+   * This is either the TreeSet impleemntation (unlikely) or something to
+   * do with comparisons but under debug the compare method doesn't even get
+   * called for some of he objects in deleted
+   */
+  private boolean isDeleted(Collection deleted, CoreEventInfo tryCei) {
+    if ((deleted == null) || (deleted.size() == 0)) {
+      return false;
+    }
+    boolean try1 = false;
+
+    Iterator it = deleted.iterator();
+    while (it.hasNext()) {
+      CoreEventInfo cei = (CoreEventInfo)it.next();
+      BwEventProxy pr = (BwEventProxy)cei.getEvent();
+      if (debug) {
+        trace("Deleted: " + pr.getTarget().getId());
+      }
+
+      if (cei.equals(tryCei)) {
+        if (!debug) {
+          return true;
+        }
+
+        trace("Matched: " + tryCei.getEvent().getId());
+        try1 = true;
+        break;
+      }
+    }
+
+    // only here for debug mode
+    boolean try2 = deleted.contains(tryCei);
+    trace("  try2 for : " + tryCei.getEvent().getId() + " gives " + try2);
+
+    return try1 || try2;
+  }
+
+  private void traceDeleted(Collection c) {
+    Iterator it = c.iterator();
+    while (it.hasNext()) {
+      CoreEventInfo cei = (CoreEventInfo)it.next();
+      BwEventProxy pr = (BwEventProxy)cei.getEvent();
+      trace("Deleted: " + pr.getTarget().getId());
+    }
+  }
+
   private BwPreferences getPreferences() throws CalFacadeException {
     return dbi.getPreferences();
   }
@@ -2037,7 +2134,7 @@
       dbi = new CalSvcDb(this, auth);
 
       if (userCreated) {
-      	initUser(auth, cali);
+        initUser(auth, cali);
       }
 
       if (debug) {
@@ -2061,7 +2158,7 @@
       cali.close();
     }
   }
-  
+
   private void initUser(BwUser user, Calintf cali) throws CalFacadeException {
     // Add preferences
     BwPreferences prefs = new BwPreferences();
@@ -2193,7 +2290,7 @@
 
     public Collection getEvent(BwCalendar cal, String guid, String rid,
                                int recurRetrieval) throws CalFacadeException {
-      return CalSvc.this.getEvent(BwSubscription.makeSubscription(cal), cal, guid, 
+      return CalSvc.this.getEvent(BwSubscription.makeSubscription(cal), cal, guid,
                                   rid, recurRetrieval);
     }
 

Modified: trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java
===================================================================
--- trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java	2006-04-09 01:42:46 UTC (rev 355)
+++ trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java	2006-04-10 04:26:24 UTC (rev 356)
@@ -107,13 +107,13 @@
    */
   public abstract void init(CalSvcIPars pars) throws CalFacadeException;
 
-  /** Called after init to flag this user as a super user. 
+  /** Called after init to flag this user as a super user.
    *
    * @param val       true for a super user
    */
   public abstract void setSuperUser(boolean val);
 
-  /** Called after init to flag this user as a super user. 
+  /** Called after init to flag this user as a super user.
    *
    * @return boolean true if super user
    */
@@ -126,27 +126,27 @@
    */
   public abstract BwStats getStats() throws CalFacadeException;
 
-  /** Enable/disable db statistics 
+  /** Enable/disable db statistics
    *
    * @param enable       boolean true to turn on db statistics collection
    * @throws CalFacadeException if not admin
    */
   public abstract void setDbStatsEnabled(boolean enable) throws CalFacadeException;
 
-  /**  
+  /**
    *
    * @return boolean true if statistics collection enabled
    * @throws CalFacadeException if not admin
    */
   public abstract boolean getDbStatsEnabled() throws CalFacadeException;
 
-  /** Dump db statistics 
+  /** Dump db statistics
    *
    * @throws CalFacadeException if not admin
    */
   public abstract void dumpDbStats() throws CalFacadeException;
 
-  /** Get db statistics 
+  /** Get db statistics
    *
    * @return Collection of BwStats.StatsEntry objects
    * @throws CalFacadeException if not admin
@@ -406,11 +406,11 @@
 
   /** Change the access to the given calendar entity.
   *
-  * @param ent      BwShareableDbentity 
+  * @param ent      BwShareableDbentity
   * @param aces     Collection of ace
   * @throws CalFacadeException
   */
- public abstract void changeAccess(BwShareableDbentity ent, 
+ public abstract void changeAccess(BwShareableDbentity ent,
                                    Collection aces) throws CalFacadeException;
 
   /* ====================================================================
@@ -1082,7 +1082,7 @@
    * @param   eventId   int id of the event
    * @return  EventInfo   value object representing event.
    * @throws CalFacadeException
-   * 
+   *
    * @deprecated - other calendar systems won't support this. Doesn't make sense
    *               for recurring events.
    */
@@ -1103,8 +1103,8 @@
    * @return  Collection of EventInfo objects representing event(s).
    * @throws CalFacadeException
    */
-  public abstract Collection getEvent(BwSubscription sub, BwCalendar cal, 
-                                      String guid, 
+  public abstract Collection getEvent(BwSubscription sub, BwCalendar cal,
+                                      String guid,
                                       String recurrenceId,
                                       int recurRetrieval)
         throws CalFacadeException;
@@ -1230,18 +1230,14 @@
    */
   public abstract void updateEvent(BwEvent event) throws CalFacadeException;
 
-  /** Delete a subscribed event for the current user.
+  /** For an event to which we have write access we simply mark it deleted.
    *
-   * <p>This is a partially implemented feature which currently only changes
-   * the synch state. What we need is in effect a reverse event ref - I guess
-   * a new purpose, which indicates the event is hidden for this user.
+   * <p>Otherwise we add an annotation maarking the event as deleted.
    *
-   * @param  event          BwEvent object
-   * @return  boolean       false for no such item.
+   * @param event
    * @throws CalFacadeException
    */
-  public abstract boolean deleteSubscribedEvent(BwEvent event)
-      throws CalFacadeException;
+  public abstract void markDeleted(BwEvent event) throws CalFacadeException;
 
   /* ====================================================================
    *                       Caldav support

Modified: trunk/calendar3/synchml/src/edu/rpi/cct/uwcal/synchml/common/Synchml.java
===================================================================
--- trunk/calendar3/synchml/src/edu/rpi/cct/uwcal/synchml/common/Synchml.java	2006-04-09 01:42:46 UTC (rev 355)
+++ trunk/calendar3/synchml/src/edu/rpi/cct/uwcal/synchml/common/Synchml.java	2006-04-10 04:26:24 UTC (rev 356)
@@ -56,6 +56,7 @@
 
 import org.bedework.calfacade.BwEvent;
 import org.bedework.calfacade.BwEventObj;
+import org.bedework.calfacade.BwRecurrence;
 import org.bedework.calfacade.BwSynchData;
 import org.bedework.calfacade.BwSynchInfo;
 import org.bedework.calfacade.BwSynchState;
@@ -121,7 +122,7 @@
     svci = new CalSvc();
     this.deviceId = deviceId;
     this.debug = debug;
-    CalSvcIPars pars = new CalSvcIPars(account, 
+    CalSvcIPars pars = new CalSvcIPars(account,
                                        account,
                                        null,     // XXX Requires an env prefix
                                        false,    // public
@@ -270,9 +271,9 @@
    */
   public boolean deleteEvent(VEvent val) throws CalFacadeException {
     // FIXME - We need a subscription to the calendar we are synching - second par
-    return deleteEvent(BwEventUtil.toEvent(svci.getIcalCallback(), 
-                                           null,  // BwCalendar 
-                                           null,  // overrides 
+    return deleteEvent(BwEventUtil.toEvent(svci.getIcalCallback(),
+                                           null,  // BwCalendar
+                                           null,  // overrides
                                            val, debug).getEvent());
   }
 
@@ -457,23 +458,37 @@
    * @throws CalFacadeException
    */
   public boolean deleteEvent(BwEvent val) throws CalFacadeException {
-    EventInfo ei = svci.getEvent(val.getId());
+    String recurId = null;
 
-    if (ei == null) {
-      return false;
+    BwRecurrence recur = val.getRecurrence();
+
+    if (recur != null) {
+      recurId = recur.getRecurrenceId();
     }
 
-    if (ei.getKind() == EventInfo.kindEntry) {
-      CalSvcI.DelEventResult der = svci.deleteEvent(ei.getEvent(), true);
-      return der.eventDeleted;
+    int recurRetrieval = CalFacadeDefs.retrieveRecurMaster;
+    if (recurId != null) {
+      // Get the instance
+      recurRetrieval = CalFacadeDefs.retrieveRecurExpanded;
     }
+    Collection evs = svci.getEvent(null, val.getCalendar(), val.getGuid(),
+                                   recurId, recurRetrieval);
 
-    if (ei.getKind() == EventInfo.kindAdded) {
-      svci.deleteEvent(ei.getEvent(), true);
-    } else if (ei.getKind() == EventInfo.kindUndeletable) {
-      svci.deleteSubscribedEvent(ei.getEvent());
+    if ((evs == null) || (evs.size() == 0)) {
+      return false;
     }
 
+    /* We should have one only
+     */
+
+    if (evs.size() != 1) {
+      throw new CalFacadeException("org.dedwork.synchml.unexpected.result");
+    }
+
+    EventInfo ei = (EventInfo)evs.iterator().next();
+
+    svci.markDeleted(ei.getEvent());
+
     return true;
   }
 

Modified: trunk/calendar3/webclient/src/org/bedework/webclient/BwDelEventAction.java
===================================================================
--- trunk/calendar3/webclient/src/org/bedework/webclient/BwDelEventAction.java	2006-04-09 01:42:46 UTC (rev 355)
+++ trunk/calendar3/webclient/src/org/bedework/webclient/BwDelEventAction.java	2006-04-10 04:26:24 UTC (rev 356)
@@ -86,24 +86,18 @@
       return "doNothing";
     }
 
-    int id = form.getEventId();
-
-    if (id < 0) {
-      // Do nothing
-      form.getErr().emit("org.bedework.client.error.nosuchevent", id);
-      return "doNothing";
-    }
-
     CalSvcI svci = form.fetchSvci();
 
-    EventInfo ei = svci.getEvent(id);
+    EventInfo ei = findEvent(request, form);
 
     if (ei == null) {
       // Do nothing
-      form.getErr().emit("org.bedework.client.error.nosuchevent", id);
+      form.getErr().emit("org.bedework.client.error.nosuchevent");
       return "doNothing";
     }
 
+    // XXX temp - just mark as deleted
+    /*
     CalSvcI.DelEventResult delResult = form.fetchSvci().deleteEvent(ei.getEvent(), true);
 
     if (!delResult.eventDeleted) {
@@ -114,6 +108,8 @@
     if (delResult.locationDeleted) {
       form.getMsg().emit("org.bedework.client.message.deleted.locations", 1);
     }
+    */
+    svci.markDeleted(ei.getEvent());
 
     form.getMsg().emit("org.bedework.client.message.deleted.events", 1);
     form.refreshIsNeeded();

Modified: trunk/calendar3/webclient/war/WEB-INF/struts-config.xml
===================================================================
--- trunk/calendar3/webclient/war/WEB-INF/struts-config.xml	2006-04-09 01:42:46 UTC (rev 355)
+++ trunk/calendar3/webclient/war/WEB-INF/struts-config.xml	2006-04-10 04:26:24 UTC (rev 356)
@@ -413,7 +413,7 @@
       <forward name="success" path="/showMain.rdo" redirect="true" />
     </action>
 
-    <!-- ..................... subscriptionss .......................... -->
+    <!-- ..................... subscriptions .......................... -->
 
      <action    path="/subs/showSubs"
                type="org.bedework.webclient.BwRenderAction"

Modified: trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java
===================================================================
--- trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java	2006-04-09 01:42:46 UTC (rev 355)
+++ trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java	2006-04-10 04:26:24 UTC (rev 356)
@@ -102,7 +102,7 @@
 public abstract class BwAbstractAction extends UtilAbstractAction {
   /** Name of the init parameter holding our name */
   private static final String appNameInitParameter = "rpiappname";
-  
+
   public String getId() {
     return getClass().getName();
   }
@@ -129,7 +129,7 @@
         adminUserId = form.getCurrentUser();
       }
     }
-    
+
     if (getPublicAdmin(form)) {
       /** We may want to masquerade as a different user
        */
@@ -171,6 +171,13 @@
       request.setAttribute("org.bedework.action.appbase", appBase);
     }
 
+    if (!form.getNewSession()) {
+      // First time through here for this session
+
+      // Set to default view
+      setView(null, form);
+    }
+
     /* Set up ready for the action */
 
     if (getPublicAdmin(form)) {
@@ -292,20 +299,20 @@
     return true;
   }
 
-  /** Method to retrieve an event. An event is identified by the calendar + 
+  /** Method to retrieve an event. An event is identified by the calendar +
    * guid + recurrence id. We also take the subscription id as a parameter so
    * we can pass it along in the result for display purposes.
-   * 
+   *
    * <p>We cannot just take the calendar from the subscription, because the
-   * calendar has to be the actual collection containing the event. A 
+   * calendar has to be the actual collection containing the event. A
    * subscription may be to higher up the tree (i.e. a folder).
-   * 
+   *
    * <p>We need to also allow the calendar path instead of the id. External
-   * calendars don't have an id. This means changing the api (again) and 
+   * calendars don't have an id. This means changing the api (again) and
    * changing the urls (again).
-   * 
+   *
    * <p>It may be more appropriate to simply encode a url to the event.
-   * 
+   *
    * <p>Request parameters<ul>
    *      <li>"subid"    subscription id for event. < 0 if there is none
    *                     e.g. displayed directly from calendar.</li>
@@ -336,7 +343,7 @@
         return null;
       }
     }
-    
+
     int calId = getIntReqPar(request, "calid", -1);
     BwCalendar cal = null;
 
@@ -344,9 +351,9 @@
       form.getErr().emit("org.bedework.client.error.missingcalendarid");
       return null;
     }
-    
+
     cal = svci.getCalendar(calId);
-    
+
     if (cal == null) {
       // Assume no access
       form.getErr().emit("org.bedework.client.error.noaccess");
@@ -599,18 +606,18 @@
 
     HttpSession session = request.getSession();
     ServletContext sc = session.getServletContext();
-    
+
     String appName = sc.getInitParameter("bwappname");
-    
+
     if ((appName == null) || (appName.length() == 0)) {
       appName = "unknown-app-name";
     }
-    
+
     String envPrefix = "org.bedework.app." + appName + ".";
 
     env = new CalEnv(envPrefix, debug);
     frm.assignEnv(env);
-    
+
     return env;
   }
 
@@ -669,7 +676,7 @@
     BwSession s = BwWebUtil.getState(request);
     HttpSession sess = request.getSession(false);
     String appName = getAppName(sess);
-    
+
     if (s != null) {
       if (debug) {
         debugMsg("getState-- obtainedfrom session");
@@ -776,7 +783,7 @@
 
     return s;
   }
-  
+
   private String getAppName(HttpSession sess) {
     ServletContext sc = sess.getServletContext();
 
@@ -784,7 +791,7 @@
     if (appname == null) {
       appname = "?";
     }
-    
+
     return appname;
   }
 
@@ -796,7 +803,7 @@
                                   UtilActionForm form) {
     HttpSession hsess = request.getSession();
     BwCallback cb = (BwCallback)hsess.getAttribute(BwCallback.cbAttrName);
-    
+
     if (cb == null) {
       if (form.getDebug()) {
         debugMsg("No cb object for logout");
@@ -808,12 +815,12 @@
       try {
         cb.out();
       } catch (Throwable t) {}
-      
+
       try {
         cb.close();
       } catch (Throwable t) {}
     }
-    
+
     return true;
   }
 
@@ -875,7 +882,7 @@
         debugMsg("CalSvcI-- Obtained from session for user " +
                           svci.getUser());
       }
-      
+
       // XXX access - disable use of roles
       access = svci.getUserAuth().getUsertype();
     } else {
@@ -896,9 +903,9 @@
         if (publicAdmin || (user == null)) {
           runAsUser = form.getEnv().getAppProperty("run.as.user");
         }
-        
-        CalSvcIPars pars = new CalSvcIPars(user, //access, 
-                                           runAsUser, 
+
+        CalSvcIPars pars = new CalSvcIPars(user, //access,
+                                           runAsUser,
                                            form.getEnv().getAppPrefix(),
                                            publicAdmin,
                                            false,    // caldav
@@ -916,17 +923,17 @@
         UserAuthPar par = new UserAuthPar();
         par.svlt = servlet;
         par.req = request;
-        
+
         if (publicAdmin) {
           try {
             ua = svci.getUserAuth(user, par);
-            
+
             form.assignAuthorisedUser(ua.getUsertype() != UserAuth.noPrivileges);
             svci.setSuperUser((ua.getUsertype() & UserAuth.superUser) != 0);
-            
+
             // XXX access - disable use of roles
             access = ua.getUsertype();
-            
+
             if (debug) {
               debugMsg("UserAuth says that current user has the type: " +
                        ua.getUsertype());
@@ -943,7 +950,7 @@
         throw new CalFacadeException(t);
       }
     }
-    
+
     form.assignUserVO((BwUser)svci.getUser().clone());
 
     if (publicAdmin) {



More information about the Bedework-commit mailing list