Index: lams_common/src/java/org/lamsfoundation/lams/tool/ToolContentManager.java
===================================================================
diff -u -reae4bd587b30549441371edeca19210f3339cf33 -r2b831e534444ad040546c3762a267a2f73e4199d
--- lams_common/src/java/org/lamsfoundation/lams/tool/ToolContentManager.java (.../ToolContentManager.java) (revision eae4bd587b30549441371edeca19210f3339cf33)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/ToolContentManager.java (.../ToolContentManager.java) (revision 2b831e534444ad040546c3762a267a2f73e4199d)
@@ -21,7 +21,11 @@
* ***********************************************************************/
package org.lamsfoundation.lams.tool;
+import org.lamsfoundation.lams.tool.exception.DataMissingException;
+import org.lamsfoundation.lams.tool.exception.SessionDataExistsException;
+import org.lamsfoundation.lams.tool.exception.ToolException;
+
/**
* Tool interface that defines the contract regarding tool content manipulation.
*
@@ -32,33 +36,53 @@
public interface ToolContentManager
{
/**
- * Make a copy of requested tool content. It will be needed by lams to
- * create a copy of learning design and start a new tool session.
+ * Make a copy of requested tool content. It will be needed by LAMS to
+ * create a copy of learning design and start a new tool session. If
+ * no content exists with the given tool content id, then use the
+ * default content id.
+ *
* @param fromContentId the original tool content id.
* @param toContentId the destination tool content id.
+ * @throws ToolException if an error occurs e.g. defaultContent is missing
*/
- public void copyToolContent(Long fromContentId, Long toContentId);
-
+ public void copyToolContent(Long fromContentId, Long toContentId)
+ throws ToolException;
+
/** This tool content should be define later, that is, the
* teacher will define the content at runtime. The toolContentId
* should already exist in the tool. This method will normally be
* called after copyToolContent.
* @param toolContentId the tool content id of the tool content to be changed.
- */
- public void setAsDefineLater(Long toolContentId);
+ * @throws DataMissingException if no tool content matches the toolContentId
+ * @throws ToolException if any other error occurs
+ */
+ public void setAsDefineLater(Long toolContentId)
+ throws DataMissingException, ToolException;
+
/** This tool content should be setup to run offline, that is, the
* activity will be done offline. The toolContentId
* should already exist in the tool. This method will normally be
* called after copyToolContent.
* @param toolContentId the tool content id of the tool content to be changed.
+ * @throws DataMissingException if no tool content matches the toolContentId
+ * @throws ToolException if any other error occurs
*/
- public void setAsRunOffline(Long toolContentId);
-
+ public void setAsRunOffline(Long toolContentId)
+ throws DataMissingException, ToolException;
+
/**
* Remove tool's content according specified the content id. It will be
- * needed by lams to modify the learning design.
+ * needed by lams to modify the learning design. Note: if session data
+ * for this toolContentId exists and removeSessionData = false, then
+ * the tool should throw SessionDataExists.
+ *
+ * If no matching data exists, return without throwing an exception.
+ *
* @param toolContentId the requested tool content id.
+ * @param removeSessionData should it remove any related session data?
+ * @throws ToolException if any other error occurs
*/
- public void removeToolContent(Long toolContentId);
+ public void removeToolContent(Long toolContentId, boolean removeSessionData)
+ throws SessionDataExistsException, ToolException;
}
Fisheye: Tag 2b831e534444ad040546c3762a267a2f73e4199d refers to a dead (removed) revision in file `lams_common/src/java/org/lamsfoundation/lams/tool/ToolException.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_common/src/java/org/lamsfoundation/lams/tool/ToolSessionManager.java
===================================================================
diff -u -r0735f8bbbe378127d27795e3d9773f3c1293ed41 -r2b831e534444ad040546c3762a267a2f73e4199d
--- lams_common/src/java/org/lamsfoundation/lams/tool/ToolSessionManager.java (.../ToolSessionManager.java) (revision 0735f8bbbe378127d27795e3d9773f3c1293ed41)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/ToolSessionManager.java (.../ToolSessionManager.java) (revision 2b831e534444ad040546c3762a267a2f73e4199d)
@@ -11,6 +11,8 @@
import java.util.List;
+import org.lamsfoundation.lams.tool.exception.DataMissingException;
+import org.lamsfoundation.lams.tool.exception.ToolException;
import org.lamsfoundation.lams.usermanagement.User;
@@ -28,21 +30,48 @@
{
/**
* Create a tool session for a piece of tool content using the tool
- * session id generated by lams.
+ * session id generated by LAMS. If no content exists with the given
+ * tool content id, then use the default content id.
+ *
* @param toolSessionId the generated tool session id.
* @param toolContentId the tool content id specified.
+ * @throws ToolException if an error occurs e.g. defaultContent is missing.
*/
- public void createToolSession(Long toolSessionId, Long toolContentId);
+ public void createToolSession(Long toolSessionId, Long toolContentId) throws ToolException;
/**
* Call the controller service to complete and leave the tool session.
* @param toolSessionId the runtime tool session id.
* @return the url for next activity.
+ * @throws DataMissingException if no tool session matches the toolSessionId
+ * @throws ToolException if any other error occurs
*/
- public String leaveToolSession(Long toolSessionId, User learner);
-
- public ToolSessionExportOutputData exportToolSession(Long toolSessionId);
+ public String leaveToolSession(Long toolSessionId, User learner)
+ throws DataMissingException, ToolException;
- public ToolSessionExportOutputData exportToolSession(List toolSessionIds);
+ /**
+ * Export the XML fragment for the session export. Not sure if this is required.
+ * @throws DataMissingException if no tool session matches the toolSessionId
+ * @throws ToolException if any other error occurs
+ */
+ public ToolSessionExportOutputData exportToolSession(Long toolSessionId)
+ throws DataMissingException, ToolException;
+
+ /**
+ * Export the XML fragment for the session export. Not sure if this is required.
+ * @throws DataMissingException if no tool session matches the toolSessionId
+ * @throws ToolException if any other error occurs
+ */
+ public ToolSessionExportOutputData exportToolSession(List toolSessionIds)
+ throws DataMissingException, ToolException;
+ /**
+ * Remove sesson data according specified the tool session id.
+ * @param toolSessionId the generated tool session id.
+ * @throws DataMissingException if no tool session matches the toolSessionId
+ * @throws ToolException if any other error occurs
+ */
+ public void removeToolSession(Long toolSessionId)
+ throws DataMissingException, ToolException;
+
}
Index: lams_common/src/java/org/lamsfoundation/lams/tool/exception/DataMissingException.java
===================================================================
diff -u
--- lams_common/src/java/org/lamsfoundation/lams/tool/exception/DataMissingException.java (revision 0)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/exception/DataMissingException.java (revision 2b831e534444ad040546c3762a267a2f73e4199d)
@@ -0,0 +1,39 @@
+/*
+Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+http://www.gnu.org/licenses/gpl.txt
+*/
+package org.lamsfoundation.lams.tool.exception;
+
+/**
+ * The data required to carry out the request is missing. For example,
+ * if removeToolSession is called and there isn't a matching
+ * tool session, then this exception should be thrown.
+ */
+public class DataMissingException extends ToolException {
+
+ public DataMissingException() {
+ super("The data required to carry out the request is missing");
+ }
+
+ public DataMissingException(String msg)
+ {
+ super(msg);
+ }
+
+}
Index: lams_common/src/java/org/lamsfoundation/lams/tool/exception/LamsToolServiceException.java
===================================================================
diff -u
--- lams_common/src/java/org/lamsfoundation/lams/tool/exception/LamsToolServiceException.java (revision 0)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/exception/LamsToolServiceException.java (revision 2b831e534444ad040546c3762a267a2f73e4199d)
@@ -0,0 +1,34 @@
+/*
+ * LamsToolServiceException.java
+ *
+ * Created on 11 January 2005, 13:56
+ */
+
+package org.lamsfoundation.lams.tool.exception;
+
+
+/**
+ * Type of ToolException thrown by the LamsToolService
+ * @author chris
+ */
+public class LamsToolServiceException extends ToolException
+{
+
+ /**
+ * Creates a new instance of LamsToolServiceException
without detail message.
+ */
+ public LamsToolServiceException()
+ {
+ }
+
+
+ /**
+ * Constructs an instance of LamsToolServiceException
with the specified detail message.
+ * @param msg the detail message.
+ */
+ public LamsToolServiceException(String msg)
+ {
+ super(msg);
+ }
+
+}
Index: lams_common/src/java/org/lamsfoundation/lams/tool/exception/SessionDataExistsException.java
===================================================================
diff -u
--- lams_common/src/java/org/lamsfoundation/lams/tool/exception/SessionDataExistsException.java (revision 0)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/exception/SessionDataExistsException.java (revision 2b831e534444ad040546c3762a267a2f73e4199d)
@@ -0,0 +1,45 @@
+/*
+Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+http://www.gnu.org/licenses/gpl.txt
+*/
+package org.lamsfoundation.lams.tool.exception;
+
+import org.lamsfoundation.lams.tool.exception.ToolException;
+
+/**
+ * Session data exists and is stopping an action being done. For example,
+ * cannot delete the tool's content record if related session data exists.
+ */
+public class SessionDataExistsException extends ToolException {
+
+ /**
+ *
+ */
+ public SessionDataExistsException() {
+ super("Session data exists. Unable to perform requested action.");
+ }
+
+ /**
+ * @param msg
+ */
+ public SessionDataExistsException(String msg) {
+ super(msg);
+ }
+
+}
Index: lams_common/src/java/org/lamsfoundation/lams/tool/exception/ToolException.java
===================================================================
diff -u
--- lams_common/src/java/org/lamsfoundation/lams/tool/exception/ToolException.java (revision 0)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/exception/ToolException.java (revision 2b831e534444ad040546c3762a267a2f73e4199d)
@@ -0,0 +1,32 @@
+/*
+ * ToolException.java
+ *
+ * Created on 11 January 2005, 13:55
+ */
+
+package org.lamsfoundation.lams.tool.exception;
+
+/**
+ * Type of exception thrown by Tool operations and interfaces.
+ * @author chris
+ */
+public class ToolException extends java.lang.Exception
+{
+
+ /**
+ * Creates a new instance of ToolException
without detail message.
+ */
+ public ToolException()
+ {
+ }
+
+
+ /**
+ * Constructs an instance of ToolException
with the specified detail message.
+ * @param msg the detail message.
+ */
+ public ToolException(String msg)
+ {
+ super(msg);
+ }
+}
Index: lams_common/src/java/org/lamsfoundation/lams/tool/service/ILamsCoreToolService.java
===================================================================
diff -u -r00294d4a7ec90fbdac3951f4130dbcecf8cbf543 -r2b831e534444ad040546c3762a267a2f73e4199d
--- lams_common/src/java/org/lamsfoundation/lams/tool/service/ILamsCoreToolService.java (.../ILamsCoreToolService.java) (revision 00294d4a7ec90fbdac3951f4130dbcecf8cbf543)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/service/ILamsCoreToolService.java (.../ILamsCoreToolService.java) (revision 2b831e534444ad040546c3762a267a2f73e4199d)
@@ -29,6 +29,9 @@
import org.lamsfoundation.lams.lesson.Lesson;
import org.lamsfoundation.lams.tool.ToolAccessMode;
import org.lamsfoundation.lams.tool.ToolSession;
+import org.lamsfoundation.lams.tool.exception.DataMissingException;
+import org.lamsfoundation.lams.tool.exception.LamsToolServiceException;
+import org.lamsfoundation.lams.tool.exception.ToolException;
import org.lamsfoundation.lams.usermanagement.User;
/**
@@ -87,7 +90,8 @@
* @param toolSessionId the tool session generated by lams.
* @param activity the activity correspondent to that tool session.
*/
- public void notifyToolsToCreateSession(Long toolSessionId, ToolActivity activity);
+ public void notifyToolsToCreateSession(Long toolSessionId, ToolActivity activity)
+ throws ToolException;
/**
* Notify a tool to make a copy of its own content. Lams needs to dynamically
@@ -96,7 +100,8 @@
* @param toolActivity the requested tool activity.
* @return new tool content id.
*/
- public Long notifyToolToCopyContent(ToolActivity toolActivity);
+ public Long notifyToolToCopyContent(ToolActivity toolActivity)
+ throws DataMissingException, ToolException;
/**
* Update the tool session data.
Index: lams_common/src/java/org/lamsfoundation/lams/tool/service/ILamsToolService.java
===================================================================
diff -u -rd07ab22c47381f20a9773e08503dacab3040f111 -r2b831e534444ad040546c3762a267a2f73e4199d
--- lams_common/src/java/org/lamsfoundation/lams/tool/service/ILamsToolService.java (.../ILamsToolService.java) (revision d07ab22c47381f20a9773e08503dacab3040f111)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/service/ILamsToolService.java (.../ILamsToolService.java) (revision 2b831e534444ad040546c3762a267a2f73e4199d)
@@ -25,6 +25,7 @@
import java.util.List;
import org.lamsfoundation.lams.tool.BasicToolVO;
+import org.lamsfoundation.lams.tool.exception.LamsToolServiceException;
/**
Index: lams_common/src/java/org/lamsfoundation/lams/tool/service/LamsCoreToolService.java
===================================================================
diff -u -rf34fc4debfe3c6dd47597f623250fbc006783267 -r2b831e534444ad040546c3762a267a2f73e4199d
--- lams_common/src/java/org/lamsfoundation/lams/tool/service/LamsCoreToolService.java (.../LamsCoreToolService.java) (revision f34fc4debfe3c6dd47597f623250fbc006783267)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/service/LamsCoreToolService.java (.../LamsCoreToolService.java) (revision 2b831e534444ad040546c3762a267a2f73e4199d)
@@ -31,6 +31,9 @@
import org.lamsfoundation.lams.tool.ToolSession;
import org.lamsfoundation.lams.tool.ToolSessionManager;
import org.lamsfoundation.lams.tool.dao.IToolSessionDAO;
+import org.lamsfoundation.lams.tool.exception.DataMissingException;
+import org.lamsfoundation.lams.tool.exception.LamsToolServiceException;
+import org.lamsfoundation.lams.tool.exception.ToolException;
import org.lamsfoundation.lams.usermanagement.User;
import org.lamsfoundation.lams.util.WebUtil;
import org.springframework.beans.BeansException;
@@ -133,9 +136,10 @@
}
/**
+ * @throws ToolException
* @see org.lamsfoundation.lams.tool.service.ILamsCoreToolService#notifyToolsToCreateSession(java.lang.Long, org.lamsfoundation.lams.learningdesign.ToolActivity)
*/
- public void notifyToolsToCreateSession(Long toolSessionId, ToolActivity activity)
+ public void notifyToolsToCreateSession(Long toolSessionId, ToolActivity activity) throws ToolException
{
ToolSessionManager sessionManager = (ToolSessionManager) findToolService(activity);
@@ -148,9 +152,11 @@
* Make a copy of all tools content which belongs to this learning design.
*
* @param toolActivity the tool activity defined in the design.
+ * @throws DataMissingException, ToolException
* @see org.lamsfoundation.lams.tool.service.ILamsCoreToolService#notifyToolToCopyContent(org.lamsfoundation.lams.learningdesign.ToolActivity)
*/
- public Long notifyToolToCopyContent(ToolActivity toolActivity)
+ public Long notifyToolToCopyContent(ToolActivity toolActivity)
+ throws DataMissingException, ToolException
{
Long newToolcontentID = contentIDGenerator.getNextToolContentIDFor(toolActivity.getTool());
//This is just for testing purpose because surveyService is the only
Index: lams_common/src/java/org/lamsfoundation/lams/tool/service/LamsToolService.java
===================================================================
diff -u -rb9d108908940cd377d1c092fd32b2dea39d4c4f1 -r2b831e534444ad040546c3762a267a2f73e4199d
--- lams_common/src/java/org/lamsfoundation/lams/tool/service/LamsToolService.java (.../LamsToolService.java) (revision b9d108908940cd377d1c092fd32b2dea39d4c4f1)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/service/LamsToolService.java (.../LamsToolService.java) (revision 2b831e534444ad040546c3762a267a2f73e4199d)
@@ -27,6 +27,7 @@
import org.lamsfoundation.lams.tool.BasicToolVO;
import org.lamsfoundation.lams.tool.Tool;
import org.lamsfoundation.lams.tool.dao.IToolDAO;
+import org.lamsfoundation.lams.tool.exception.LamsToolServiceException;
/**
Index: lams_common/src/java/org/lamsfoundation/lams/tool/service/LamsToolServiceException.java
===================================================================
diff -u -rbefb60ab3288d93e681e0316168ede788a874895 -r2b831e534444ad040546c3762a267a2f73e4199d
--- lams_common/src/java/org/lamsfoundation/lams/tool/service/LamsToolServiceException.java (.../LamsToolServiceException.java) (revision befb60ab3288d93e681e0316168ede788a874895)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/service/LamsToolServiceException.java (.../LamsToolServiceException.java) (revision 2b831e534444ad040546c3762a267a2f73e4199d)
@@ -6,7 +6,7 @@
package org.lamsfoundation.lams.tool.service;
-import org.lamsfoundation.lams.tool.ToolException;
+import org.lamsfoundation.lams.tool.exception.ToolException;
/**
* Type of ToolException thrown by the LamsToolService