[Bedework-commit] r521 - in trunk/calendar3: calCore/resources/hbms
webcommon/src/org/bedework/webcommon
webcommon/src/org/bedework/webcommon/calendars
webcommon/src/org/bedework/webcommon/calsuite
webcommon/src/org/bedework/webcommon/views
svnadmin at bedework.org
svnadmin at bedework.org
Thu Jun 1 14:59:13 EDT 2006
Author: douglm
Date: 2006-06-01 14:59:13 -0400 (Thu, 01 Jun 2006)
New Revision: 521
Added:
trunk/calendar3/webcommon/src/org/bedework/webcommon/calsuite/FetchCalSuiteAction.java
trunk/calendar3/webcommon/src/org/bedework/webcommon/calsuite/UpdateCalSuiteAction.java
Modified:
trunk/calendar3/calCore/resources/hbms/CalSuite.hbm.xml
trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java
trunk/calendar3/webcommon/src/org/bedework/webcommon/calendars/UpdateCalendarAction.java
trunk/calendar3/webcommon/src/org/bedework/webcommon/views/FetchViewAction.java
Log:
New calsuite actions
Modified: trunk/calendar3/calCore/resources/hbms/CalSuite.hbm.xml
===================================================================
--- trunk/calendar3/calCore/resources/hbms/CalSuite.hbm.xml 2006-06-01 15:43:41 UTC (rev 520)
+++ trunk/calendar3/calCore/resources/hbms/CalSuite.hbm.xml 2006-06-01 18:59:13 UTC (rev 521)
@@ -19,14 +19,14 @@
<many-to-one name="creator"
class="org.bedework.calfacade.BwUser"
unique="true">
- <column name="creatorid" not-null="true" index="idx_sp_creator" />
+ <column name="creatorid" not-null="true" index="idx_calsuite_creator" />
</many-to-one>
<many-to-one name="owner"
class="org.bedework.calfacade.BwUser"
unique="true">
<column name="ownerid" not-null="true"
- index="idx_sp_owner" unique-key="sponsor_key" />
+ index="idx_calsuite_owner" unique-key="sponsor_key" />
</many-to-one>
<property name="access" column="bwaccess" type="text" />
Modified: trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java
===================================================================
--- trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java 2006-06-01 15:43:41 UTC (rev 520)
+++ trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java 2006-06-01 18:59:13 UTC (rev 521)
@@ -609,6 +609,19 @@
return addingCalSuite;
}
+ /** Return the collection of cal suites
+ *
+ * @return views
+ */
+ public Collection getCalSuites() {
+ try {
+ return fetchSvci().getCalSuites();
+ } catch (Throwable t) {
+ err.emit(t);
+ return null;
+ }
+ }
+
/* ====================================================================
* Admin groups
* ==================================================================== */
Modified: trunk/calendar3/webcommon/src/org/bedework/webcommon/calendars/UpdateCalendarAction.java
===================================================================
--- trunk/calendar3/webcommon/src/org/bedework/webcommon/calendars/UpdateCalendarAction.java 2006-06-01 15:43:41 UTC (rev 520)
+++ trunk/calendar3/webcommon/src/org/bedework/webcommon/calendars/UpdateCalendarAction.java 2006-06-01 18:59:13 UTC (rev 521)
@@ -70,7 +70,7 @@
* <p>Parameters are:<ul>
* <li>"calendar.summary" Summary for calendar</li>
* <li>"calendar.description" Description for calendar</li>
- * <li>"calendarCollection" Calendar/Folder flag true/false</li>
+ * <li>"calendar.calendarCollection" Calendar/Folder flag true/false</li>
* </ul>
*
* <p>Forwards to:<ul>
Added: trunk/calendar3/webcommon/src/org/bedework/webcommon/calsuite/FetchCalSuiteAction.java
===================================================================
--- trunk/calendar3/webcommon/src/org/bedework/webcommon/calsuite/FetchCalSuiteAction.java (rev 0)
+++ trunk/calendar3/webcommon/src/org/bedework/webcommon/calsuite/FetchCalSuiteAction.java 2006-06-01 18:59:13 UTC (rev 521)
@@ -0,0 +1,115 @@
+/*
+ Copyright (c) 2000-2005 University of Washington. All rights reserved.
+
+ Redistribution and use of this distribution in source and binary forms,
+ with or without modification, are permitted provided that:
+
+ The above copyright notice and this permission notice appear in
+ all copies and supporting documentation;
+
+ The name, identifiers, and trademarks of the University of Washington
+ are not used in advertising or publicity without the express prior
+ written permission of the University of Washington;
+
+ Recipients acknowledge that this distribution is made available as a
+ research courtesy, "as is", potentially with defects, without
+ any obligation on the part of the University of Washington to
+ provide support, services, or repair;
+
+ THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR
+ IMPLIED, WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION
+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF
+ WASHINGTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT (INCLUDING
+ NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION WITH
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* **********************************************************************
+ Copyright 2005 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:
+ The above copyright notice and this permission notice appear in all
+ copies and supporting documentation;
+
+ The name, identifiers, and trademarks of Rensselaer Polytechnic
+ Institute are not used in advertising or publicity without the
+ express prior written permission of Rensselaer Polytechnic Institute;
+
+ DISCLAIMER: The software is distributed" AS IS" without any express or
+ implied warranty, including but not limited to, any implied warranties
+ of merchantability or fitness for a particular purpose or any warrant)'
+ of non-infringement of any current or pending patent rights. The authors
+ of the software make no representations about the suitability of this
+ software for any particular purpose. The entire risk as to the quality
+ and performance of the software is with the user. Should the software
+ prove defective, the user assumes the cost of all necessary servicing,
+ repair or correction. In particular, neither Rensselaer Polytechnic
+ Institute, nor the authors of the software are liable for any indirect,
+ special, consequential, or incidental damages related to the software,
+ to the maximum extent the law permits.
+*/
+package org.bedework.webcommon.calsuite;
+
+import org.bedework.calfacade.svc.wrappers.BwCalSuiteWrapper;
+import org.bedework.calsvci.CalSvcI;
+import org.bedework.webcommon.BwAbstractAction;
+import org.bedework.webcommon.BwActionFormBase;
+import org.bedework.webcommon.BwSession;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/** Fetch a calendar suite for update/display/delete.
+ *
+ * <p>Parameters are:<ul>
+ * <li>"name" Name of suite</li>
+ * </ul>
+ *
+ * <p>Forwards to:<ul>
+ * <li>"error" some form of fatal error.</li>
+ * <li>"noAccess" user not authorised.</li>
+ * <li>"notFound" no such subscription.</li>
+ * <li>"retry" try again.</li>
+ * <li>"success" subscribed ok.</li>
+ * </ul>
+ *
+ * @author Mike Douglass douglm at rpi.edu
+ */
+public class FetchCalSuiteAction extends BwAbstractAction {
+ /* (non-Javadoc)
+ * @see org.bedework.webcommon.BwAbstractAction#doAction(javax.servlet.http.HttpServletRequest, org.bedework.webcommon.BwSession, org.bedework.webcommon.BwActionFormBase)
+ */
+ public String doAction(HttpServletRequest request,
+ HttpServletResponse response,
+ BwSession sess,
+ BwActionFormBase form) throws Throwable {
+ CalSvcI svc = form.fetchSvci();
+
+ String name = getReqPar(request, "name");
+
+ if (name == null) {
+ form.getErr().emit("org.bedework.client.error.missingfield", "name");
+ return "retry";
+ }
+
+ BwCalSuiteWrapper cs = svc.getCalSuite(name);
+
+ if (cs == null) {
+ form.getErr().emit("org.bedework.client.error.notfound", name);
+ return "notFound";
+ }
+
+ form.setCalSuite(cs);
+
+ String reqpar = getReqPar(request, "delete");
+
+ if (reqpar != null) {
+ return "delete";
+ }
+
+ return "success";
+ }
+}
Added: trunk/calendar3/webcommon/src/org/bedework/webcommon/calsuite/UpdateCalSuiteAction.java
===================================================================
--- trunk/calendar3/webcommon/src/org/bedework/webcommon/calsuite/UpdateCalSuiteAction.java (rev 0)
+++ trunk/calendar3/webcommon/src/org/bedework/webcommon/calsuite/UpdateCalSuiteAction.java 2006-06-01 18:59:13 UTC (rev 521)
@@ -0,0 +1,132 @@
+/*
+ Copyright (c) 2000-2005 University of Washington. All rights reserved.
+
+ Redistribution and use of this distribution in source and binary forms,
+ with or without modification, are permitted provided that:
+
+ The above copyright notice and this permission notice appear in
+ all copies and supporting documentation;
+
+ The name, identifiers, and trademarks of the University of Washington
+ are not used in advertising or publicity without the express prior
+ written permission of the University of Washington;
+
+ Recipients acknowledge that this distribution is made available as a
+ research courtesy, "as is", potentially with defects, without
+ any obligation on the part of the University of Washington to
+ provide support, services, or repair;
+
+ THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR
+ IMPLIED, WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION
+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF
+ WASHINGTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT (INCLUDING
+ NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION WITH
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* **********************************************************************
+ Copyright 2005 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:
+ The above copyright notice and this permission notice appear in all
+ copies and supporting documentation;
+
+ The name, identifiers, and trademarks of Rensselaer Polytechnic
+ Institute are not used in advertising or publicity without the
+ express prior written permission of Rensselaer Polytechnic Institute;
+
+ DISCLAIMER: The software is distributed" AS IS" without any express or
+ implied warranty, including but not limited to, any implied warranties
+ of merchantability or fitness for a particular purpose or any warrant)'
+ of non-infringement of any current or pending patent rights. The authors
+ of the software make no representations about the suitability of this
+ software for any particular purpose. The entire risk as to the quality
+ and performance of the software is with the user. Should the software
+ prove defective, the user assumes the cost of all necessary servicing,
+ repair or correction. In particular, neither Rensselaer Polytechnic
+ Institute, nor the authors of the software are liable for any indirect,
+ special, consequential, or incidental damages related to the software,
+ to the maximum extent the law permits.
+*/
+package org.bedework.webcommon.calsuite;
+
+import org.bedework.calfacade.svc.wrappers.BwCalSuiteWrapper;
+import org.bedework.calsvci.CalSvcI;
+import org.bedework.webcommon.BwAbstractAction;
+import org.bedework.webcommon.BwActionFormBase;
+import org.bedework.webcommon.BwSession;
+
+import edu.rpi.sss.util.Util;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/** Update a calendar suite for a user.
+ *
+ * <p>Parameters are:<ul>
+ * <li>"calSuite.name" Name of calsuite to update</li>
+ * </ul>
+ *
+ * <p>Forwards to:<ul>
+ * <li>"error" some form of fatal error.</li>
+ * <li>"noAccess" user not authorised.</li>
+ * <li>"retry" try again.</li>
+ * <li>"success" subscribed ok.</li>
+ * </ul>
+ *
+ * @author Mike Douglass douglm at rpi.edu
+ */
+public class UpdateCalSuiteAction extends BwAbstractAction {
+ /* (non-Javadoc)
+ * @see org.bedework.webcommon.BwAbstractAction#doAction(javax.servlet.http.HttpServletRequest, org.bedework.webcommon.BwSession, org.bedework.webcommon.BwActionFormBase)
+ */
+ public String doAction(HttpServletRequest request,
+ HttpServletResponse response,
+ BwSession sess,
+ BwActionFormBase form) throws Throwable {
+ if (form.getGuest()) {
+ return "noAccess"; // First line of defence
+ }
+
+ CalSvcI svc = form.fetchSvci();
+
+ BwCalSuiteWrapper csw = form.getCalSuite();
+
+ if (csw == null) {
+ return "error";
+ }
+
+ if (!validateCalSuite(csw, form)) {
+ return "retry";
+ }
+
+ svc.updateCalSuite(csw);
+
+ return "success";
+ }
+
+ protected boolean validateCalSuite(BwCalSuiteWrapper csw,
+ BwActionFormBase form) throws Throwable {
+ csw.setName(Util.checkNull(csw.getName()));
+
+ if (csw.getName() == null) {
+ form.getErr().emit("org.bedework.client.error.missingfield", "name");
+ return false;
+ }
+
+ if (csw.getGroup() == null) {
+ form.getErr().emit("org.bedework.client.error.missingfield", "group");
+ return false;
+ }
+
+ if (csw.getRootCalendar() == null) {
+ form.getErr().emit("org.bedework.client.error.missingfield", "rootCalendar");
+ return false;
+ }
+
+ return true;
+ }
+}
Modified: trunk/calendar3/webcommon/src/org/bedework/webcommon/views/FetchViewAction.java
===================================================================
--- trunk/calendar3/webcommon/src/org/bedework/webcommon/views/FetchViewAction.java 2006-06-01 15:43:41 UTC (rev 520)
+++ trunk/calendar3/webcommon/src/org/bedework/webcommon/views/FetchViewAction.java 2006-06-01 18:59:13 UTC (rev 521)
@@ -62,7 +62,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-/** Delete a view.
+/** Fetch a view for update/display/delete.
*
* <p>Parameters are:<ul>
* <li>"name" Name of view</li>
More information about the Bedework-commit
mailing list