Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/taskListApplicationContext.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/taskListApplicationContext.xml,v
diff -u -r1.5 -r1.6
--- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/taskListApplicationContext.xml 9 Apr 2008 06:00:27 -0000 1.5
+++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/taskListApplicationContext.xml 11 Apr 2008 06:46:38 -0000 1.6
@@ -145,6 +145,7 @@
PROPAGATION_REQUIRED,-java.lang.Exception
PROPAGATION_REQUIRED,-java.lang.Exception
PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED, -java.lang.Exception
PROPAGATION_REQUIRED,-java.lang.Exception
PROPAGATION_REQUIRED,-java.lang.Exception
PROPAGATION_REQUIRED,-java.lang.Exception
@@ -153,7 +154,7 @@
PROPAGATION_REQUIRED,-java.lang.Exception
PROPAGATION_REQUIRED,-java.lang.Exception
PROPAGATION_REQUIRED,-java.lang.Exception
- PROPAGATION_REQUIRED,+java.lang.Exception
+ PROPAGATION_REQUIRED,+java.lang.Exception
PROPAGATION_REQUIRED,+java.lang.Exception
PROPAGATION_REQUIRED,+java.lang.Exception
PROPAGATION_REQUIRED,+java.lang.Exception
Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/TaskListItemVisitDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/TaskListItemVisitDAO.java,v
diff -u -r1.2 -r1.3
--- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/TaskListItemVisitDAO.java 2 Apr 2008 05:07:56 -0000 1.2
+++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/TaskListItemVisitDAO.java 11 Apr 2008 06:46:39 -0000 1.3
@@ -53,5 +53,15 @@
* @return list of taskListItemVisitLogs which corresponds to specified sessionId and itemUid
*/
public List getTaskListItemLogBySession(Long sessionId,Long itemUid);
+
+ /**
+ *
+ *
+ * @param toolSessionId
+ * @param userUid
+ * @return
+ */
+ public int getTasksCompletedCountByUser(Long toolSessionId ,Long userUid);
+
}
Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/hibernate/TaskListItemVisitDAOHibernate.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/hibernate/TaskListItemVisitDAOHibernate.java,v
diff -u -r1.2 -r1.3
--- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/hibernate/TaskListItemVisitDAOHibernate.java 2 Apr 2008 05:07:56 -0000 1.2
+++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/hibernate/TaskListItemVisitDAOHibernate.java 11 Apr 2008 06:46:38 -0000 1.3
@@ -46,9 +46,9 @@
private static final String FIND_BY_ITEM_BYSESSION = "from " + TaskListItemVisitLog.class.getName()
+ " as r where r.sessionId = ? and r.taskListItem.uid=?";
-// private static final String FIND_VIEW_COUNT_BY_USER = "select count(*) from " + TaskListItemVisitLog.class.getName()
-// + " as r where r.sessionId=? and r.user.userId =?";
-//
+ private static final String FIND_TASKS_COMPLETED_COUNT_BY_USER = "select count(*) from " + TaskListItemVisitLog.class.getName()
+ + " as r where r.complete=true and r.sessionId=? and r.user.userId =?";
+
// private static final String FIND_SUMMARY = "select v.taskListItem.uid, count(v.taskListItem) from "
// + TaskListItemVisitLog.class.getName() + " as v , "
// + TaskListSession.class.getName() + " as s, "
@@ -68,13 +68,16 @@
return (TaskListItemVisitLog) list.get(0);
}
-// public int getUserViewLogCount(Long toolSessionId ,Long userUid) {
-// List list = getHibernateTemplate().find(FIND_VIEW_COUNT_BY_USER,new Object[]{toolSessionId, userUid});
-// if(list == null || list.size() ==0)
-// return 0;
-// return ((Number) list.get(0)).intValue();
-// }
-//
+ /**
+ * {@inheritDoc}
+ */
+ public int getTasksCompletedCountByUser(Long toolSessionId ,Long userUid) {
+ List list = getHibernateTemplate().find(FIND_TASKS_COMPLETED_COUNT_BY_USER, new Object[]{toolSessionId, userUid});
+ if(list == null || list.size() ==0)
+ return 0;
+ return ((Number) list.get(0)).intValue();
+ }
+
// public Map getSummary(Long contentId) {
//
// // Note: Hibernate 3.1 query.uniqueResult() returns Integer, Hibernate 3.2 query.uniqueResult() returns Long
Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskList.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskList.java,v
diff -u -r1.7 -r1.8
--- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskList.java 9 Apr 2008 02:03:29 -0000 1.7
+++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskList.java 11 Apr 2008 06:46:38 -0000 1.8
@@ -137,6 +137,7 @@
}
taskList.taskListItems = set;
}
+
//clone attachment
if(attachments != null){
Iterator iter = attachments.iterator();
@@ -157,8 +158,23 @@
while(iter.hasNext()){
TaskListCondition condition = (TaskListCondition)iter.next();
TaskListCondition newCondition = (TaskListCondition) condition.clone();
- //just clone old file without duplicate it in repository
+ //picking up all the taskListItems that condition had
+ if(condition.getTaskListItems() != null){
+ Set set2 = new HashSet();
+ newCondition.setTaskListItems(set2);
+// Iterator iter2 = taskListItems.iterator();
+// while(iter.hasNext()){
+// TaskListItem item = (TaskListItem)iter.next();
+// TaskListItem newItem = (TaskListItem) item.clone();
+// //just clone old file without duplicate it in repository
+// set.add(newItem);
+// }
+
+ }
+
+
+
set.add(newCondition);
}
taskList.conditions = set;
Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListCondition.hbm.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/Attic/TaskListCondition.hbm.xml,v
diff -u -r1.4 -r1.5
--- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListCondition.hbm.xml 9 Apr 2008 06:00:27 -0000 1.4
+++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListCondition.hbm.xml 11 Apr 2008 06:46:38 -0000 1.5
@@ -38,7 +38,7 @@
table="tl_latask10_condition_tl_item"
lazy="true"
inverse="false"
- cascade="none"
+ cascade="all"
sort="unsorted"
>
Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListCondition.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListCondition.java,v
diff -u -r1.4 -r1.5
--- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListCondition.java 9 Apr 2008 06:00:27 -0000 1.4
+++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListCondition.java 11 Apr 2008 06:46:38 -0000 1.5
@@ -116,27 +116,15 @@
*/
public Object clone(){
- TaskListCondition taskList = null;
+ TaskListCondition condition = null;
try{
- taskList = (TaskListCondition) super.clone();
- taskList.setUid(null);
- //clone taskListItems
- if(taskListItems != null){
- Iterator iter = taskListItems.iterator();
- Set set = new HashSet();
- while(iter.hasNext()){
- TaskListItem item = (TaskListItem)iter.next();
- TaskListItem newItem = (TaskListItem) item.clone();
- //just clone old file without duplicate it in repository
- set.add(newItem);
- }
- taskList.taskListItems = set;
- }
+ condition = (TaskListCondition) super.clone();
+ condition.setUid(null);
} catch (CloneNotSupportedException e) {
log.error("When clone " + TaskListCondition.class + " failed");
}
- return taskList;
+ return condition;
}
//**********************************************************
@@ -196,6 +184,8 @@
* @hibernate.collection-key column="condition_uid"
* @hibernate.collection-many-to-many column="uid" class="org.lamsfoundation.lams.tool.taskList.model.TaskListItem"
*/
+
+ //TODO maybe th reason of a problem cascade="all"!!!
public Set getTaskListItems() {
return taskListItems;
}
Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java,v
diff -u -r1.9 -r1.10
--- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java 7 Apr 2008 07:33:30 -0000 1.9
+++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java 11 Apr 2008 06:46:38 -0000 1.10
@@ -26,10 +26,14 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.SortedMap;
import java.util.SortedSet;
+import java.util.TreeMap;
import org.apache.struts.upload.FormFile;
import org.lamsfoundation.lams.notebook.model.NotebookEntry;
+import org.lamsfoundation.lams.tool.ToolOutputDefinition;
+import org.lamsfoundation.lams.tool.exception.ToolException;
import org.lamsfoundation.lams.tool.taskList.dto.ReflectDTO;
import org.lamsfoundation.lams.tool.taskList.dto.Summary;
import org.lamsfoundation.lams.tool.taskList.dto.TaskSummary;
@@ -47,9 +51,17 @@
* @author Dapeng.Ni
* @author Andrey Balan
*/
-public interface ITaskListService
-{
+public interface ITaskListService {
+
+
/**
+ * @param toolSessionId
+ * @param userUid
+ * @return
+ */
+ public int getNumTasksCompletedByUser(Long toolSessionId, Long userUid);
+
+ /**
* Get TaskList
by toolContentID.
*
* @param contentId
@@ -63,9 +75,9 @@
*
* @param contentId
* @return
- * @throws TaskListApplicationException
+ * @throws TaskListException
*/
- TaskList getDefaultContent(Long contentId) throws TaskListApplicationException;
+ TaskList getDefaultContent(Long contentId) throws TaskListException;
/**
* Get list of taskList items by given taskListUid. These taskList items must be created by author.
@@ -143,9 +155,9 @@
*
* @param fileUuid
* @param fileVersionId
- * @throws TaskListApplicationException
+ * @throws TaskListException
*/
- void deleteFromRepository(Long fileUuid, Long fileVersionId) throws TaskListApplicationException ;
+ void deleteFromRepository(Long fileUuid, Long fileVersionId) throws TaskListException ;
/**
* Save or update taskList into database.
@@ -257,7 +269,7 @@
* @param userId
* @return
*/
- String finishToolSession(Long toolSessionId, Long userId) throws TaskListApplicationException;
+ String finishToolSession(Long toolSessionId, Long userId) throws TaskListException;
/**
* Create refection entry into notebook tool.
@@ -331,6 +343,6 @@
* @return
*/
TaskSummary getTaskSummary(Long contentId, Long taskListItemUid);
-
+
}
Fisheye: Tag 1.3 refers to a dead (removed) revision in file `lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListApplicationException.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListException.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListException.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListException.java 11 Apr 2008 06:46:38 -0000 1.1
@@ -0,0 +1,47 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: TaskListException.java,v 1.1 2008/04/11 06:46:38 andreyb Exp $$ */
+package org.lamsfoundation.lams.tool.taskList.service;
+
+/**
+ * @author Andrey Balan
+ */
+public class TaskListException extends RuntimeException{
+
+ public TaskListException() {
+ super();
+ }
+
+ public TaskListException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TaskListException(String message) {
+ super(message);
+ }
+
+ public TaskListException(Throwable cause) {
+ super(cause);
+ }
+
+}
Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListOutputFactory.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListOutputFactory.java,v
diff -u -r1.1 -r1.2
--- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListOutputFactory.java 9 Apr 2008 06:00:27 -0000 1.1
+++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListOutputFactory.java 11 Apr 2008 06:46:38 -0000 1.2
@@ -23,22 +23,61 @@
/* $Id$ */
package org.lamsfoundation.lams.tool.taskList.service;
+import java.util.List;
import java.util.SortedMap;
+import java.util.TreeMap;
import org.lamsfoundation.lams.tool.OutputFactory;
+import org.lamsfoundation.lams.tool.ToolOutput;
import org.lamsfoundation.lams.tool.ToolOutputDefinition;
import org.lamsfoundation.lams.tool.exception.ToolException;
/**
+ * Creates the output definitions for forum. Eventually there will be a definition
+ * that outputs some or all of the forum queries, but for now there are just a couple of
+ * simple definitions so that we can try various features of the tool output based
+ * branching.
+ *
* @author Andrey Balan
*/
public class TaskListOutputFactory extends OutputFactory{
- @Override
+ /** The number of posts the learner has made in one forum activity. */
+ protected final static String OUTPUT_NAME_LEARNER_NUM_TASKS_COMPLETED = "learner.number.of.tasks.completed";
+
+ /**
+ * {@inheritDoc}
+ */
public SortedMap getToolOutputDefinitions(Object toolContentObject) throws ToolException {
+ TreeMap definitionMap = new TreeMap();
+
+ ToolOutputDefinition definition = buildRangeDefinition(OUTPUT_NAME_LEARNER_NUM_TASKS_COMPLETED, new Long(0), null);
+ definitionMap.put(OUTPUT_NAME_LEARNER_NUM_TASKS_COMPLETED, definition);
+ return definitionMap;
+ }
+
+ public SortedMap getToolOutput(List names, ITaskListService taskListService, Long toolSessionId, Long learnerId) {
+
+ TreeMap map = new TreeMap();
+ if ( names == null || names.contains(OUTPUT_NAME_LEARNER_NUM_TASKS_COMPLETED)) {
+ map.put(OUTPUT_NAME_LEARNER_NUM_TASKS_COMPLETED,getNumTasksCompleted(taskListService, learnerId, toolSessionId));
+ }
+ return map;
+
+ }
+
+ public ToolOutput getToolOutput(String name, ITaskListService taskListService, Long toolSessionId, Long learnerId) {
+
+ if ( name != null && name.equals(OUTPUT_NAME_LEARNER_NUM_TASKS_COMPLETED)) {
+ return getNumTasksCompleted(taskListService, learnerId, toolSessionId);
+ }
return null;
+
}
+ private ToolOutput getNumTasksCompleted(ITaskListService taskListService, Long learnerId, Long toolSessionId) {
+ int num = taskListService.getNumTasksCompletedByUser(toolSessionId, learnerId);
+ return new ToolOutput(OUTPUT_NAME_LEARNER_NUM_TASKS_COMPLETED, getI18NText(OUTPUT_NAME_LEARNER_NUM_TASKS_COMPLETED, true), new Long(num));
+ }
}
-
\ No newline at end of file
Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java,v
diff -u -r1.8 -r1.9
--- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java 9 Apr 2008 06:00:27 -0000 1.8
+++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java 11 Apr 2008 06:46:38 -0000 1.9
@@ -126,7 +126,7 @@
//tool service
private TaskListToolContentHandler taskListToolContentHandler;
private MessageService messageService;
- TaskListOutputFactory taskListOutputFactory;
+ private TaskListOutputFactory taskListOutputFactory;
//system services
private IRepositoryService repositoryService;
private ILamsToolService toolService;
@@ -154,12 +154,12 @@
/**
* {@inheritDoc}
*/
- public TaskList getDefaultContent(Long contentId) throws TaskListApplicationException {
+ public TaskList getDefaultContent(Long contentId) throws TaskListException {
if (contentId == null)
{
String error=messageService.getMessage("error.msg.default.content.not.find");
log.error(error);
- throw new TaskListApplicationException(error);
+ throw new TaskListException(error);
}
TaskList defaultContent = getDefaultTaskList();
@@ -249,12 +249,12 @@
/**
* {@inheritDoc}
*/
- public void deleteFromRepository(Long fileUuid, Long fileVersionId) throws TaskListApplicationException {
+ public void deleteFromRepository(Long fileUuid, Long fileVersionId) throws TaskListException {
ITicket ticket = getRepositoryLoginTicket();
try {
repositoryService.deleteVersion(ticket, fileUuid,fileVersionId);
} catch (Exception e) {
- throw new TaskListApplicationException(
+ throw new TaskListException(
"Exception occured while deleting files from"
+ " the repository " + e.getMessage());
}
@@ -357,7 +357,7 @@
/**
* {@inheritDoc}
*/
- public String finishToolSession(Long toolSessionId, Long userId) throws TaskListApplicationException {
+ public String finishToolSession(Long toolSessionId, Long userId) throws TaskListException {
TaskListUser user = taskListUserDao.getUserByUserIDAndSessionID(userId, toolSessionId);
user.setSessionFinished(true);
taskListUserDao.saveObject(user);
@@ -370,9 +370,9 @@
try {
nextUrl = this.leaveToolSession(toolSessionId,userId);
} catch (DataMissingException e) {
- throw new TaskListApplicationException(e);
+ throw new TaskListException(e);
} catch (ToolException e) {
- throw new TaskListApplicationException(e);
+ throw new TaskListException(e);
}
return nextUrl;
}
@@ -427,11 +427,6 @@
}
}
-
-
-
-
-
/**
* {@inheritDoc}
*/
@@ -488,6 +483,13 @@
/**
* {@inheritDoc}
*/
+ public int getNumTasksCompletedByUser(Long toolSessionId, Long userUid) {
+ return getTaskListItemVisitDao().getTasksCompletedCountByUser(toolSessionId, userUid);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public TaskSummary getTaskSummary(Long contentId, Long taskListItemUid) {
TaskListItem taskListItem = taskListItemDao.getByUid(taskListItemUid);
@@ -771,7 +773,7 @@
if(toolContentObj == null) {
try {
toolContentObj = getDefaultTaskList();
- } catch (TaskListApplicationException e) {
+ } catch (TaskListException e) {
throw new DataMissingException(e.getMessage());
}
}
@@ -834,14 +836,24 @@
throw new ToolException(e);
}
}
-
- /** Get the definitions for possible output for an activity, based on the toolContentId. These may be definitions that are always
- * available for the tool (e.g. number of marks for Multiple Choice) or a custom definition created for a particular activity
- * such as the answer to the third question contains the word Koala and hence the need for the toolContentId
- * @return SortedMap of ToolOutputDefinitions with the key being the name of each definition
- */
+
+ /**
+ * Get the definitions for possible output for an activity, based on the
+ * toolContentId. These may be definitions that are always available for the
+ * tool (e.g. number of marks for Multiple Choice) or a custom definition
+ * created for a particular activity such as the answer to the third
+ * question contains the word Koala and hence the need for the toolContentId
+ *
+ * @return SortedMap of ToolOutputDefinitions with the key being the name of
+ * each definition
+ * @throws TaskListException
+ */
public SortedMap getToolOutputDefinitions(Long toolContentId) throws ToolException {
- return new TreeMap();
+ TaskList taskList = getTaskListByContentId(toolContentId);
+ if ( taskList == null ) {
+ taskList = getDefaultTaskList();
+ }
+ return getTaskListOutputFactory().getToolOutputDefinitions(taskList);
}
/**
@@ -859,7 +871,7 @@
if ( taskList == null ) {
try {
taskList = getDefaultTaskList();
- } catch (TaskListApplicationException e) {
+ } catch (TaskListException e) {
throw new ToolException(e);
}
}
@@ -980,16 +992,15 @@
* @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.util.List, java.lang.Long, java.lang.Long)
*/
public SortedMap getToolOutput(List names, Long toolSessionId, Long learnerId) {
- return new TreeMap();
+ return taskListOutputFactory.getToolOutput(names, this, toolSessionId, learnerId);
}
/**
* Get the tool output for the given tool output name.
* @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.lang.String, java.lang.Long, java.lang.Long)
*/
- public ToolOutput getToolOutput(String name, Long toolSessionId,
- Long learnerId) {
- return null;
+ public ToolOutput getToolOutput(String name, Long toolSessionId, Long learnerId) {
+ return taskListOutputFactory.getToolOutput(name, this, toolSessionId, learnerId);
}
//*******************************************************************************
@@ -1020,35 +1031,34 @@
// Private methods
//*****************************************************************************
- private TaskList getDefaultTaskList() throws TaskListApplicationException {
+ private TaskList getDefaultTaskList() throws TaskListException {
Long defaultTaskListId = getToolDefaultContentIdBySignature(TaskListConstants.TOOL_SIGNATURE);
TaskList defaultTaskList = getTaskListByContentId(defaultTaskListId);
- if(defaultTaskList == null)
- {
+ if(defaultTaskList == null) {
String error=messageService.getMessage("error.msg.default.content.not.find");
log.error(error);
- throw new TaskListApplicationException(error);
+ throw new TaskListException(error);
}
return defaultTaskList;
}
- private Long getToolDefaultContentIdBySignature(String toolSignature) throws TaskListApplicationException {
+ private Long getToolDefaultContentIdBySignature(String toolSignature) throws TaskListException {
Long contentId = null;
contentId=new Long(toolService.getToolDefaultContentIdBySignature(toolSignature));
if (contentId == null)
{
String error=messageService.getMessage("error.msg.default.content.not.find");
log.error(error);
- throw new TaskListApplicationException(error);
+ throw new TaskListException(error);
}
return contentId;
}
/**
* Process an uploaded file.
*
- * @throws TaskListApplicationException
+ * @throws TaskListException
* @throws FileNotFoundException
* @throws IOException
* @throws RepositoryCheckedException
@@ -1140,7 +1150,7 @@
* @return file node
* @throws ImscpApplicationException
*/
- private IVersionedNode getFile(Long uuid, Long versionId, String relativePath) throws TaskListApplicationException {
+ private IVersionedNode getFile(Long uuid, Long versionId, String relativePath) throws TaskListException {
ITicket tic = getRepositoryLoginTicket();
@@ -1154,7 +1164,7 @@
error = error+"AccessDeniedException: "+e.getMessage()+" Unable to retry further.";
log.error(error);
- throw new TaskListApplicationException(error,e);
+ throw new TaskListException(error,e);
} catch (Exception e) {
@@ -1163,7 +1173,7 @@
+" path " + relativePath+"."
+" Exception: "+e.getMessage();
log.error(error);
- throw new TaskListApplicationException(error,e);
+ throw new TaskListException(error,e);
}
}
@@ -1177,19 +1187,19 @@
* upload/download files from the content repository.
*
* @return ITicket The ticket for repostory access
- * @throws TaskListApplicationException
+ * @throws TaskListException
*/
- private ITicket getRepositoryLoginTicket() throws TaskListApplicationException {
+ private ITicket getRepositoryLoginTicket() throws TaskListException {
ICredentials credentials = new SimpleCredentials(taskListToolContentHandler.getRepositoryUser(), taskListToolContentHandler.getRepositoryId());
try {
ITicket ticket = repositoryService.login(credentials, taskListToolContentHandler.getRepositoryWorkspaceName());
return ticket;
} catch (AccessDeniedException ae) {
- throw new TaskListApplicationException("Access Denied to repository." + ae.getMessage());
+ throw new TaskListException("Access Denied to repository." + ae.getMessage());
} catch (WorkspaceNotFoundException we) {
- throw new TaskListApplicationException("Workspace not found." + we.getMessage());
+ throw new TaskListException("Workspace not found." + we.getMessage());
} catch (LoginException e) {
- throw new TaskListApplicationException("Login failed." + e.getMessage());
+ throw new TaskListException("Login failed." + e.getMessage());
}
}
}
Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringAction.java,v
diff -u -r1.6 -r1.7
--- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringAction.java 9 Apr 2008 08:56:31 -0000 1.6
+++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringAction.java 11 Apr 2008 06:46:38 -0000 1.7
@@ -62,7 +62,7 @@
import org.lamsfoundation.lams.tool.taskList.model.TaskListItem;
import org.lamsfoundation.lams.tool.taskList.model.TaskListUser;
import org.lamsfoundation.lams.tool.taskList.service.ITaskListService;
-import org.lamsfoundation.lams.tool.taskList.service.TaskListApplicationException;
+import org.lamsfoundation.lams.tool.taskList.service.TaskListException;
import org.lamsfoundation.lams.tool.taskList.service.UploadTaskListFileException;
import org.lamsfoundation.lams.tool.taskList.util.TaskListConditionComparator;
import org.lamsfoundation.lams.tool.taskList.util.TaskListItemComparator;
@@ -387,6 +387,24 @@
iter.remove();
}
+
+
+ //Handle taskList items
+ Set itemList = new LinkedHashSet();
+ SortedSet topics = getTaskListItemList(sessionMap);
+ iter = topics.iterator();
+ while(iter.hasNext()){
+ TaskListItem item = (TaskListItem) iter.next();
+ if(item != null){
+ //This flushs user UID info to message if this user is a new user.
+ item.setCreateBy(taskListUser);
+ itemList.add(item);
+ }
+ }
+ taskListPO.setTaskListItems(itemList);
+
+
+
//Handle taskList conditions. Also delete conditions that don't contain any taskLIstItems.
SortedSet conditionList = getTaskListConditionList(sessionMap);
SortedSet conditionListWithoutEmptyElements = new TreeSet(conditionList);
@@ -406,24 +424,40 @@
while(iter.hasNext()){
TaskListCondition condition = (TaskListCondition) iter.next();
iter.remove();
+
if(condition.getUid() != null)
service.deleteTaskListCondition(condition.getUid());
}
+
//Handle taskList items
- Set itemList = new LinkedHashSet();
- SortedSet topics = getTaskListItemList(sessionMap);
- iter = topics.iterator();
- while(iter.hasNext()){
- TaskListItem item = (TaskListItem) iter.next();
- if(item != null){
- //This flushs user UID info to message if this user is a new user.
- item.setCreateBy(taskListUser);
- itemList.add(item);
- }
+ SortedSet conditions = getTaskListConditionList(sessionMap);
+ for (TaskListCondition condition:conditions) {
+
+
+ Set itemList2 = new LinkedHashSet();
+ Set topics2 = condition.getTaskListItems();
+ iter = topics2.iterator();
+ while(iter.hasNext()){
+ TaskListItem item2 = (TaskListItem) iter.next();
+ if(item2 != null){
+ //This flushs user UID info to message if this user is a new user.
+ item2.setCreateBy(taskListUser);
+ itemList2.add(item2);
+ }
+ }
+ condition.setTaskListItems(itemList2);
+
+
}
- taskListPO.setTaskListItems(itemList);
+
+
+
+
+
+
+
// delete TaskListItems from database. This should be done after
// TaskListConditions have been deleted from the database. This is due
// to prevent errors with foreign keys.
@@ -907,7 +941,7 @@
* Extract web from content to taskList item.
* @param request
* @param itemForm
- * @throws TaskListApplicationException
+ * @throws TaskListException
*/
private void extractFormToTaskListItem(HttpServletRequest request, TaskListItemForm itemForm)
throws Exception {
Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringTaskListConditionAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringTaskListConditionAction.java,v
diff -u -r1.1 -r1.2
--- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringTaskListConditionAction.java 7 Apr 2008 07:33:31 -0000 1.1
+++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringTaskListConditionAction.java 11 Apr 2008 06:46:38 -0000 1.2
@@ -53,7 +53,7 @@
import org.lamsfoundation.lams.tool.taskList.model.TaskListCondition;
import org.lamsfoundation.lams.tool.taskList.model.TaskListItem;
import org.lamsfoundation.lams.tool.taskList.service.ITaskListService;
-import org.lamsfoundation.lams.tool.taskList.service.TaskListApplicationException;
+import org.lamsfoundation.lams.tool.taskList.service.TaskListException;
import org.lamsfoundation.lams.tool.taskList.util.TaskListConditionComparator;
import org.lamsfoundation.lams.tool.taskList.util.TaskListItemComparator;
import org.lamsfoundation.lams.tool.taskList.web.form.TaskListConditionForm;
@@ -435,7 +435,7 @@
* Extract form content to taskListContent.
* @param request
* @param form
- * @throws TaskListApplicationException
+ * @throws TaskListException
*/
private void extractFormToTaskListCondition(HttpServletRequest request, TaskListConditionForm form) throws Exception {
/* BE CAREFUL: This method will copy necessary info from request form to a old or new TaskListItem instance.
Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java,v
diff -u -r1.4 -r1.5
--- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java 28 Mar 2008 02:21:27 -0000 1.4
+++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java 11 Apr 2008 06:46:38 -0000 1.5
@@ -58,7 +58,7 @@
import org.lamsfoundation.lams.tool.taskList.model.TaskListSession;
import org.lamsfoundation.lams.tool.taskList.model.TaskListUser;
import org.lamsfoundation.lams.tool.taskList.service.ITaskListService;
-import org.lamsfoundation.lams.tool.taskList.service.TaskListApplicationException;
+import org.lamsfoundation.lams.tool.taskList.service.TaskListException;
import org.lamsfoundation.lams.tool.taskList.util.TaskListItemComparator;
import org.lamsfoundation.lams.tool.taskList.web.form.ReflectionForm;
import org.lamsfoundation.lams.tool.taskList.web.form.TaskListItemForm;
@@ -291,7 +291,7 @@
nextActivityUrl = service.finishToolSession(sessionId,userID);
request.setAttribute(TaskListConstants.ATTR_NEXT_ACTIVITY_URL,nextActivityUrl);
- } catch (TaskListApplicationException e) {
+ } catch (TaskListException e) {
log.error("Failed get next activity url:" + e.getMessage());
}
Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/servlet/ExportServlet.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/servlet/ExportServlet.java,v
diff -u -r1.5 -r1.6
--- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/servlet/ExportServlet.java 10 Apr 2008 07:51:58 -0000 1.5
+++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/servlet/ExportServlet.java 11 Apr 2008 06:46:38 -0000 1.6
@@ -49,7 +49,7 @@
import org.lamsfoundation.lams.tool.taskList.model.TaskListSession;
import org.lamsfoundation.lams.tool.taskList.model.TaskListUser;
import org.lamsfoundation.lams.tool.taskList.service.ITaskListService;
-import org.lamsfoundation.lams.tool.taskList.service.TaskListApplicationException;
+import org.lamsfoundation.lams.tool.taskList.service.TaskListException;
import org.lamsfoundation.lams.tool.taskList.service.TaskListServiceProxy;
import org.lamsfoundation.lams.tool.taskList.util.TaskListToolContentHandler;
import org.lamsfoundation.lams.util.FileUtil;
@@ -92,7 +92,7 @@
sessionMap.put(AttributeNames.ATTR_MODE,ToolAccessMode.TEACHER);
teacher(request, response, directoryName, cookies,sessionMap);
}
- } catch (TaskListApplicationException e) {
+ } catch (TaskListException e) {
logger.error("Cannot perform export for taskList tool.");
}
@@ -135,33 +135,33 @@
* @param directoryName
* @param cookies
* @param sessionMap
- * @throws TaskListApplicationException
+ * @throws TaskListException
* @throws IOException
*/
- private void learner(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies, HashMap sessionMap) throws TaskListApplicationException{
+ private void learner(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies, HashMap sessionMap) throws TaskListException{
ITaskListService service = TaskListServiceProxy.getTaskListService(getServletContext());
if (userID == null || toolSessionID == null) {
String error = "Tool session Id or user Id is null. Unable to continue";
logger.error(error);
- throw new TaskListApplicationException(error);
+ throw new TaskListException(error);
}
TaskListUser learner = service.getUserByIDAndSession(userID,toolSessionID);
if (learner == null) {
String error = "The user with user id " + userID + " does not exist.";
logger.error(error);
- throw new TaskListApplicationException(error);
+ throw new TaskListException(error);
}
TaskList content = service.getTaskListBySessionId(toolSessionID);
if (content == null) {
String error = "The content for this activity has not been defined yet.";
logger.error(error);
- throw new TaskListApplicationException(error);
+ throw new TaskListException(error);
}
List taskSummaries = service.exportForLearner(toolSessionID, learner);
@@ -180,25 +180,25 @@
* @param directoryName
* @param cookies
* @param sessionMap
- * @throws TaskListApplicationException
+ * @throws TaskListException
* @throws IOException
*/
- private void teacher(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies, HashMap sessionMap) throws TaskListApplicationException {
+ private void teacher(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies, HashMap sessionMap) throws TaskListException {
ITaskListService service = TaskListServiceProxy.getTaskListService(getServletContext());
// check if toolContentId exists in db or not
if (toolContentID == null) {
String error = "Tool Content Id is missing. Unable to continue";
logger.error(error);
- throw new TaskListApplicationException(error);
+ throw new TaskListException(error);
}
TaskList content = service.getTaskListByContentId(toolContentID);
if (content == null) {
String error = "Data is missing from the database. Unable to Continue";
logger.error(error);
- throw new TaskListApplicationException(error);
+ throw new TaskListException(error);
}
List taskSummaries = service.exportForTeacher(toolContentID);