[Bedework-commit] calendarapi r630 - in trunk:
calCore/src/org/bedework/calcore/hibernate
calFacade/src/org/bedework/calfacade/wrappers
svnadmin at bedework.org
svnadmin at bedework.org
Thu May 22 10:52:54 EDT 2008
Author: douglm
Date: 2008-05-22 10:52:52 -0400 (Thu, 22 May 2008)
New Revision: 630
Modified:
trunk/calCore/src/org/bedework/calcore/hibernate/CoreCalendars.java
trunk/calFacade/src/org/bedework/calfacade/wrappers/CalendarWrapper.java
Log:
Make collection rename work.
Add some more tests
Modified: trunk/calCore/src/org/bedework/calcore/hibernate/CoreCalendars.java
===================================================================
--- trunk/calCore/src/org/bedework/calcore/hibernate/CoreCalendars.java 2008-05-22 14:52:09 UTC (rev 629)
+++ trunk/calCore/src/org/bedework/calcore/hibernate/CoreCalendars.java 2008-05-22 14:52:52 UTC (rev 630)
@@ -131,24 +131,22 @@
parentCal.addChild(usercal);
- sess.save(parentCal);
- } else {
- if (usercal == null) {
- /* Create a new system owned folder for part of the principal
- * hierarchy
- */
- usercal = new BwCalendar();
- usercal.setName(pathSeg);
- usercal.setCreator(userrootcal.getCreator());
- usercal.setOwner(userrootcal.getOwner());
- usercal.setPublick(false);
- usercal.setPath(path);
- usercal.setCalendar(parentCal);
+ sess.save(usercal);
+ } else if (usercal == null) {
+ /* Create a new system owned folder for part of the principal
+ * hierarchy
+ */
+ usercal = new BwCalendar();
+ usercal.setName(pathSeg);
+ usercal.setCreator(userrootcal.getCreator());
+ usercal.setOwner(userrootcal.getOwner());
+ usercal.setPublick(false);
+ usercal.setPath(path);
+ usercal.setCalendar(parentCal);
- parentCal.addChild(usercal);
+ parentCal.addChild(usercal);
- sess.save(parentCal);
- }
+ sess.save(usercal);
}
parentCal = usercal;
@@ -160,13 +158,13 @@
cal.setCreator(user);
cal.setOwner(user);
cal.setPublick(false);
- cal.setPath(path + "/" + getSyspars().getUserDefaultCalendar());
+ cal.setPath(path + "/" + cal.getName());
cal.setCalendar(usercal);
cal.setCalType(BwCalendar.calTypeCollection);
usercal.addChild(cal);
- sess.save(usercal);
+ sess.save(cal);
sess.update(user);
}
@@ -331,11 +329,11 @@
/* update will check access
*/
- /* Ensure the name isn't reserved and the path is unique */
- checkNewCalendarName(val.getName(), false, val.getCalendar());
-
BwCalendar parent = val.getCalendar();
+ /* Ensure the name isn't reserved and the path is unique */
+ checkNewCalendarName(newName, false, parent);
+
val.setName(newName);
/* This triggers off a cascade of updates down the tree as we are storing the
Modified: trunk/calFacade/src/org/bedework/calfacade/wrappers/CalendarWrapper.java
===================================================================
--- trunk/calFacade/src/org/bedework/calfacade/wrappers/CalendarWrapper.java 2008-05-22 14:52:09 UTC (rev 629)
+++ trunk/calFacade/src/org/bedework/calfacade/wrappers/CalendarWrapper.java 2008-05-22 14:52:52 UTC (rev 630)
@@ -192,7 +192,8 @@
* @see org.bedework.calfacade.BwCalendar#setName(java.lang.String)
*/
public void setName(String val) {
- entity.setName(val);
+ // Immutable - use the rename api method.
+ throw new RuntimeException("org.bedework.noaccess");
}
/* (non-Javadoc)
More information about the Bedework-commit
mailing list