+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: lams_tool_forum/build.properties
===================================================================
diff -u -rc081e2b0c9c82fc97d2d39fb7109c9c2f10ff224 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_forum/build.properties (.../build.properties) (revision c081e2b0c9c82fc97d2d39fb7109c9c2f10ff224)
+++ lams_tool_forum/build.properties (.../build.properties) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -9,7 +9,7 @@
### project properties ###
signature=lafrum11
project.displayname = lams forum tool
-tool.version=20081022
+tool.version=20081118
# hide tool option
hideTool=false
Index: lams_tool_forum/conf/xdoclet/struts-actions.xml
===================================================================
diff -u -rc081e2b0c9c82fc97d2d39fb7109c9c2f10ff224 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_forum/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision c081e2b0c9c82fc97d2d39fb7109c9c2f10ff224)
+++ lams_tool_forum/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -124,6 +124,33 @@
scope="request">
+
+
+
+
+
+
+
+
+
+
+
+ newTopics = new LinkedList();
+ Iterator forumTopicIterator = forum.getMessages().iterator();
+ do {
+ topic = plannerForm.getTopic(topicIndex);
+ if (StringUtils.isEmpty(topic)) {
+ plannerForm.removeTopic(topicIndex);
+ } else {
+ if (forumTopicIterator.hasNext()) {
+ message = forumTopicIterator.next();
+ message.setUpdated(new Date());
+ message.setSubject(topic);
+ } else {
+ message = new Message();
+ message.setIsAuthored(true);
+ Date currentDate = new Date();
+ message.setCreated(currentDate);
+ message.setUpdated(currentDate);
+ message.setLastReplyDate(currentDate);
+
+ HttpSession ss = SessionManager.getSession();
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ ForumUser forumUser = getForumManager().getUserByID(new Long(user.getUserID().intValue()));
+ message.setCreatedBy(forumUser);
+ message.setModifiedBy(forumUser);
+
+ message.setSubject(topic);
+
+ newTopics.add(message);
+ message.setForum(forum);
+ getForumManager().createRootTopic(forum.getUid(), null, message);
+ }
+ topicIndex++;
+ }
+
+ } while (topic != null);
+ while (forumTopicIterator.hasNext()) {
+ message = forumTopicIterator.next();
+ forumTopicIterator.remove();
+ getForumManager().deleteTopic(message.getUid());
+ }
+ forum.getMessages().addAll(newTopics);
+ getForumManager().updateForum(forum);
+ } else {
+ saveErrors(request, errors);
+ }
+ return mapping.findForward("success");
+ }
+
+ public ActionForward createPedagogicalPlannerTopic(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException,
+ PersistenceException {
+ ForumPedagogicalPlannerForm plannerForm = (ForumPedagogicalPlannerForm) form;
+ plannerForm.setTopic(plannerForm.getTopicCount().intValue(), "");
+ return mapping.findForward("success");
+ }
}
Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/ForumPedagogicalPlannerForm.java
===================================================================
diff -u
--- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/ForumPedagogicalPlannerForm.java (revision 0)
+++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/ForumPedagogicalPlannerForm.java (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -0,0 +1,110 @@
+/****************************************************************
+ * 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 version 2.0
+ * 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$ */
+package org.lamsfoundation.lams.tool.forum.web.forms;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.lamsfoundation.lams.tool.forum.persistence.Forum;
+import org.lamsfoundation.lams.tool.forum.persistence.Message;
+import org.lamsfoundation.lams.web.planner.PedagogicalPlannerForm;
+
+/**
+ * @struts.form name="pedagogicalPlannerForm"
+ */
+public class ForumPedagogicalPlannerForm extends PedagogicalPlannerForm {
+ private List topic;
+
+ @Override
+ public ActionMessages validate() {
+ ActionMessages errors = new ActionMessages();
+ boolean valid = true;
+ boolean allEmpty = true;
+ if (topic != null && !topic.isEmpty()) {
+ for (String item : topic) {
+ if (!StringUtils.isEmpty(item)) {
+ allEmpty = false;
+ break;
+ }
+ }
+ }
+ if (allEmpty) {
+ ActionMessage error = new ActionMessage("error.must.have.topic");
+ errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ valid = false;
+ topic = null;
+ }
+
+ setValid(valid);
+ return errors;
+ }
+
+ public void fillForm(Forum forum) {
+ if (forum != null) {
+ setToolContentID(forum.getContentId());
+
+ topic = new ArrayList();
+ Set messages = forum.getMessages();
+ if (messages != null) {
+ int topicIndex = 0;
+ for (Message message : (Set) messages) {
+ setTopic(topicIndex++, message.getSubject());
+ }
+ }
+ }
+ }
+
+ public void setTopic(int number, String Topics) {
+ if (topic == null) {
+ topic = new ArrayList();
+ }
+ while (number >= topic.size()) {
+ topic.add(null);
+ }
+ topic.set(number, Topics);
+ }
+
+ public String getTopic(int number) {
+ if (topic == null || number >= topic.size()) {
+ return null;
+ }
+ return topic.get(number);
+ }
+
+ public Integer getTopicCount() {
+ return topic == null ? 0 : topic.size();
+ }
+
+ public boolean removeTopic(int number) {
+ if (topic == null || number >= topic.size()) {
+ return false;
+ }
+ topic.remove(number);
+ return true;
+ }
+}
\ No newline at end of file
Index: lams_tool_forum/web/WEB-INF/struts-config.xml
===================================================================
diff -u -rc081e2b0c9c82fc97d2d39fb7109c9c2f10ff224 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_forum/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision c081e2b0c9c82fc97d2d39fb7109c9c2f10ff224)
+++ lams_tool_forum/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -26,6 +26,10 @@
type="org.lamsfoundation.lams.tool.forum.web.forms.MarkForm"
/>
+
@@ -170,6 +174,30 @@
scope="request">
+
+
+
+
+
+
+
+
+
+
+<%@ include file="/common/taglibs.jsp"%>
+
+
+
+
+
+
+
+
+
+
+
+
+ <%@ include file="/common/messages.jsp"%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: lams_tool_lamc/build.properties
===================================================================
diff -u -r89837538d45d0f73f6c1f22ccbcebbdedb706f8d -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_lamc/build.properties (.../build.properties) (revision 89837538d45d0f73f6c1f22ccbcebbdedb706f8d)
+++ lams_tool_lamc/build.properties (.../build.properties) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -4,7 +4,7 @@
signature=lamc11
#version of this project
-tool.version=20070820
+tool.version=20081127
# hide tool option
hideTool=false
Index: lams_tool_lamc/conf/hibernate/mappings/org/lamsfoundation/lams/tool/mc/McQueContent.hbm.xml
===================================================================
diff -u -r771dd93b9ea84cec2b55db5c66a5d187da0874c0 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_lamc/conf/hibernate/mappings/org/lamsfoundation/lams/tool/mc/McQueContent.hbm.xml (.../McQueContent.hbm.xml) (revision 771dd93b9ea84cec2b55db5c66a5d187da0874c0)
+++ lams_tool_lamc/conf/hibernate/mappings/org/lamsfoundation/lams/tool/mc/McQueContent.hbm.xml (.../McQueContent.hbm.xml) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -88,6 +88,7 @@
lazy="true"
inverse="true"
cascade="all-delete-orphan"
+ order-by="displayOrder"
>
Index: lams_tool_lamc/conf/language/lams/ApplicationResources.properties
===================================================================
diff -u -rfbbc8abd933da6ee584c8a4fd777f9834aee92e3 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_lamc/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision fbbc8abd933da6ee584c8a4fd777f9834aee92e3)
+++ lams_tool_lamc/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -261,5 +261,6 @@
error.content.inUse =modification of the content is not allowed since one or more learners has attempted the activity.
error.noStudentActivity =Sorry, the report can not be generated. No learner has attempted the activity yet.
+error.pedagogical.planner.empty.answer.selected=In question {0} correct answer cannot be blank.
#======= End labels: Exported 254 labels for en AU =====
Index: lams_tool_lamc/conf/language/lams/ApplicationResources_en_AU.properties
===================================================================
diff -u -rfbbc8abd933da6ee584c8a4fd777f9834aee92e3 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_lamc/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision fbbc8abd933da6ee584c8a4fd777f9834aee92e3)
+++ lams_tool_lamc/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -261,5 +261,5 @@
error.content.inUse =modification of the content is not allowed since one or more learners has attempted the activity.
error.noStudentActivity =Sorry, the report can not be generated. No learner has attempted the activity yet.
-
+error.pedagogical.planner.empty.answer.selected=In question {0} correct answer cannot be blank.
#======= End labels: Exported 254 labels for en AU =====
Index: lams_tool_lamc/db/sql/tool_insert.sql
===================================================================
diff -u -r1dbf40946efb1324c987cccf44c18ad5559cdc53 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_lamc/db/sql/tool_insert.sql (.../tool_insert.sql) (revision 1dbf40946efb1324c987cccf44c18ad5559cdc53)
+++ lams_tool_lamc/db/sql/tool_insert.sql (.../tool_insert.sql) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -23,6 +23,7 @@
export_pfolio_class_url,
contribute_url,
moderation_url,
+pedagogical_planner_url,
help_url,
language_file,
classpath_addition,
@@ -54,6 +55,7 @@
'tool/lamc11/exportPortfolio?mode=teacher',
'tool/lamc11/monitoringStarter.do',
'tool/lamc11/monitoringStarter.do',
+'tool/lamc11/pedagogicalPlanner.do',
'http://wiki.lamsfoundation.org/display/lamsdocs/lamc11',
'org.lamsfoundation.lams.tool.mc.ApplicationResources',
'lams-tool-lamc11.jar',
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java
===================================================================
diff -u -r7e6ebfd5557305fbb05f12d799297e25c2d02084 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision 7e6ebfd5557305fbb05f12d799297e25c2d02084)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -23,354 +23,351 @@
package org.lamsfoundation.lams.tool.mc;
/**
- * @author Ozgur Demirtas
- * Defines constants used throughout the application
+ * @author Ozgur Demirtas Defines constants used throughout the application
*/
public interface McAppConstants {
- public static final String MY_SIGNATURE ="lamc11";
- public static final String DEFAULT_CONTENT_ID ="defaultContentId";
- public static final String TOOL_SERVICE ="tool_service";
- public static final String ERROR_MCAPPLICATION = "error.exception.McApplication";
-
- /*
+ public static final String MY_SIGNATURE = "lamc11";
+ public static final String DEFAULT_CONTENT_ID = "defaultContentId";
+ public static final String TOOL_SERVICE = "tool_service";
+ public static final String ERROR_MCAPPLICATION = "error.exception.McApplication";
+
+ /*
* Struts level constants
*/
- public static final String LOAD ="load";
- public static final String LOAD_QUESTIONS ="load";
- public static final String LOAD_STARTER ="starter";
- public static final String AUTHORING_STARTER ="starter";
- public static final String LEARNING_STARTER ="learningStarter";
- public static final String MONITORING_STARTER ="monitoringStarter";
- public static final String LOAD_LEARNER ="loadLearner";
- public static final String LOAD_MONITORING_CONTENT ="loadMonitoring";
- public static final String LOAD_MONITORING ="refreshMonitoring";
- public static final String LOAD_MONITORING_CONTENT_EDITACTIVITY ="loadMonitoringEditActivity";
- public static final String LIST_ALL_GROUPS_DTO ="listAllGroupsDTO";
- public static final String EXPORT_PORTFOLIO = "exportPortfolio";
- public static final String INDIVIDUAL_REPORT ="individualReport";
- public static final String VIEW_SUMMARY ="viewSummary";
- public static final String REDO_QUESTIONS ="redoQuestions";
- public static final String SINGLE_QUESTION_ANSWERS ="singleQuestionAnswers";
- public static final String RESULTS_SUMMARY ="resultsSummary";
- public static final String ERROR_LIST ="errorList";
- public static final String PREVIEW ="preview";
- public static final String LEARNER_PROGRESS ="learnerProgress";
- public static final String LEARNER_PROGRESS_USERID ="learnerProgressUserId";
- public static final String ATTACHMENT_LIST_KEY = "attachmentListKey";
- public static final String DELETED_ATTACHMENT_LIST_KEY = "deletedAttachmentListKey";
- public static final String ACTIVITY_TITLE_KEY = "activityTitleKey";
- public static final String ACTIVITY_INSTRUCTIONS_KEY = "activityInstructionsKey";
- public static final String LIST_QUESTION_CONTENT_DTO = "listQuestionContentDTO";
- public static final String LIST_QUESTION_CONTENT_DTO_KEY = "listQuestionContentDTOKey";
- public static final String DEFAULT_ONLINE_INST ="";
- public static final String DEFAULT_OFFLINE_INST ="";
- public static final String ONLINE_INSTRUCTIONS_KEY = "onlineInstructionsKey";
- public static final String OFFLINE_INSTRUCTIONS_KEY = "offlineInstructionsKey";
- public static final String MAP_QUESTION_CONTENT_KEY = "mapQuestionContentKey";
- public static final String LOAD_VIEW_ONLY ="loadViewOnly";
- public static final String MC_GENERAL_AUTHORING_DTO ="mcGeneralAuthoringDTO";
- public static final String DEFAULT_CONTENT_ID_STR ="defaultContentIdStr";
- public static final String LIST_ADD_QUESTION_CONTENT_DTO_KEY ="listAddQuestionContentDtoKey";
- public static final String NEW_QUESTION_CONTENT_DTO ="newQuestionContentDTO";
- public static final Integer MAX_QUESTION_COUNT =new Integer(50);
- public static final String ONLINE_INSTRUCTIONS ="onlineInstructions";
- public static final String OFFLINE_INSTRUCTIONS ="offlineInstructions";
- public static final String UUID ="uuid";
- public static final String EDIT_ACTIVITY_DTO ="editActivityDTO";
- public static final String LIST_CANDIDATE_ANSWERS_DTO ="listCandidateAnswersDTO";
- public static final String CURRENT_EDITABLE_QUESTION_INDEX ="currentEditableQuestionIndex";
- public static final String MC_GENERAL_MONITORING_DTO ="mcGeneralMonitoringDTO";
- public static final String NOTEBOOK_ENTRIES_EXIST ="notebookEntriesExist";
- public static final String NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST ="noSessionsNotebookEntriesExist";
- public static final String MONITORING ="monitoring";
- public static final String RESPONSE_ID ="responseId";
- public static final String CURRENT_UID ="currentUid";
- public static final String NEW_QUESTION_BOX_DTO ="newQuestionBoxDTO";
- public static final String NEW_QUESTION_BOX_DTO_KEY ="newQuestionBoxDTOKey";
- public static final String PASSMARK_MAP ="passmarkMap";
- public static final String NEW_ADDABLE_QUESTION_CONTENT ="newAddableQuestionContent";
- public static final String NEW_ADDABLE_QUESTION_CONTENT_KEY ="newAddableQuestionContentKey";
- public static final String NEW_ADDABLE_QUESTION_CONTENT_LIST ="newAddableQuestionContentList";
- public static final String TOTAL_MARKS_POSSIBLE ="totalMarksPossible";
-
+ public static final String LOAD = "load";
+ public static final String LOAD_QUESTIONS = "load";
+ public static final String LOAD_STARTER = "starter";
+ public static final String AUTHORING_STARTER = "starter";
+ public static final String LEARNING_STARTER = "learningStarter";
+ public static final String MONITORING_STARTER = "monitoringStarter";
+ public static final String LOAD_LEARNER = "loadLearner";
+ public static final String LOAD_MONITORING_CONTENT = "loadMonitoring";
+ public static final String LOAD_MONITORING = "refreshMonitoring";
+ public static final String LOAD_MONITORING_CONTENT_EDITACTIVITY = "loadMonitoringEditActivity";
+ public static final String LIST_ALL_GROUPS_DTO = "listAllGroupsDTO";
+ public static final String EXPORT_PORTFOLIO = "exportPortfolio";
+ public static final String INDIVIDUAL_REPORT = "individualReport";
+ public static final String VIEW_SUMMARY = "viewSummary";
+ public static final String REDO_QUESTIONS = "redoQuestions";
+ public static final String SINGLE_QUESTION_ANSWERS = "singleQuestionAnswers";
+ public static final String RESULTS_SUMMARY = "resultsSummary";
+ public static final String ERROR_LIST = "errorList";
+ public static final String PREVIEW = "preview";
+ public static final String LEARNER_PROGRESS = "learnerProgress";
+ public static final String LEARNER_PROGRESS_USERID = "learnerProgressUserId";
+ public static final String ATTACHMENT_LIST_KEY = "attachmentListKey";
+ public static final String DELETED_ATTACHMENT_LIST_KEY = "deletedAttachmentListKey";
+ public static final String ACTIVITY_TITLE_KEY = "activityTitleKey";
+ public static final String ACTIVITY_INSTRUCTIONS_KEY = "activityInstructionsKey";
+ public static final String LIST_QUESTION_CONTENT_DTO = "listQuestionContentDTO";
+ public static final String LIST_QUESTION_CONTENT_DTO_KEY = "listQuestionContentDTOKey";
+ public static final String DEFAULT_ONLINE_INST = "";
+ public static final String DEFAULT_OFFLINE_INST = "";
+ public static final String ONLINE_INSTRUCTIONS_KEY = "onlineInstructionsKey";
+ public static final String OFFLINE_INSTRUCTIONS_KEY = "offlineInstructionsKey";
+ public static final String MAP_QUESTION_CONTENT_KEY = "mapQuestionContentKey";
+ public static final String LOAD_VIEW_ONLY = "loadViewOnly";
+ public static final String MC_GENERAL_AUTHORING_DTO = "mcGeneralAuthoringDTO";
+ public static final String DEFAULT_CONTENT_ID_STR = "defaultContentIdStr";
+ public static final String LIST_ADD_QUESTION_CONTENT_DTO_KEY = "listAddQuestionContentDtoKey";
+ public static final String NEW_QUESTION_CONTENT_DTO = "newQuestionContentDTO";
+ public static final Integer MAX_QUESTION_COUNT = new Integer(50);
+ public static final String ONLINE_INSTRUCTIONS = "onlineInstructions";
+ public static final String OFFLINE_INSTRUCTIONS = "offlineInstructions";
+ public static final String UUID = "uuid";
+ public static final String EDIT_ACTIVITY_DTO = "editActivityDTO";
+ public static final String LIST_CANDIDATE_ANSWERS_DTO = "listCandidateAnswersDTO";
+ public static final String CURRENT_EDITABLE_QUESTION_INDEX = "currentEditableQuestionIndex";
+ public static final String MC_GENERAL_MONITORING_DTO = "mcGeneralMonitoringDTO";
+ public static final String NOTEBOOK_ENTRIES_EXIST = "notebookEntriesExist";
+ public static final String NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST = "noSessionsNotebookEntriesExist";
+ public static final String MONITORING = "monitoring";
+ public static final String RESPONSE_ID = "responseId";
+ public static final String CURRENT_UID = "currentUid";
+ public static final String NEW_QUESTION_BOX_DTO = "newQuestionBoxDTO";
+ public static final String NEW_QUESTION_BOX_DTO_KEY = "newQuestionBoxDTOKey";
+ public static final String PASSMARK_MAP = "passmarkMap";
+ public static final String NEW_ADDABLE_QUESTION_CONTENT = "newAddableQuestionContent";
+ public static final String NEW_ADDABLE_QUESTION_CONTENT_KEY = "newAddableQuestionContentKey";
+ public static final String NEW_ADDABLE_QUESTION_CONTENT_LIST = "newAddableQuestionContentList";
+ public static final String TOTAL_MARKS_POSSIBLE = "totalMarksPossible";
- public static final String AUTHORING ="authoring";
- public static final String SOURCE_MC_STARTER ="sourceMcStarter";
- public static final String TARGET_MODE_AUTHORING ="Authoring";
- public static final String AUTHORING_CANCELLED ="authoringCancelled";
- public static final String DEFINE_LATER_EDIT_ACTIVITY ="defineLaterEditActivity";
- public static final String ACTIVE_MODULE ="activeModule";
- public static final String EDIT_OPTIONS_MODE ="editOptionsMode";
- public static final String DEFINE_LATER_IN_EDIT_MODE ="defineLaterInEditMode";
- public static final String SUBMIT_SUCCESS ="sbmtSuccess";
- public static final String QUESTION_INDEX ="questionIndex";
- public static final String REFLECTION_SUBJECT ="reflectionSubject";
- public static final String REFLECTIONS_CONTAINER_DTO ="reflectionsContainerDTO";
- public static final String LEARNER_NOTEBOOK ="learnerNotebook";
-
+ public static final String AUTHORING = "authoring";
+ public static final String SOURCE_MC_STARTER = "sourceMcStarter";
+ public static final String TARGET_MODE_AUTHORING = "Authoring";
+ public static final String AUTHORING_CANCELLED = "authoringCancelled";
+ public static final String DEFINE_LATER_EDIT_ACTIVITY = "defineLaterEditActivity";
+ public static final String ACTIVE_MODULE = "activeModule";
+ public static final String EDIT_OPTIONS_MODE = "editOptionsMode";
+ public static final String DEFINE_LATER_IN_EDIT_MODE = "defineLaterInEditMode";
+ public static final String SUBMIT_SUCCESS = "sbmtSuccess";
+ public static final String QUESTION_INDEX = "questionIndex";
+ public static final String REFLECTION_SUBJECT = "reflectionSubject";
+ public static final String REFLECTIONS_CONTAINER_DTO = "reflectionsContainerDTO";
+ public static final String LEARNER_NOTEBOOK = "learnerNotebook";
+
/*
* authoring mode controllers
- */
- public static final String IS_ADD_QUESTION ="isAddQuestion";
- public static final String IS_REMOVE_QUESTION ="isRemoveQuestion";
- public static final String IS_REMOVE_CONTENT ="isRemoveContent";
- public static final String IS_REVISITING_USER ="isRevisitingUser";
-
- public static final String USER = "user";
- public static final String TOOL_CONTENT_ID = "toolContentID";
- public static final String TOOL_CONTENT_UID = "toolContentUID";
- public static final String TOOL_SESSION_ID = "toolSessionID";
- public static final String USER_ID = "userID";
- public static final String MAX_QUESTION_INDEX = "maxQuestionIndex";
- public static final String COPY_TOOL_CONTENT = "copyToolContent";
- public static final String REMOVE_TOOL_CONTENT = "removeToolContent";
- public static final String SIMPLE_LEARNING_ERROR = "simpleLearningError";
-
- public static final String DEFAULT_MCQ_TITLE = "MCQ";
- public static final String DEFAULT_MCQ_INSTRUCTIONS = "Instructions";
-
+ */
+ public static final String IS_ADD_QUESTION = "isAddQuestion";
+ public static final String IS_REMOVE_QUESTION = "isRemoveQuestion";
+ public static final String IS_REMOVE_CONTENT = "isRemoveContent";
+ public static final String IS_REVISITING_USER = "isRevisitingUser";
+
+ public static final String USER = "user";
+ public static final String TOOL_CONTENT_ID = "toolContentID";
+ public static final String TOOL_CONTENT_UID = "toolContentUID";
+ public static final String TOOL_SESSION_ID = "toolSessionID";
+ public static final String USER_ID = "userID";
+ public static final String MAX_QUESTION_INDEX = "maxQuestionIndex";
+ public static final String COPY_TOOL_CONTENT = "copyToolContent";
+ public static final String REMOVE_TOOL_CONTENT = "removeToolContent";
+ public static final String SIMPLE_LEARNING_ERROR = "simpleLearningError";
+
+ public static final String DEFAULT_MCQ_TITLE = "MCQ";
+ public static final String DEFAULT_MCQ_INSTRUCTIONS = "Instructions";
+
/*
* refers to number of questions presented initially, we have a single record for default content
*/
- public static final Long INITIAL_QUESTION_COUNT =new Long(1);
- public static final int MAX_OPTION_COUNT =25;
- public static final int MAX_ATTEMPT_HISTORY =30;
- public static final String QUESTION_AND_CANDIDATE_ANSWERS_KEY ="questionAndCandidateAnswersKey";
-
-
-
+ public static final Long INITIAL_QUESTION_COUNT = new Long(1);
+ public static final int MAX_OPTION_COUNT = 25;
+ public static final int MAX_ATTEMPT_HISTORY = 30;
+ public static final String QUESTION_AND_CANDIDATE_ANSWERS_KEY = "questionAndCandidateAnswersKey";
+
/*
* authoring mode constants
*/
- public static final String MAP_QUESTIONS_CONTENT ="mapQuestionsContent";
- public static final String MAP_OPTIONS_CONTENT ="mapOptionsContent";
- public static final String MAP_DEFAULTOPTIONS_CONTENT ="mapDefaultOptionsContent";
- public static final String MAP_DEFAULTSELECTEDOPTIONS_CONTENT ="mapDefaultSelectedOptionsContent";
- public static final String MAP_DISABLED_QUESTIONS ="mapDisabledQuestions";
- public static final String MAP_GENERAL_OPTIONS_CONTENT ="mapGeneralOptionsContent";
- public static final String MAP_GENERAL_SELECTED_OPTIONS_CONTENT ="mapGeneralSelectedOptionsContent";
- public static final String MAP_STARTUP_GENERAL_OPTIONS_CONTENT ="mapStartupGeneralOptionsContent";
- public static final String MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT ="mapStartupGeneralSelectedOptionsContent";
- public static final String MAP_STARTUP_GENERAL_OPTIONS_QUEID ="mapStartupGeneralOptionsQueId";
- public static final String QUESTIONS_WITHNO_OPTIONS ="questionsWithNoOptions";
-
- public static final String MAP_GENERAL_CHECKED_OPTIONS_CONTENT ="mapGeneralCheckedOptionsContent";
- public static final String MAP_LEARNER_QUESTIONS_CONTENT ="mapLearnerQuestionsContent";
- public static final String MAP_LEARNER_CHECKED_OPTIONS_CONTENT ="mapLearnerCheckedOptionsContent";
- public static final String MAP_LEARNER_ASSESSMENT_RESULTS ="mapLearnerAssessmentResults";
- public static final String MAP_LEARNER_FEEDBACK_INCORRECT ="mapLeanerFeedbackIncorrect";
- public static final String MAP_LEARNER_FEEDBACK_CORRECT ="mapLeanerFeedbackCorrect";
- public static final String MAP_QUESTION_WEIGHTS ="mapQuestionWeights";
- public static final String MAP_QUE_ATTEMPTS ="mapQueAttempts";
- public static final String MAP_QUE_CORRECT_ATTEMPTS ="mapQueCorrectAttempts";
- public static final String MAP_QUE_INCORRECT_ATTEMPTS ="mapQueIncorrectAttempts";
- public static final String MAP_RESPONSES ="mapResponses";
-
-
- public static final String MAP_WEIGHTS ="mapWeights";
- public static final String MAP_CHECKBOX_STATES ="mapCheckBoxStates";
- public static final String MAP_SELECTED_OPTIONS ="mapSelectedOptions";
-
- public static final String DEFAULT_FIRST_OPTION ="Candidate Answer 1";
- public static final String DEFAULT_SELECTED_OPTION ="Candidate Answer 2";
- public static final String MAP_FEEDBACK_INCORRECT ="mapFeedbackIncorrect";
- public static final String MAP_INCORRECT_FEEDBACK ="mapIncorrectFeedback";
-
- public static final String MAP_INCORRECT_FEEDBACK_LEARNER ="mapIncorrectFeedbackLearner";
- public static final String MAP_CORRECT_FEEDBACK_LEARNER ="mapCorrectFeedbackLearner";
- public static final String MAP_CORRECT_FEEDBACK ="mapCorrectFeedback";
- public static final String MAP_FEEDBACK_CORRECT ="mapFeedbackCorrect";
- public static final String IS_PORTFOLIO_EXPORT ="isPortfolioExport";
- public static final String PORTFOLIO_EXPORT_MODE ="portfolioExportMode";
- public static final String PORTFOLIO_EXPORT_DATA_FILENAME ="portfolioExportDataFileName";
-
- public static final String SELECTED_QUESTION ="selectedQuestion";
- public static final String SELECTED_QUESTION_INDEX ="selectedQuestionIndex";
- public static final String DEFAULT_QUESTION_UID ="defaultQuestionUid";
-
- public static final String DEFAULT_FEEDBACK_INCORRECT ="Your answer is incorrect";
- public static final String DEFAULT_FEEDBACK_CORRECT ="Correct";
-
- public static final String TITLE ="title";
- public static final String INSTRUCTIONS ="instructions";
- public static final String CREATION_DATE ="creationDate";
- public static final String DEFINE_LATER ="defineLater";
- public static final String RUN_OFFLINE ="runOffline";
- public static final String RETRIES ="retries";
- public static final String PASSMARK ="passMark";
- public static final String VIEW_ANSWERS ="viewAnswers";
- public static final String SHOW_AUTHORING_TABS ="showAuthoringTabs";
- public static final String REQUEST_BY_STARTER ="requestByStarter";
-
- public static final String ON ="ON";
- public static final String OFF ="OFF";
- public static final String RICHTEXT_FEEDBACK_CORRECT ="richTextFeedbackCorrect";
- public static final String RICHTEXT_INCORRECT_FEEDBACK ="richTextIncorrectFeedback";
- public static final String RICHTEXT_CORRECT_FEEDBACK ="richTextCorrectFeedback";
- public static final String RICHTEXT_FEEDBACK_INCORRECT ="richTextFeedbackInCorrect";
- public static final String RICHTEXT_OFFLINEINSTRUCTIONS ="richTextOfflineInstructions";
- public static final String RICHTEXT_ONLINEINSTRUCTIONS ="richTextOnlineInstructions";
- public static final String RICHTEXT_REPORT_TITLE ="richTextReportTitle";
- //public static final String RICHTEXT_END_LEARNING_MSG ="richTextEndLearningMsg";
- public static final String RICHTEXT_TITLE ="richTextTitle";
- public static final String RICHTEXT_INSTRUCTIONS ="richTextInstructions";
- public static final String RICHTEXT_BLANK ="
";
- public static final String SUBMIT_OFFLINE_FILE ="submitOfflineFile";
- public static final String SUBMIT_ONLINE_FILE ="submitOnlineFile";
- public static final String LIST_UPLOADED_OFFLINE_FILENAMES ="listUploadedOfflineFileNames";
- public static final String LIST_UPLOADED_ONLINE_FILENAMES ="listUploadedOnlineFileNames";
- public static final String LIST_OFFLINEFILES_METADATA ="listOfflineFilesMetadata";
- public static final String LIST_ONLINEFILES_METADATA ="listOnlineFilesMetadata";
-
- public static final String COUNT_SESSION_COMPLETE ="countSessionComplete";
- public static final String COUNT_ALL_USERS ="countAllUsers";
- public static final String COUNT_MAX_ATTEMPT ="countMaxAttempt";
- public static final String TOP_MARK ="topMark";
- public static final String LOWEST_MARK ="lowestMark";
- public static final String AVERAGE_MARK ="averageMark";
+ public static final String MAP_QUESTIONS_CONTENT = "mapQuestionsContent";
+ public static final String MAP_OPTIONS_CONTENT = "mapOptionsContent";
+ public static final String MAP_DEFAULTOPTIONS_CONTENT = "mapDefaultOptionsContent";
+ public static final String MAP_DEFAULTSELECTEDOPTIONS_CONTENT = "mapDefaultSelectedOptionsContent";
+ public static final String MAP_DISABLED_QUESTIONS = "mapDisabledQuestions";
+ public static final String MAP_GENERAL_OPTIONS_CONTENT = "mapGeneralOptionsContent";
+ public static final String MAP_GENERAL_SELECTED_OPTIONS_CONTENT = "mapGeneralSelectedOptionsContent";
+ public static final String MAP_STARTUP_GENERAL_OPTIONS_CONTENT = "mapStartupGeneralOptionsContent";
+ public static final String MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT = "mapStartupGeneralSelectedOptionsContent";
+ public static final String MAP_STARTUP_GENERAL_OPTIONS_QUEID = "mapStartupGeneralOptionsQueId";
+ public static final String QUESTIONS_WITHNO_OPTIONS = "questionsWithNoOptions";
-
+ public static final String MAP_GENERAL_CHECKED_OPTIONS_CONTENT = "mapGeneralCheckedOptionsContent";
+ public static final String MAP_LEARNER_QUESTIONS_CONTENT = "mapLearnerQuestionsContent";
+ public static final String MAP_LEARNER_CHECKED_OPTIONS_CONTENT = "mapLearnerCheckedOptionsContent";
+ public static final String MAP_LEARNER_ASSESSMENT_RESULTS = "mapLearnerAssessmentResults";
+ public static final String MAP_LEARNER_FEEDBACK_INCORRECT = "mapLeanerFeedbackIncorrect";
+ public static final String MAP_LEARNER_FEEDBACK_CORRECT = "mapLeanerFeedbackCorrect";
+ public static final String MAP_QUESTION_WEIGHTS = "mapQuestionWeights";
+ public static final String MAP_QUE_ATTEMPTS = "mapQueAttempts";
+ public static final String MAP_QUE_CORRECT_ATTEMPTS = "mapQueCorrectAttempts";
+ public static final String MAP_QUE_INCORRECT_ATTEMPTS = "mapQueIncorrectAttempts";
+ public static final String MAP_RESPONSES = "mapResponses";
+
+ public static final String MAP_WEIGHTS = "mapWeights";
+ public static final String MAP_CHECKBOX_STATES = "mapCheckBoxStates";
+ public static final String MAP_SELECTED_OPTIONS = "mapSelectedOptions";
+
+ public static final String DEFAULT_FIRST_OPTION = "Candidate Answer 1";
+ public static final String DEFAULT_SELECTED_OPTION = "Candidate Answer 2";
+ public static final String MAP_FEEDBACK_INCORRECT = "mapFeedbackIncorrect";
+ public static final String MAP_INCORRECT_FEEDBACK = "mapIncorrectFeedback";
+
+ public static final String MAP_INCORRECT_FEEDBACK_LEARNER = "mapIncorrectFeedbackLearner";
+ public static final String MAP_CORRECT_FEEDBACK_LEARNER = "mapCorrectFeedbackLearner";
+ public static final String MAP_CORRECT_FEEDBACK = "mapCorrectFeedback";
+ public static final String MAP_FEEDBACK_CORRECT = "mapFeedbackCorrect";
+ public static final String IS_PORTFOLIO_EXPORT = "isPortfolioExport";
+ public static final String PORTFOLIO_EXPORT_MODE = "portfolioExportMode";
+ public static final String PORTFOLIO_EXPORT_DATA_FILENAME = "portfolioExportDataFileName";
+
+ public static final String SELECTED_QUESTION = "selectedQuestion";
+ public static final String SELECTED_QUESTION_INDEX = "selectedQuestionIndex";
+ public static final String DEFAULT_QUESTION_UID = "defaultQuestionUid";
+
+ public static final String DEFAULT_FEEDBACK_INCORRECT = "Your answer is incorrect";
+ public static final String DEFAULT_FEEDBACK_CORRECT = "Correct";
+
+ public static final String TITLE = "title";
+ public static final String INSTRUCTIONS = "instructions";
+ public static final String CREATION_DATE = "creationDate";
+ public static final String DEFINE_LATER = "defineLater";
+ public static final String RUN_OFFLINE = "runOffline";
+ public static final String RETRIES = "retries";
+ public static final String PASSMARK = "passMark";
+ public static final String VIEW_ANSWERS = "viewAnswers";
+ public static final String SHOW_AUTHORING_TABS = "showAuthoringTabs";
+ public static final String REQUEST_BY_STARTER = "requestByStarter";
+
+ public static final String ON = "ON";
+ public static final String OFF = "OFF";
+ public static final String RICHTEXT_FEEDBACK_CORRECT = "richTextFeedbackCorrect";
+ public static final String RICHTEXT_INCORRECT_FEEDBACK = "richTextIncorrectFeedback";
+ public static final String RICHTEXT_CORRECT_FEEDBACK = "richTextCorrectFeedback";
+ public static final String RICHTEXT_FEEDBACK_INCORRECT = "richTextFeedbackInCorrect";
+ public static final String RICHTEXT_OFFLINEINSTRUCTIONS = "richTextOfflineInstructions";
+ public static final String RICHTEXT_ONLINEINSTRUCTIONS = "richTextOnlineInstructions";
+ public static final String RICHTEXT_REPORT_TITLE = "richTextReportTitle";
+ // public static final String RICHTEXT_END_LEARNING_MSG ="richTextEndLearningMsg";
+ public static final String RICHTEXT_TITLE = "richTextTitle";
+ public static final String RICHTEXT_INSTRUCTIONS = "richTextInstructions";
+ public static final String RICHTEXT_BLANK = "
";
+ public static final String SUBMIT_OFFLINE_FILE = "submitOfflineFile";
+ public static final String SUBMIT_ONLINE_FILE = "submitOnlineFile";
+ public static final String LIST_UPLOADED_OFFLINE_FILENAMES = "listUploadedOfflineFileNames";
+ public static final String LIST_UPLOADED_ONLINE_FILENAMES = "listUploadedOnlineFileNames";
+ public static final String LIST_OFFLINEFILES_METADATA = "listOfflineFilesMetadata";
+ public static final String LIST_ONLINEFILES_METADATA = "listOnlineFilesMetadata";
+
+ public static final String COUNT_SESSION_COMPLETE = "countSessionComplete";
+ public static final String COUNT_ALL_USERS = "countAllUsers";
+ public static final String COUNT_MAX_ATTEMPT = "countMaxAttempt";
+ public static final String TOP_MARK = "topMark";
+ public static final String LOWEST_MARK = "lowestMark";
+ public static final String AVERAGE_MARK = "averageMark";
+
/*
* the learner or monitoring environment provides toolSessionId
*/
- public final long ONE_DAY =60 * 60 * 1000 * 24;
- public final static String NOT_ATTEMPTED ="NOT_ATTEMPTED";
- public final static String INCOMPLETE ="INCOMPLETE";
- public static final String COMPLETED ="COMPLETED";
-
- public static final String MAP_TOOL_SESSIONS ="mapToolSessions";
- public static final Integer MAX_TOOL_SESSION_COUNT =new Integer(500);
- public static final String IS_TOOL_SESSION_CHANGED ="isToolSessionChanged";
- public static final String OPTION_OFF ="false";
- public static final String ACTIVITY_TITLE = "activityTitle";
- public static final String ACTIVITY_INSTRUCTIONS = "activityInstructions";
- public static final String CORRECT = "Correct";
+ public final long ONE_DAY = 60 * 60 * 1000 * 24;
+ public final static String NOT_ATTEMPTED = "NOT_ATTEMPTED";
+ public final static String INCOMPLETE = "INCOMPLETE";
+ public static final String COMPLETED = "COMPLETED";
-
+ public static final String MAP_TOOL_SESSIONS = "mapToolSessions";
+ public static final Integer MAX_TOOL_SESSION_COUNT = new Integer(500);
+ public static final String IS_TOOL_SESSION_CHANGED = "isToolSessionChanged";
+ public static final String OPTION_OFF = "false";
+ public static final String ACTIVITY_TITLE = "activityTitle";
+ public static final String ACTIVITY_INSTRUCTIONS = "activityInstructions";
+ public static final String CORRECT = "Correct";
+
/*
* user actions
*/
- public static final String ADD_NEW_QUESTION ="addNewQuestion";
- public static final String REMOVE_QUESTION ="removeQuestion";
- public static final String REMOVE_ALL_CONTENT ="removeAllContent";
- public static final String SUBMIT_ALL_CONTENT ="submitAllContent";
- public static final String SUBMIT_TAB_DONE ="submitTabDone";
+ public static final String ADD_NEW_QUESTION = "addNewQuestion";
+ public static final String REMOVE_QUESTION = "removeQuestion";
+ public static final String REMOVE_ALL_CONTENT = "removeAllContent";
+ public static final String SUBMIT_ALL_CONTENT = "submitAllContent";
+ public static final String SUBMIT_TAB_DONE = "submitTabDone";
-
/* learner mode contants */
- public static final String MAP_QUESTION_CONTENT_LEARNER ="mapQuestionContentLearner";
- public static final String LIST_QUESTION_CANDIDATEANSWERS_DTO ="listQuestionCandidateAnswersDto";
- public static final String MC_GENERAL_LEARNER_FLOW_DTO ="mcGeneralLearnerFlowDTO";
- public static final String LIST_SELECTED_QUESTION_CANDIDATEANSWERS_DTO ="listSelectedQuestionCandidateAnswersDto";
- public static final String CURRENT_QUESTION_INDEX ="currentQuestionIndex";
- public static final String TOTAL_QUESTION_COUNT ="totalQuestionCount";
- public static final String HR_COLUMN_COUNT ="hrColumnCount";
- public static final String LEARNER_MARK ="learnerMark";
- public static final String MAP_ANSWERS ="mapAnswers";
- public static final String CURRENT_ANSWER ="currentAnswer";
- public static final String USER_FEEDBACK ="userFeedback";
- public static final String REPORT_TITLE_LEARNER ="reportTitleLearner";
- public static final String TOTAL_COUNT_REACHED ="totalCountReached";
- public static final String NOTEBOOK ="notebook";
- public static final String ENTRY_TEXT ="entryText";
-
- public static final String MC_LEARNER_STARTER_DTO ="mcLearnerStarterDTO";
- public static final String IS_TOOL_ACTIVITY_OFFLINE ="isToolActivityOffline";
- public static final String IS_USERNAME_VISIBLE ="isUsernameVisible";
- public static final String IS_CONTENT_IN_USE ="isContentInUse";
- public static final String IS_MONITORED_CONTENT_IN_USE ="isMonitoredContentInUse";
- public static final String IS_RETRIES ="isRetries";
- public static final String IS_SHOW_FEEDBACK ="isShowFeedback";
- public static final String IS_SHOW_LEARNERS_REPORT ="isShowLearnersReport";
- public static final String IS_ALL_SESSIONS_COMPLETED ="isAllSessionsCompleted";
- public static final String CHECK_ALL_SESSIONS_COMPLETED ="checkAllSessionsCompleted";
- public static final String FROM_TOOL_CONTENT_ID ="fromToolContentId";
- public static final String TO_TOOL_CONTENT_ID ="toToolContentId";
- public static final String LEARNER_REPORT ="learnerReport";
- public static final String MAP_USER_RESPONSES ="mapUserResponses";
- public static final String MAP_MAIN_REPORT ="mapMainReport";
- public static final String MAP_STATS ="mapStats";
-
-
+ public static final String MAP_QUESTION_CONTENT_LEARNER = "mapQuestionContentLearner";
+ public static final String LIST_QUESTION_CANDIDATEANSWERS_DTO = "listQuestionCandidateAnswersDto";
+ public static final String MC_GENERAL_LEARNER_FLOW_DTO = "mcGeneralLearnerFlowDTO";
+ public static final String LIST_SELECTED_QUESTION_CANDIDATEANSWERS_DTO = "listSelectedQuestionCandidateAnswersDto";
+ public static final String CURRENT_QUESTION_INDEX = "currentQuestionIndex";
+ public static final String TOTAL_QUESTION_COUNT = "totalQuestionCount";
+ public static final String HR_COLUMN_COUNT = "hrColumnCount";
+ public static final String LEARNER_MARK = "learnerMark";
+ public static final String MAP_ANSWERS = "mapAnswers";
+ public static final String CURRENT_ANSWER = "currentAnswer";
+ public static final String USER_FEEDBACK = "userFeedback";
+ public static final String REPORT_TITLE_LEARNER = "reportTitleLearner";
+ public static final String TOTAL_COUNT_REACHED = "totalCountReached";
+ public static final String NOTEBOOK = "notebook";
+ public static final String ENTRY_TEXT = "entryText";
+
+ public static final String MC_LEARNER_STARTER_DTO = "mcLearnerStarterDTO";
+ public static final String IS_TOOL_ACTIVITY_OFFLINE = "isToolActivityOffline";
+ public static final String IS_USERNAME_VISIBLE = "isUsernameVisible";
+ public static final String IS_CONTENT_IN_USE = "isContentInUse";
+ public static final String IS_MONITORED_CONTENT_IN_USE = "isMonitoredContentInUse";
+ public static final String IS_RETRIES = "isRetries";
+ public static final String IS_SHOW_FEEDBACK = "isShowFeedback";
+ public static final String IS_SHOW_LEARNERS_REPORT = "isShowLearnersReport";
+ public static final String IS_ALL_SESSIONS_COMPLETED = "isAllSessionsCompleted";
+ public static final String CHECK_ALL_SESSIONS_COMPLETED = "checkAllSessionsCompleted";
+ public static final String FROM_TOOL_CONTENT_ID = "fromToolContentId";
+ public static final String TO_TOOL_CONTENT_ID = "toToolContentId";
+ public static final String LEARNER_REPORT = "learnerReport";
+ public static final String MAP_USER_RESPONSES = "mapUserResponses";
+ public static final String MAP_MAIN_REPORT = "mapMainReport";
+ public static final String MAP_STATS = "mapStats";
+
/*
* Monitoring Mode constants
*/
- public static final String CURRENT_MONITORING_TAB ="currentMonitoringTab";
- public static final String REPORT_TITLE_MONITOR ="reportTitleMonitor";
- public static final String MONITOR_USER_ID ="userId";
- public static final String MONITORING_REPORT ="monitoringReport";
- public static final String MONITORING_ERROR ="monitoringError";
- public static final String MAP_MONITORING_QUESTIONS ="mapMonitoringQuestions";
- public static final String SUMMARY_TOOL_SESSIONS ="summaryToolSessions";
- public static final String CURRENT_SESSION_NAME ="currentSessionName";
- public static final String SUMMARY_TOOL_SESSIONS_ID ="summaryToolSessionsId";
- public static final String MONITORED_CONTENT_ID ="monitoredContentId";
- public static final String EDITACTIVITY_EDITMODE ="editActivityEditMode";
- public static final String FORM_INDEX ="formIndex";
- public static final String CURRENT_MONITORED_TOOL_SESSION ="currentMonitoredToolSession";
- public static final String CURRENT_MONITORED_TOOL_SESSION_NAME ="currentMonitoredToolSessionName";
- public static final String SELECTION_CASE ="selectionCase";
- public static final String LIST_MONITORED_ANSWERS_CONTAINER_DTO ="listMonitoredAnswersContainerDto";
- public static final String LIST_GROUPING_DATA ="listGroupingData";
- public static final String LEARNER_NAME ="learnerName";
- public static final String LIST_MONITORED_MARKS_CONTAINER_DTO ="listMonitoredMarksContainerDto";
- public static final String TIMEZONE ="timeZone";
-
- public static final String QUESTION_LISTING_MODE ="questionListingMode";
- public static final String QUESTION_LISTING_MODE_SEQUENTIAL ="questionListingModeSequential";
- public static final String QUESTION_LISTING_MODE_COMBINED ="questionListingModeCombined";
- public static final String PREVIEW_ONLY ="previewOnly";
-
- public static final String MODE ="mode";
- public static final String LEARNING_MODE ="learningMode";
- public static final String EXPORT_USER_ID ="exportUserId";
- public static final String REFLECT ="reflect";
-
+ public static final String CURRENT_MONITORING_TAB = "currentMonitoringTab";
+ public static final String REPORT_TITLE_MONITOR = "reportTitleMonitor";
+ public static final String MONITOR_USER_ID = "userId";
+ public static final String MONITORING_REPORT = "monitoringReport";
+ public static final String MONITORING_ERROR = "monitoringError";
+ public static final String MAP_MONITORING_QUESTIONS = "mapMonitoringQuestions";
+ public static final String SUMMARY_TOOL_SESSIONS = "summaryToolSessions";
+ public static final String CURRENT_SESSION_NAME = "currentSessionName";
+ public static final String SUMMARY_TOOL_SESSIONS_ID = "summaryToolSessionsId";
+ public static final String MONITORED_CONTENT_ID = "monitoredContentId";
+ public static final String EDITACTIVITY_EDITMODE = "editActivityEditMode";
+ public static final String FORM_INDEX = "formIndex";
+ public static final String CURRENT_MONITORED_TOOL_SESSION = "currentMonitoredToolSession";
+ public static final String CURRENT_MONITORED_TOOL_SESSION_NAME = "currentMonitoredToolSessionName";
+ public static final String SELECTION_CASE = "selectionCase";
+ public static final String LIST_MONITORED_ANSWERS_CONTAINER_DTO = "listMonitoredAnswersContainerDto";
+ public static final String LIST_GROUPING_DATA = "listGroupingData";
+ public static final String LEARNER_NAME = "learnerName";
+ public static final String LIST_MONITORED_MARKS_CONTAINER_DTO = "listMonitoredMarksContainerDto";
+ public static final String TIMEZONE = "timeZone";
+
+ public static final String QUESTION_LISTING_MODE = "questionListingMode";
+ public static final String QUESTION_LISTING_MODE_SEQUENTIAL = "questionListingModeSequential";
+ public static final String QUESTION_LISTING_MODE_COMBINED = "questionListingModeCombined";
+ public static final String PREVIEW_ONLY = "previewOnly";
+
+ public static final String MODE = "mode";
+ public static final String LEARNING_MODE = "learningMode";
+ public static final String EXPORT_USER_ID = "exportUserId";
+ public static final String REFLECT = "reflect";
+
/*
* exception constants
*/
- public static final String USER_EXCEPTION_WRONG_FORMAT ="userExceptionWrongFormat";
- public static final String USER_EXCEPTION_INCOMPATIBLE_IDS ="userExceptionIncompatibleIds";
- public static final String USER_EXCEPTION_NUMBERFORMAT ="userExceptionNumberFormat";
- public static final String USER_EXCEPTION_CONTENT_DOESNOTEXIST ="userExceptionContentDoesNotExist";
- public static final String USER_EXCEPTION_TOOLSESSION_DOESNOTEXIST ="userExceptionToolSessionDoesNotExist";
- public static final String USER_EXCEPTION_TOOLCONTENT_DOESNOTEXIST ="userExceptionToolContentDoesNotExist";
- public static final String USER_EXCEPTION_LEARNER_REQUIRED ="userExceptionLearnerRequired";
- public static final String USER_EXCEPTION_CONTENTID_REQUIRED ="userExceptionContentIdRequired";
- public static final String USER_EXCEPTION_TOOLSESSIONID_REQUIRED ="userExceptionToolSessionIdRequired";
- public static final String USER_EXCEPTION_TOOLSESSIONID_INCONSISTENT ="userExceptionToolSessionIdInconsistent";
- public static final String USER_EXCEPTION_DEFAULTCONTENT_NOT_AVAILABLE ="userExceptionDefaultContentNotAvailable";
- public static final String USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE ="userExceptionDefaultQuestionContentNotAvailable";
- public static final String USER_EXCEPTION_DEFAULTOPTIONSCONTENT_NOT_AVAILABLE ="userExceptionDefaultOptionsContentNotAvailable";
- public static final String USER_EXCEPTION_USERID_NOTAVAILABLE ="userExceptionUserIdNotAvailable";
- public static final String USER_EXCEPTION_USERID_NOTNUMERIC ="userExceptionUserIdNotNumeric";
- public static final String USER_EXCEPTION_ONLYCONTENT_ANDNOSESSIONS ="userExceptionOnlyContentAndNoSessions";
- public static final String USER_EXCEPTION_USERID_EXISTING ="userExceptionUserIdExisting";
- public static final String USER_EXCEPTION_USER_DOESNOTEXIST ="userExceptionUserDoesNotExist";
- public static final String USER_EXCEPTION_MONITORINGTAB_CONTENTID_REQUIRED ="userExceptionMonitoringTabContentIdRequired";
- public static final String USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP ="userExceptionDefaultContentNotSetup";
- public static final String USER_EXCEPTION_NO_TOOL_SESSIONS ="userExceptionNoToolSessions";
- public static final String USER_EXCEPTION_NO_STUDENT_ACTIVITY ="userExceptionNoStudentActivity";
- public static final String USER_EXCEPTION_MODE_REQUIRED ="userExceptionModeRequired";
- public static final String USER_EXCEPTION_CONTENT_IN_USE ="userExceptionContentInUse";
- public static final String USER_EXCEPTION_CONTENT_BEING_MODIFIED ="userExceptionContentBeingModified";
- public static final String USER_EXCEPTION_CONTENT_RUNOFFLINE ="userExceptionContentRunOffline";
- public static final String USER_EXCEPTION_MODE_INVALID ="userExceptionModeInvalid";
- public static final String USER_EXCEPTION_QUESTION_EMPTY ="userExceptionQuestionEmpty";
- public static final String USER_EXCEPTION_ANSWER_EMPTY ="userExceptionAnswerEmpty";
- public static final String USER_EXCEPTION_WEIGHT_TOTAL ="userExceptionWeightTotal";
- public static final String USER_EXCEPTION_WEIGHT_EMPTY ="userExceptionWeightEmpty";
- public static final String USER_EXCEPTION_WEIGHT_NOTINTEGER ="userExceptionWeightNotInteger";
- public static final String USER_EXCEPTION_WEIGHT_ZERO ="userExceptionWeightZero";
- public static final String USER_EXCEPTION_ANSWERS_DUPLICATE ="userExceptionAnswersDuplicate";
- public static final String USER_EXCEPTION_OPTIONS_COUNT_ZERO ="userExceptionOptionsCountZero";
- public static final String USER_EXCEPTION_CHKBOXES_EMPTY ="userExceptionChkboxesEmpty";
- public static final String USER_EXCEPTION_SUBMIT_NONE ="userExceptionSubmitNone";
- public static final String USER_EXCEPTION_PASSMARK_NOTINTEGER ="userExceptionPassmarkNotInteger";
- public static final String USER_EXCEPTION_PASSMARK_EMPTY ="userExceptionPassmarkEmpty";
- public static final String USER_EXCEPTION_PASSMARK_GREATER100 ="userExceptionPassmarkGreater100";
- public static final String USER_EXCEPTION_FILENAME_EMPTY ="userExceptionFilenameEmpty";
- public static final String USER_EXCEPTION_WEIGHT_MUST_EQUAL100 ="userExceptionWeightMustEqual100";
- public static final String USER_EXCEPTION_SINGLE_OPTION ="userExceptionSingleOption";
+ public static final String USER_EXCEPTION_WRONG_FORMAT = "userExceptionWrongFormat";
+ public static final String USER_EXCEPTION_INCOMPATIBLE_IDS = "userExceptionIncompatibleIds";
+ public static final String USER_EXCEPTION_NUMBERFORMAT = "userExceptionNumberFormat";
+ public static final String USER_EXCEPTION_CONTENT_DOESNOTEXIST = "userExceptionContentDoesNotExist";
+ public static final String USER_EXCEPTION_TOOLSESSION_DOESNOTEXIST = "userExceptionToolSessionDoesNotExist";
+ public static final String USER_EXCEPTION_TOOLCONTENT_DOESNOTEXIST = "userExceptionToolContentDoesNotExist";
+ public static final String USER_EXCEPTION_LEARNER_REQUIRED = "userExceptionLearnerRequired";
+ public static final String USER_EXCEPTION_CONTENTID_REQUIRED = "userExceptionContentIdRequired";
+ public static final String USER_EXCEPTION_TOOLSESSIONID_REQUIRED = "userExceptionToolSessionIdRequired";
+ public static final String USER_EXCEPTION_TOOLSESSIONID_INCONSISTENT = "userExceptionToolSessionIdInconsistent";
+ public static final String USER_EXCEPTION_DEFAULTCONTENT_NOT_AVAILABLE = "userExceptionDefaultContentNotAvailable";
+ public static final String USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE = "userExceptionDefaultQuestionContentNotAvailable";
+ public static final String USER_EXCEPTION_DEFAULTOPTIONSCONTENT_NOT_AVAILABLE = "userExceptionDefaultOptionsContentNotAvailable";
+ public static final String USER_EXCEPTION_USERID_NOTAVAILABLE = "userExceptionUserIdNotAvailable";
+ public static final String USER_EXCEPTION_USERID_NOTNUMERIC = "userExceptionUserIdNotNumeric";
+ public static final String USER_EXCEPTION_ONLYCONTENT_ANDNOSESSIONS = "userExceptionOnlyContentAndNoSessions";
+ public static final String USER_EXCEPTION_USERID_EXISTING = "userExceptionUserIdExisting";
+ public static final String USER_EXCEPTION_USER_DOESNOTEXIST = "userExceptionUserDoesNotExist";
+ public static final String USER_EXCEPTION_MONITORINGTAB_CONTENTID_REQUIRED = "userExceptionMonitoringTabContentIdRequired";
+ public static final String USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP = "userExceptionDefaultContentNotSetup";
+ public static final String USER_EXCEPTION_NO_TOOL_SESSIONS = "userExceptionNoToolSessions";
+ public static final String USER_EXCEPTION_NO_STUDENT_ACTIVITY = "userExceptionNoStudentActivity";
+ public static final String USER_EXCEPTION_MODE_REQUIRED = "userExceptionModeRequired";
+ public static final String USER_EXCEPTION_CONTENT_IN_USE = "userExceptionContentInUse";
+ public static final String USER_EXCEPTION_CONTENT_BEING_MODIFIED = "userExceptionContentBeingModified";
+ public static final String USER_EXCEPTION_CONTENT_RUNOFFLINE = "userExceptionContentRunOffline";
+ public static final String USER_EXCEPTION_MODE_INVALID = "userExceptionModeInvalid";
+ public static final String USER_EXCEPTION_QUESTION_EMPTY = "userExceptionQuestionEmpty";
+ public static final String USER_EXCEPTION_ANSWER_EMPTY = "userExceptionAnswerEmpty";
+ public static final String USER_EXCEPTION_WEIGHT_TOTAL = "userExceptionWeightTotal";
+ public static final String USER_EXCEPTION_WEIGHT_EMPTY = "userExceptionWeightEmpty";
+ public static final String USER_EXCEPTION_WEIGHT_NOTINTEGER = "userExceptionWeightNotInteger";
+ public static final String USER_EXCEPTION_WEIGHT_ZERO = "userExceptionWeightZero";
+ public static final String USER_EXCEPTION_ANSWERS_DUPLICATE = "userExceptionAnswersDuplicate";
+ public static final String USER_EXCEPTION_OPTIONS_COUNT_ZERO = "userExceptionOptionsCountZero";
+ public static final String USER_EXCEPTION_CHKBOXES_EMPTY = "userExceptionChkboxesEmpty";
+ public static final String USER_EXCEPTION_SUBMIT_NONE = "userExceptionSubmitNone";
+ public static final String USER_EXCEPTION_PASSMARK_NOTINTEGER = "userExceptionPassmarkNotInteger";
+ public static final String USER_EXCEPTION_PASSMARK_EMPTY = "userExceptionPassmarkEmpty";
+ public static final String USER_EXCEPTION_PASSMARK_GREATER100 = "userExceptionPassmarkGreater100";
+ public static final String USER_EXCEPTION_FILENAME_EMPTY = "userExceptionFilenameEmpty";
+ public static final String USER_EXCEPTION_WEIGHT_MUST_EQUAL100 = "userExceptionWeightMustEqual100";
+ public static final String USER_EXCEPTION_SINGLE_OPTION = "userExceptionSingleOption";
+
+ public static final String SUCCESS = "success";
+ public static final String CANDIDATE_ANSWER_COUNT = "candidateAnswerCount";
+ public static final String CANDIDATE_ANSWER_PREFIX = "candidateAnswer";
+ public static final int QUESTION_DEFAULT_MARK = 1;
+ public static final int CANDIDATE_ANSWER_DEFAULT_COUNT = 3;
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dbupdates/patch20081127_updateFrom22.sql
===================================================================
diff -u
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dbupdates/patch20081127_updateFrom22.sql (revision 0)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dbupdates/patch20081127_updateFrom22.sql (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -0,0 +1,14 @@
+-- SQL statements to update from LAMS 2.2
+
+-- Turn off autocommit, so nothing is committed if there is an error
+SET AUTOCOMMIT = 0;
+
+----------------------Put all sql statements below here-------------------------
+
+UPDATE lams_tool SET pedagogical_planner_url='tool/lamc11/pedagogicalPlanner.do' WHERE tool_signature='lamc11';
+
+----------------------Put all sql statements above here-------------------------
+
+-- If there were no errors, commit and restore autocommit to on
+COMMIT;
+SET AUTOCOMMIT = 1;
\ No newline at end of file
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerAction.java
===================================================================
diff -u
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerAction.java (revision 0)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerAction.java (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -0,0 +1,184 @@
+/****************************************************************
+ * 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$$ */
+
+package org.lamsfoundation.lams.tool.mc.web;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.math.NumberUtils;
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessages;
+import org.lamsfoundation.lams.tool.mc.McAppConstants;
+import org.lamsfoundation.lams.tool.mc.McCandidateAnswersDTO;
+import org.lamsfoundation.lams.tool.mc.pojos.McContent;
+import org.lamsfoundation.lams.tool.mc.pojos.McOptsContent;
+import org.lamsfoundation.lams.tool.mc.pojos.McQueContent;
+import org.lamsfoundation.lams.tool.mc.service.IMcService;
+import org.lamsfoundation.lams.tool.mc.service.McServiceProxy;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.action.LamsDispatchAction;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+public class McPedagogicalPlannerAction extends LamsDispatchAction {
+
+ private static Logger logger = Logger.getLogger(McPedagogicalPlannerAction.class);
+
+ @Override
+ protected ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ return initPedagogicalPlannerForm(mapping, form, request, response);
+ }
+
+ public ActionForward initPedagogicalPlannerForm(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ McPedagogicalPlannerForm plannerForm = (McPedagogicalPlannerForm) form;
+ Long toolContentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID);
+ McContent qaContent = getMcService().retrieveMc(toolContentID);
+ plannerForm.fillForm(qaContent, getMcService());
+
+ return mapping.findForward(McAppConstants.SUCCESS);
+ }
+
+ public ActionForward saveOrUpdatePedagogicalPlannerForm(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response) throws IOException {
+
+ McPedagogicalPlannerForm plannerForm = (McPedagogicalPlannerForm) form;
+ ActionMessages errors = plannerForm.validate(request);
+
+ if (errors.isEmpty()) {
+ McContent mcContent = getMcService().retrieveMc(plannerForm.getToolContentID());
+ int questionIndex = 1;
+ String question = null;
+
+ do {
+ question = plannerForm.getQuestion(questionIndex - 1);
+ List candidateAnswerDTOList = plannerForm.extractCandidateAnswers(request,
+ questionIndex);
+ boolean removeQuestion = true;
+ if (!StringUtils.isEmpty(question)) {
+ if (candidateAnswerDTOList != null) {
+ for (McCandidateAnswersDTO answer : candidateAnswerDTOList) {
+ if (answer != null && !StringUtils.isEmpty(answer.getCandidateAnswer())) {
+ removeQuestion = false;
+ break;
+ }
+ }
+ }
+ }
+ if (removeQuestion) {
+ plannerForm.removeQuestion(questionIndex - 1);
+ } else {
+ if (questionIndex <= mcContent.getMcQueContents().size()) {
+ McQueContent mcQueContent = getMcService().getQuestionContentByDisplayOrder(
+ (long) questionIndex, mcContent.getUid());
+ mcQueContent.setQuestion(question);
+ int candidateAnswerDTOIndex = 0;
+ Set candidateAnswers = mcQueContent.getMcOptionsContents();
+ Iterator candidateAnswerIter = candidateAnswers.iterator();
+ while (candidateAnswerIter.hasNext()) {
+ McOptsContent candidateAnswer = candidateAnswerIter.next();
+ if (candidateAnswerDTOIndex >= candidateAnswerDTOList.size()) {
+ candidateAnswerIter.remove();
+ } else {
+ McCandidateAnswersDTO answerDTO = candidateAnswerDTOList.get(candidateAnswerDTOIndex);
+ candidateAnswer.setCorrectOption(McAppConstants.CORRECT.equals(answerDTO.getCorrect()));
+ candidateAnswer.setMcQueOptionText(answerDTO.getCandidateAnswer());
+ getMcService().updateMcOptionsContent(candidateAnswer);
+ }
+ candidateAnswerDTOIndex++;
+ }
+ getMcService().saveOrUpdateMcQueContent(mcQueContent);
+ } else {
+ McQueContent mcQueContent = new McQueContent();
+ mcQueContent.setDisplayOrder(questionIndex);
+ mcQueContent.setMcContent(mcContent);
+ mcQueContent.setMcContentId(mcContent.getMcContentId());
+ mcQueContent.setQuestion(question);
+ mcQueContent.setMark(McAppConstants.QUESTION_DEFAULT_MARK);
+ Set candidateAnswers = mcQueContent.getMcOptionsContents();
+ for (int candidateAnswerDTOIndex = 0; candidateAnswerDTOIndex < candidateAnswerDTOList.size(); candidateAnswerDTOIndex++) {
+ McCandidateAnswersDTO answerDTO = candidateAnswerDTOList.get(candidateAnswerDTOIndex);
+ McOptsContent candidateAnswer = new McOptsContent(candidateAnswerDTOIndex + 1,
+ McAppConstants.CORRECT.equals(answerDTO.getCorrect()), answerDTO
+ .getCandidateAnswer(), mcQueContent, null);
+ candidateAnswer.setMcQueContentId(mcQueContent.getMcContentId());
+ candidateAnswers.add(candidateAnswer);
+ }
+ getMcService().saveOrUpdateMcQueContent(mcQueContent);
+ mcContent.getMcQueContents().add(mcQueContent);
+ }
+ questionIndex++;
+ }
+ } while (questionIndex <= plannerForm.getQuestionCount());
+ for (; questionIndex <= mcContent.getMcQueContents().size(); questionIndex++) {
+ McQueContent mcQueContent = getMcService().getQuestionContentByDisplayOrder((long) questionIndex,
+ mcContent.getUid());
+ mcContent.getMcQueContents().remove(mcQueContent);
+ getMcService().removeMcQueContent(mcQueContent);
+ }
+ plannerForm.fillForm(mcContent, getMcService());
+ } else {
+ saveErrors(request, errors);
+ }
+ return mapping.findForward(McAppConstants.SUCCESS);
+ }
+
+ public ActionForward createPedagogicalPlannerQuestion(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response) {
+ McPedagogicalPlannerForm plannerForm = (McPedagogicalPlannerForm) form;
+ int questionDisplayOrder = plannerForm.getQuestionCount().intValue() + 1;
+ plannerForm.setCandidateAnswerCount(new ArrayList(plannerForm.getQuestionCount()));
+ Map paramMap = request.getParameterMap();
+ for (int questionIndex = 1; questionIndex < questionDisplayOrder; questionIndex++) {
+ Object param = paramMap.get(McAppConstants.CANDIDATE_ANSWER_COUNT + questionIndex);
+ int count = NumberUtils.stringToInt(((String[]) param)[0]);
+ plannerForm.getCandidateAnswerCount().add(count);
+ }
+ plannerForm.setQuestion(questionDisplayOrder - 1, "");
+ plannerForm.getCandidateAnswerCount().add(McAppConstants.CANDIDATE_ANSWER_DEFAULT_COUNT);
+ plannerForm.setCorrect(questionDisplayOrder - 1, "1");
+ return mapping.findForward(McAppConstants.SUCCESS);
+ }
+
+ private IMcService getMcService() {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
+ .getServletContext());
+ return McServiceProxy.getMcService(getServlet().getServletContext());
+ }
+
+}
\ No newline at end of file
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerForm.java
===================================================================
diff -u
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerForm.java (revision 0)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerForm.java (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -0,0 +1,237 @@
+/****************************************************************
+ * 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 version 2.0
+ * 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$ */
+package org.lamsfoundation.lams.tool.mc.web;
+
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.math.NumberUtils;
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.lamsfoundation.lams.tool.mc.McAppConstants;
+import org.lamsfoundation.lams.tool.mc.McCandidateAnswersDTO;
+import org.lamsfoundation.lams.tool.mc.McQuestionContentDTO;
+import org.lamsfoundation.lams.tool.mc.pojos.McContent;
+import org.lamsfoundation.lams.tool.mc.service.IMcService;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.planner.PedagogicalPlannerForm;
+
+public class McPedagogicalPlannerForm extends PedagogicalPlannerForm {
+ private static Logger logger = Logger.getLogger(McPedagogicalPlannerForm.class);
+
+ private List question;
+ private List candidateAnswerCount;
+ private String candidateAnswersString;
+ private List correct;
+
+ public ActionMessages validate(HttpServletRequest request) {
+ ActionMessages errors = new ActionMessages();
+ boolean allEmpty = true;
+
+ if (question != null && !question.isEmpty()) {
+ int questionIndex = 1;
+ for (String item : question) {
+ if (item != null || !StringUtils.isEmpty(item)) {
+ try {
+ List candidateAnswerList = extractCandidateAnswers(request,
+ questionIndex);
+ if (candidateAnswerList != null) {
+ boolean answersEmpty = true;
+ ActionMessage correctAnswerBlankError = null;
+ for (McCandidateAnswersDTO answer : candidateAnswerList) {
+ if (answer != null && !StringUtils.isEmpty(answer.getCandidateAnswer())) {
+ allEmpty = false;
+ answersEmpty = false;
+ } else if (McAppConstants.CORRECT.equals(answer.getCorrect())) {
+ correctAnswerBlankError = new ActionMessage(
+ "error.pedagogical.planner.empty.answer.selected", questionIndex);
+ }
+ }
+ if (!answersEmpty && correctAnswerBlankError != null) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, correctAnswerBlankError);
+ }
+ }
+ } catch (UnsupportedEncodingException e) {
+ McPedagogicalPlannerForm.logger.error(e.getMessage());
+ return errors;
+ }
+ questionIndex++;
+ }
+ }
+ }
+ if (allEmpty) {
+ ActionMessage error = new ActionMessage("questions.none.submitted");
+ errors.clear();
+ errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ question = null;
+ setCandidateAnswersString("");
+ } else if (!errors.isEmpty()) {
+ StringBuilder candidateAnswersBuilder = new StringBuilder();
+ Map paramMap = request.getParameterMap();
+ setCandidateAnswerCount(new ArrayList(getQuestionCount()));
+ for (String key : paramMap.keySet()) {
+ if (key.startsWith(McAppConstants.CANDIDATE_ANSWER_PREFIX)) {
+ Object param = paramMap.get(key);
+ String answer = ((String[]) param)[0];
+ candidateAnswersBuilder.append(key).append('=').append(answer).append('&');
+ }
+ }
+ setCandidateAnswersString(candidateAnswersBuilder.toString());
+ for (int questionIndex = 1; questionIndex <= getQuestionCount(); questionIndex++) {
+ Object param = paramMap.get(McAppConstants.CANDIDATE_ANSWER_COUNT + questionIndex);
+ int count = NumberUtils.stringToInt(((String[]) param)[0]);
+ getCandidateAnswerCount().add(count);
+ }
+ }
+
+ setValid(errors.isEmpty());
+ return errors;
+ }
+
+ public void fillForm(McContent mcContent, IMcService mcService) {
+ if (mcContent != null) {
+ setToolContentID(mcContent.getMcContentId());
+
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+ List questions = authoringUtil.buildDefaultQuestionContent(mcContent, mcService);
+
+ StringBuilder candidateAnswersBuilder = new StringBuilder();
+ setCandidateAnswerCount(new ArrayList(questions.size()));
+ for (int questionIndex = 1; questionIndex <= questions.size(); questionIndex++) {
+ McQuestionContentDTO item = questions.get(questionIndex - 1);
+ int questionDisplayOrder = Integer.parseInt(item.getDisplayOrder());
+ String questionText = WebUtil.removeHTMLtags(item.getQuestion());
+ setQuestion(questionDisplayOrder - 1, questionText);
+ List candidateAnswers = item.getListCandidateAnswersDTO();
+
+ for (int candidateAnswerIndex = 1; candidateAnswerIndex <= candidateAnswers.size(); candidateAnswerIndex++) {
+
+ McCandidateAnswersDTO candidateAnswer = candidateAnswers.get(candidateAnswerIndex - 1);
+
+ candidateAnswersBuilder.append(McAppConstants.CANDIDATE_ANSWER_PREFIX).append(questionDisplayOrder)
+ .append('-').append(candidateAnswerIndex).append('=').append(
+ candidateAnswer.getCandidateAnswer()).append('&');
+ if (candidateAnswer.getCorrect().equals(McAppConstants.CORRECT)) {
+ setCorrect(questionDisplayOrder - 1, String.valueOf(candidateAnswerIndex));
+ }
+ getCandidateAnswerCount().add(candidateAnswers.size());
+ }
+ }
+ setCandidateAnswersString(candidateAnswersBuilder.toString());
+ }
+ }
+
+ public void setQuestion(int number, String Questions) {
+ if (question == null) {
+ question = new ArrayList();
+ }
+ while (number >= question.size()) {
+ question.add(null);
+ }
+ question.set(number, Questions);
+ }
+
+ public String getQuestion(int number) {
+ if (question == null || number >= question.size()) {
+ return null;
+ }
+ return question.get(number);
+ }
+
+ public Integer getQuestionCount() {
+ return question == null ? 0 : question.size();
+ }
+
+ public boolean removeQuestion(int number) {
+ if (question == null || number >= question.size()) {
+ return false;
+ }
+ question.remove(number);
+ return true;
+ }
+
+ public String getCandidateAnswersString() {
+ return candidateAnswersString;
+ }
+
+ public void setCandidateAnswersString(String candidateAnswers) {
+ candidateAnswersString = candidateAnswers;
+ }
+
+ public List extractCandidateAnswers(HttpServletRequest request, int questionIndex)
+ throws UnsupportedEncodingException {
+ Map paramMap = request.getParameterMap();
+ Object param = paramMap.get(McAppConstants.CANDIDATE_ANSWER_COUNT + questionIndex);
+
+ int count = NumberUtils.stringToInt(((String[]) param)[0]);
+ int correct = Integer.parseInt(getCorrect(questionIndex - 1));
+ List candidateAnswerList = new ArrayList();
+ for (int index = 1; index <= count; index++) {
+ param = paramMap.get(McAppConstants.CANDIDATE_ANSWER_PREFIX + questionIndex + "-" + index);
+ String answer = ((String[]) param)[0];
+ if (answer != null) {
+ McCandidateAnswersDTO candidateAnswer = new McCandidateAnswersDTO();
+ candidateAnswer.setCandidateAnswer(answer);
+ if (index == correct) {
+ candidateAnswer.setCorrect(McAppConstants.CORRECT);
+ }
+ candidateAnswerList.add(candidateAnswer);
+ }
+ }
+ return candidateAnswerList;
+ }
+
+ public String getCorrect(int number) {
+ if (correct == null || number >= correct.size()) {
+ return null;
+ }
+ return correct.get(number);
+ }
+
+ public void setCorrect(int number, String correct) {
+ if (this.correct == null) {
+ this.correct = new ArrayList();
+ }
+ while (number >= this.correct.size()) {
+ this.correct.add(null);
+ }
+ this.correct.set(number, correct);
+ }
+
+ public List getCandidateAnswerCount() {
+
+ return candidateAnswerCount;
+ }
+
+ public void setCandidateAnswerCount(List candidateAnswerCount) {
+
+ this.candidateAnswerCount = candidateAnswerCount;
+ }
+}
\ No newline at end of file
Index: lams_tool_lamc/web/WEB-INF/struts-config.xml
===================================================================
diff -u -rdf91db7838416bb48e59d2582549cc7d1e1ce8e6 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_lamc/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision df91db7838416bb48e59d2582549cc7d1e1ce8e6)
+++ lams_tool_lamc/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -7,6 +7,7 @@
+
@@ -219,7 +220,25 @@
+
+
+
+
+
+
+
+<%@ include file="/common/taglibs.jsp"%>
+
+
+
+
+
+
+
+
+
+
+ <%@ include file="/common/messages.jsp"%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${candidateAnswerIndex}.
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: lams_tool_laqa/build.properties
===================================================================
diff -u -r0af4ed13b963a588f3499b080801863d57f8ad95 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_laqa/build.properties (.../build.properties) (revision 0af4ed13b963a588f3499b080801863d57f8ad95)
+++ lams_tool_laqa/build.properties (.../build.properties) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -4,7 +4,7 @@
signature=laqa11
#version of this project
-tool.version=20080926
+tool.version=20081126
# hide tool option
hideTool=false
Index: lams_tool_laqa/db/sql/tool_insert.sql
===================================================================
diff -u -r80a367726b9e7607851be28429bda54d9b306159 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_laqa/db/sql/tool_insert.sql (.../tool_insert.sql) (revision 80a367726b9e7607851be28429bda54d9b306159)
+++ lams_tool_laqa/db/sql/tool_insert.sql (.../tool_insert.sql) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -44,6 +44,7 @@
export_pfolio_class_url,
contribute_url,
moderation_url,
+pedagogical_planner_url,
help_url,
language_file,
classpath_addition,
@@ -76,6 +77,7 @@
'tool/laqa11/exportPortfolio?mode=teacher',
'tool/laqa11/monitoringStarter.do',
'tool/laqa11/monitoringStarter.do',
+'tool/laqa11/pedagogicalPlanner.do',
'http://wiki.lamsfoundation.org/display/lamsdocs/laqa11',
'org.lamsfoundation.lams.tool.qa.ApplicationResources',
'lams-tool-laqa11.jar',
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaCondition.java
===================================================================
diff -u -rd52e38e168a77a2c8b0e58dfdde7d1e73fcfda31 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaCondition.java (.../QaCondition.java) (revision d52e38e168a77a2c8b0e58dfdde7d1e73fcfda31)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaCondition.java (.../QaCondition.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -37,6 +37,7 @@
import org.lamsfoundation.lams.tool.ToolOutputValue;
import org.lamsfoundation.lams.tool.qa.util.QaQueContentComparator;
import org.lamsfoundation.lams.tool.qa.util.QaQuestionContentDTOComparator;
+import org.lamsfoundation.lams.util.WebUtil;
/**
* A text search condition with a set of questions on answers to which the search should be performed.
@@ -87,7 +88,7 @@
result = true;
for (QaQueContent question : questions) {
String textToMatch = answers[question.getDisplayOrder() - 1];
- textToMatch = removeHTMLtags(textToMatch);
+ textToMatch = WebUtil.removeHTMLtags(textToMatch);
result &= matches(textToMatch);
// if at least one answer does not satisfy the condition, there is no need to look further
if (!result) {
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaContentDAO.java
===================================================================
diff -u -r97aceb8f087c5d2613e004dc2be171ac8acae574 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaContentDAO.java (.../IQaContentDAO.java) (revision 97aceb8f087c5d2613e004dc2be171ac8acae574)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaContentDAO.java (.../IQaContentDAO.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -57,4 +57,6 @@
public int countUserResponsed(QaContent content);
public void deleteCondition(QaCondition condition);
+
+ public void removeQuestionsFromCache(QaContent qaContent);
}
\ No newline at end of file
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaQueContentDAO.java
===================================================================
diff -u -r0db83894504dc7652d3670a6ce496605b961faa1 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaQueContentDAO.java (.../IQaQueContentDAO.java) (revision 0db83894504dc7652d3670a6ce496605b961faa1)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaQueContentDAO.java (.../IQaQueContentDAO.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -44,7 +44,7 @@
public void createQueContent(QaQueContent queContent);
- public void updateQaQueContent(QaQueContent qaQueContent);
+ public void saveOrUpdateQaQueContent(QaQueContent qaQueContent);
public void removeQueContent(long qaQueContentId);
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaContentDAO.java
===================================================================
diff -u -r97aceb8f087c5d2613e004dc2be171ac8acae574 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaContentDAO.java (.../QaContentDAO.java) (revision 97aceb8f087c5d2613e004dc2be171ac8acae574)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaContentDAO.java (.../QaContentDAO.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -24,13 +24,15 @@
package org.lamsfoundation.lams.tool.qa.dao.hibernate;
import java.util.List;
+import java.util.Set;
import org.apache.log4j.Logger;
import org.hibernate.FlushMode;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.lamsfoundation.lams.tool.qa.QaCondition;
import org.lamsfoundation.lams.tool.qa.QaContent;
+import org.lamsfoundation.lams.tool.qa.QaQueContent;
import org.lamsfoundation.lams.tool.qa.dao.IQaContentDAO;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.HibernateTemplate;
@@ -151,4 +153,15 @@
}
}
+ public void removeQuestionsFromCache(QaContent qaContent) {
+ if (qaContent != null) {
+
+ for (QaQueContent question : (Set) qaContent.getQaQueContents()) {
+ getHibernateTemplate().evict(question);
+ }
+ getHibernateTemplate().evict(qaContent);
+ }
+
+ }
+
}
\ No newline at end of file
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueContentDAO.java
===================================================================
diff -u -r0db83894504dc7652d3670a6ce496605b961faa1 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueContentDAO.java (.../QaQueContentDAO.java) (revision 0db83894504dc7652d3670a6ce496605b961faa1)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueContentDAO.java (.../QaQueContentDAO.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -34,150 +34,120 @@
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
-
-
-
/**
* @author Ozgur Demirtas
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
+ *
+ * TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code
+ * Templates
*/
public class QaQueContentDAO extends HibernateDaoSupport implements IQaQueContentDAO {
- static Logger logger = Logger.getLogger(QaQueContentDAO.class.getName());
- private static final String LOAD_QUESTION_CONTENT_BY_CONTENT_ID = "from qaQueContent in class QaQueContent where qaQueContent.qaContentId=:qaContentId";
- private static final String GET_QUESTION_IDS_FOR_CONTENT = "select qaQueContent.qaQueContentId from QaQueContent qaQueContent where qaQueContent.qaContentId = :qa";
- private static final String LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT = "from qaQueContent in class QaQueContent where qaQueContent.question=:question and qaQueContent.qaContentId=:qaContentId";
- private static final String LOAD_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from qaQueContent in class QaQueContent where qaQueContent.displayOrder=:displayOrder and qaQueContent.qaContentId=:qaContentId";
- private static final String SORT_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from qaQueContent in class QaQueContent where qaQueContent.qaContentId=:qaContentId order by qaQueContent.displayOrder";
-
- public QaQueContent getToolDefaultQuestionContent(final long qaContentId)
- {
+ static Logger logger = Logger.getLogger(QaQueContentDAO.class.getName());
+ private static final String LOAD_QUESTION_CONTENT_BY_CONTENT_ID = "from qaQueContent in class QaQueContent where qaQueContent.qaContentId=:qaContentId";
+ private static final String GET_QUESTION_IDS_FOR_CONTENT = "select qaQueContent.qaQueContentId from QaQueContent qaQueContent where qaQueContent.qaContentId = :qa";
+ private static final String LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT = "from qaQueContent in class QaQueContent where qaQueContent.question=:question and qaQueContent.qaContentId=:qaContentId";
+ private static final String LOAD_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from qaQueContent in class QaQueContent where qaQueContent.displayOrder=:displayOrder and qaQueContent.qaContentId=:qaContentId";
+ private static final String SORT_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from qaQueContent in class QaQueContent where qaQueContent.qaContentId=:qaContentId order by qaQueContent.displayOrder";
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_CONTENT_ID)
- .setLong("qaContentId", qaContentId)
- .list();
+ public QaQueContent getToolDefaultQuestionContent(final long qaContentId) {
- if(list != null && list.size() > 0){
- QaQueContent qa = (QaQueContent) list.get(0);
- return qa;
- }
- return null;
- }
-
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(QaQueContentDAO.LOAD_QUESTION_CONTENT_BY_CONTENT_ID).setLong(
+ "qaContentId", qaContentId).list();
- public QaQueContent getQaQueById(long qaQueContentId)
- {
- String query = "from QaQueContent as qu where qu.qaQueContentId = ?";
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(query)
- .setLong(0,qaQueContentId)
- .list();
-
- if(list != null && list.size() > 0){
- QaQueContent qa = (QaQueContent) list.get(0);
- return qa;
- }
- return null;
- }
+ if (list != null && list.size() > 0) {
+ QaQueContent qa = (QaQueContent) list.get(0);
+ return qa;
+ }
+ return null;
+ }
-
- public QaQueContent getQuestionContentByQuestionText(final String question, Long qaContentId)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
+ public QaQueContent getQaQueById(long qaQueContentId) {
+ String query = "from QaQueContent as qu where qu.qaQueContentId = ?";
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(query).setLong(0, qaQueContentId).list();
- List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT)
- .setString("question", question)
- .setLong("qaContentId", qaContentId.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- QaQueContent qa = (QaQueContent) list.get(0);
- return qa;
- }
- return null;
- }
+ if (list != null && list.size() > 0) {
+ QaQueContent qa = (QaQueContent) list.get(0);
+ return qa;
+ }
+ return null;
+ }
+ public QaQueContent getQuestionContentByQuestionText(final String question, Long qaContentId) {
+ HibernateTemplate templ = this.getHibernateTemplate();
- public QaQueContent getQuestionContentByDisplayOrder(Long displayOrder, Long qaContentId)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(QaQueContentDAO.LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT).setString(
+ "question", question).setLong("qaContentId", qaContentId.longValue()).list();
- List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_DISPLAY_ORDER)
- .setLong("displayOrder", displayOrder.longValue())
- .setLong("qaContentId", qaContentId.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- QaQueContent qa = (QaQueContent) list.get(0);
- return qa;
- }
- return null;
- }
+ if (list != null && list.size() > 0) {
+ QaQueContent qa = (QaQueContent) list.get(0);
+ return qa;
+ }
+ return null;
+ }
- public List getAllQuestionEntriesSorted(final long qaContentId)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(SORT_QUESTION_CONTENT_BY_DISPLAY_ORDER)
- .setLong("qaContentId", qaContentId)
- .list();
+ public QaQueContent getQuestionContentByDisplayOrder(Long displayOrder, Long qaContentId) {
+ HibernateTemplate templ = this.getHibernateTemplate();
- return list;
- }
+ List list = getSession().createQuery(QaQueContentDAO.LOAD_QUESTION_CONTENT_BY_DISPLAY_ORDER).setLong(
+ "displayOrder", displayOrder.longValue()).setLong("qaContentId", qaContentId.longValue()).list();
+ if (list != null && list.size() > 0) {
+ QaQueContent qa = (QaQueContent) list.get(0);
+ return qa;
+ }
+ return null;
+ }
- public List getQuestionIndsForContent(QaContent qa)
- {
-
- List listDefaultQuestionIds=(getHibernateTemplate().findByNamedParam(GET_QUESTION_IDS_FOR_CONTENT,
- "qa",
- qa));
-
- return listDefaultQuestionIds;
- }
-
- public List getAllQuestionEntries(final long qaContentId)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_CONTENT_ID)
- .setLong("qaContentId", qaContentId)
- .list();
+ public List getAllQuestionEntriesSorted(final long qaContentId) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(QaQueContentDAO.SORT_QUESTION_CONTENT_BY_DISPLAY_ORDER).setLong(
+ "qaContentId", qaContentId).list();
- return list;
- }
-
-
- public void createQueContent(QaQueContent queContent)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().save(queContent);
- }
-
- public void updateQaQueContent(QaQueContent qaQueContent)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().update(qaQueContent);
- }
+ return list;
+ }
-
- public void removeQueContent(long qaQueContentId)
- {
- QaQueContent qaQueContent= (QaQueContent) this.getHibernateTemplate().load(QaQueContent.class, new Long(qaQueContentId));
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().delete(qaQueContent);
- }
-
-
- public void removeQaQueContent(QaQueContent qaQueContent)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().delete(qaQueContent);
- }
+ public List getQuestionIndsForContent(QaContent qa) {
-
- public List getQaQueContentsByContentId(long qaContentId){
- return getHibernateTemplate().findByNamedParam(LOAD_QUESTION_CONTENT_BY_CONTENT_ID, "qaContentId", new Long(qaContentId));
- }
-}
\ No newline at end of file
+ List listDefaultQuestionIds = getHibernateTemplate().findByNamedParam(
+ QaQueContentDAO.GET_QUESTION_IDS_FOR_CONTENT, "qa", qa);
+
+ return listDefaultQuestionIds;
+ }
+
+ public List getAllQuestionEntries(final long qaContentId) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(QaQueContentDAO.LOAD_QUESTION_CONTENT_BY_CONTENT_ID).setLong(
+ "qaContentId", qaContentId).list();
+
+ return list;
+ }
+
+ public void createQueContent(QaQueContent queContent) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().save(queContent);
+ }
+
+ public void saveOrUpdateQaQueContent(QaQueContent qaQueContent) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().saveOrUpdate(qaQueContent);
+ }
+
+ public void removeQueContent(long qaQueContentId) {
+ QaQueContent qaQueContent = (QaQueContent) this.getHibernateTemplate().load(QaQueContent.class,
+ new Long(qaQueContentId));
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().delete(qaQueContent);
+ }
+
+ public void removeQaQueContent(QaQueContent qaQueContent) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().delete(qaQueContent);
+ }
+
+ public List getQaQueContentsByContentId(long qaContentId) {
+ return getHibernateTemplate().findByNamedParam(QaQueContentDAO.LOAD_QUESTION_CONTENT_BY_CONTENT_ID,
+ "qaContentId", new Long(qaContentId));
+ }
+}
\ No newline at end of file
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dbupdates/patch20081126_updateFrom22.sql
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dbupdates/patch20081126_updateFrom22.sql (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dbupdates/patch20081126_updateFrom22.sql (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -0,0 +1,14 @@
+-- SQL statements to update from LAMS 2.2
+
+-- Turn off autocommit, so nothing is committed if there is an error
+SET AUTOCOMMIT = 0;
+
+----------------------Put all sql statements below here-------------------------
+
+UPDATE lams_tool SET pedagogical_planner_url='tool/laqa11/pedagogicalPlanner.do' WHERE tool_signature='laqa11';
+
+----------------------Put all sql statements above here-------------------------
+
+-- If there were no errors, commit and restore autocommit to on
+COMMIT;
+SET AUTOCOMMIT = 1;
\ No newline at end of file
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java
===================================================================
diff -u -ra82189db31f6fb6dd4a25a50a688b2812e93ddce -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java (.../IQaService.java) (revision a82189db31f6fb6dd4a25a50a688b2812e93ddce)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java (.../IQaService.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -120,7 +120,7 @@
public List getAllQuestionEntriesSorted(final long qaContentId) throws QaApplicationException;
- public void updateQaQueContent(QaQueContent qaQueContent) throws QaApplicationException;
+ public void saveOrUpdateQaQueContent(QaQueContent qaQueContent) throws QaApplicationException;
/**
* Return the qa session object according to the requested session id.
@@ -297,54 +297,63 @@
public String createConditionName(Collection existingConditions);
public void deleteCondition(QaCondition condition);
-
+
public QaCondition createDefaultComplexCondition(QaContent qaContent);
-
+
/**
* Gets the qa config item with the given key
+ *
* @param configKey
* @return
*/
public QaConfigItem getConfigItem(String configKey);
-
+
/**
* Saves or updates a qa config item
+ *
* @param configItem
*/
public void saveOrUpdateConfigItem(QaConfigItem configItem);
-
+
/**
* Gets the set of wizard categories from the database
+ *
* @return
*/
public SortedSet getWizardCategories();
-
+
/**
* Saves the entire set of QaWizardCategories (including the child cognitive skills and questions)
+ *
* @param categories
*/
public void saveOrUpdateQaWizardCategories(SortedSet categories);
-
+
/**
* Deletes a wizard category from the db
+ *
* @param uid
*/
public void deleteWizardCategoryByUID(Long uid);
-
+
/**
* Deletes a wizard cognitive skill from the db
+ *
* @param uid
*/
public void deleteWizardSkillByUID(Long uid);
-
+
/**
* Deletes a wizard question from the db
+ *
* @param uid
*/
public void deleteWizardQuestionByUID(Long uid);
-
+
/**
* Deletes all categories, sub skills and sub questions
*/
public void deleteAllWizardCategories();
+
+ public void removeQuestionsFromCache(QaContent qaContent);
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java
===================================================================
diff -u -ra82189db31f6fb6dd4a25a50a688b2812e93ddce -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java (.../QaServicePOJO.java) (revision a82189db31f6fb6dd4a25a50a688b2812e93ddce)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java (.../QaServicePOJO.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -237,9 +237,9 @@
}
}
- public void updateQaQueContent(QaQueContent qaQueContent) throws QaApplicationException {
+ public void saveOrUpdateQaQueContent(QaQueContent qaQueContent) throws QaApplicationException {
try {
- qaQueContentDAO.updateQaQueContent(qaQueContent);
+ qaQueContentDAO.saveOrUpdateQaQueContent(qaQueContent);
} catch (DataAccessException e) {
throw new QaApplicationException("Exception occured when lams is updating qa content by question: "
@@ -1831,23 +1831,21 @@
public void setQaOutputFactory(QaOutputFactory qaOutputFactory) {
this.qaOutputFactory = qaOutputFactory;
}
-
-
public IQaConfigItemDAO getQaConfigItemDAO() {
- return qaConfigItemDAO;
+ return qaConfigItemDAO;
}
public void setQaConfigItemDAO(IQaConfigItemDAO qaConfigItemDAO) {
- this.qaConfigItemDAO = qaConfigItemDAO;
+ this.qaConfigItemDAO = qaConfigItemDAO;
}
-
+
public IQaWizardDAO getQaWizardDAO() {
- return qaWizardDAO;
+ return qaWizardDAO;
}
public void setQaWizardDAO(IQaWizardDAO qaWizardDAO) {
- this.qaWizardDAO = qaWizardDAO;
+ this.qaWizardDAO = qaWizardDAO;
}
public QaContent getQaContentBySessionId(Long sessionId) {
@@ -1880,79 +1878,83 @@
qaDAO.deleteCondition(condition);
}
}
-
+
public QaCondition createDefaultComplexCondition(QaContent qaContent) {
return getQaOutputFactory().createDefaultComplexCondition(qaContent);
}
-
+
/**
* Gets the qa config item with the given key
+ *
* @param configKey
* @return
*/
- public QaConfigItem getConfigItem(String configKey)
- {
+ public QaConfigItem getConfigItem(String configKey) {
return qaConfigItemDAO.getConfigItemByKey(configKey);
}
-
+
/**
* Saves or updates a qa config item
+ *
* @param configItem
*/
- public void saveOrUpdateConfigItem(QaConfigItem configItem)
- {
+ public void saveOrUpdateConfigItem(QaConfigItem configItem) {
qaConfigItemDAO.saveOrUpdate(configItem);
}
-
+
/**
* Gets the set of wizard categories from the database
+ *
* @return
*/
- public SortedSet getWizardCategories()
- {
+ public SortedSet getWizardCategories() {
return qaWizardDAO.getWizardCategories();
}
-
+
/**
* Saves the entire set of QaWizardCategories (including the child cognitive skills and questions)
+ *
* @param categories
*/
- public void saveOrUpdateQaWizardCategories(SortedSet categories)
- {
+ public void saveOrUpdateQaWizardCategories(SortedSet categories) {
qaWizardDAO.saveOrUpdateCategories(categories);
}
-
+
/**
* Deletes a wizard category from the db
+ *
* @param uid
*/
- public void deleteWizardCategoryByUID(Long uid)
- {
+ public void deleteWizardCategoryByUID(Long uid) {
qaWizardDAO.deleteWizardCategoryByUID(uid);
}
-
+
/**
* Deletes a wizard cognitive skill from the db
+ *
* @param uid
*/
- public void deleteWizardSkillByUID(Long uid)
- {
+ public void deleteWizardSkillByUID(Long uid) {
qaWizardDAO.deleteWizardSkillByUID(uid);
}
-
+
/**
* Deletes a wizard question from the db
+ *
* @param uid
*/
- public void deleteWizardQuestionByUID(Long uid){
+ public void deleteWizardQuestionByUID(Long uid) {
qaWizardDAO.deleteWizardQuestionByUID(uid);
}
-
+
/**
* Deletes all categories, sub skills and sub questions
*/
- public void deleteAllWizardCategories()
- {
+ public void deleteAllWizardCategories() {
qaWizardDAO.deleteAllWizardCategories();
}
+
+ public void removeQuestionsFromCache(QaContent qaContent) {
+ qaDAO.removeQuestionsFromCache(qaContent);
+ }
}
\ No newline at end of file
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java
===================================================================
diff -u -r33f9171c071c179459972380a9b732f1aeec87bf -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 33f9171c071c179459972380a9b732f1aeec87bf)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -713,7 +713,7 @@
existingQaQueContent.setDisplayOrder(displayOrder);
AuthoringUtil.logger.debug("updating the existing question content: " + existingQaQueContent);
- qaService.updateQaQueContent(existingQaQueContent);
+ qaService.saveOrUpdateQaQueContent(existingQaQueContent);
}
}
}
@@ -774,7 +774,7 @@
existingQaQueContent.setDisplayOrder(displayOrder);
AuthoringUtil.logger.debug("updating the existing question content for displayOrder: "
+ existingQaQueContent);
- qaService.updateQaQueContent(existingQaQueContent);
+ qaService.saveOrUpdateQaQueContent(existingQaQueContent);
displayOrder++;
}
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringConditionAction.java
===================================================================
diff -u -r97aceb8f087c5d2613e004dc2be171ac8acae574 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringConditionAction.java (.../QaAuthoringConditionAction.java) (revision 97aceb8f087c5d2613e004dc2be171ac8acae574)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringConditionAction.java (.../QaAuthoringConditionAction.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -43,7 +43,6 @@
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.util.LabelValueBean;
-import org.lamsfoundation.lams.learningdesign.TextSearchCondition;
import org.lamsfoundation.lams.learningdesign.TextSearchConditionComparator;
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
import org.lamsfoundation.lams.tool.qa.QaCondition;
@@ -384,7 +383,7 @@
for (QaQuestionContentDTO question : questions) {
String nonHTMLQuestion = question.getQuestion();
if (nonHTMLQuestion != null) {
- nonHTMLQuestion = TextSearchCondition.removeHTMLtags(nonHTMLQuestion);
+ nonHTMLQuestion = WebUtil.removeHTMLtags(nonHTMLQuestion);
// we don't want to cite the whole question, so we just leave some first characters; it should be enough
// to recognise the question by a teacher
if (nonHTMLQuestion.length() > QaAppConstants.QUESTION_CUTOFF_INDEX) {
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaPedagogicalPlannerAction.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaPedagogicalPlannerAction.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaPedagogicalPlannerAction.java (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -0,0 +1,129 @@
+/****************************************************************
+ * 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$$ */
+
+package org.lamsfoundation.lams.tool.qa.web;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessages;
+import org.lamsfoundation.lams.tool.qa.QaAppConstants;
+import org.lamsfoundation.lams.tool.qa.QaContent;
+import org.lamsfoundation.lams.tool.qa.QaQueContent;
+import org.lamsfoundation.lams.tool.qa.service.IQaService;
+import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.action.LamsDispatchAction;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+public class QaPedagogicalPlannerAction extends LamsDispatchAction {
+
+ private static Logger logger = Logger.getLogger(QaPedagogicalPlannerAction.class);
+
+ @Override
+ protected ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ return initPedagogicalPlannerForm(mapping, form, request, response);
+ }
+
+ public ActionForward initPedagogicalPlannerForm(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ QaPedagogicalPlannerForm plannerForm = (QaPedagogicalPlannerForm) form;
+ Long toolContentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID);
+ QaContent qaContent = getQaService().retrieveQa(toolContentID);
+ plannerForm.fillForm(qaContent);
+
+ return mapping.findForward(QaAppConstants.SUCCESS);
+ }
+
+ public ActionForward saveOrUpdatePedagogicalPlannerForm(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response) throws IOException {
+ QaPedagogicalPlannerForm plannerForm = (QaPedagogicalPlannerForm) form;
+ ActionMessages errors = plannerForm.validate();
+ if (errors.isEmpty()) {
+
+ QaContent qaContent = getQaService().retrieveQa(plannerForm.getToolContentID());
+
+ int questionIndex = 0;
+ String question = null;
+
+ do {
+ question = plannerForm.getQuestion(questionIndex);
+ if (StringUtils.isEmpty(question)) {
+ plannerForm.removeQuestion(questionIndex);
+ } else {
+ if (questionIndex < qaContent.getQaQueContents().size()) {
+ QaQueContent qaQueContent = getQaService().getQuestionContentByDisplayOrder(
+ (long) questionIndex, qaContent.getUid());
+ qaQueContent.setQuestion(question);
+ getQaService().saveOrUpdateQaQueContent(qaQueContent);
+
+ } else {
+ QaQueContent qaQueContent = new QaQueContent();
+ qaQueContent.setDisplayOrder(questionIndex);
+ qaQueContent.setIsOptional(false);
+ qaQueContent.setQaContent(qaContent);
+ qaQueContent.setQaContentId(qaContent.getQaContentId());
+ qaQueContent.setQuestion(question);
+ getQaService().saveOrUpdateQaQueContent(qaQueContent);
+ }
+ questionIndex++;
+ }
+ } while (question != null);
+ if (questionIndex < qaContent.getQaQueContents().size()) {
+ getQaService().removeQuestionsFromCache(qaContent);
+ for (; questionIndex < qaContent.getQaQueContents().size(); questionIndex++) {
+ QaQueContent qaQueContent = getQaService().getQuestionContentByDisplayOrder((long) questionIndex,
+ qaContent.getUid());
+ getQaService().removeQaQueContent(qaQueContent);
+ }
+ }
+ } else {
+ saveErrors(request, errors);
+ }
+ return mapping.findForward(QaAppConstants.SUCCESS);
+ }
+
+ public ActionForward createPedagogicalPlannerQuestion(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response) {
+ QaPedagogicalPlannerForm plannerForm = (QaPedagogicalPlannerForm) form;
+ plannerForm.setQuestion(plannerForm.getQuestionCount().intValue(), "");
+ return mapping.findForward(QaAppConstants.SUCCESS);
+ }
+
+ private IQaService getQaService() {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
+ .getServletContext());
+ return QaServiceProxy.getQaService(getServlet().getServletContext());
+ }
+}
\ No newline at end of file
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaPedagogicalPlannerForm.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaPedagogicalPlannerForm.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaPedagogicalPlannerForm.java (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -0,0 +1,108 @@
+/****************************************************************
+ * 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 version 2.0
+ * 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$ */
+package org.lamsfoundation.lams.tool.qa.web;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.lamsfoundation.lams.tool.qa.QaContent;
+import org.lamsfoundation.lams.tool.qa.QaQueContent;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.planner.PedagogicalPlannerForm;
+
+public class QaPedagogicalPlannerForm extends PedagogicalPlannerForm {
+ private List question;
+
+ @Override
+ public ActionMessages validate() {
+ ActionMessages errors = new ActionMessages();
+ boolean valid = true;
+ boolean allEmpty = true;
+ if (question != null && !question.isEmpty()) {
+ for (String item : question) {
+ if (!StringUtils.isEmpty(item)) {
+ allEmpty = false;
+ break;
+ }
+ }
+ }
+ if (allEmpty) {
+ ActionMessage error = new ActionMessage("questions.none.submitted");
+ errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ valid = false;
+ question = null;
+ }
+
+ setValid(valid);
+ return errors;
+ }
+
+ public void fillForm(QaContent qaContent) {
+ if (qaContent != null) {
+ setToolContentID(qaContent.getQaContentId());
+
+ question = new ArrayList();
+ Set questions = qaContent.getQaQueContents();
+ if (questions != null) {
+ int topicIndex = 0;
+ for (QaQueContent message : (Set) questions) {
+ setQuestion(topicIndex++, WebUtil.removeHTMLtags(message.getQuestion()));
+ }
+ }
+ }
+ }
+
+ public void setQuestion(int number, String Questions) {
+ if (question == null) {
+ question = new ArrayList();
+ }
+ while (number >= question.size()) {
+ question.add(null);
+ }
+ question.set(number, Questions);
+ }
+
+ public String getQuestion(int number) {
+ if (question == null || number >= question.size()) {
+ return null;
+ }
+ return question.get(number);
+ }
+
+ public Integer getQuestionCount() {
+ return question == null ? 0 : question.size();
+ }
+
+ public boolean removeQuestion(int number) {
+ if (question == null || number >= question.size()) {
+ return false;
+ }
+ question.remove(number);
+ return true;
+ }
+}
\ No newline at end of file
Index: lams_tool_laqa/web/WEB-INF/struts-config.xml
===================================================================
diff -u -r80a367726b9e7607851be28429bda54d9b306159 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_laqa/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 80a367726b9e7607851be28429bda54d9b306159)
+++ lams_tool_laqa/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -16,9 +16,10 @@
-
-
-
+
+
+
+
@@ -181,6 +182,23 @@
parameter="downCondition">
+
+
+
+
+
Index: lams_tool_laqa/web/authoring/pedagogicalPlannerForm.jsp
===================================================================
diff -u
--- lams_tool_laqa/web/authoring/pedagogicalPlannerForm.jsp (revision 0)
+++ lams_tool_laqa/web/authoring/pedagogicalPlannerForm.jsp (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -0,0 +1,48 @@
+
+
+<%@ include file="/common/taglibs.jsp"%>
+
+
+
+
+
+
+
+
+
+
+ <%@ include file="/common/messages.jsp"%>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: lams_tool_notebook/build.properties
===================================================================
diff -u -re64f3e306f3139c78e8917240c33ea232e75e848 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_notebook/build.properties (.../build.properties) (revision e64f3e306f3139c78e8917240c33ea232e75e848)
+++ lams_tool_notebook/build.properties (.../build.properties) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -3,7 +3,7 @@
signature=lantbk11
#project version
-tool.version=20080929
+tool.version=20081118
package=org/lamsfoundation/lams/tool/notebook
package.name=org.lamsfoundation.lams.tool.notebook
Index: lams_tool_notebook/db/sql/tool_insert.sql
===================================================================
diff -u -re64f3e306f3139c78e8917240c33ea232e75e848 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_notebook/db/sql/tool_insert.sql (.../tool_insert.sql) (revision e64f3e306f3139c78e8917240c33ea232e75e848)
+++ lams_tool_notebook/db/sql/tool_insert.sql (.../tool_insert.sql) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -23,6 +23,7 @@
export_pfolio_class_url,
contribute_url,
moderation_url,
+pedagogical_planner_url,
help_url,
language_file,
classpath_addition,
@@ -54,6 +55,7 @@
'tool/lantbk11/exportPortfolio?mode=teacher',
'tool/lantbk11/contribute.do',
'tool/lantbk11/moderate.do',
+'tool/lantbk11/pedagogicalPlanner.do',
'http://wiki.lamsfoundation.org/display/lamsdocs/lantbk11',
'org.lamsfoundation.lams.tool.notebook.ApplicationResources',
'lams-tool-lantbk11.jar',
Index: lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/dbupdates/patch20081118_updateFrom22.sql
===================================================================
diff -u
--- lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/dbupdates/patch20081118_updateFrom22.sql (revision 0)
+++ lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/dbupdates/patch20081118_updateFrom22.sql (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -0,0 +1,14 @@
+-- SQL statements to update from LAMS 2.2
+
+-- Turn off autocommit, so nothing is committed if there is an error
+SET AUTOCOMMIT = 0;
+
+----------------------Put all sql statements below here-------------------------
+
+UPDATE lams_tool SET pedagogical_planner_url='tool/lantbk11/pedagogicalPlanner.do' WHERE tool_signature='lantbk11';
+
+----------------------Put all sql statements above here-------------------------
+
+-- If there were no errors, commit and restore autocommit to on
+COMMIT;
+SET AUTOCOMMIT = 1;
\ No newline at end of file
Index: lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/actions/PedagogicalPlannerAction.java
===================================================================
diff -u
--- lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/actions/PedagogicalPlannerAction.java (revision 0)
+++ lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/actions/PedagogicalPlannerAction.java (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -0,0 +1,101 @@
+/****************************************************************
+ * 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$$ */
+
+package org.lamsfoundation.lams.tool.notebook.web.actions;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessages;
+import org.lamsfoundation.lams.tool.notebook.model.Notebook;
+import org.lamsfoundation.lams.tool.notebook.service.INotebookService;
+import org.lamsfoundation.lams.tool.notebook.service.NotebookServiceProxy;
+import org.lamsfoundation.lams.tool.notebook.web.forms.NotebookPedagogicalPlannerForm;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.action.LamsDispatchAction;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+
+/**
+ * @author
+ * @version
+ *
+ * @struts.action path="/pedagogicalPlanner" name="pedagogicalPlannerForm" parameter="dispatch" scope="request"
+ * validate="false"
+ *
+ * @struts.action-forward name="success" path="/pages/authoring/pedagogicalPlannerForm.jsp"
+ */
+public class PedagogicalPlannerAction extends LamsDispatchAction {
+
+ private static Logger logger = Logger.getLogger(PedagogicalPlannerAction.class);
+
+ public INotebookService notebookService;
+
+ @Override
+ protected ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ if (notebookService == null) {
+ notebookService = NotebookServiceProxy.getNotebookService(this.getServlet().getServletContext());
+ }
+ return initPedagogicalPlannerForm(mapping, form, request, response);
+ }
+
+ public ActionForward initPedagogicalPlannerForm(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ NotebookPedagogicalPlannerForm plannerForm = (NotebookPedagogicalPlannerForm) form;
+ Long toolContentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID);
+ Notebook notebook = getNotebookService().getNotebookByContentId(toolContentID);
+ plannerForm.fillForm(notebook);
+ return mapping.findForward("success");
+ }
+
+ public ActionForward saveOrUpdatePedagogicalPlannerForm(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response) throws IOException {
+ NotebookPedagogicalPlannerForm plannerForm = (NotebookPedagogicalPlannerForm) form;
+ ActionMessages errors = plannerForm.validate();
+ if (errors.isEmpty()) {
+ String instructions = plannerForm.getInstructions();
+ Long toolContentID = plannerForm.getToolContentID();
+ Notebook notebook = getNotebookService().getNotebookByContentId(toolContentID);
+ notebook.setInstructions(instructions);
+ getNotebookService().saveOrUpdateNotebook(notebook);
+ } else {
+ saveErrors(request, errors);
+ }
+ return mapping.findForward("success");
+ }
+
+ private INotebookService getNotebookService() {
+ if (notebookService == null) {
+ notebookService = NotebookServiceProxy.getNotebookService(this.getServlet().getServletContext());
+ }
+ return notebookService;
+ }
+
+}
\ No newline at end of file
Index: lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/forms/NotebookPedagogicalPlannerForm.java
===================================================================
diff -u
--- lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/forms/NotebookPedagogicalPlannerForm.java (revision 0)
+++ lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/forms/NotebookPedagogicalPlannerForm.java (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -0,0 +1,49 @@
+/****************************************************************
+ * 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 version 2.0
+ * 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$ */
+package org.lamsfoundation.lams.tool.notebook.web.forms;
+
+import org.lamsfoundation.lams.tool.notebook.model.Notebook;
+import org.lamsfoundation.lams.web.planner.PedagogicalPlannerForm;
+
+/**
+ * @struts.form name="pedagogicalPlannerForm"
+ */
+public class NotebookPedagogicalPlannerForm extends PedagogicalPlannerForm {
+ String instructions;
+
+ public String getInstructions() {
+ return instructions;
+ }
+
+ public void setInstructions(String instructions) {
+ this.instructions = instructions;
+ }
+
+ public void fillForm(Notebook notebook) {
+ if (notebook != null) {
+ setInstructions(notebook.getInstructions());
+ setToolContentID(notebook.getToolContentId());
+ }
+ }
+}
\ No newline at end of file
Index: lams_tool_notebook/web/WEB-INF/struts/struts-config.xml
===================================================================
diff -u -ra74ae929e1b5f6e321e7251fb5bf5f93285c5b92 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_notebook/web/WEB-INF/struts/struts-config.xml (.../struts-config.xml) (revision a74ae929e1b5f6e321e7251fb5bf5f93285c5b92)
+++ lams_tool_notebook/web/WEB-INF/struts/struts-config.xml (.../struts-config.xml) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -14,6 +14,10 @@
+
@@ -117,6 +121,21 @@
redirect="false"
/>
+
+
+
-
+
-   
-   
+
-
-
-
-<%-- Success Messages --%>
-
-
-
-   
-   
-
-
+
\ No newline at end of file
Index: lams_tool_notebook/web/pages/authoring/pedagogicalPlannerForm.jsp
===================================================================
diff -u
--- lams_tool_notebook/web/pages/authoring/pedagogicalPlannerForm.jsp (revision 0)
+++ lams_tool_notebook/web/pages/authoring/pedagogicalPlannerForm.jsp (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -0,0 +1,20 @@
+
+
+<%@ include file="/common/taglibs.jsp"%>
+
+
+
+
+
+ <%@ include file="/common/messages.jsp"%>
+
+ * Defines constants used throughout the application
+ *
*
* @author Ozgur Demirtas
- *
+ *
*/
public interface VoteAppConstants {
- public static final String MY_SIGNATURE ="lavote11";
- public static final String DEFAULT_CONTENT_ID ="defaultContentId";
- public static final String TOOL_SERVICE ="tool_service";
- public static final String ERROR_VOTEAPPLICATION = "error.exception.VoteApplication";
-
- /*
+ public static final String MY_SIGNATURE = "lavote11";
+ public static final String DEFAULT_CONTENT_ID = "defaultContentId";
+ public static final String TOOL_SERVICE = "tool_service";
+ public static final String ERROR_VOTEAPPLICATION = "error.exception.VoteApplication";
+
+ /*
* Struts level constants
*/
- public static final String LOAD ="load";
- public static final String LOAD_QUESTIONS ="load";
- public static final String LOAD_MONITORING ="refreshMonitoring";
- public static final String LOAD_STARTER ="starter";
- public static final String AUTHORING_STARTER ="starter";
- public static final String LEARNING_STARTER ="learningStarter";
- public static final String MONITORING_STARTER ="monitoringStarter";
- public static final String LOAD_LEARNER ="loadLearner";
- public static final String GENERATE_CHART ="generateChart";
- public static final String ALL_NOMINATIONS ="allNominations";
- public static final String LOAD_MONITORING_CONTENT ="loadMonitoring";
- public static final String LOAD_MONITORING_CONTENT_EDITACTIVITY ="loadMonitoringEditActivity";
- public static final String EXPORT_PORTFOLIO = "exportPortfolio";
- public static final String INDIVIDUAL_REPORT ="individualReport";
- public static final String EXIT_PAGE ="exitPage";
- public static final String VIEW_SUMMARY ="viewSummary";
- public static final String REDO_QUESTIONS ="redoQuestions";
- public static final String SINGLE_QUESTION_ANSWERS ="singleQuestionAnswers";
- public static final String RESULTS_SUMMARY ="resultsSummary";
- public static final String ERROR_LIST ="errorList";
- public static final String PREVIEW ="preview";
- public static final String LEARNER_PROGRESS ="learnerProgress";
- public static final String VOTE_NOMINATION_VIEWER ="voteNominationViewer";
- public static final String LEARNER_PROGRESS_USERID ="learnerProgressUserId";
- public static final String MAX_NOMINATION_COUNT ="maxNominationCount";
- public static final String ALLOW_TEXT ="allowText";
- public static final String ALLOW_TEXT_ENTRY ="allowTextEntry";
- public static final String SHOW_RESULTS ="showResults";
- public static final String LOCK_ON_FINISH ="lockOnFinish";
- public static final String REPORT_VIEW_ONLY ="reportViewOnly";
- public static final String USER_ENTRY ="userEntry";
- public static final String RESPONSE_ID ="responseId";
- public static final String CURRENT_UID ="currentUid";
- public static final String SELECTED_TOOL_SESSION_ID ="selectedToolSessionId";
- public static final String DEFAULT_VOTING_TITLE ="Voting";
- public static final String DEFAULT_VOTING_INSTRUCTIONS ="Instructions";
- public static final String NOTEBOOK_ENTRIES_EXIST ="notebookEntriesExist";
- public static final String NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST ="noSessionsNotebookEntriesExist";
- public static final String UUID ="uuid";
- public static final String VOTE_STATS_DTO ="voteStatsDTO";
- public static final String LIST_ALL_GROUPS_DTO ="listAllGroupsDTO";
- public static final String CURRENT_SESSION_NAME ="currentSessionName";
- public static final String REVISITED_ALL_NOMINATIONS ="revisitedAllNominations";
-
- public static final String ATTACHMENT_LIST_KEY = "attachmentListKey";
- public static final String DELETED_ATTACHMENT_LIST_KEY = "deletedAttachmentListKey";
- public static final String ACTIVITY_TITLE_KEY = "activityTitleKey";
- public static final String ACTIVITY_INSTRUCTIONS_KEY = "activityInstructionsKey";
- public static final String VOTE_GENERAL_MONITORING_DTO = "voteGeneralMonitoringDTO";
- public static final String LEARNER_NOTEBOOK ="learnerNotebook";
-
-
- public static final String AUTHORING ="authoring";
- public static final String SOURCE_VOTE_STARTER ="sourceVoteStarter";
- public static final String REMOVABLE_OPTION_INDEX ="removableOptionIndex";
- public static final String AUTHORING_CANCELLED ="authoringCancelled";
- public static final String DEFINE_LATER_EDIT_ACTIVITY ="defineLaterEditActivity";
- public static final String ACTIVE_MODULE ="activeModule";
- public static final String DEFINE_LATER_IN_EDIT_MODE ="defineLaterInEditMode";
- public static final String SUBMIT_SUCCESS ="sbmtSuccess";
- public static final String REQUEST_LEARNING_REPORT ="requestLearningReport";
- public static final String REQUEST_LEARNING_REPORT_PROGRESS ="requestLearningReportProgress";
- public static final String VOTE_GENERAL_AUTHORING_DTO ="voteGeneralAuthoringDTO";
- public static final String MAP_OPTIONS_CONTENT_KEY ="mapOptionsContentKey";
- public static final String HTTP_SESSION_ID ="httpSessionID";
- public static final String LIST_NOMINATION_CONTENT_DTO = "listNominationContentDTO";
- public static final String LIST_NOMINATION_CONTENT_DTO_KEY = "listNominationContentDTOKey";
-
- public static final String DEFAULT_ONLINE_INST ="";
- public static final String DEFAULT_OFFLINE_INST ="";
- public static final String ONLINE_INSTRUCTIONS ="onlineInstructions";
- public static final String OFFLINE_INSTRUCTIONS ="offlineInstructions";
- public static final String ONLINE_INSTRUCTIONS_KEY = "onlineInstructionsKey";
- public static final String OFFLINE_INSTRUCTIONS_KEY = "offlineInstructionsKey";
- public static final String TOTAL_NOMINATION_COUNT = "totalNominationCount";
+ public static final String LOAD = "load";
+ public static final String LOAD_QUESTIONS = "load";
+ public static final String LOAD_MONITORING = "refreshMonitoring";
+ public static final String LOAD_STARTER = "starter";
+ public static final String AUTHORING_STARTER = "starter";
+ public static final String LEARNING_STARTER = "learningStarter";
+ public static final String MONITORING_STARTER = "monitoringStarter";
+ public static final String LOAD_LEARNER = "loadLearner";
+ public static final String GENERATE_CHART = "generateChart";
+ public static final String ALL_NOMINATIONS = "allNominations";
+ public static final String LOAD_MONITORING_CONTENT = "loadMonitoring";
+ public static final String LOAD_MONITORING_CONTENT_EDITACTIVITY = "loadMonitoringEditActivity";
+ public static final String EXPORT_PORTFOLIO = "exportPortfolio";
+ public static final String INDIVIDUAL_REPORT = "individualReport";
+ public static final String EXIT_PAGE = "exitPage";
+ public static final String VIEW_SUMMARY = "viewSummary";
+ public static final String REDO_QUESTIONS = "redoQuestions";
+ public static final String SINGLE_QUESTION_ANSWERS = "singleQuestionAnswers";
+ public static final String RESULTS_SUMMARY = "resultsSummary";
+ public static final String ERROR_LIST = "errorList";
+ public static final String PREVIEW = "preview";
+ public static final String LEARNER_PROGRESS = "learnerProgress";
+ public static final String VOTE_NOMINATION_VIEWER = "voteNominationViewer";
+ public static final String LEARNER_PROGRESS_USERID = "learnerProgressUserId";
+ public static final String MAX_NOMINATION_COUNT = "maxNominationCount";
+ public static final String ALLOW_TEXT = "allowText";
+ public static final String ALLOW_TEXT_ENTRY = "allowTextEntry";
+ public static final String SHOW_RESULTS = "showResults";
+ public static final String LOCK_ON_FINISH = "lockOnFinish";
+ public static final String REPORT_VIEW_ONLY = "reportViewOnly";
+ public static final String USER_ENTRY = "userEntry";
+ public static final String RESPONSE_ID = "responseId";
+ public static final String CURRENT_UID = "currentUid";
+ public static final String SELECTED_TOOL_SESSION_ID = "selectedToolSessionId";
+ public static final String DEFAULT_VOTING_TITLE = "Voting";
+ public static final String DEFAULT_VOTING_INSTRUCTIONS = "Instructions";
+ public static final String NOTEBOOK_ENTRIES_EXIST = "notebookEntriesExist";
+ public static final String NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST = "noSessionsNotebookEntriesExist";
+ public static final String UUID = "uuid";
+ public static final String VOTE_STATS_DTO = "voteStatsDTO";
+ public static final String LIST_ALL_GROUPS_DTO = "listAllGroupsDTO";
+ public static final String CURRENT_SESSION_NAME = "currentSessionName";
+ public static final String REVISITED_ALL_NOMINATIONS = "revisitedAllNominations";
- public static final String EXPORT_PORTFOLIO_DTO = "exportPortfolioDto";
- public static final String NOTEBOOK ="notebook";
- public static final String ENTRY_TEXT ="entryText";
- public static final String REFLECTION_SUBJECT ="reflectionSubject";
- public static final String REFLECTIONS_CONTAINER_DTO ="reflectionsContainerDTO";
-
-
+ public static final String ATTACHMENT_LIST_KEY = "attachmentListKey";
+ public static final String DELETED_ATTACHMENT_LIST_KEY = "deletedAttachmentListKey";
+ public static final String ACTIVITY_TITLE_KEY = "activityTitleKey";
+ public static final String ACTIVITY_INSTRUCTIONS_KEY = "activityInstructionsKey";
+ public static final String VOTE_GENERAL_MONITORING_DTO = "voteGeneralMonitoringDTO";
+ public static final String LEARNER_NOTEBOOK = "learnerNotebook";
+
+ public static final String AUTHORING = "authoring";
+ public static final String SOURCE_VOTE_STARTER = "sourceVoteStarter";
+ public static final String REMOVABLE_OPTION_INDEX = "removableOptionIndex";
+ public static final String AUTHORING_CANCELLED = "authoringCancelled";
+ public static final String DEFINE_LATER_EDIT_ACTIVITY = "defineLaterEditActivity";
+ public static final String ACTIVE_MODULE = "activeModule";
+ public static final String DEFINE_LATER_IN_EDIT_MODE = "defineLaterInEditMode";
+ public static final String SUBMIT_SUCCESS = "sbmtSuccess";
+ public static final String REQUEST_LEARNING_REPORT = "requestLearningReport";
+ public static final String REQUEST_LEARNING_REPORT_PROGRESS = "requestLearningReportProgress";
+ public static final String VOTE_GENERAL_AUTHORING_DTO = "voteGeneralAuthoringDTO";
+ public static final String MAP_OPTIONS_CONTENT_KEY = "mapOptionsContentKey";
+ public static final String HTTP_SESSION_ID = "httpSessionID";
+ public static final String LIST_NOMINATION_CONTENT_DTO = "listNominationContentDTO";
+ public static final String LIST_NOMINATION_CONTENT_DTO_KEY = "listNominationContentDTOKey";
+
+ public static final String DEFAULT_ONLINE_INST = "";
+ public static final String DEFAULT_OFFLINE_INST = "";
+ public static final String ONLINE_INSTRUCTIONS = "onlineInstructions";
+ public static final String OFFLINE_INSTRUCTIONS = "offlineInstructions";
+ public static final String ONLINE_INSTRUCTIONS_KEY = "onlineInstructionsKey";
+ public static final String OFFLINE_INSTRUCTIONS_KEY = "offlineInstructionsKey";
+ public static final String TOTAL_NOMINATION_COUNT = "totalNominationCount";
+
+ public static final String EXPORT_PORTFOLIO_DTO = "exportPortfolioDto";
+ public static final String NOTEBOOK = "notebook";
+ public static final String ENTRY_TEXT = "entryText";
+ public static final String REFLECTION_SUBJECT = "reflectionSubject";
+ public static final String REFLECTIONS_CONTAINER_DTO = "reflectionsContainerDTO";
+
/*
* authoring mode controllers
- */
- public static final String IS_ADD_QUESTION ="isAddQuestion";
- public static final String IS_REMOVE_QUESTION ="isRemoveQuestion";
- public static final String IS_REMOVE_CONTENT ="isRemoveContent";
- public static final String IS_REVISITING_USER ="isRevisitingUser";
- public static final String REVISITING_USER ="revisitingUser";
-
- public static final String USER = "user";
- public static final String TOOL_CONTENT_ID = "toolContentID";
- public static final String TOOL_CONTENT_UID = "toolContentUID";
- public static final String TOOL_SESSION_ID = "toolSessionID";
- public static final String USER_ID = "userID";
- public static final String MAX_OPTION_INDEX = "maxOptionIndex";
- public static final String COPY_TOOL_CONTENT = "copyToolContent";
- public static final String REMOVE_TOOL_CONTENT = "removeToolContent";
- public static final String OPT_INDEX = "optIndex";
-
- public static final String RUN_OFFLINE = "runOffline";
-
+ */
+ public static final String IS_ADD_QUESTION = "isAddQuestion";
+ public static final String IS_REMOVE_QUESTION = "isRemoveQuestion";
+ public static final String IS_REMOVE_CONTENT = "isRemoveContent";
+ public static final String IS_REVISITING_USER = "isRevisitingUser";
+ public static final String REVISITING_USER = "revisitingUser";
+
+ public static final String USER = "user";
+ public static final String TOOL_CONTENT_ID = "toolContentID";
+ public static final String TOOL_CONTENT_UID = "toolContentUID";
+ public static final String TOOL_SESSION_ID = "toolSessionID";
+ public static final String USER_ID = "userID";
+ public static final String MAX_OPTION_INDEX = "maxOptionIndex";
+ public static final String COPY_TOOL_CONTENT = "copyToolContent";
+ public static final String REMOVE_TOOL_CONTENT = "removeToolContent";
+ public static final String OPT_INDEX = "optIndex";
+
+ public static final String RUN_OFFLINE = "runOffline";
+
/*
* refers to number of questions presented initially, we have a single record for default content
*/
- public static final Long INITIAL_QUESTION_COUNT =new Long(1);
- public static final long MAX_QUESTION_COUNT =20;
- public static final long MAX_OPTION_COUNT =10;
- public static final int MAX_ATTEMPT_HISTORY =30;
-
-
+ public static final Long INITIAL_QUESTION_COUNT = new Long(1);
+ public static final long MAX_QUESTION_COUNT = 20;
+ public static final long MAX_OPTION_COUNT = 10;
+ public static final int MAX_ATTEMPT_HISTORY = 30;
+
/*
* authoring mode constants
*/
- public static final String IS_DEFINE_LATER ="isDefineLater";
- public static final String DEFAULT_CONTENT_ID_STR ="defaultContentIdStr";
- public static final String DEFAULT_QUESTION_CONTENT ="defaultQuestionContent";
- public static final String DEFAULT_OPTION_CONTENT ="defaultOptionContent";
- public static final String MAP_QUESTIONS_CONTENT ="mapQuestionsContent";
- public static final String MAP_QUESTION_CONTENT ="mapQuestionContent";
- public static final String MAP_OPTIONS_CONTENT ="mapOptionsContent";
- public static final String MAP_VOTERATES_CONTENT ="mapVoteRatesContent";
- public static final String MAP_STANDARD_USER_COUNT ="mapStandardUserCount";
- public static final String MAP_STANDARD_NOMINATIONS_VISIBILITY ="mapStandardNominationsVisibility";
- public static final String MAP_STANDARD_NOMINATIONS_CONTENT ="mapStandardNominationsContent";
- public static final String MAP_STANDARD_NOMINATIONS_HTMLED_CONTENT ="mapStandardNominationsHTMLedContent";
- public static final String MAP_STANDARD_RATES_CONTENT ="mapStandardRatesContent";
- public static final String MAP_OPTIONS_CONTENT_FCK ="mapOptionsContentFck";
- public static final String MAP_DEFAULTOPTIONS_CONTENT ="mapDefaultOptionsContent";
- public static final String MAP_DISABLED_QUESTIONS ="mapDisabledQuestions";
- public static final String MAP_GENERAL_OPTIONS_CONTENT ="mapGeneralOptionsContent";
- public static final String MAP_GENERAL_SELECTED_OPTIONS_CONTENT ="mapGeneralSelectedOptionsContent";
- public static final String MAP_STARTUP_GENERAL_OPTIONS_CONTENT ="mapStartupGeneralOptionsContent";
- public static final String MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT ="mapStartupGeneralSelectedOptionsContent";
- public static final String LIST_GENERAL_CHECKED_OPTIONS_CONTENT ="listGeneralCheckedOptionsContent";
- public static final String MAP_STUDENTS_VOTED ="mapStudentsVoted";
- public static final String LIST_USER_ENTRIES_CONTENT ="listUserEntriesContent";
-
- public static final String QUESTIONS_WITHNO_OPTIONS ="questionsWithNoOptions";
- public static final String VOTE_GENERAL_LEARNER_FLOW_DTO ="voteGeneralLearnerFlowDTO";
-
- public static final String MAP_GENERAL_CHECKED_OPTIONS_CONTENT ="mapGeneralCheckedOptionsContent";
- public static final String MAP_LEARNER_QUESTIONS_CONTENT ="mapLearnerQuestionsContent";
- public static final String MAP_LEARNER_CHECKED_OPTIONS_CONTENT ="mapLearnerCheckedOptionsContent";
- public static final String MAP_VIEWONLY_QUESTION_CONTENT_LEARNER ="mapViewOnlyQuestionContentLearner";
- public static final String MAP_QUE_ATTEMPTS ="mapQueAttempts";
- public static final String LIST_USER_ENTRIES ="listUserEntries";
- public static final String IS_PORTFOLIO_EXPORT ="isPortfolioExport";
- public static final String PORTFOLIO_EXPORT_MODE ="portfolioExportMode";
-
- public static final String SELECTED_QUESTION ="selectedQuestion";
- public static final String SELECTED_QUESTION_INDEX ="selectedQuestionIndex";
- public static final String DEFAULT_QUESTION_UID ="defaultQuestionUid";
-
- public static final String TITLE ="title";
- public static final String INSTRUCTIONS ="instructions";
- public static final String CREATION_DATE ="creationDate";
- public static final String DEFINE_LATER ="defineLater";
- public static final String VIEW_ANSWERS ="viewAnswers";
-
- public static final String EDIT_ACTIVITY_DTO ="editActivityDTO";
-
- public static final String REFLECT ="reflect";
- public static final String ON ="ON";
- public static final String OFF ="OFF";
- public static final String RICHTEXT_FEEDBACK_CORRECT ="richTextFeedbackCorrect";
- public static final String RICHTEXT_INCORRECT_FEEDBACK ="richTextIncorrectFeedback";
- public static final String RICHTEXT_CORRECT_FEEDBACK ="richTextCorrectFeedback";
- public static final String RICHTEXT_FEEDBACK_INCORRECT ="richTextFeedbackInCorrect";
- public static final String RICHTEXT_OFFLINEINSTRUCTIONS ="richTextOfflineInstructions";
- public static final String RICHTEXT_ONLINEINSTRUCTIONS ="richTextOnlineInstructions";
- public static final String RICHTEXT_TITLE ="richTextTitle";
- public static final String RICHTEXT_INSTRUCTIONS ="richTextInstructions";
- public static final String RICHTEXT_BLANK ="
";
- public static final String SUBMIT_OFFLINE_FILE ="submitOfflineFile";
- public static final String SUBMIT_ONLINE_FILE ="submitOnlineFile";
- public static final String LIST_UPLOADED_OFFLINE_FILENAMES ="listUploadedOfflineFileNames";
- public static final String LIST_UPLOADED_OFFLINE_FILENAMES_KEY ="listUploadedOfflineFileNamesKey";
- public static final String LIST_UPLOADED_ONLINE_FILENAMES ="listUploadedOnlineFileNames";
- public static final String LIST_UPLOADED_ONLINE_FILENAMES_KEY ="listUploadedOnlineFileNamesKey";
- public static final String LIST_OFFLINEFILES_METADATA ="listOfflineFilesMetadata";
- public static final String LIST_OFFLINEFILES_METADATA_KEY ="listOfflineFilesMetadataKey";
- public static final String LIST_ONLINEFILES_METADATA ="listOnlineFilesMetadata";
- public static final String LIST_ONLINEFILES_METADATA_KEY ="listOnlineFilesMetadataKey";
- public static final String LIST_VOTE_ALLSESSIONS_DTO ="listVoteAllSessionsDTO";
- public static final String ATTACHMENT_LIST ="attachmentList";
- public static final String DELETED_ATTACHMENT_LIST ="deletedAttachmentList";
-
- public static final String COUNT_SESSION_COMPLETE ="countSessionComplete";
- public static final String COUNT_ALL_USERS ="countAllUsers";
- public static final String COUNT_MAX_ATTEMPT ="countMaxAttempt";
-
+ public static final String IS_DEFINE_LATER = "isDefineLater";
+ public static final String DEFAULT_CONTENT_ID_STR = "defaultContentIdStr";
+ public static final String DEFAULT_QUESTION_CONTENT = "defaultQuestionContent";
+ public static final String DEFAULT_OPTION_CONTENT = "defaultOptionContent";
+ public static final String MAP_QUESTIONS_CONTENT = "mapQuestionsContent";
+ public static final String MAP_QUESTION_CONTENT = "mapQuestionContent";
+ public static final String MAP_OPTIONS_CONTENT = "mapOptionsContent";
+ public static final String MAP_VOTERATES_CONTENT = "mapVoteRatesContent";
+ public static final String MAP_STANDARD_USER_COUNT = "mapStandardUserCount";
+ public static final String MAP_STANDARD_NOMINATIONS_VISIBILITY = "mapStandardNominationsVisibility";
+ public static final String MAP_STANDARD_NOMINATIONS_CONTENT = "mapStandardNominationsContent";
+ public static final String MAP_STANDARD_NOMINATIONS_HTMLED_CONTENT = "mapStandardNominationsHTMLedContent";
+ public static final String MAP_STANDARD_RATES_CONTENT = "mapStandardRatesContent";
+ public static final String MAP_OPTIONS_CONTENT_FCK = "mapOptionsContentFck";
+ public static final String MAP_DEFAULTOPTIONS_CONTENT = "mapDefaultOptionsContent";
+ public static final String MAP_DISABLED_QUESTIONS = "mapDisabledQuestions";
+ public static final String MAP_GENERAL_OPTIONS_CONTENT = "mapGeneralOptionsContent";
+ public static final String MAP_GENERAL_SELECTED_OPTIONS_CONTENT = "mapGeneralSelectedOptionsContent";
+ public static final String MAP_STARTUP_GENERAL_OPTIONS_CONTENT = "mapStartupGeneralOptionsContent";
+ public static final String MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT = "mapStartupGeneralSelectedOptionsContent";
+ public static final String LIST_GENERAL_CHECKED_OPTIONS_CONTENT = "listGeneralCheckedOptionsContent";
+ public static final String MAP_STUDENTS_VOTED = "mapStudentsVoted";
+ public static final String LIST_USER_ENTRIES_CONTENT = "listUserEntriesContent";
+
+ public static final String QUESTIONS_WITHNO_OPTIONS = "questionsWithNoOptions";
+ public static final String VOTE_GENERAL_LEARNER_FLOW_DTO = "voteGeneralLearnerFlowDTO";
+
+ public static final String MAP_GENERAL_CHECKED_OPTIONS_CONTENT = "mapGeneralCheckedOptionsContent";
+ public static final String MAP_LEARNER_QUESTIONS_CONTENT = "mapLearnerQuestionsContent";
+ public static final String MAP_LEARNER_CHECKED_OPTIONS_CONTENT = "mapLearnerCheckedOptionsContent";
+ public static final String MAP_VIEWONLY_QUESTION_CONTENT_LEARNER = "mapViewOnlyQuestionContentLearner";
+ public static final String MAP_QUE_ATTEMPTS = "mapQueAttempts";
+ public static final String LIST_USER_ENTRIES = "listUserEntries";
+ public static final String IS_PORTFOLIO_EXPORT = "isPortfolioExport";
+ public static final String PORTFOLIO_EXPORT_MODE = "portfolioExportMode";
+
+ public static final String SELECTED_QUESTION = "selectedQuestion";
+ public static final String SELECTED_QUESTION_INDEX = "selectedQuestionIndex";
+ public static final String DEFAULT_QUESTION_UID = "defaultQuestionUid";
+
+ public static final String TITLE = "title";
+ public static final String INSTRUCTIONS = "instructions";
+ public static final String CREATION_DATE = "creationDate";
+ public static final String DEFINE_LATER = "defineLater";
+ public static final String VIEW_ANSWERS = "viewAnswers";
+
+ public static final String EDIT_ACTIVITY_DTO = "editActivityDTO";
+
+ public static final String REFLECT = "reflect";
+ public static final String ON = "ON";
+ public static final String OFF = "OFF";
+ public static final String RICHTEXT_FEEDBACK_CORRECT = "richTextFeedbackCorrect";
+ public static final String RICHTEXT_INCORRECT_FEEDBACK = "richTextIncorrectFeedback";
+ public static final String RICHTEXT_CORRECT_FEEDBACK = "richTextCorrectFeedback";
+ public static final String RICHTEXT_FEEDBACK_INCORRECT = "richTextFeedbackInCorrect";
+ public static final String RICHTEXT_OFFLINEINSTRUCTIONS = "richTextOfflineInstructions";
+ public static final String RICHTEXT_ONLINEINSTRUCTIONS = "richTextOnlineInstructions";
+ public static final String RICHTEXT_TITLE = "richTextTitle";
+ public static final String RICHTEXT_INSTRUCTIONS = "richTextInstructions";
+ public static final String RICHTEXT_BLANK = "
";
+ public static final String SUBMIT_OFFLINE_FILE = "submitOfflineFile";
+ public static final String SUBMIT_ONLINE_FILE = "submitOnlineFile";
+ public static final String LIST_UPLOADED_OFFLINE_FILENAMES = "listUploadedOfflineFileNames";
+ public static final String LIST_UPLOADED_OFFLINE_FILENAMES_KEY = "listUploadedOfflineFileNamesKey";
+ public static final String LIST_UPLOADED_ONLINE_FILENAMES = "listUploadedOnlineFileNames";
+ public static final String LIST_UPLOADED_ONLINE_FILENAMES_KEY = "listUploadedOnlineFileNamesKey";
+ public static final String LIST_OFFLINEFILES_METADATA = "listOfflineFilesMetadata";
+ public static final String LIST_OFFLINEFILES_METADATA_KEY = "listOfflineFilesMetadataKey";
+ public static final String LIST_ONLINEFILES_METADATA = "listOnlineFilesMetadata";
+ public static final String LIST_ONLINEFILES_METADATA_KEY = "listOnlineFilesMetadataKey";
+ public static final String LIST_VOTE_ALLSESSIONS_DTO = "listVoteAllSessionsDTO";
+ public static final String ATTACHMENT_LIST = "attachmentList";
+ public static final String DELETED_ATTACHMENT_LIST = "deletedAttachmentList";
+
+ public static final String COUNT_SESSION_COMPLETE = "countSessionComplete";
+ public static final String COUNT_ALL_USERS = "countAllUsers";
+ public static final String COUNT_MAX_ATTEMPT = "countMaxAttempt";
+
/*
* the learner or monitoring environment provides toolSessionId
*/
- public final long ONE_DAY =60 * 60 * 1000 * 24;
- public final static String NOT_ATTEMPTED ="NOT_ATTEMPTED";
- public final static String INCOMPLETE ="INCOMPLETE";
- public static final String COMPLETED ="COMPLETED";
-
- public static final String MAP_TOOL_SESSIONS ="mapToolSessions";
- public static final Integer MAX_TOOL_SESSION_COUNT =new Integer(500);
- public static final String IS_TOOL_SESSION_CHANGED ="isToolSessionChanged";
- public static final String OPTION_OFF ="false";
- public static final String ACTIVITY_TITLE ="activityTitle";
- public static final String ACTIVITY_INSTRUCTIONS = "activityInstructions";
- public static final String MONITORING ="monitoring";
- public static final String REMOVABLE_QUESTION_INDEX ="removableQuestionIndex";
- public static final String EXISTS_OPEN_VOTES ="existsOpenVotes";
-
+ public final long ONE_DAY = 60 * 60 * 1000 * 24;
+ public final static String NOT_ATTEMPTED = "NOT_ATTEMPTED";
+ public final static String INCOMPLETE = "INCOMPLETE";
+ public static final String COMPLETED = "COMPLETED";
+
+ public static final String MAP_TOOL_SESSIONS = "mapToolSessions";
+ public static final Integer MAX_TOOL_SESSION_COUNT = new Integer(500);
+ public static final String IS_TOOL_SESSION_CHANGED = "isToolSessionChanged";
+ public static final String OPTION_OFF = "false";
+ public static final String ACTIVITY_TITLE = "activityTitle";
+ public static final String ACTIVITY_INSTRUCTIONS = "activityInstructions";
+ public static final String MONITORING = "monitoring";
+ public static final String REMOVABLE_QUESTION_INDEX = "removableQuestionIndex";
+ public static final String EXISTS_OPEN_VOTES = "existsOpenVotes";
+
/*
* user actions
*/
- public static final String ADD_NEW_QUESTION ="addNewQuestion";
- public static final String REMOVE_QUESTION ="removeQuestion";
- public static final String REMOVE_ALL_CONTENT ="removeAllContent";
- public static final String SUBMIT_ALL_CONTENT ="submitAllContent";
- public static final String SUBMIT_TAB_DONE ="submitTabDone";
+ public static final String ADD_NEW_QUESTION = "addNewQuestion";
+ public static final String REMOVE_QUESTION = "removeQuestion";
+ public static final String REMOVE_ALL_CONTENT = "removeAllContent";
+ public static final String SUBMIT_ALL_CONTENT = "submitAllContent";
+ public static final String SUBMIT_TAB_DONE = "submitTabDone";
-
/* learner mode contants */
- public static final String MAP_QUESTION_CONTENT_LEARNER ="mapQuestionContentLearner";
- public static final String CURRENT_QUESTION_INDEX ="currentQuestionIndex";
- public static final String TOTAL_QUESTION_COUNT ="totalQuestionCount";
- public static final String MAP_ANSWERS ="mapAnswers";
- public static final String CURRENT_ANSWER ="currentAnswer";
- public static final String REPORT_TITLE_LEARNER ="reportTitleLearner";
-
- public static final String IS_TOOL_ACTIVITY_OFFLINE ="isToolActivityOffline";
- public static final String IS_CONTENT_IN_USE ="isContentInUse";
- public static final String IS_MONITORED_CONTENT_IN_USE ="isMonitoredContentInUse";
- public static final String IS_ALL_SESSIONS_COMPLETED ="isAllSessionsCompleted";
- public static final String CHECK_ALL_SESSIONS_COMPLETED ="checkAllSessionsCompleted";
- public static final String FROM_TOOL_CONTENT_ID ="fromToolContentId";
- public static final String TO_TOOL_CONTENT_ID ="toToolContentId";
- public static final String LEARNER_REPORT ="learnerReport";
- public static final String MAP_USER_RESPONSES ="mapUserResponses";
- public static final String MAP_MAIN_REPORT ="mapMainReport";
- public static final String MAP_STATS ="mapStats";
-
+ public static final String MAP_QUESTION_CONTENT_LEARNER = "mapQuestionContentLearner";
+ public static final String CURRENT_QUESTION_INDEX = "currentQuestionIndex";
+ public static final String TOTAL_QUESTION_COUNT = "totalQuestionCount";
+ public static final String MAP_ANSWERS = "mapAnswers";
+ public static final String CURRENT_ANSWER = "currentAnswer";
+ public static final String REPORT_TITLE_LEARNER = "reportTitleLearner";
+
+ public static final String IS_TOOL_ACTIVITY_OFFLINE = "isToolActivityOffline";
+ public static final String IS_CONTENT_IN_USE = "isContentInUse";
+ public static final String IS_MONITORED_CONTENT_IN_USE = "isMonitoredContentInUse";
+ public static final String IS_ALL_SESSIONS_COMPLETED = "isAllSessionsCompleted";
+ public static final String CHECK_ALL_SESSIONS_COMPLETED = "checkAllSessionsCompleted";
+ public static final String FROM_TOOL_CONTENT_ID = "fromToolContentId";
+ public static final String TO_TOOL_CONTENT_ID = "toToolContentId";
+ public static final String LEARNER_REPORT = "learnerReport";
+ public static final String MAP_USER_RESPONSES = "mapUserResponses";
+ public static final String MAP_MAIN_REPORT = "mapMainReport";
+ public static final String MAP_STATS = "mapStats";
+
/*
* Monitoring Mode constants
*/
- public static final String CURRENT_MONITORING_TAB ="currentMonitoringTab";
- public static final String REPORT_TITLE_MONITOR ="reportTitleMonitor";
- public static final String MONITOR_USER_ID ="userId";
- public static final String MONITORING_REPORT ="monitoringReport";
- public static final String MONITORING_ERROR ="monitoringError";
- public static final String MAP_MONITORING_QUESTIONS ="mapMonitoringQuestions";
- public static final String SUMMARY_TOOL_SESSIONS ="summaryToolSessions";
- public static final String SUMMARY_TOOL_SESSIONS_ID ="summaryToolSessionsId";
- public static final String MONITORED_CONTENT_ID ="monitoredContentId";
- public static final String EDITACTIVITY_EDITMODE ="editActivityEditMode";
- public static final String VALIDATION_ERROR ="validationError";
- public static final String FORM_INDEX ="formIndex";
- public static final String CURRENT_MONITORED_TOOL_SESSION ="currentMonitoredToolSession";
- public static final String SELECTION_CASE ="selectionCase";
- public static final String LIST_MONITORED_ANSWERS_CONTAINER_DTO ="listMonitoredAnswersContainerDto";
- public static final String GROUP_NAME ="groupName";
- public static final String TIMEZONE ="timeZone";
- public static final String PREVIEW_ONLY ="previewOnly";
-
- public static final String MODE ="mode";
- public static final String LEARNING_MODE ="learningMode";
- public static final String EXPORT_USER_ID ="exportUserId";
- public static final String SESSION_VOTES_CHART ="Session Votes Chart";
-
+ public static final String CURRENT_MONITORING_TAB = "currentMonitoringTab";
+ public static final String REPORT_TITLE_MONITOR = "reportTitleMonitor";
+ public static final String MONITOR_USER_ID = "userId";
+ public static final String MONITORING_REPORT = "monitoringReport";
+ public static final String MONITORING_ERROR = "monitoringError";
+ public static final String MAP_MONITORING_QUESTIONS = "mapMonitoringQuestions";
+ public static final String SUMMARY_TOOL_SESSIONS = "summaryToolSessions";
+ public static final String SUMMARY_TOOL_SESSIONS_ID = "summaryToolSessionsId";
+ public static final String MONITORED_CONTENT_ID = "monitoredContentId";
+ public static final String EDITACTIVITY_EDITMODE = "editActivityEditMode";
+ public static final String VALIDATION_ERROR = "validationError";
+ public static final String FORM_INDEX = "formIndex";
+ public static final String CURRENT_MONITORED_TOOL_SESSION = "currentMonitoredToolSession";
+ public static final String SELECTION_CASE = "selectionCase";
+ public static final String LIST_MONITORED_ANSWERS_CONTAINER_DTO = "listMonitoredAnswersContainerDto";
+ public static final String GROUP_NAME = "groupName";
+ public static final String TIMEZONE = "timeZone";
+ public static final String PREVIEW_ONLY = "previewOnly";
+
+ public static final String MODE = "mode";
+ public static final String LEARNING_MODE = "learningMode";
+ public static final String EXPORT_USER_ID = "exportUserId";
+ public static final String SESSION_VOTES_CHART = "Session Votes Chart";
+
/*
* exception constants
*/
- public static final String USER_EXCEPTION_WRONG_FORMAT ="userExceptionWrongFormat";
- public static final String USER_EXCEPTION_INCOMPATIBLE_IDS ="userExceptionIncompatibleIds";
- public static final String USER_EXCEPTION_NUMBERFORMAT ="userExceptionNumberFormat";
- public static final String USER_EXCEPTION_CONTENT_DOESNOTEXIST ="userExceptionContentDoesNotExist";
- public static final String USER_EXCEPTION_TOOLSESSION_DOESNOTEXIST ="userExceptionToolSessionDoesNotExist";
- public static final String USER_EXCEPTION_TOOLCONTENT_DOESNOTEXIST ="userExceptionToolContentDoesNotExist";
- public static final String USER_EXCEPTION_LEARNER_REQUIRED ="userExceptionLearnerRequired";
- public static final String USER_EXCEPTION_CONTENTID_REQUIRED ="userExceptionContentIdRequired";
- public static final String USER_EXCEPTION_TOOLSESSIONID_REQUIRED ="userExceptionToolSessionIdRequired";
- public static final String USER_EXCEPTION_TOOLSESSIONID_INCONSISTENT ="userExceptionToolSessionIdInconsistent";
- public static final String USER_EXCEPTION_DEFAULTCONTENT_NOT_AVAILABLE ="userExceptionDefaultContentNotAvailable";
- public static final String USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE ="userExceptionDefaultQuestionContentNotAvailable";
- public static final String USER_EXCEPTION_DEFAULTOPTIONSCONTENT_NOT_AVAILABLE ="userExceptionDefaultOptionsContentNotAvailable";
- public static final String USER_EXCEPTION_USERID_NOTAVAILABLE ="userExceptionUserIdNotAvailable";
- public static final String USER_EXCEPTION_USERID_NOTNUMERIC ="userExceptionUserIdNotNumeric";
- public static final String USER_EXCEPTION_ONLYCONTENT_ANDNOSESSIONS ="userExceptionOnlyContentAndNoSessions";
- public static final String USER_EXCEPTION_USERID_EXISTING ="userExceptionUserIdExisting";
- public static final String USER_EXCEPTION_USER_DOESNOTEXIST ="userExceptionUserDoesNotExist";
- public static final String USER_EXCEPTION_MONITORINGTAB_CONTENTID_REQUIRED ="userExceptionMonitoringTabContentIdRequired";
- public static final String USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP ="userExceptionDefaultContentNotSetup";
- public static final String USER_EXCEPTION_NO_TOOL_SESSIONS ="userExceptionNoToolSessions";
- public static final String USER_EXCEPTION_NO_STUDENT_ACTIVITY ="userExceptionNoStudentActivity";
- public static final String USER_EXCEPTION_MODE_REQUIRED ="userExceptionModeRequired";
- public static final String USER_EXCEPTION_CONTENT_IN_USE ="userExceptionContentInUse";
- public static final String USER_EXCEPTION_CONTENT_BEING_MODIFIED ="userExceptionContentBeingModified";
- public static final String USER_EXCEPTION_CONTENT_RUNOFFLINE ="userExceptionContentRunOffline";
- public static final String USER_EXCEPTION_MODE_INVALID ="userExceptionModeInvalid";
- public static final String USER_EXCEPTION_QUESTION_EMPTY ="userExceptionQuestionEmpty";
- public static final String USER_EXCEPTION_ANSWER_EMPTY ="userExceptionAnswerEmpty";
- public static final String USER_EXCEPTION_ANSWERS_DUPLICATE ="userExceptionAnswersDuplicate";
- public static final String USER_EXCEPTION_OPTIONS_COUNT_ZERO ="userExceptionOptionsCountZero";
- public static final String USER_EXCEPTION_CHKBOXES_EMPTY ="userExceptionChkboxesEmpty";
- public static final String USER_EXCEPTION_SUBMIT_NONE ="userExceptionSubmitNone";
- public static final String USER_EXCEPTION_FILENAME_EMPTY ="userExceptionFilenameEmpty";
- public static final String USER_EXCEPTION_WEIGHT_MUST_EQUAL100 ="userExceptionWeightMustEqual100";
- public static final String USER_EXCEPTION_SINGLE_OPTION ="userExceptionSingleOption";
- public static final String USER_EXCEPTION_OPTIONS_DUPLICATE ="userExceptionOptionsDuplicate";
- public static final String USER_EXCEPTION_MAXNOMINATION_INVALID ="userExceptionMaxNominationInvalid";
+ public static final String USER_EXCEPTION_WRONG_FORMAT = "userExceptionWrongFormat";
+ public static final String USER_EXCEPTION_INCOMPATIBLE_IDS = "userExceptionIncompatibleIds";
+ public static final String USER_EXCEPTION_NUMBERFORMAT = "userExceptionNumberFormat";
+ public static final String USER_EXCEPTION_CONTENT_DOESNOTEXIST = "userExceptionContentDoesNotExist";
+ public static final String USER_EXCEPTION_TOOLSESSION_DOESNOTEXIST = "userExceptionToolSessionDoesNotExist";
+ public static final String USER_EXCEPTION_TOOLCONTENT_DOESNOTEXIST = "userExceptionToolContentDoesNotExist";
+ public static final String USER_EXCEPTION_LEARNER_REQUIRED = "userExceptionLearnerRequired";
+ public static final String USER_EXCEPTION_CONTENTID_REQUIRED = "userExceptionContentIdRequired";
+ public static final String USER_EXCEPTION_TOOLSESSIONID_REQUIRED = "userExceptionToolSessionIdRequired";
+ public static final String USER_EXCEPTION_TOOLSESSIONID_INCONSISTENT = "userExceptionToolSessionIdInconsistent";
+ public static final String USER_EXCEPTION_DEFAULTCONTENT_NOT_AVAILABLE = "userExceptionDefaultContentNotAvailable";
+ public static final String USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE = "userExceptionDefaultQuestionContentNotAvailable";
+ public static final String USER_EXCEPTION_DEFAULTOPTIONSCONTENT_NOT_AVAILABLE = "userExceptionDefaultOptionsContentNotAvailable";
+ public static final String USER_EXCEPTION_USERID_NOTAVAILABLE = "userExceptionUserIdNotAvailable";
+ public static final String USER_EXCEPTION_USERID_NOTNUMERIC = "userExceptionUserIdNotNumeric";
+ public static final String USER_EXCEPTION_ONLYCONTENT_ANDNOSESSIONS = "userExceptionOnlyContentAndNoSessions";
+ public static final String USER_EXCEPTION_USERID_EXISTING = "userExceptionUserIdExisting";
+ public static final String USER_EXCEPTION_USER_DOESNOTEXIST = "userExceptionUserDoesNotExist";
+ public static final String USER_EXCEPTION_MONITORINGTAB_CONTENTID_REQUIRED = "userExceptionMonitoringTabContentIdRequired";
+ public static final String USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP = "userExceptionDefaultContentNotSetup";
+ public static final String USER_EXCEPTION_NO_TOOL_SESSIONS = "userExceptionNoToolSessions";
+ public static final String USER_EXCEPTION_NO_STUDENT_ACTIVITY = "userExceptionNoStudentActivity";
+ public static final String USER_EXCEPTION_MODE_REQUIRED = "userExceptionModeRequired";
+ public static final String USER_EXCEPTION_CONTENT_IN_USE = "userExceptionContentInUse";
+ public static final String USER_EXCEPTION_CONTENT_BEING_MODIFIED = "userExceptionContentBeingModified";
+ public static final String USER_EXCEPTION_CONTENT_RUNOFFLINE = "userExceptionContentRunOffline";
+ public static final String USER_EXCEPTION_MODE_INVALID = "userExceptionModeInvalid";
+ public static final String USER_EXCEPTION_QUESTION_EMPTY = "userExceptionQuestionEmpty";
+ public static final String USER_EXCEPTION_ANSWER_EMPTY = "userExceptionAnswerEmpty";
+ public static final String USER_EXCEPTION_ANSWERS_DUPLICATE = "userExceptionAnswersDuplicate";
+ public static final String USER_EXCEPTION_OPTIONS_COUNT_ZERO = "userExceptionOptionsCountZero";
+ public static final String USER_EXCEPTION_CHKBOXES_EMPTY = "userExceptionChkboxesEmpty";
+ public static final String USER_EXCEPTION_SUBMIT_NONE = "userExceptionSubmitNone";
+ public static final String USER_EXCEPTION_FILENAME_EMPTY = "userExceptionFilenameEmpty";
+ public static final String USER_EXCEPTION_WEIGHT_MUST_EQUAL100 = "userExceptionWeightMustEqual100";
+ public static final String USER_EXCEPTION_SINGLE_OPTION = "userExceptionSingleOption";
+ public static final String USER_EXCEPTION_OPTIONS_DUPLICATE = "userExceptionOptionsDuplicate";
+ public static final String USER_EXCEPTION_MAXNOMINATION_INVALID = "userExceptionMaxNominationInvalid";
+ public static final String SUCCESS = "success";
}
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteContentDAO.java
===================================================================
diff -u -r00759d7592ccc90e8769763524afb69546f641d4 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteContentDAO.java (.../IVoteContentDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteContentDAO.java (.../IVoteContentDAO.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -30,19 +30,21 @@
/**
* @author Ozgur Demirtas
*
- *
Interface that defines the contract for VoteContent access
+ *
+ * Interface that defines the contract for VoteContent access
+ *
*/
public interface IVoteContentDAO {
- public VoteContent getVoteContentByUID(Long uid);
+ public VoteContent getVoteContentByUID(Long uid);
- public VoteContent findVoteContentById(Long voteContentId);
+ public VoteContent findVoteContentById(Long voteContentId);
- public VoteContent getVoteContentBySession(Long voteSessionId);
+ public VoteContent getVoteContentBySession(Long voteSessionId);
public void saveVoteContent(VoteContent voteContent);
public void updateVoteContent(VoteContent voteContent);
-
+
public void saveOrUpdateVote(VoteContent voteContent);
public void removeVote(VoteContent voteContent);
@@ -52,8 +54,10 @@
public void removeVoteSessions(VoteContent voteContent);
public void addVoteSession(Long voteContentId, VoteSession voteSession);
-
+
public List findAll(Class objClass);
-
+
public void flush();
- }
\ No newline at end of file
+
+ public void removeNominationsFromCache(VoteContent voteContent);
+}
\ No newline at end of file
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteContentDAO.java
===================================================================
diff -u -r00759d7592ccc90e8769763524afb69546f641d4 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteContentDAO.java (.../VoteContentDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteContentDAO.java (.../VoteContentDAO.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -23,136 +23,129 @@
package org.lamsfoundation.lams.tool.vote.dao.hibernate;
import java.util.List;
+import java.util.Set;
import org.apache.log4j.Logger;
import org.hibernate.FlushMode;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.lamsfoundation.lams.tool.vote.dao.IVoteContentDAO;
import org.lamsfoundation.lams.tool.vote.pojos.VoteContent;
+import org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent;
import org.lamsfoundation.lams.tool.vote.pojos.VoteSession;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
* @author Ozgur Demirtas
- *
Hibernate implementation for database access to VoteContent for the voting tool.
+ *
+ * Hibernate implementation for database access to VoteContent for the voting tool.
+ *
*/
public class VoteContentDAO extends HibernateDaoSupport implements IVoteContentDAO {
- static Logger logger = Logger.getLogger(VoteContentDAO.class.getName());
-
- private static final String FIND_VOTE_CONTENT = "from " + VoteContent.class.getName() + " as vote where content_id=?";
-
- private static final String LOAD_VOTE_BY_SESSION = "select vote from VoteContent vote left join fetch "
- + "vote.voteSessions session where session.voteSessionId=:sessionId";
+ static Logger logger = Logger.getLogger(VoteContentDAO.class.getName());
- public VoteContent getVoteContentByUID(Long uid)
- {
- return (VoteContent) this.getHibernateTemplate().get(VoteContent.class, uid);
- }
-
- public void saveOrUpdateVote(VoteContent vote)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- logger.debug("before saveOrUpdateVote: " + vote);
- this.getHibernateTemplate().saveOrUpdate(vote);
+ private static final String FIND_VOTE_CONTENT = "from " + VoteContent.class.getName()
+ + " as vote where content_id=?";
+
+ private static final String LOAD_VOTE_BY_SESSION = "select vote from VoteContent vote left join fetch "
+ + "vote.voteSessions session where session.voteSessionId=:sessionId";
+
+ public VoteContent getVoteContentByUID(Long uid) {
+ return (VoteContent) this.getHibernateTemplate().get(VoteContent.class, uid);
}
-
- public VoteContent findVoteContentById(Long voteContentId)
- {
- String query = "from VoteContent as vote where vote.voteContentId = ?";
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(query)
- .setLong(0,voteContentId.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- VoteContent vote = (VoteContent) list.get(0);
- return vote;
- }
- return null;
- }
-
+ public void saveOrUpdateVote(VoteContent vote) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ VoteContentDAO.logger.debug("before saveOrUpdateVote: " + vote);
+ this.getHibernateTemplate().saveOrUpdate(vote);
+ }
- public VoteContent getVoteContentBySession(final Long voteSessionId)
- {
- return (VoteContent) getHibernateTemplate().execute(new HibernateCallback()
- {
+ public VoteContent findVoteContentById(Long voteContentId) {
+ String query = "from VoteContent as vote where vote.voteContentId = ?";
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(query).setLong(0, voteContentId.longValue()).list();
- public Object doInHibernate(Session session) throws HibernateException
- {
- return session.createQuery(LOAD_VOTE_BY_SESSION)
- .setLong("sessionId",
- voteSessionId.longValue())
- .uniqueResult();
- }
- });
+ if (list != null && list.size() > 0) {
+ VoteContent vote = (VoteContent) list.get(0);
+ return vote;
}
-
-
- public void saveVoteContent(VoteContent voteContent)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- logger.debug("before saveOrUpdate");
- this.getHibernateTemplate().saveOrUpdate(voteContent);
- logger.debug("after saveOrUpdate");
+ return null;
}
-
- public void updateVoteContent(VoteContent voteContent)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().update(voteContent);
+
+ public VoteContent getVoteContentBySession(final Long voteSessionId) {
+ return (VoteContent) getHibernateTemplate().execute(new HibernateCallback() {
+
+ public Object doInHibernate(Session session) throws HibernateException {
+ return session.createQuery(VoteContentDAO.LOAD_VOTE_BY_SESSION).setLong("sessionId",
+ voteSessionId.longValue()).uniqueResult();
+ }
+ });
}
-
- public void removeVoteById(Long voteContentId)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- if ( voteContentId != null) {
- List list = getSession().createQuery(FIND_VOTE_CONTENT)
- .setLong(0,voteContentId.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- VoteContent vote = (VoteContent) list.get(0);
- this.getSession().setFlushMode(FlushMode.AUTO);
- templ.delete(vote);
- templ.flush();
- }
- }
+ public void saveVoteContent(VoteContent voteContent) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ VoteContentDAO.logger.debug("before saveOrUpdate");
+ this.getHibernateTemplate().saveOrUpdate(voteContent);
+ VoteContentDAO.logger.debug("after saveOrUpdate");
}
-
- public void removeVote(VoteContent voteContent)
- {
- this.getHibernateTemplate().delete(voteContent);
+
+ public void updateVoteContent(VoteContent voteContent) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().update(voteContent);
}
-
- public void removeVoteSessions(VoteContent voteContent)
- {
- this.getHibernateTemplate().deleteAll(voteContent.getVoteSessions());
+ public void removeVoteById(Long voteContentId) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ if (voteContentId != null) {
+ List list = getSession().createQuery(VoteContentDAO.FIND_VOTE_CONTENT)
+ .setLong(0, voteContentId.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ VoteContent vote = (VoteContent) list.get(0);
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ templ.delete(vote);
+ templ.flush();
+ }
+ }
}
-
- public void addVoteSession(Long voteContentId, VoteSession voteSession)
- {
- VoteContent content = findVoteContentById(voteContentId);
- voteSession.setVoteContent(content);
- content.getVoteSessions().add(voteSession);
- this.getHibernateTemplate().saveOrUpdate(voteSession);
- this.getHibernateTemplate().saveOrUpdate(content);
+ public void removeVote(VoteContent voteContent) {
+ this.getHibernateTemplate().delete(voteContent);
}
-
+
+ public void removeVoteSessions(VoteContent voteContent) {
+ this.getHibernateTemplate().deleteAll(voteContent.getVoteSessions());
+ }
+
+ public void addVoteSession(Long voteContentId, VoteSession voteSession) {
+ VoteContent content = findVoteContentById(voteContentId);
+ voteSession.setVoteContent(content);
+ content.getVoteSessions().add(voteSession);
+ this.getHibernateTemplate().saveOrUpdate(voteSession);
+ this.getHibernateTemplate().saveOrUpdate(content);
+
+ }
+
public List findAll(Class objClass) {
- String query="from obj in class " + objClass.getName();
- return this.getHibernateTemplate().find(query);
+ String query = "from obj in class " + objClass.getName();
+ return this.getHibernateTemplate().find(query);
+ }
+
+ public void flush() {
+ this.getHibernateTemplate().flush();
+ }
+
+ public void removeNominationsFromCache(VoteContent voteContent) {
+ if (voteContent != null) {
+
+ for (VoteQueContent question : (Set) voteContent.getVoteQueContents()) {
+ getHibernateTemplate().evict(question);
+ }
+ getHibernateTemplate().evict(voteContent);
}
-
- public void flush()
- {
- this.getHibernateTemplate().flush();
+
}
}
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dbupdates/patch20081203_updateFrom22.sql
===================================================================
diff -u
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dbupdates/patch20081203_updateFrom22.sql (revision 0)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dbupdates/patch20081203_updateFrom22.sql (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -0,0 +1,14 @@
+-- SQL statements to update from LAMS 2.2
+
+-- Turn off autocommit, so nothing is committed if there is an error
+SET AUTOCOMMIT = 0;
+
+----------------------Put all sql statements below here-------------------------
+
+UPDATE lams_tool SET pedagogical_planner_url='tool/lavote11/pedagogicalPlanner.do' WHERE tool_signature='lavote11';
+
+----------------------Put all sql statements above here-------------------------
+
+-- If there were no errors, commit and restore autocommit to on
+COMMIT;
+SET AUTOCOMMIT = 1;
\ No newline at end of file
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java
===================================================================
diff -u -rf6956d3b109f928cb5529b00da8228d5e25f7a16 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision f6956d3b109f928cb5529b00da8228d5e25f7a16)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -25,15 +25,13 @@
import java.io.InputStream;
import java.util.List;
import java.util.Set;
-import java.util.SortedMap;
import org.lamsfoundation.lams.contentrepository.ITicket;
import org.lamsfoundation.lams.contentrepository.NodeKey;
import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException;
import org.lamsfoundation.lams.lesson.Lesson;
import org.lamsfoundation.lams.notebook.model.NotebookEntry;
import org.lamsfoundation.lams.tool.IToolVO;
-import org.lamsfoundation.lams.tool.ToolOutputDefinition;
import org.lamsfoundation.lams.tool.ToolSessionExportOutputData;
import org.lamsfoundation.lams.tool.exception.DataMissingException;
import org.lamsfoundation.lams.tool.exception.SessionDataExistsException;
@@ -47,249 +45,263 @@
import org.lamsfoundation.lams.tool.vote.pojos.VoteUsrAttempt;
import org.lamsfoundation.lams.usermanagement.User;
-
/**
* @author Ozgur Demirtas
*
- * Interface that defines the contract Voting service provider must follow.
+ * Interface that defines the contract Voting service provider must follow.
*/
-public interface IVoteService
-{
- public void configureContentRepository() throws VoteApplicationException;
-
+public interface IVoteService {
+ public void configureContentRepository() throws VoteApplicationException;
+
public void createVote(VoteContent voteContent) throws VoteApplicationException;
-
+
public VoteContent retrieveVote(Long toolContentID) throws VoteApplicationException;
-
+
public VoteUsrAttempt getAttemptByUID(Long uid) throws VoteApplicationException;
-
+
public void createVoteQue(VoteQueContent voteQueContent) throws VoteApplicationException;
-
+
public void createVoteSession(VoteSession voteSession) throws VoteApplicationException;
-
+
public void createVoteQueUsr(VoteQueUsr voteQueUsr) throws VoteApplicationException;
-
+
public List getUserEnteredVotesForSession(final String userEntry, final Long voteSessionUid);
-
+
public boolean isVoteVisibleForSession(final String userEntry, final Long voteSessionUid);
-
- public VoteQueUsr getVoteUserBySession(final Long queUsrId, final Long voteSessionId) throws VoteApplicationException;
-
- public VoteQueUsr retrieveVoteQueUsr(Long userId) throws VoteApplicationException;
-
- public List getVoteUserBySessionUid(final Long voteSessionUid) throws VoteApplicationException;
-
- public int getCompletedVoteUserBySessionUid(final Long voteSessionUid) throws VoteApplicationException;
-
- public VoteQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long voteContentUid) throws VoteApplicationException;
-
- public List getAttemptsListForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException;
-
- public Set getAttemptsForUserAndSessionUseOpenAnswer(final Long queUsrId, final Long voteSessionId);
-
- public int getLastNominationCount(Long userId) throws VoteApplicationException;
-
- public Set getSessionUserEntriesSet(final Long voteSessionUid) throws VoteApplicationException;
-
+
+ public VoteQueUsr getVoteUserBySession(final Long queUsrId, final Long voteSessionId)
+ throws VoteApplicationException;
+
+ public VoteQueUsr retrieveVoteQueUsr(Long userId) throws VoteApplicationException;
+
+ public List getVoteUserBySessionUid(final Long voteSessionUid) throws VoteApplicationException;
+
+ public int getCompletedVoteUserBySessionUid(final Long voteSessionUid) throws VoteApplicationException;
+
+ public VoteQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long voteContentUid)
+ throws VoteApplicationException;
+
+ public List getAttemptsListForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId)
+ throws VoteApplicationException;
+
+ public Set getAttemptsForUserAndSessionUseOpenAnswer(final Long queUsrId, final Long voteSessionId);
+
+ public int getLastNominationCount(Long userId) throws VoteApplicationException;
+
+ public Set getSessionUserEntriesSet(final Long voteSessionUid) throws VoteApplicationException;
+
public void createVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException;
-
+
public void updateVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException;
-
+
public List getUserRecords(final String userEntry) throws VoteApplicationException;
-
+
public List getUserBySessionOnly(final VoteSession voteSession) throws VoteApplicationException;
-
+
public void hideOpenVote(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException;
-
+
public void showOpenVote(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException;
-
+
public void updateVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException;
-
+
public int getAttemptsForQuestionContent(final Long voteQueContentId) throws VoteApplicationException;
-
+
public boolean studentActivityOccurredStandardAndOpen(VoteContent voteContent) throws VoteApplicationException;
-
+
public int getUserEnteredVotesCountForContent(final Long voteContentUid) throws VoteApplicationException;
-
- public List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid);
-
- public int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionId) throws VoteApplicationException;
-
- public int getAllEntriesCount() throws VoteApplicationException;
-
- public int getSessionEntriesCount(final Long voteSessionId) throws VoteApplicationException;
-
- public int getCompletedSessionEntriesCount(final Long voteSessionUid) throws VoteApplicationException;
-
- public int getUserRecordsEntryCount(final String userEntry) throws VoteApplicationException;
-
- //public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException;
-
- public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId) throws VoteApplicationException;
-
- public VoteUsrAttempt getAttemptsForUserAndQuestionContentAndSession(final Long queUsrId, final Long voteQueContentId, final Long toolSessionUid) throws VoteApplicationException;
-
+
+ public List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId,
+ final Long voteSessionUid);
+
+ public int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionId)
+ throws VoteApplicationException;
+
+ public int getAllEntriesCount() throws VoteApplicationException;
+
+ public int getSessionEntriesCount(final Long voteSessionId) throws VoteApplicationException;
+
+ public int getCompletedSessionEntriesCount(final Long voteSessionUid) throws VoteApplicationException;
+
+ public int getUserRecordsEntryCount(final String userEntry) throws VoteApplicationException;
+
+ // public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId)
+ // throws VoteApplicationException;
+
+ public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId)
+ throws VoteApplicationException;
+
+ public VoteUsrAttempt getAttemptsForUserAndQuestionContentAndSession(final Long queUsrId,
+ final Long voteQueContentId, final Long toolSessionUid) throws VoteApplicationException;
+
public List retrieveVoteQueContentsByToolContentId(long qaContentId) throws VoteApplicationException;
-
+
public VoteQueContent retrieveVoteQueContentByUID(Long uid) throws VoteApplicationException;
-
+
public void removeVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException;
-
+
public VoteQueContent getVoteQueContentByUID(Long uid) throws VoteApplicationException;
-
+
public void saveOrUpdateVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException;
-
+
public void removeQuestionContentByVoteUid(final Long voteContentUid) throws VoteApplicationException;
-
+
public void cleanAllQuestionsSimple(final Long voteContentUid) throws VoteApplicationException;
-
+
public void resetAllQuestions(final Long voteContentUid) throws VoteApplicationException;
-
+
public void cleanAllQuestions(final Long voteContentUid) throws VoteApplicationException;
-
+
public Set getUserEntries() throws VoteApplicationException;
-
+
public List getContentEntries(final Long voteContentUid) throws VoteApplicationException;
-
+
public int getStandardAttemptsForQuestionContentAndContentUid(final Long voteQueContentId, final Long voteContentUid);
-
- public int getSessionUserRecordsEntryCount(final String userEntry, final Long voteSessionUid, IVoteService voteService) throws VoteApplicationException;
-
+
+ public int getSessionUserRecordsEntryCount(final String userEntry, final Long voteSessionUid,
+ IVoteService voteService) throws VoteApplicationException;
+
public List getSessionUserEntries(final Long voteSessionId) throws VoteApplicationException;
-
+
public VoteQueContent getQuestionContentByQuestionText(final String question, final Long voteContentUid);
-
+
public void removeVoteQueContentByUID(Long uid) throws VoteApplicationException;
-
+
public VoteQueUsr getVoteUserByUID(Long uid) throws VoteApplicationException;
-
+
public void updateVoteUser(VoteQueUsr voteUser) throws VoteApplicationException;
-
+
public void removeAttemptsForUser(final Long queUsrId) throws VoteApplicationException;
-
- public void removeAttemptsForUserandSession(final Long queUsrId, final Long voteSessionId) throws VoteApplicationException;
-
+
+ public void removeAttemptsForUserandSession(final Long queUsrId, final Long voteSessionId)
+ throws VoteApplicationException;
+
public List getAllQuestionEntries(final Long voteContentId) throws VoteApplicationException;
-
+
public VoteQueUsr getVoteQueUsrById(long voteQueUsrId) throws VoteApplicationException;
-
+
public VoteSession retrieveVoteSession(Long voteSessionId) throws VoteApplicationException;
-
+
public VoteContent retrieveVoteBySessionId(Long voteSessionId) throws VoteApplicationException;
-
+
public void updateVote(VoteContent vote) throws VoteApplicationException;
-
+
public void updateVoteSession(VoteSession voteSession) throws VoteApplicationException;
-
+
public List getVoteUserBySessionOnly(final VoteSession voteSession) throws VoteApplicationException;
-
+
public VoteSession getVoteSessionByUID(Long uid) throws VoteApplicationException;
-
- /** Get the count of all the potential learners for the vote session. This will include
- * the people that have never logged into the lesson. Not great, but it is a better estimate of
- * how many users there will be eventually than the number of people already known to the tool.
- * @param voteSessionId The tool session id
+
+ /**
+ * Get the count of all the potential learners for the vote session. This will include the people that have never
+ * logged into the lesson. Not great, but it is a better estimate of how many users there will be eventually than
+ * the number of people already known to the tool.
+ *
+ * @param voteSessionId
+ * The tool session id
*/
public int getVoteSessionPotentialLearnersCount(Long voteSessionId) throws VoteApplicationException;
-
+
public void deleteVote(VoteContent vote) throws VoteApplicationException;
-
+
public void deleteVoteById(Long voteId) throws VoteApplicationException;
-
+
public void deleteVoteSession(VoteSession voteSession) throws VoteApplicationException;
-
+
public List getSessionNamesFromContent(VoteContent voteContent) throws VoteApplicationException;
-
- public void removeAttempt (VoteUsrAttempt attempt) throws VoteApplicationException;
-
+
+ public void removeAttempt(VoteUsrAttempt attempt) throws VoteApplicationException;
+
public void deleteVoteQueUsr(VoteQueUsr voteQueUsr) throws VoteApplicationException;
-
- public User getCurrentUserData(String username) throws VoteApplicationException;
-
- public int getTotalNumberOfUsers() throws VoteApplicationException;
-
+
+ public User getCurrentUserData(String username) throws VoteApplicationException;
+
+ public int getTotalNumberOfUsers() throws VoteApplicationException;
+
public Lesson getCurrentLesson(long lessonId) throws VoteApplicationException;
-
+
public void saveVoteContent(VoteContent vote) throws VoteApplicationException;
-
- public boolean studentActivityOccurredGlobal(VoteContent voteContent) throws VoteApplicationException;
-
- public int countIncompleteSession(VoteContent vote) throws VoteApplicationException;
-
- public boolean studentActivityOccurred(VoteContent vote) throws VoteApplicationException;
-
- public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException;
-
+
+ public boolean studentActivityOccurredGlobal(VoteContent voteContent) throws VoteApplicationException;
+
+ public int countIncompleteSession(VoteContent vote) throws VoteApplicationException;
+
+ public boolean studentActivityOccurred(VoteContent vote) throws VoteApplicationException;
+
+ public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException;
+
public void setAsDefineLater(Long toolContentID, boolean value) throws DataMissingException, ToolException;
-
+
public void setAsRunOffline(Long toolContentID, boolean value) throws DataMissingException, ToolException;
- public void removeToolContent(Long toolContentID, boolean removeSessionData) throws SessionDataExistsException, ToolException;
-
- public boolean existsSession(Long toolSessionId);
-
+ public void removeToolContent(Long toolContentID, boolean removeSessionData) throws SessionDataExistsException,
+ ToolException;
+
+ public boolean existsSession(Long toolSessionId);
+
public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentID) throws ToolException;
-
+
public void removeToolSession(Long toolSessionId) throws DataMissingException, ToolException;
- public String leaveToolSession(Long toolSessionId,Long learnerId) throws DataMissingException, ToolException;
+ public String leaveToolSession(Long toolSessionId, Long learnerId) throws DataMissingException, ToolException;
public ToolSessionExportOutputData exportToolSession(Long toolSessionId) throws DataMissingException, ToolException;
- public ToolSessionExportOutputData exportToolSession(List toolSessionIds) throws DataMissingException, ToolException;
-
+ public ToolSessionExportOutputData exportToolSession(List toolSessionIds) throws DataMissingException,
+ ToolException;
+
public IToolVO getToolBySignature(String toolSignature) throws VoteApplicationException;
-
+
public long getToolDefaultContentIdBySignature(String toolSignature) throws VoteApplicationException;
-
+
public VoteQueContent getToolDefaultQuestionContent(long contentId) throws VoteApplicationException;
public List getToolSessionsForContent(VoteContent vote);
-
+
public ITicket getRepositoryLoginTicket() throws VoteApplicationException;
-
- public void deleteFromRepository(Long uuid, Long versionID);
-
- public NodeKey uploadFileToRepository(InputStream stream, String fileName) throws VoteApplicationException;
-
- public InputStream downloadFile(Long uuid, Long versionID) throws VoteApplicationException;
-
- public void cleanUploadedFilesMetaData() throws VoteApplicationException;
-
- public void persistFile(String uuid, boolean isOnlineFile, String fileName, VoteContent voteContent) throws VoteApplicationException;
-
- public List getAttemptForQueContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException;
-
- public List getAttemptsForUser(final Long queUsrId) throws VoteApplicationException;
-
- public int countSessionComplete() throws VoteApplicationException;
-
- public VoteSession findVoteSessionById(Long voteSessionId) throws VoteApplicationException;
-
- public int countSessionIncomplete() throws VoteApplicationException;
-
- public NodeKey uploadFile(InputStream istream, String filename, String contentType, String fileType) throws RepositoryCheckedException;
-
+
+ public void deleteFromRepository(Long uuid, Long versionID);
+
+ public NodeKey uploadFileToRepository(InputStream stream, String fileName) throws VoteApplicationException;
+
+ public InputStream downloadFile(Long uuid, Long versionID) throws VoteApplicationException;
+
+ public void cleanUploadedFilesMetaData() throws VoteApplicationException;
+
+ public void persistFile(String uuid, boolean isOnlineFile, String fileName, VoteContent voteContent)
+ throws VoteApplicationException;
+
+ public List getAttemptForQueContent(final Long queUsrId, final Long voteQueContentId)
+ throws VoteApplicationException;
+
+ public List getAttemptsForUser(final Long queUsrId) throws VoteApplicationException;
+
+ public int countSessionComplete() throws VoteApplicationException;
+
+ public VoteSession findVoteSessionById(Long voteSessionId) throws VoteApplicationException;
+
+ public int countSessionIncomplete() throws VoteApplicationException;
+
+ public NodeKey uploadFile(InputStream istream, String filename, String contentType, String fileType)
+ throws RepositoryCheckedException;
+
public NodeKey copyFile(Long uuid) throws RepositoryCheckedException;
-
+
public List getAllQuestionEntriesSorted(final long voteContentId) throws VoteApplicationException;
-
+
public List getSessionsFromContent(VoteContent mcContent) throws VoteApplicationException;
-
- public Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionId) throws VoteApplicationException;
-
- public Long createNotebookEntry(Long id, Integer idType, String signature,
- Integer userID, String entry);
-
- public NotebookEntry getEntry(Long id, Integer idType, String signature,
- Integer userID);
-
+ public Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionId)
+ throws VoteApplicationException;
+
+ public Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry);
+
+ public NotebookEntry getEntry(Long id, Integer idType, String signature, Integer userID);
+
public void removeFile(Long submissionId) throws VoteApplicationException;
-
+
public void persistFile(VoteContent content, VoteUploadedFile file) throws VoteApplicationException;
-
+
public List retrieveVoteUploadedFiles(VoteContent Vote) throws VoteApplicationException;
-
-}
+ public void removeNominationsFromCache(VoteContent voteContent);
+}
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java
===================================================================
diff -u -rf9356efe2fe0d2e08e10c52543c5ea80822196c9 -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision f9356efe2fe0d2e08e10c52543c5ea80822196c9)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -21,14 +21,14 @@
* ***********************************************************************/
package org.lamsfoundation.lams.tool.vote.service;
+
import java.io.InputStream;
import java.util.Date;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.SortedMap;
-import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Vector;
@@ -66,7 +66,6 @@
import org.lamsfoundation.lams.tool.exception.LamsToolServiceException;
import org.lamsfoundation.lams.tool.exception.SessionDataExistsException;
import org.lamsfoundation.lams.tool.exception.ToolException;
-
import org.lamsfoundation.lams.tool.service.ILamsToolService;
import org.lamsfoundation.lams.tool.vote.VoteAppConstants;
import org.lamsfoundation.lams.tool.vote.VoteApplicationException;
@@ -96,2591 +95,2113 @@
*
* @author Ozgur Demirtas
*
- * The POJO implementation of Voting service. All business logic of Voting tool
- * is implemented in this class. It translates the request from presentation
- * layer and performs appropriate database operation.
+ * The POJO implementation of Voting service. All business logic of Voting tool is implemented in this class. It
+ * translates the request from presentation layer and performs appropriate database operation.
*
*/
-public class VoteServicePOJO implements
- IVoteService, ToolContentManager, ToolSessionManager, ToolContentImport102Manager, VoteAppConstants
-
+public class VoteServicePOJO implements IVoteService, ToolContentManager, ToolSessionManager,
+ ToolContentImport102Manager, VoteAppConstants
+
{
- static Logger logger = Logger.getLogger(VoteServicePOJO.class.getName());
-
+ static Logger logger = Logger.getLogger(VoteServicePOJO.class.getName());
+
private static String repositoryWorkspaceName = "vote11";
- private final String repositoryUser = "vote11";
- private final char[] repositoryId = {'v','o','t','e','_','1', '1'};
+ private final String repositoryUser = "vote11";
+ private final char[] repositoryId = { 'v', 'o', 't', 'e', '_', '1', '1' };
-
- private IRepositoryService repositoryService;
- private ICredentials cred;
-
- private IVoteContentDAO voteContentDAO;
- private IVoteQueContentDAO voteQueContentDAO;
- private IVoteSessionDAO voteSessionDAO;
- private IVoteUserDAO voteUserDAO;
- private IVoteUsrAttemptDAO voteUsrAttemptDAO;
-
- private IVoteUploadedFileDAO voteUploadedFileDAO;
- private IUserManagementService userManagementService;
- private ILearnerService learnerService;
- private IAuditService auditService;
- private ILamsToolService toolService;
- private IExportToolContentService exportContentService;
+ private IRepositoryService repositoryService;
+ private ICredentials cred;
- private ICoreNotebookService coreNotebookService;
- private IToolContentHandler voteToolContentHandler = null;
- private VoteOutputFactory voteOutputFactory;
+ private IVoteContentDAO voteContentDAO;
+ private IVoteQueContentDAO voteQueContentDAO;
+ private IVoteSessionDAO voteSessionDAO;
+ private IVoteUserDAO voteUserDAO;
+ private IVoteUsrAttemptDAO voteUsrAttemptDAO;
- private MessageService messageService;
-
- public VoteServicePOJO(){}
-
+ private IVoteUploadedFileDAO voteUploadedFileDAO;
+ private IUserManagementService userManagementService;
+ private ILearnerService learnerService;
+ private IAuditService auditService;
+ private ILamsToolService toolService;
+ private IExportToolContentService exportContentService;
+
+ private ICoreNotebookService coreNotebookService;
+ private IToolContentHandler voteToolContentHandler = null;
+ private VoteOutputFactory voteOutputFactory;
+
+ private MessageService messageService;
+
+ public VoteServicePOJO() {
+ }
+
public void configureContentRepository() throws VoteApplicationException {
- logger.debug("retrieved repService: " + repositoryService);
- cred = new SimpleCredentials(repositoryUser, repositoryId);
- logger.debug("retrieved cred: "+ cred);
- try
- {
- repositoryService.createCredentials(cred);
- logger.debug("created credentails.");
- repositoryService.addWorkspace(cred,repositoryWorkspaceName);
- logger.debug("created workspace.");
- } catch (ItemExistsException ie) {
- logger.warn("Tried to configure repository but it "
- +" appears to be already configured. Exception thrown by repository being ignored. ", ie);
- } catch (RepositoryCheckedException e) {
- String error = "Error occured while trying to configure repository."
- +" Unable to recover from error: "+e.getMessage();
- logger.error(error, e);
- throw new VoteApplicationException(error,e);
- }
- }
-
-
-
- public void createVote(VoteContent voteContent) throws VoteApplicationException
- {
- try
- {
- logger.debug("using voteContent defineLater:" + voteContent.isDefineLater());
- voteContentDAO.saveVoteContent(voteContent);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is creating vote content: "
- + e.getMessage(),
- e);
- }
+ VoteServicePOJO.logger.debug("retrieved repService: " + repositoryService);
+ cred = new SimpleCredentials(repositoryUser, repositoryId);
+ VoteServicePOJO.logger.debug("retrieved cred: " + cred);
+ try {
+ repositoryService.createCredentials(cred);
+ VoteServicePOJO.logger.debug("created credentails.");
+ repositoryService.addWorkspace(cred, VoteServicePOJO.repositoryWorkspaceName);
+ VoteServicePOJO.logger.debug("created workspace.");
+ } catch (ItemExistsException ie) {
+ VoteServicePOJO.logger.warn("Tried to configure repository but it "
+ + " appears to be already configured. Exception thrown by repository being ignored. ", ie);
+ } catch (RepositoryCheckedException e) {
+ String error = "Error occured while trying to configure repository." + " Unable to recover from error: "
+ + e.getMessage();
+ VoteServicePOJO.logger.error(error, e);
+ throw new VoteApplicationException(error, e);
+ }
}
-
-
- public VoteContent retrieveVote(Long toolContentID) throws VoteApplicationException
- {
- try
- {
- return voteContentDAO.findVoteContentById(toolContentID);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is loading vote content: "
- + e.getMessage(),
- e);
- }
+
+ public void createVote(VoteContent voteContent) throws VoteApplicationException {
+ try {
+ VoteServicePOJO.logger.debug("using voteContent defineLater:" + voteContent.isDefineLater());
+ voteContentDAO.saveVoteContent(voteContent);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is creating vote content: "
+ + e.getMessage(), e);
+ }
}
-
- public void updateVoteContent(VoteContent voteContent) throws VoteApplicationException
- {
- try
- {
- voteContentDAO.updateVoteContent(voteContent);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is updating vote content: "
- + e.getMessage(),
- e);
- }
+
+ public VoteContent retrieveVote(Long toolContentID) throws VoteApplicationException {
+ try {
+ return voteContentDAO.findVoteContentById(toolContentID);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is loading vote content: " + e.getMessage(), e);
+ }
}
-
-
- public VoteQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long voteContentUid) throws VoteApplicationException
- {
- try
- {
- return voteQueContentDAO.getQuestionContentByDisplayOrder(displayOrder, voteContentUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting vote que content by display order: "
- + e.getMessage(),
- e);
- }
+
+ public void updateVoteContent(VoteContent voteContent) throws VoteApplicationException {
+ try {
+ voteContentDAO.updateVoteContent(voteContent);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is updating vote content: "
+ + e.getMessage(), e);
}
-
-
- public VoteQueUsr getVoteQueUsrById(long voteQueUsrId) throws VoteApplicationException
- {
- try
- {
- VoteQueUsr voteQueUsr=voteUserDAO.getVoteQueUsrById(voteQueUsrId);
- return voteQueUsr;
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting vote QueUsr: "
- + e.getMessage(),
- e);
- }
+ }
+
+ public VoteQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long voteContentUid)
+ throws VoteApplicationException {
+ try {
+ return voteQueContentDAO.getQuestionContentByDisplayOrder(displayOrder, voteContentUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is getting vote que content by display order: " + e.getMessage(), e);
}
-
- public List retrieveVoteQueContentsByToolContentId(long voteContentId) throws VoteApplicationException
- {
- try
- {
- return voteQueContentDAO.getVoteQueContentsByContentId(voteContentId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is loading vote que usr: "
- + e.getMessage(),
- e);
- }
}
- public void createVoteQue(VoteQueContent voteQueContent) throws VoteApplicationException
- {
- try
- {
- voteQueContentDAO.saveVoteQueContent(voteQueContent);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is creating vote que content: "
- + e.getMessage(),
- e);
- }
+ public VoteQueUsr getVoteQueUsrById(long voteQueUsrId) throws VoteApplicationException {
+ try {
+ VoteQueUsr voteQueUsr = voteUserDAO.getVoteQueUsrById(voteQueUsrId);
+ return voteQueUsr;
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting vote QueUsr: " + e.getMessage(),
+ e);
+ }
}
-
- public List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid)
- {
- try
- {
- return voteUsrAttemptDAO.getStandardAttemptUsersForQuestionContentAndSessionUid(voteQueContentId, voteSessionUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is retrieving usernames for votes: "
- + e.getMessage(),
- e);
- }
+ public List retrieveVoteQueContentsByToolContentId(long voteContentId) throws VoteApplicationException {
+ try {
+ return voteQueContentDAO.getVoteQueContentsByContentId(voteContentId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is loading vote que usr: " + e.getMessage(), e);
+ }
}
-
- public List getContentEntries(final Long voteContentUid) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getContentEntries(voteContentUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting content entries: "
- + e.getMessage(),
- e);
- }
+ public void createVoteQue(VoteQueContent voteQueContent) throws VoteApplicationException {
+ try {
+ voteQueContentDAO.saveVoteQueContent(voteQueContent);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is creating vote que content: "
+ + e.getMessage(), e);
+ }
}
-
- public Set getUserEntries() throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getUserEntries();
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting user entries: "
- + e.getMessage(),
- e);
- }
+ public List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId,
+ final Long voteSessionUid) {
+ try {
+ return voteUsrAttemptDAO.getStandardAttemptUsersForQuestionContentAndSessionUid(voteQueContentId,
+ voteSessionUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is retrieving usernames for votes: "
+ + e.getMessage(), e);
+ }
}
-
-
- public Set getAttemptsForUserAndSessionUseOpenAnswer(final Long queUsrId, final Long voteSessionId)
- {
- try
- {
- return voteUsrAttemptDAO.getAttemptsForUserAndSessionUseOpenAnswer(queUsrId, voteSessionId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting all user entries, standard plus open text"
- + e.getMessage(),
- e);
- }
-
+
+ public List getContentEntries(final Long voteContentUid) throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getContentEntries(voteContentUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting content entries: "
+ + e.getMessage(), e);
+ }
}
-
- public int getCompletedSessionEntriesCount(final Long voteSessionUid) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getCompletedSessionEntriesCount(voteSessionUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting completed session user entries count: "
- + e.getMessage(),
- e);
- }
+ public Set getUserEntries() throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getUserEntries();
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is getting user entries: " + e.getMessage(), e);
+ }
}
-
-
- public boolean isVoteVisibleForSession(final String userEntry, final Long voteSessionUid) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.isVoteVisibleForSession(userEntry, voteSessionUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is finding if the open vote is hidden: "
- + e.getMessage(),
- e);
- }
+
+ public Set getAttemptsForUserAndSessionUseOpenAnswer(final Long queUsrId, final Long voteSessionId) {
+ try {
+ return voteUsrAttemptDAO.getAttemptsForUserAndSessionUseOpenAnswer(queUsrId, voteSessionId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is getting all user entries, standard plus open text" + e.getMessage(),
+ e);
+ }
+
}
-
- public List getSessionUserEntries(final Long voteSessionUid) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getSessionUserEntries(voteSessionUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting session user entries: "
- + e.getMessage(),
- e);
- }
+
+ public int getCompletedSessionEntriesCount(final Long voteSessionUid) throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getCompletedSessionEntriesCount(voteSessionUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is getting completed session user entries count: " + e.getMessage(), e);
+ }
}
-
- public Set getAttemptsForUserAndSession(final Long queUsrUid, final Long voteSessionUid) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getAttemptsForUserAndSession(queUsrUid, voteSessionUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting user entries: "
- + e.getMessage(),
- e);
- }
-
+
+ public boolean isVoteVisibleForSession(final String userEntry, final Long voteSessionUid)
+ throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.isVoteVisibleForSession(userEntry, voteSessionUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is finding if the open vote is hidden: "
+ + e.getMessage(), e);
+ }
}
-
-
- public Set getSessionUserEntriesSet(final Long voteSessionUid) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getSessionUserEntriesSet(voteSessionUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting session user entries: "
- + e.getMessage(),
- e);
- }
+
+ public List getSessionUserEntries(final Long voteSessionUid) throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getSessionUserEntries(voteSessionUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting session user entries: "
+ + e.getMessage(), e);
+ }
}
-
- public VoteQueContent getVoteQueContentByUID(Long uid) throws VoteApplicationException
- {
- try
- {
- return voteQueContentDAO.getVoteQueContentByUID(uid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting vote que content by uid: "
- + e.getMessage(),
- e);
- }
+
+ public Set getAttemptsForUserAndSession(final Long queUsrUid, final Long voteSessionUid)
+ throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getAttemptsForUserAndSession(queUsrUid, voteSessionUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting user entries: "
+ + e.getMessage(), e);
+ }
+
}
-
-
- public void saveOrUpdateVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException
- {
- try
- {
- voteQueContentDAO.saveOrUpdateVoteQueContent(voteQueContent);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is updating vote que content: "
- + e.getMessage(),
- e);
- }
+
+ public Set getSessionUserEntriesSet(final Long voteSessionUid) throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getSessionUserEntriesSet(voteSessionUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting session user entries: "
+ + e.getMessage(), e);
}
-
-
- public List getUserBySessionOnly(final VoteSession voteSession) throws VoteApplicationException
- {
- try
- {
- return voteUserDAO.getUserBySessionOnly(voteSession);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting vote QueUsr by vote session "
- + e.getMessage(),
- e);
- }
}
-
-
- public void removeQuestionContentByVoteUid(final Long voteContentUid) throws VoteApplicationException
- {
- try
- {
- voteQueContentDAO.removeQuestionContentByVoteUid(voteContentUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is removing vote que content by vote content id: "
- + e.getMessage(),
- e);
- }
+
+ public VoteQueContent getVoteQueContentByUID(Long uid) throws VoteApplicationException {
+ try {
+ return voteQueContentDAO.getVoteQueContentByUID(uid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting vote que content by uid: "
+ + e.getMessage(), e);
}
-
- public void resetAllQuestions(final Long voteContentUid) throws VoteApplicationException
- {
- try
- {
- voteQueContentDAO.resetAllQuestions(voteContentUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is resetting all questions: "
- + e.getMessage(),
- e);
- }
+ }
+
+ public void saveOrUpdateVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException {
+ try {
+ voteQueContentDAO.saveOrUpdateVoteQueContent(voteQueContent);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is updating vote que content: "
+ + e.getMessage(), e);
}
-
-
-
- public void cleanAllQuestions(final Long voteContentUid) throws VoteApplicationException
- {
- try
- {
- voteQueContentDAO.cleanAllQuestions(voteContentUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is cleaning all questions: "
- + e.getMessage(),
- e);
- }
+ }
+
+ public List getUserBySessionOnly(final VoteSession voteSession) throws VoteApplicationException {
+ try {
+ return voteUserDAO.getUserBySessionOnly(voteSession);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting vote QueUsr by vote session "
+ + e.getMessage(), e);
}
-
-
- public void createVoteSession(VoteSession voteSession) throws VoteApplicationException
- {
- try
- {
- voteSessionDAO.saveVoteSession(voteSession);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is creating vote session: "
- + e.getMessage(),
- e);
- }
}
-
- public VoteSession getVoteSessionByUID(Long uid) throws VoteApplicationException
- {
- try
- {
- return voteSessionDAO.getVoteSessionByUID(uid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting voteSession by uid: "
- + e.getMessage(),
- e);
- }
+ public void removeQuestionContentByVoteUid(final Long voteContentUid) throws VoteApplicationException {
+ try {
+ voteQueContentDAO.removeQuestionContentByVoteUid(voteContentUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is removing vote que content by vote content id: " + e.getMessage(), e);
+ }
}
- public int getVoteSessionPotentialLearnersCount(Long voteSessionId) throws VoteApplicationException
- {
- try
- {
- VoteSession session = voteSessionDAO.getVoteSessionByUID(voteSessionId);
- if ( session != null ) {
- Set potentialLearners = toolService.getAllPotentialLearners(session.getVoteSessionId().longValue());
- return potentialLearners != null ? potentialLearners.size() : 0;
- } else {
- logger.error("Unable to find vote session record id="+voteSessionId+". Returning 0 users.");
- return 0;
- }
- }
- catch (LamsToolServiceException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting count of potential voteSession learners: "
- + e.getMessage(),
- e);
- }
+ public void resetAllQuestions(final Long voteContentUid) throws VoteApplicationException {
+ try {
+ voteQueContentDAO.resetAllQuestions(voteContentUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is resetting all questions: "
+ + e.getMessage(), e);
+ }
}
- public void createVoteQueUsr(VoteQueUsr voteQueUsr) throws VoteApplicationException
- {
- try
- {
- voteUserDAO.saveVoteUser(voteQueUsr);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is creating vote QueUsr: "
- + e.getMessage(),
- e);
- }
+ public void cleanAllQuestions(final Long voteContentUid) throws VoteApplicationException {
+ try {
+ voteQueContentDAO.cleanAllQuestions(voteContentUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is cleaning all questions: "
+ + e.getMessage(), e);
+ }
}
-
-
- public VoteQueUsr getVoteUserBySession(final Long queUsrId, final Long voteSessionId) throws VoteApplicationException
- {
- try
- {
- return voteUserDAO.getVoteUserBySession(queUsrId, voteSessionId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting vote QueUsr: "
- + e.getMessage(),
- e);
- }
+
+ public void createVoteSession(VoteSession voteSession) throws VoteApplicationException {
+ try {
+ voteSessionDAO.saveVoteSession(voteSession);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is creating vote session: "
+ + e.getMessage(), e);
}
-
-
- public VoteQueUsr getVoteUserByUID(Long uid) throws VoteApplicationException
- {
- try
- {
- return voteUserDAO.getVoteUserByUID(uid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting the vote QueUsr by uid."
- + e.getMessage(),
- e);
- }
}
-
- public void updateVoteUser(VoteQueUsr voteUser) throws VoteApplicationException
- {
- try
- {
- voteUserDAO.updateVoteUser(voteUser);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is updating VoteQueUsr: "
- + e.getMessage(),
- e);
- }
+
+ public VoteSession getVoteSessionByUID(Long uid) throws VoteApplicationException {
+ try {
+ return voteSessionDAO.getVoteSessionByUID(uid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting voteSession by uid: "
+ + e.getMessage(), e);
+ }
}
-
- public VoteQueUsr retrieveVoteQueUsr(Long userID) throws VoteApplicationException
- {
- try
- {
- VoteQueUsr voteQueUsr=voteUserDAO.findVoteUserById(userID);
- return voteQueUsr;
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is retrieving VoteQueUsr: "
- + e.getMessage(),
- e);
- }
+
+ public int getVoteSessionPotentialLearnersCount(Long voteSessionId) throws VoteApplicationException {
+ try {
+ VoteSession session = voteSessionDAO.getVoteSessionByUID(voteSessionId);
+ if (session != null) {
+ Set potentialLearners = toolService.getAllPotentialLearners(session.getVoteSessionId().longValue());
+ return potentialLearners != null ? potentialLearners.size() : 0;
+ } else {
+ VoteServicePOJO.logger.error("Unable to find vote session record id=" + voteSessionId
+ + ". Returning 0 users.");
+ return 0;
+ }
+ } catch (LamsToolServiceException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is getting count of potential voteSession learners: " + e.getMessage(),
+ e);
+ }
}
-
-
- public void createVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException
- {
- try
- {
- voteUsrAttemptDAO.saveVoteUsrAttempt(voteUsrAttempt);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is creating vote UsrAttempt: "
- + e.getMessage(),
- e);
- }
+
+ public void createVoteQueUsr(VoteQueUsr voteQueUsr) throws VoteApplicationException {
+ try {
+ voteUserDAO.saveVoteUser(voteQueUsr);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is creating vote QueUsr: " + e.getMessage(), e);
+ }
}
-
- public void removeAttemptsForUser(final Long queUsrId) throws VoteApplicationException
- {
- try
- {
- voteUsrAttemptDAO.removeAttemptsForUser(queUsrId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is removing voteUsrAttempts: "
- + e.getMessage(),
- e);
- }
+
+ public VoteQueUsr getVoteUserBySession(final Long queUsrId, final Long voteSessionId)
+ throws VoteApplicationException {
+ try {
+ return voteUserDAO.getVoteUserBySession(queUsrId, voteSessionId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting vote QueUsr: " + e.getMessage(),
+ e);
+ }
}
- public int getAllEntriesCount() throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getAllEntriesCount();
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting all attempts entries count: "
- + e.getMessage(),
- e);
- }
+ public VoteQueUsr getVoteUserByUID(Long uid) throws VoteApplicationException {
+ try {
+ return voteUserDAO.getVoteUserByUID(uid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting the vote QueUsr by uid."
+ + e.getMessage(), e);
+ }
}
-
-
- public int getStandardAttemptsForQuestionContentAndContentUid(final Long voteQueContentId, final Long voteContentUid)
- {
- try
- {
- return voteUsrAttemptDAO.getStandardAttemptsForQuestionContentAndContentUid(voteQueContentId, voteContentUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting all standard attempts entries count: "
- + e.getMessage(),
- e);
- }
-
+
+ public void updateVoteUser(VoteQueUsr voteUser) throws VoteApplicationException {
+ try {
+ voteUserDAO.updateVoteUser(voteUser);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is updating VoteQueUsr: " + e.getMessage(),
+ e);
+ }
}
-
- public int getSessionEntriesCount(final Long voteSessionUid) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getSessionEntriesCount(voteSessionUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting all attempts session entries count: "
- + e.getMessage(),
- e);
- }
+
+ public VoteQueUsr retrieveVoteQueUsr(Long userID) throws VoteApplicationException {
+ try {
+ VoteQueUsr voteQueUsr = voteUserDAO.findVoteUserById(userID);
+ return voteQueUsr;
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is retrieving VoteQueUsr: "
+ + e.getMessage(), e);
+ }
}
-
- public VoteUsrAttempt getAttemptByUID(Long uid) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getAttemptByUID(uid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting attemptby uid: "
- + e.getMessage(),
- e);
- }
+ public void createVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException {
+ try {
+ voteUsrAttemptDAO.saveVoteUsrAttempt(voteUsrAttempt);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is creating vote UsrAttempt: "
+ + e.getMessage(), e);
+ }
}
-
-
- public int getUserRecordsEntryCount(final String userEntry) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getUserRecordsEntryCount(userEntry);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting userrecords entry count: "
- + e.getMessage(),
- e);
- }
-
+
+ public void removeAttemptsForUser(final Long queUsrId) throws VoteApplicationException {
+ try {
+ voteUsrAttemptDAO.removeAttemptsForUser(queUsrId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is removing voteUsrAttempts: "
+ + e.getMessage(), e);
+ }
}
-
- public int getSessionUserRecordsEntryCount(final String userEntry, final Long voteSessionUid, IVoteService voteService) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getSessionUserRecordsEntryCount(userEntry, voteSessionUid, voteService);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting session userrecords entry count: "
- + e.getMessage(),
- e);
- }
-
+ public int getAllEntriesCount() throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getAllEntriesCount();
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting all attempts entries count: "
+ + e.getMessage(), e);
+ }
}
-
- public int getAttemptsForQuestionContent(final Long voteQueContentId) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getAttemptsForQuestionContent(voteQueContentId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting vote UsrAttempt by question content id only: "
- + e.getMessage(),
- e);
- }
+
+ public int getStandardAttemptsForQuestionContentAndContentUid(final Long voteQueContentId, final Long voteContentUid) {
+ try {
+ return voteUsrAttemptDAO.getStandardAttemptsForQuestionContentAndContentUid(voteQueContentId,
+ voteContentUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is getting all standard attempts entries count: " + e.getMessage(), e);
+ }
+
}
-
- public int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getStandardAttemptsForQuestionContentAndSessionUid(voteQueContentId, voteSessionUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting vote UsrAttempt by question content id and session uid: "
- + e.getMessage(),
- e);
- }
+
+ public int getSessionEntriesCount(final Long voteSessionUid) throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getSessionEntriesCount(voteSessionUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is getting all attempts session entries count: " + e.getMessage(), e);
+ }
}
-
-
-
- public List getUserRecords(final String userEntry) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getUserRecords(userEntry);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting user records for user entry: "
- + e.getMessage(),
- e);
- }
+
+ public VoteUsrAttempt getAttemptByUID(Long uid) throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getAttemptByUID(uid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting attemptby uid: "
+ + e.getMessage(), e);
+ }
}
-
- public List getAttemptsListForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getAttemptsListForUserAndQuestionContent(queUsrId, voteQueContentId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting vote UsrAttempt by user id and que content id: "
- + e.getMessage(),
- e);
- }
-
+ public int getUserRecordsEntryCount(final String userEntry) throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getUserRecordsEntryCount(userEntry);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting userrecords entry count: "
+ + e.getMessage(), e);
+ }
+
}
- public VoteUsrAttempt getAttemptsForUserAndQuestionContentAndSession(final Long queUsrId, final Long voteQueContentId, final Long toolSessionUid) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getAttemptsForUserAndQuestionContentAndSession(queUsrId, voteQueContentId, toolSessionUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is updating vote UsrAttempt: "
- + e.getMessage(),
- e);
- }
+ public int getSessionUserRecordsEntryCount(final String userEntry, final Long voteSessionUid,
+ IVoteService voteService) throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getSessionUserRecordsEntryCount(userEntry, voteSessionUid, voteService);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is getting session userrecords entry count: " + e.getMessage(), e);
+ }
+
}
-
- public void updateVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException
- {
- try
- {
- voteUsrAttemptDAO.updateVoteUsrAttempt(voteUsrAttempt);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is updating vote UsrAttempt: "
- + e.getMessage(),
- e);
- }
+
+ public int getAttemptsForQuestionContent(final Long voteQueContentId) throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getAttemptsForQuestionContent(voteQueContentId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is getting vote UsrAttempt by question content id only: "
+ + e.getMessage(), e);
+ }
}
-
- public void removeAttemptsForUserandSession(final Long queUsrId, final Long voteSessionId) throws VoteApplicationException
- {
- try
- {
- voteUsrAttemptDAO.removeAttemptsForUserandSession(queUsrId, voteSessionId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is removing by user and votesession id : "
- + e.getMessage(),
- e);
- }
+
+ public int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid)
+ throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getStandardAttemptsForQuestionContentAndSessionUid(voteQueContentId,
+ voteSessionUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is getting vote UsrAttempt by question content id and session uid: "
+ + e.getMessage(), e);
}
-
- public List getAttemptsForUser(final Long queUsrId) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getAttemptsForUser(queUsrId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting the attempts by user id: "
- + e.getMessage(),
- e);
- }
-
+ }
+
+ public List getUserRecords(final String userEntry) throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getUserRecords(userEntry);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting user records for user entry: "
+ + e.getMessage(), e);
}
-
- public List getUserEnteredVotesForSession(final String userEntry, final Long voteSessionUid)
- {
- try
- {
- return voteUsrAttemptDAO.getUserEnteredVotesForSession(userEntry, voteSessionUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting user entered votes for session: "
- + e.getMessage(),
- e);
- }
-
+ }
+
+ public List getAttemptsListForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId)
+ throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getAttemptsListForUserAndQuestionContent(queUsrId, voteQueContentId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is getting vote UsrAttempt by user id and que content id: "
+ + e.getMessage(), e);
}
-
-
- public List getAttemptForQueContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getAttemptForQueContent(queUsrId, voteQueContentId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting the learner's attempts by user id and que content id: "
- + e.getMessage(),
- e);
- }
+
+ }
+
+ public VoteUsrAttempt getAttemptsForUserAndQuestionContentAndSession(final Long queUsrId,
+ final Long voteQueContentId, final Long toolSessionUid) throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getAttemptsForUserAndQuestionContentAndSession(queUsrId, voteQueContentId,
+ toolSessionUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is updating vote UsrAttempt: "
+ + e.getMessage(), e);
}
-
-
- public int getUserEnteredVotesCountForContent(final Long voteContentUid) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getUserEnteredVotesCountForContent(voteContentUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting the user entered votes count:"
- + e.getMessage(),
- e);
- }
-
+ }
+
+ public void updateVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException {
+ try {
+ voteUsrAttemptDAO.updateVoteUsrAttempt(voteUsrAttempt);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is updating vote UsrAttempt: "
+ + e.getMessage(), e);
}
-
-
- public VoteQueContent retrieveVoteQueContentByUID(Long uid) throws VoteApplicationException
- {
- try
- {
- return voteQueContentDAO.getVoteQueContentByUID(uid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is retrieving by uid vote question content: "
- + e.getMessage(),
- e);
- }
}
-
- public void updateVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException
- {
- try
- {
- voteQueContentDAO.updateVoteQueContent(voteQueContent);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is updating vote content by question: "
- + e.getMessage(),
- e);
- }
-
+ public void removeAttemptsForUserandSession(final Long queUsrId, final Long voteSessionId)
+ throws VoteApplicationException {
+ try {
+ voteUsrAttemptDAO.removeAttemptsForUserandSession(queUsrId, voteSessionId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is removing by user and votesession id : "
+ + e.getMessage(), e);
}
+ }
- public void cleanAllQuestionsSimple(final Long voteContentId) throws VoteApplicationException
- {
- try
- {
- voteQueContentDAO.cleanAllQuestionsSimple(voteContentId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is cleaning vote question content by voteContentId : "
- + e.getMessage(),
- e);
- }
+ public List getAttemptsForUser(final Long queUsrId) throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getAttemptsForUser(queUsrId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting the attempts by user id: "
+ + e.getMessage(), e);
}
-
- public List getAllQuestionEntries(final Long uid) throws VoteApplicationException
- {
- try
- {
- return voteQueContentDAO.getAllQuestionEntries(uid.longValue());
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting by uid vote question content: "
- + e.getMessage(),
- e);
- }
+
+ }
+
+ public List getUserEnteredVotesForSession(final String userEntry, final Long voteSessionUid) {
+ try {
+ return voteUsrAttemptDAO.getUserEnteredVotesForSession(userEntry, voteSessionUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is getting user entered votes for session: " + e.getMessage(), e);
}
-
-
- public void removeVoteQueContentByUID(Long uid) throws VoteApplicationException
- {
- try
- {
- voteQueContentDAO.removeVoteQueContentByUID(uid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is removing by uid vote question content: "
- + e.getMessage(),
- e);
- }
+
+ }
+
+ public List getAttemptForQueContent(final Long queUsrId, final Long voteQueContentId)
+ throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getAttemptForQueContent(queUsrId, voteQueContentId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is getting the learner's attempts by user id and que content id: "
+ + e.getMessage(), e);
}
-
+ }
- public void removeVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException
- {
- try
- {
- voteQueContentDAO.removeVoteQueContent(voteQueContent);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is removing vote question content: "
- + e.getMessage(),
- e);
- }
+ public int getUserEnteredVotesCountForContent(final Long voteContentUid) throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getUserEnteredVotesCountForContent(voteContentUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting the user entered votes count:"
+ + e.getMessage(), e);
}
-
- public VoteQueContent getQuestionContentByQuestionText(final String question, final Long voteContentId)
- {
- try
- {
- return voteQueContentDAO.getQuestionContentByQuestionText(question, voteContentId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is retrieving question content by question text: "
- + e.getMessage(),
- e);
- }
}
-
-
- public VoteSession retrieveVoteSession(Long voteSessionId) throws VoteApplicationException
- {
- try
- {
- return voteSessionDAO.findVoteSessionById(voteSessionId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is retrieving by id vote session : "
- + e.getMessage(),
- e);
- }
+
+ public VoteQueContent retrieveVoteQueContentByUID(Long uid) throws VoteApplicationException {
+ try {
+ return voteQueContentDAO.getVoteQueContentByUID(uid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is retrieving by uid vote question content: " + e.getMessage(), e);
+ }
}
-
-
- public VoteSession findVoteSessionById(Long voteSessionId) throws VoteApplicationException
- {
- try
- {
- return voteSessionDAO.findVoteSessionById(voteSessionId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is retrieving by id vote session : "
- + e.getMessage(),
- e);
- }
-
+
+ public void updateVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException {
+ try {
+ voteQueContentDAO.updateVoteQueContent(voteQueContent);
+
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is updating vote content by question: "
+ + e.getMessage(), e);
}
-
- public int getCompletedVoteUserBySessionUid(final Long voteSessionUid) throws VoteApplicationException
- {
- try
- {
- return voteUserDAO.getCompletedVoteUserBySessionUid(voteSessionUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is retrieving completed users by session uid: "
- + e.getMessage(),
- e);
- }
+
}
- public List getVoteUserBySessionUid(final Long voteSessionUid) throws VoteApplicationException
- {
- try
- {
- return voteUserDAO.getVoteUserBySessionUid(voteSessionUid);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is retrieving users by session uid: "
- + e.getMessage(),
- e);
- }
+ public void cleanAllQuestionsSimple(final Long voteContentId) throws VoteApplicationException {
+ try {
+ voteQueContentDAO.cleanAllQuestionsSimple(voteContentId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is cleaning vote question content by voteContentId : "
+ + e.getMessage(), e);
}
+ }
-
- public List getVoteUserBySessionOnly(final VoteSession voteSession) throws VoteApplicationException
- {
- try
- {
- return voteUserDAO.getVoteUserBySessionOnly(voteSession);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is retrieving users by session: "
- + e.getMessage(),
- e);
- }
+ public List getAllQuestionEntries(final Long uid) throws VoteApplicationException {
+ try {
+ return voteQueContentDAO.getAllQuestionEntries(uid.longValue());
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting by uid vote question content: "
+ + e.getMessage(), e);
+ }
}
-
-
- public VoteContent retrieveVoteBySessionId(Long voteSessionId) throws VoteApplicationException
- {
- try
- {
- return voteContentDAO.getVoteContentBySession(voteSessionId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is retrieving vote by session id: "
- + e.getMessage(),
- e);
- }
+
+ public void removeVoteQueContentByUID(Long uid) throws VoteApplicationException {
+ try {
+ voteQueContentDAO.removeVoteQueContentByUID(uid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is removing by uid vote question content: " + e.getMessage(), e);
+ }
}
-
- public List getSessionNamesFromContent(VoteContent voteContent) throws VoteApplicationException
- {
- try
- {
- return voteSessionDAO.getSessionNamesFromContent(voteContent);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting session names from content: "
- + e.getMessage(),
- e);
- }
+
+ public void removeVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException {
+ try {
+ voteQueContentDAO.removeVoteQueContent(voteQueContent);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is removing vote question content: "
+ + e.getMessage(), e);
+ }
}
-
-
- public void updateVote(VoteContent vote) throws VoteApplicationException
- {
- try
- {
- voteContentDAO.updateVoteContent(vote);
- }
- catch(DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is updating"
- + " the vote content: "
- + e.getMessage(),e);
- }
+ public VoteQueContent getQuestionContentByQuestionText(final String question, final Long voteContentId) {
+ try {
+ return voteQueContentDAO.getQuestionContentByQuestionText(question, voteContentId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is retrieving question content by question text: " + e.getMessage(), e);
+ }
}
-
- public void updateVoteSession(VoteSession voteSession) throws VoteApplicationException
- {
- try
- {
- voteSessionDAO.updateVoteSession(voteSession);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is updating vote session : "
- + e.getMessage(),
- e);
- }
+ public VoteSession retrieveVoteSession(Long voteSessionId) throws VoteApplicationException {
+ try {
+ return voteSessionDAO.findVoteSessionById(voteSessionId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is retrieving by id vote session : "
+ + e.getMessage(), e);
+ }
}
-
- public void deleteVote(VoteContent vote) throws VoteApplicationException
- {
- try
- {
- voteContentDAO.removeVote(vote);
- }
- catch(DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is removing"
- + " the vote content: "
- + e.getMessage(),e);
- }
+
+ public VoteSession findVoteSessionById(Long voteSessionId) throws VoteApplicationException {
+ try {
+ return voteSessionDAO.findVoteSessionById(voteSessionId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is retrieving by id vote session : "
+ + e.getMessage(), e);
+ }
+
}
-
- public void deleteVoteById(Long voteId) throws VoteApplicationException
- {
- try
- {
- voteContentDAO.removeVoteById(voteId);
- }
- catch(DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is removing by id"
- + " the vote content: "
- + e.getMessage(),e);
- }
+
+ public int getCompletedVoteUserBySessionUid(final Long voteSessionUid) throws VoteApplicationException {
+ try {
+ return voteUserDAO.getCompletedVoteUserBySessionUid(voteSessionUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is retrieving completed users by session uid: " + e.getMessage(), e);
+ }
}
-
- public int countSessionComplete() throws VoteApplicationException
- {
- try
- {
- return voteSessionDAO.countSessionComplete();
- }
- catch(DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is counting incomplete sessions"
- + e.getMessage(),e);
- }
+ public List getVoteUserBySessionUid(final Long voteSessionUid) throws VoteApplicationException {
+ try {
+ return voteUserDAO.getVoteUserBySessionUid(voteSessionUid);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is retrieving users by session uid: "
+ + e.getMessage(), e);
}
-
-
- public int countSessionIncomplete() throws VoteApplicationException
- {
- try
- {
- return voteSessionDAO.countSessionIncomplete();
- }
- catch(DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is counting incomplete sessions"
- + e.getMessage(),e);
- }
+ }
+
+ public List getVoteUserBySessionOnly(final VoteSession voteSession) throws VoteApplicationException {
+ try {
+ return voteUserDAO.getVoteUserBySessionOnly(voteSession);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is retrieving users by session: "
+ + e.getMessage(), e);
}
-
- public void deleteVoteSession(VoteSession voteSession) throws VoteApplicationException
- {
- try
- {
- voteSessionDAO.removeVoteSession(voteSession);
- }
- catch(DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is deleting"
- + " the vote session: "
- + e.getMessage(),e);
- }
+ }
+
+ public VoteContent retrieveVoteBySessionId(Long voteSessionId) throws VoteApplicationException {
+ try {
+ return voteContentDAO.getVoteContentBySession(voteSessionId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is retrieving vote by session id: "
+ + e.getMessage(), e);
}
-
-
- public void removeAttempt (VoteUsrAttempt attempt) throws VoteApplicationException
- {
- try
- {
- voteUsrAttemptDAO.removeVoteUsrAttempt(attempt);
- }
- catch(DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is removing"
- + " the attempt: "
- + e.getMessage(),e);
- }
+ }
+
+ public List getSessionNamesFromContent(VoteContent voteContent) throws VoteApplicationException {
+ try {
+ return voteSessionDAO.getSessionNamesFromContent(voteContent);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting session names from content: "
+ + e.getMessage(), e);
}
-
- public int getLastNominationCount(Long userID) throws VoteApplicationException
- {
- try
- {
- int lastNomCount=voteUsrAttemptDAO.getLastNominationCount(userID);
- return lastNomCount;
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is retrieving lastNominationount: "
- + e.getMessage(),
- e);
- }
}
-
+
+ public void updateVote(VoteContent vote) throws VoteApplicationException {
+ try {
+ voteContentDAO.updateVoteContent(vote);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is updating" + " the vote content: "
+ + e.getMessage(), e);
+ }
+ }
+
+ public void updateVoteSession(VoteSession voteSession) throws VoteApplicationException {
+ try {
+ voteSessionDAO.updateVoteSession(voteSession);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is updating vote session : "
+ + e.getMessage(), e);
+ }
+ }
+
+ public void deleteVote(VoteContent vote) throws VoteApplicationException {
+ try {
+ voteContentDAO.removeVote(vote);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is removing" + " the vote content: "
+ + e.getMessage(), e);
+ }
+ }
+
+ public void deleteVoteById(Long voteId) throws VoteApplicationException {
+ try {
+ voteContentDAO.removeVoteById(voteId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is removing by id" + " the vote content: "
+ + e.getMessage(), e);
+ }
+ }
+
+ public int countSessionComplete() throws VoteApplicationException {
+ try {
+ return voteSessionDAO.countSessionComplete();
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is counting incomplete sessions"
+ + e.getMessage(), e);
+ }
+ }
+
+ public int countSessionIncomplete() throws VoteApplicationException {
+ try {
+ return voteSessionDAO.countSessionIncomplete();
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is counting incomplete sessions"
+ + e.getMessage(), e);
+ }
+ }
+
+ public void deleteVoteSession(VoteSession voteSession) throws VoteApplicationException {
+ try {
+ voteSessionDAO.removeVoteSession(voteSession);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is deleting" + " the vote session: "
+ + e.getMessage(), e);
+ }
+ }
+
+ public void removeAttempt(VoteUsrAttempt attempt) throws VoteApplicationException {
+ try {
+ voteUsrAttemptDAO.removeVoteUsrAttempt(attempt);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is removing" + " the attempt: "
+ + e.getMessage(), e);
+ }
+ }
+
+ public int getLastNominationCount(Long userID) throws VoteApplicationException {
+ try {
+ int lastNomCount = voteUsrAttemptDAO.getLastNominationCount(userID);
+ return lastNomCount;
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is retrieving lastNominationount: "
+ + e.getMessage(), e);
+ }
+ }
+
/**
- * logs hiding of a user entered vote
+ * logs hiding of a user entered vote
*/
- public void hideOpenVote(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException
- {
- logger.debug("hiding user entry: " + voteUsrAttempt.getUserEntry());
- auditService.logHideEntry(MY_SIGNATURE, voteUsrAttempt.getQueUsrId(),
- voteUsrAttempt.getVoteQueUsr().getUsername(), voteUsrAttempt.getUserEntry());
+ public void hideOpenVote(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException {
+ VoteServicePOJO.logger.debug("hiding user entry: " + voteUsrAttempt.getUserEntry());
+ auditService.logHideEntry(VoteAppConstants.MY_SIGNATURE, voteUsrAttempt.getQueUsrId(), voteUsrAttempt
+ .getVoteQueUsr().getUsername(), voteUsrAttempt.getUserEntry());
}
/**
- * logs showing of a user entered vote
+ * logs showing of a user entered vote
*/
- public void showOpenVote(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException
- {
- logger.debug("showing user entry: " + voteUsrAttempt.getUserEntry());
- auditService.logShowEntry(MY_SIGNATURE, voteUsrAttempt.getQueUsrId(),
- voteUsrAttempt.getVoteQueUsr().getUsername(), voteUsrAttempt.getUserEntry());
+ public void showOpenVote(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException {
+ VoteServicePOJO.logger.debug("showing user entry: " + voteUsrAttempt.getUserEntry());
+ auditService.logShowEntry(VoteAppConstants.MY_SIGNATURE, voteUsrAttempt.getQueUsrId(), voteUsrAttempt
+ .getVoteQueUsr().getUsername(), voteUsrAttempt.getUserEntry());
}
-
- public void deleteVoteQueUsr(VoteQueUsr voteQueUsr) throws VoteApplicationException
- {
- try
- {
- voteUserDAO.removeVoteUser(voteQueUsr);
- }
- catch(DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is removing"
- + " the user: "
- + e.getMessage(),e);
- }
+ public void deleteVoteQueUsr(VoteQueUsr voteQueUsr) throws VoteApplicationException {
+ try {
+ voteUserDAO.removeVoteUser(voteQueUsr);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is removing" + " the user: "
+ + e.getMessage(), e);
+ }
}
-
-
- public void saveVoteContent(VoteContent vote) throws VoteApplicationException
- {
- try
- {
- voteContentDAO.saveVoteContent(vote);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is saving"
- + " the vote content: "
- + e.getMessage(),e);
- }
+
+ public void saveVoteContent(VoteContent vote) throws VoteApplicationException {
+ try {
+ voteContentDAO.saveVoteContent(vote);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is saving" + " the vote content: "
+ + e.getMessage(), e);
+ }
}
-
-
-
- public List getSessionsFromContent(VoteContent voteContent) throws VoteApplicationException
- {
- try
- {
- return voteSessionDAO.getSessionsFromContent(voteContent);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting"
- + " the vote sessions list: "
- + e.getMessage(),e);
- }
+
+ public List getSessionsFromContent(VoteContent voteContent) throws VoteApplicationException {
+ try {
+ return voteSessionDAO.getSessionsFromContent(voteContent);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting" + " the vote sessions list: "
+ + e.getMessage(), e);
}
-
-
- public int getTotalNumberOfUsers() throws VoteApplicationException
- {
- try
- {
- return voteUserDAO.getTotalNumberOfUsers();
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is retrieving total number of VoteQueUsr: "
- + e.getMessage(),
- e);
- }
+ }
+
+ public int getTotalNumberOfUsers() throws VoteApplicationException {
+ try {
+ return voteUserDAO.getTotalNumberOfUsers();
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is retrieving total number of VoteQueUsr: "
+ + e.getMessage(), e);
}
-
- public User getCurrentUserData(String username) throws VoteApplicationException
- {
- try
- {
- logger.debug("getCurrentUserData: " + username);
- /**
- * this will return null if the username not found
- */
- User user=userManagementService.getUserByLogin(username);
- if (user == null)
- {
- logger.error("No user with the username: "+ username + " exists.");
- throw new VoteApplicationException("No user with that username exists.");
- }
- return user;
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Unable to find current user information"
- + " Root Cause: ["
- + e.getMessage() + "]",
- e);
- }
}
+ public User getCurrentUserData(String username) throws VoteApplicationException {
+ try {
+ VoteServicePOJO.logger.debug("getCurrentUserData: " + username);
+ /**
+ * this will return null if the username not found
+ */
+ User user = userManagementService.getUserByLogin(username);
+ if (user == null) {
+ VoteServicePOJO.logger.error("No user with the username: " + username + " exists.");
+ throw new VoteApplicationException("No user with that username exists.");
+ }
+ return user;
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Unable to find current user information" + " Root Cause: ["
+ + e.getMessage() + "]", e);
+ }
+ }
+
/**
*
* Unused method
+ *
* @param lessonId
* @return
* @throws VoteApplicationException
*/
- public Lesson getCurrentLesson(long lessonId) throws VoteApplicationException
- {
- try
- {
- /**this is a mock implementation to make the project compile and
- work. When the Lesson service is ready, we need to switch to
- real service implementation.
- */
- return new Lesson();
- /**return lsDAO.find(lsessionId); */
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is loading"
- + " learning session:"
- + e.getMessage(),
- e);
- }
+ public Lesson getCurrentLesson(long lessonId) throws VoteApplicationException {
+ try {
+ /**
+ * this is a mock implementation to make the project compile and work. When the Lesson service is ready, we
+ * need to switch to real service implementation.
+ */
+ return new Lesson();
+ /** return lsDAO.find(lsessionId); */
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is loading" + " learning session:"
+ + e.getMessage(), e);
+ }
}
-
- public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException
- {
- try
- {
- return voteUsrAttemptDAO.getAttemptsForUserAndQuestionContent(queUsrId, voteQueContentId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting vote voteUsrRespDAO by user id and que content id: "
- + e.getMessage(),
- e);
- }
+ public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId)
+ throws VoteApplicationException {
+ try {
+ return voteUsrAttemptDAO.getAttemptsForUserAndQuestionContent(queUsrId, voteQueContentId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "Exception occured when lams is getting vote voteUsrRespDAO by user id and que content id: "
+ + e.getMessage(), e);
}
+ }
-
- /**
- * checks the parameter content in the user responses table
- * @param voteContent
- * @return boolean
- * @throws VoteApplicationException
- */
- public boolean studentActivityOccurredGlobal(VoteContent voteContent) throws VoteApplicationException
- {
- logger.debug("voteContent uid: " + voteContent.getUid());
- Iterator questionIterator=voteContent.getVoteQueContents().iterator();
-
- while (questionIterator.hasNext())
- {
- VoteQueContent voteQueContent=(VoteQueContent)questionIterator.next();
- Iterator attemptsIterator=voteQueContent.getVoteUsrAttempts().iterator();
- while (attemptsIterator.hasNext())
- {
- logger.debug("there is at least one attempt for the standard nominamtions");
- /**
- * proved the fact that there is at least one attempt for this content.
- */
- return true;
- }
- }
- return false;
+ /**
+ * checks the parameter content in the user responses table
+ *
+ * @param voteContent
+ * @return boolean
+ * @throws VoteApplicationException
+ */
+ public boolean studentActivityOccurredGlobal(VoteContent voteContent) throws VoteApplicationException {
+ VoteServicePOJO.logger.debug("voteContent uid: " + voteContent.getUid());
+ Iterator questionIterator = voteContent.getVoteQueContents().iterator();
+
+ while (questionIterator.hasNext()) {
+ VoteQueContent voteQueContent = (VoteQueContent) questionIterator.next();
+ Iterator attemptsIterator = voteQueContent.getVoteUsrAttempts().iterator();
+ while (attemptsIterator.hasNext()) {
+ VoteServicePOJO.logger.debug("there is at least one attempt for the standard nominamtions");
+ /**
+ * proved the fact that there is at least one attempt for this content.
+ */
+ return true;
+ }
}
-
- public boolean studentActivityOccurredStandardAndOpen(VoteContent voteContent) throws VoteApplicationException
- {
- logger.debug("voteContent uid: " + voteContent.getUid());
- boolean studentActivityOccurredGlobal= studentActivityOccurredGlobal(voteContent);
- logger.debug("studentActivityOccurredGlobal: " + studentActivityOccurredGlobal);
-
- int userEnteredVotesCount=getUserEnteredVotesCountForContent(voteContent.getUid());
- logger.debug("userEnteredVotesCount: " + userEnteredVotesCount);
-
- if ((studentActivityOccurredGlobal == true) || (userEnteredVotesCount > 0))
- {
- return true;
- }
-
- logger.debug("there is no votes/nominations for this content");
- return false;
+ return false;
+ }
+
+ public boolean studentActivityOccurredStandardAndOpen(VoteContent voteContent) throws VoteApplicationException {
+ VoteServicePOJO.logger.debug("voteContent uid: " + voteContent.getUid());
+ boolean studentActivityOccurredGlobal = studentActivityOccurredGlobal(voteContent);
+ VoteServicePOJO.logger.debug("studentActivityOccurredGlobal: " + studentActivityOccurredGlobal);
+
+ int userEnteredVotesCount = getUserEnteredVotesCountForContent(voteContent.getUid());
+ VoteServicePOJO.logger.debug("userEnteredVotesCount: " + userEnteredVotesCount);
+
+ if (studentActivityOccurredGlobal == true || userEnteredVotesCount > 0) {
+ return true;
}
-
- public int countIncompleteSession(VoteContent vote) throws VoteApplicationException
- {
- int countIncompleteSession=2;
- return countIncompleteSession;
+ VoteServicePOJO.logger.debug("there is no votes/nominations for this content");
+ return false;
+ }
+
+ public int countIncompleteSession(VoteContent vote) throws VoteApplicationException {
+ int countIncompleteSession = 2;
+ return countIncompleteSession;
+ }
+
+ /**
+ * checks the parameter content in the tool sessions table
+ *
+ * find out if any student has ever used (logged in through the url and replied) to this content return true even if
+ * you have only one content passed as parameter referenced in the tool sessions table
+ *
+ * @param vote
+ * @return boolean
+ * @throws VoteApplicationException
+ */
+ public boolean studentActivityOccurred(VoteContent vote) throws VoteApplicationException {
+
+ int countStudentActivity = 2;
+
+ if (countStudentActivity > 0) {
+ return true;
}
-
- /**
- * checks the parameter content in the tool sessions table
- *
- * find out if any student has ever used (logged in through the url and replied) to this content
- * return true even if you have only one content passed as parameter referenced in the tool sessions table
- * @param vote
- * @return boolean
- * @throws VoteApplicationException
- */
- public boolean studentActivityOccurred(VoteContent vote) throws VoteApplicationException
- {
+ return false;
+ }
- int countStudentActivity=2;
-
- if (countStudentActivity > 0)
- return true;
- return false;
+ /**
+ * implemented as part of the Tool Contract copyToolContent(Long fromContentId, Long toContentId) throws
+ * ToolException
+ *
+ * @param fromContentId
+ * @param toContentId
+ * @return
+ * @throws ToolException
+ *
+ */
+ public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException {
+ VoteServicePOJO.logger.debug("start of copyToolContent with ids: " + fromContentId + " and " + toContentId);
+
+ if (fromContentId == null) {
+ VoteServicePOJO.logger.error("fromContentId is null.");
+ VoteServicePOJO.logger.debug("attempt retrieving tool's default content id with signatute : "
+ + VoteAppConstants.MY_SIGNATURE);
+ long defaultContentId = 0;
+ try {
+ defaultContentId = getToolDefaultContentIdBySignature(VoteAppConstants.MY_SIGNATURE);
+ fromContentId = new Long(defaultContentId);
+ } catch (Exception e) {
+ VoteServicePOJO.logger.error("default content id has not been setup for signature: "
+ + VoteAppConstants.MY_SIGNATURE);
+ throw new ToolException("WARNING! default content has not been setup for signature"
+ + VoteAppConstants.MY_SIGNATURE + " Can't continue!");
+ }
}
-
- /**
- * implemented as part of the Tool Contract
- * copyToolContent(Long fromContentId, Long toContentId) throws ToolException
- * @param fromContentId
- * @param toContentId
- * @return
- * @throws ToolException
- *
- */
- public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException
- {
- logger.debug("start of copyToolContent with ids: " + fromContentId + " and " + toContentId);
+ if (toContentId == null) {
+ VoteServicePOJO.logger.error("throwing ToolException: toContentId is null");
+ throw new ToolException("toContentId is missing");
+ }
+ VoteServicePOJO.logger.debug("final - copyToolContent using ids: " + fromContentId + " and " + toContentId);
- if (fromContentId == null)
- {
- logger.error("fromContentId is null.");
- logger.debug("attempt retrieving tool's default content id with signatute : " + MY_SIGNATURE);
- long defaultContentId=0;
- try
- {
- defaultContentId=getToolDefaultContentIdBySignature(MY_SIGNATURE);
- fromContentId= new Long(defaultContentId);
- }
- catch(Exception e)
- {
- logger.error("default content id has not been setup for signature: " + MY_SIGNATURE);
- throw new ToolException("WARNING! default content has not been setup for signature" + MY_SIGNATURE + " Can't continue!");
- }
- }
-
- if (toContentId == null)
- {
- logger.error("throwing ToolException: toContentId is null");
- throw new ToolException("toContentId is missing");
- }
- logger.debug("final - copyToolContent using ids: " + fromContentId + " and " + toContentId);
-
- try
- {
- VoteContent fromContent = voteContentDAO.findVoteContentById(fromContentId);
-
- if (fromContent == null)
- {
- logger.error("fromContent is null.");
- logger.error("attempt retrieving tool's default content id with signatute : " + MY_SIGNATURE);
- long defaultContentId=0;
- try
- {
- defaultContentId=getToolDefaultContentIdBySignature(MY_SIGNATURE);
- fromContentId= new Long(defaultContentId);
- }
- catch(Exception e)
- {
- logger.error("default content id has not been setup for signature: " + MY_SIGNATURE);
- throw new ToolException("WARNING! default content has not been setup for signature" + MY_SIGNATURE + " Can't continue!");
- }
-
- fromContent = voteContentDAO.findVoteContentById(fromContentId);
- logger.debug("using fromContent: " + fromContent);
- }
-
- logger.debug("final - retrieved fromContent: " + fromContent);
- logger.debug("final - before new instance using " + fromContent + " and " + toContentId);
- logger.debug("final - before new instance using voteToolContentHandler: " + voteToolContentHandler);
-
- try
- {
- VoteContent toContent = VoteContent.newInstance(voteToolContentHandler, fromContent,toContentId);
- if (toContent == null)
- {
- logger.debug("throwing ToolException: WARNING!, retrieved toContent is null.");
- throw new ToolException("WARNING! Fail to create toContent. Can't continue!");
- }
- else
- {
- logger.debug("retrieved toContent: " + toContent);
- voteContentDAO.saveVoteContent(toContent);
- logger.debug("toContent has been saved successfully: " + toContent);
- }
- logger.debug("end of copyToolContent with ids: " + fromContentId + " and " + toContentId);
+ try {
+ VoteContent fromContent = voteContentDAO.findVoteContentById(fromContentId);
- }
- catch(ItemNotFoundException e)
- {
- logger.error("exception occurred: " + e);
- }
- catch(RepositoryCheckedException e)
- {
- logger.error("exception occurred: " + e);
- }
- }
- catch (DataAccessException e)
- {
- logger.error("throwing ToolException: Exception occured when lams is copying content between content ids.");
- throw new ToolException("Exception occured when lams is copying content between content ids.");
- }
+ if (fromContent == null) {
+ VoteServicePOJO.logger.error("fromContent is null.");
+ VoteServicePOJO.logger.error("attempt retrieving tool's default content id with signatute : "
+ + VoteAppConstants.MY_SIGNATURE);
+ long defaultContentId = 0;
+ try {
+ defaultContentId = getToolDefaultContentIdBySignature(VoteAppConstants.MY_SIGNATURE);
+ fromContentId = new Long(defaultContentId);
+ } catch (Exception e) {
+ VoteServicePOJO.logger.error("default content id has not been setup for signature: "
+ + VoteAppConstants.MY_SIGNATURE);
+ throw new ToolException("WARNING! default content has not been setup for signature"
+ + VoteAppConstants.MY_SIGNATURE + " Can't continue!");
+ }
+
+ fromContent = voteContentDAO.findVoteContentById(fromContentId);
+ VoteServicePOJO.logger.debug("using fromContent: " + fromContent);
+ }
+
+ VoteServicePOJO.logger.debug("final - retrieved fromContent: " + fromContent);
+ VoteServicePOJO.logger.debug("final - before new instance using " + fromContent + " and " + toContentId);
+ VoteServicePOJO.logger.debug("final - before new instance using voteToolContentHandler: "
+ + voteToolContentHandler);
+
+ try {
+ VoteContent toContent = VoteContent.newInstance(voteToolContentHandler, fromContent, toContentId);
+ if (toContent == null) {
+ VoteServicePOJO.logger.debug("throwing ToolException: WARNING!, retrieved toContent is null.");
+ throw new ToolException("WARNING! Fail to create toContent. Can't continue!");
+ } else {
+ VoteServicePOJO.logger.debug("retrieved toContent: " + toContent);
+ voteContentDAO.saveVoteContent(toContent);
+ VoteServicePOJO.logger.debug("toContent has been saved successfully: " + toContent);
+ }
+ VoteServicePOJO.logger.debug("end of copyToolContent with ids: " + fromContentId + " and "
+ + toContentId);
+
+ } catch (ItemNotFoundException e) {
+ VoteServicePOJO.logger.error("exception occurred: " + e);
+ } catch (RepositoryCheckedException e) {
+ VoteServicePOJO.logger.error("exception occurred: " + e);
+ }
+ } catch (DataAccessException e) {
+ VoteServicePOJO.logger
+ .error("throwing ToolException: Exception occured when lams is copying content between content ids.");
+ throw new ToolException("Exception occured when lams is copying content between content ids.");
+ }
}
-
/**
* implemented as part of the tool contract. Removes content and uploaded files from the content repository.
* removeToolContent(Long toolContentID, boolean removeSessionData) throws SessionDataExistsException, ToolException
- * @param toContentId
- * @param removeSessionData
- * @return
- * @throws ToolException
- */
- public void removeToolContent(Long toolContentID, boolean removeSessionData) throws SessionDataExistsException, ToolException
- {
- logger.debug("start of removeToolContent with toolContentID: " + toolContentID + "removeSessionData: " + removeSessionData);
-
- if (toolContentID == null)
- {
- logger.error("toolContentID is null");
- throw new ToolException("toolContentID is missing");
- }
-
- VoteContent voteContent = voteContentDAO.findVoteContentById(toolContentID);
- logger.debug("retrieving voteContent: " + voteContent);
-
- if (voteContent != null)
- {
- logger.error("start deleting any uploaded file for this content from the content repository");
- Iterator filesIterator=voteContent.getVoteAttachments().iterator();
- while (filesIterator.hasNext())
- {
- VoteUploadedFile voteUploadedFile=(VoteUploadedFile) filesIterator.next();
- logger.debug("iterated voteUploadedFile : " + voteUploadedFile);
- String filesUuid=voteUploadedFile.getUuid();
- if ((filesUuid != null) && (filesUuid.length() > 0))
- {
- try
- {
- voteToolContentHandler.deleteFile(new Long(filesUuid));
- }
- catch(RepositoryCheckedException e)
- {
- logger.error("exception occured deleting files from content repository : " + e);
- throw new ToolException("undeletable file in the content repository");
- }
- }
- }
- logger.debug("end deleting any uploaded files for this content.");
-
- Iterator sessionIterator=voteContent.getVoteSessions().iterator();
- while (sessionIterator.hasNext())
- {
- if (removeSessionData == false)
- {
- logger.debug("removeSessionData is false, throwing SessionDataExistsException.");
- throw new SessionDataExistsException();
- }
-
- VoteSession voteSession=(VoteSession)sessionIterator.next();
- logger.debug("iterated voteSession : " + voteSession);
-
- Iterator sessionUsersIterator=voteSession.getVoteQueUsers().iterator();
- while (sessionUsersIterator.hasNext())
- {
- VoteQueUsr voteQueUsr=(VoteQueUsr) sessionUsersIterator.next();
- logger.debug("iterated voteQueUsr : " + voteQueUsr);
-
- Iterator sessionUsersAttemptsIterator=voteQueUsr.getVoteUsrAttempts().iterator();
- while (sessionUsersAttemptsIterator.hasNext())
- {
- VoteUsrAttempt voteUsrAttempt=(VoteUsrAttempt)sessionUsersAttemptsIterator.next();
- logger.debug("iterated voteUsrAttempt : " + voteUsrAttempt);
- removeAttempt(voteUsrAttempt);
- logger.debug("removed voteUsrAttempt : " + voteUsrAttempt);
- }
- }
- }
- logger.debug("removed all existing responses of toolContent with toolContentID:" +
- toolContentID);
- voteContentDAO.removeVoteById(toolContentID);
- logger.debug("removed voteContent:" + voteContent);
- }
- else
- {
- logger.error("Warning!!!, We should have not come here. voteContent is null.");
- throw new ToolException("toolContentID is missing");
- }
+ *
+ * @param toContentId
+ * @param removeSessionData
+ * @return
+ * @throws ToolException
+ */
+ public void removeToolContent(Long toolContentID, boolean removeSessionData) throws SessionDataExistsException,
+ ToolException {
+ VoteServicePOJO.logger.debug("start of removeToolContent with toolContentID: " + toolContentID
+ + "removeSessionData: " + removeSessionData);
+
+ if (toolContentID == null) {
+ VoteServicePOJO.logger.error("toolContentID is null");
+ throw new ToolException("toolContentID is missing");
}
+ VoteContent voteContent = voteContentDAO.findVoteContentById(toolContentID);
+ VoteServicePOJO.logger.debug("retrieving voteContent: " + voteContent);
+ if (voteContent != null) {
+ VoteServicePOJO.logger
+ .error("start deleting any uploaded file for this content from the content repository");
+ Iterator filesIterator = voteContent.getVoteAttachments().iterator();
+ while (filesIterator.hasNext()) {
+ VoteUploadedFile voteUploadedFile = (VoteUploadedFile) filesIterator.next();
+ VoteServicePOJO.logger.debug("iterated voteUploadedFile : " + voteUploadedFile);
+ String filesUuid = voteUploadedFile.getUuid();
+ if (filesUuid != null && filesUuid.length() > 0) {
+ try {
+ voteToolContentHandler.deleteFile(new Long(filesUuid));
+ } catch (RepositoryCheckedException e) {
+ VoteServicePOJO.logger.error("exception occured deleting files from content repository : " + e);
+ throw new ToolException("undeletable file in the content repository");
+ }
+ }
+ }
+ VoteServicePOJO.logger.debug("end deleting any uploaded files for this content.");
+
+ Iterator sessionIterator = voteContent.getVoteSessions().iterator();
+ while (sessionIterator.hasNext()) {
+ if (removeSessionData == false) {
+ VoteServicePOJO.logger.debug("removeSessionData is false, throwing SessionDataExistsException.");
+ throw new SessionDataExistsException();
+ }
+
+ VoteSession voteSession = (VoteSession) sessionIterator.next();
+ VoteServicePOJO.logger.debug("iterated voteSession : " + voteSession);
+
+ Iterator sessionUsersIterator = voteSession.getVoteQueUsers().iterator();
+ while (sessionUsersIterator.hasNext()) {
+ VoteQueUsr voteQueUsr = (VoteQueUsr) sessionUsersIterator.next();
+ VoteServicePOJO.logger.debug("iterated voteQueUsr : " + voteQueUsr);
+
+ Iterator sessionUsersAttemptsIterator = voteQueUsr.getVoteUsrAttempts().iterator();
+ while (sessionUsersAttemptsIterator.hasNext()) {
+ VoteUsrAttempt voteUsrAttempt = (VoteUsrAttempt) sessionUsersAttemptsIterator.next();
+ VoteServicePOJO.logger.debug("iterated voteUsrAttempt : " + voteUsrAttempt);
+ removeAttempt(voteUsrAttempt);
+ VoteServicePOJO.logger.debug("removed voteUsrAttempt : " + voteUsrAttempt);
+ }
+ }
+ }
+ VoteServicePOJO.logger.debug("removed all existing responses of toolContent with toolContentID:"
+ + toolContentID);
+ voteContentDAO.removeVoteById(toolContentID);
+ VoteServicePOJO.logger.debug("removed voteContent:" + voteContent);
+ } else {
+ VoteServicePOJO.logger.error("Warning!!!, We should have not come here. voteContent is null.");
+ throw new ToolException("toolContentID is missing");
+ }
+ }
+
/**
- * Export the XML fragment for the tool's content, along with any files needed
- * for the content.
- * @throws DataMissingException if no tool content matches the toolSessionID
- * @throws ToolException if any other error occurs
+ * Export the XML fragment for the tool's content, along with any files needed for the content.
+ *
+ * @throws DataMissingException
+ * if no tool content matches the toolSessionID
+ * @throws ToolException
+ * if any other error occurs
*/
- public void exportToolContent(Long toolContentID, String rootPath) throws DataMissingException, ToolException {
- VoteContent toolContentObj = voteContentDAO.findVoteContentById(toolContentID);
- if(toolContentObj == null) {
- long defaultContentId=getToolDefaultContentIdBySignature(MY_SIGNATURE);
- toolContentObj = voteContentDAO.findVoteContentById(defaultContentId);
- }
-
- if(toolContentObj == null)
- throw new DataMissingException("Unable to find default content for the voting tool");
-
- try {
- //set ToolContentHandler as null to avoid copy file node in repository again.
- toolContentObj = VoteContent.newInstance(null,toolContentObj,toolContentID);
-
- //clear unnecessary information attach
- toolContentObj.setVoteSessions(null);
- Set ques = toolContentObj.getVoteQueContents();
- for(VoteQueContent que : ques){
- que.setMcUsrAttempts(null);
- }
- exportContentService.registerFileClassForExport(VoteUploadedFile.class.getName(),"uuid",null);
- exportContentService.exportToolContent( toolContentID, toolContentObj,voteToolContentHandler, rootPath);
- } catch (ExportToolContentException e) {
- throw new ToolException(e);
- } catch (ItemNotFoundException e) {
- throw new ToolException(e);
- } catch (RepositoryCheckedException e) {
- throw new ToolException(e);
- }
+ public void exportToolContent(Long toolContentID, String rootPath) throws DataMissingException, ToolException {
+ VoteContent toolContentObj = voteContentDAO.findVoteContentById(toolContentID);
+ if (toolContentObj == null) {
+ long defaultContentId = getToolDefaultContentIdBySignature(VoteAppConstants.MY_SIGNATURE);
+ toolContentObj = voteContentDAO.findVoteContentById(defaultContentId);
}
+ if (toolContentObj == null) {
+ throw new DataMissingException("Unable to find default content for the voting tool");
+ }
+
+ try {
+ // set ToolContentHandler as null to avoid copy file node in repository again.
+ toolContentObj = VoteContent.newInstance(null, toolContentObj, toolContentID);
+
+ // clear unnecessary information attach
+ toolContentObj.setVoteSessions(null);
+ Set ques = toolContentObj.getVoteQueContents();
+ for (VoteQueContent que : ques) {
+ que.setMcUsrAttempts(null);
+ }
+ exportContentService.registerFileClassForExport(VoteUploadedFile.class.getName(), "uuid", null);
+ exportContentService.exportToolContent(toolContentID, toolContentObj, voteToolContentHandler, rootPath);
+ } catch (ExportToolContentException e) {
+ throw new ToolException(e);
+ } catch (ItemNotFoundException e) {
+ throw new ToolException(e);
+ } catch (RepositoryCheckedException e) {
+ throw new ToolException(e);
+ }
+ }
+
/**
- * Import the XML fragment for the tool's content, along with any files needed
- * for the content.
- * @throws ToolException if any other error occurs
+ * Import the XML fragment for the tool's content, along with any files needed for the content.
+ *
+ * @throws ToolException
+ * if any other error occurs
*/
- public void importToolContent(Long toolContentID, Integer newUserUid, String toolContentPath,String fromVersion,String toVersion) throws ToolException {
- try {
- exportContentService.registerFileClassForImport(VoteUploadedFile.class.getName()
- ,"uuid",null,"fileName","fileProperty",null,null);
-
- //register version filter class
- exportContentService.registerImportVersionFilterClass(VoteImportContentVersionFilter.class);
+ public void importToolContent(Long toolContentID, Integer newUserUid, String toolContentPath, String fromVersion,
+ String toVersion) throws ToolException {
+ try {
+ exportContentService.registerFileClassForImport(VoteUploadedFile.class.getName(), "uuid", null, "fileName",
+ "fileProperty", null, null);
-
- Object toolPOJO = exportContentService.importToolContent(toolContentPath,voteToolContentHandler,fromVersion,toVersion);
- if(!(toolPOJO instanceof VoteContent))
- throw new ImportToolContentException("Import Vote tool content failed. Deserialized object is " + toolPOJO);
- VoteContent toolContentObj = (VoteContent) toolPOJO;
-
-// reset it to new toolContentID
- toolContentObj.setVoteContentId(toolContentID);
- toolContentObj.setCreatedBy(newUserUid);
-
- voteContentDAO.saveVoteContent(toolContentObj);
- } catch (ImportToolContentException e) {
- throw new ToolException(e);
- }
+ // register version filter class
+ exportContentService.registerImportVersionFilterClass(VoteImportContentVersionFilter.class);
+
+ Object toolPOJO = exportContentService.importToolContent(toolContentPath, voteToolContentHandler,
+ fromVersion, toVersion);
+ if (!(toolPOJO instanceof VoteContent)) {
+ throw new ImportToolContentException("Import Vote tool content failed. Deserialized object is "
+ + toolPOJO);
+ }
+ VoteContent toolContentObj = (VoteContent) toolPOJO;
+
+ // reset it to new toolContentID
+ toolContentObj.setVoteContentId(toolContentID);
+ toolContentObj.setCreatedBy(newUserUid);
+
+ voteContentDAO.saveVoteContent(toolContentObj);
+ } catch (ImportToolContentException e) {
+ throw new ToolException(e);
}
+ }
- /**
- * Implemented as part of the tool contract. Sets the defineLater to true on this content.
- * setAsDefineLater(Long toolContentID) throws DataMissingException, ToolException
+ /**
+ * Implemented as part of the tool contract. Sets the defineLater to true on this content. setAsDefineLater(Long
+ * toolContentID) throws DataMissingException, ToolException
+ *
* @param toolContentID
- * @return
+ * @return
* @throws ToolException
*/
- public void setAsDefineLater(Long toolContentID, boolean value) throws DataMissingException, ToolException
- {
- if (toolContentID == null)
- {
- logger.error("throwing DataMissingException: WARNING!: retrieved toolContentID is null.");
- throw new DataMissingException("toolContentID is missing");
- }
-
- VoteContent voteContent=retrieveVote(toolContentID);
- if (voteContent == null)
- {
- logger.error("throwing DataMissingException: WARNING!: retrieved voteContent is null.");
- throw new DataMissingException("voteContent is missing");
- }
- voteContent.setDefineLater(value);
- saveVoteContent(voteContent);
+ public void setAsDefineLater(Long toolContentID, boolean value) throws DataMissingException, ToolException {
+ if (toolContentID == null) {
+ VoteServicePOJO.logger.error("throwing DataMissingException: WARNING!: retrieved toolContentID is null.");
+ throw new DataMissingException("toolContentID is missing");
+ }
+
+ VoteContent voteContent = retrieveVote(toolContentID);
+ if (voteContent == null) {
+ VoteServicePOJO.logger.error("throwing DataMissingException: WARNING!: retrieved voteContent is null.");
+ throw new DataMissingException("voteContent is missing");
+ }
+ voteContent.setDefineLater(value);
+ saveVoteContent(voteContent);
}
-
/**
- * Implemented as part of the tool contract. Sets the runOffline to true on this content.
- * setAsRunOffline(Long toolContentID) throws DataMissingException, ToolException
+ * Implemented as part of the tool contract. Sets the runOffline to true on this content. setAsRunOffline(Long
+ * toolContentID) throws DataMissingException, ToolException
*
* @param toolContentID
- * return
- * @throws ToolException
+ * return
+ * @throws ToolException
*/
- public void setAsRunOffline(Long toolContentID, boolean value) throws DataMissingException, ToolException
- {
- if (toolContentID == null)
- {
- logger.error("throwing DataMissingException: WARNING!: retrieved toolContentID is null.");
- throw new DataMissingException("toolContentID is missing");
- }
- VoteContent voteContent = voteContentDAO.findVoteContentById(toolContentID);
- if (voteContent == null)
- {
- logger.error("throwing DataMissingException: WARNING!: retrieved voteContent is null.");
- throw new DataMissingException("voteContent is missing");
- }
- voteContent.setRunOffline(value);
- saveVoteContent(voteContent);
+ public void setAsRunOffline(Long toolContentID, boolean value) throws DataMissingException, ToolException {
+ if (toolContentID == null) {
+ VoteServicePOJO.logger.error("throwing DataMissingException: WARNING!: retrieved toolContentID is null.");
+ throw new DataMissingException("toolContentID is missing");
+ }
+ VoteContent voteContent = voteContentDAO.findVoteContentById(toolContentID);
+ if (voteContent == null) {
+ VoteServicePOJO.logger.error("throwing DataMissingException: WARNING!: retrieved voteContent is null.");
+ throw new DataMissingException("voteContent is missing");
+ }
+ voteContent.setRunOffline(value);
+ saveVoteContent(voteContent);
}
-
-
+
/**
- * it is possible that the tool session id already exists in the tool sessions table
- * as the users from the same session are involved.
- * existsSession(long toolSessionID)
- * @param toolSessionID
- * @return boolean
- */
- public boolean existsSession(Long toolSessionID)
- {
- VoteSession voteSession= retrieveVoteSession(toolSessionID);
-
- if (voteSession == null)
- {
- logger.error("voteSession does not exist yet: " + toolSessionID);
- return false;
- }
- else
- {
- logger.debug("retrieving an existing voteSession: " + voteSession + " " + toolSessionID);
- }
- return true;
+ * it is possible that the tool session id already exists in the tool sessions table as the users from the same
+ * session are involved. existsSession(long toolSessionID)
+ *
+ * @param toolSessionID
+ * @return boolean
+ */
+ public boolean existsSession(Long toolSessionID) {
+ VoteSession voteSession = retrieveVoteSession(toolSessionID);
+
+ if (voteSession == null) {
+ VoteServicePOJO.logger.error("voteSession does not exist yet: " + toolSessionID);
+ return false;
+ } else {
+ VoteServicePOJO.logger.debug("retrieving an existing voteSession: " + voteSession + " " + toolSessionID);
}
-
+ return true;
+ }
+
/**
- * Implemented as part of the tool contract.
- * Gets called only in the Learner mode.
- * All the learners in the same group have the same toolSessionID.
+ * Implemented as part of the tool contract. Gets called only in the Learner mode. All the learners in the same
+ * group have the same toolSessionID.
*
- * @param toolSessionID the generated tool session id.
- * @param toolSessionName the tool session name.
- * @param toolContentID the tool content id specified.
- * @throws ToolException if an error occurs e.g. defaultContent is missing.
+ * @param toolSessionID
+ * the generated tool session id.
+ * @param toolSessionName
+ * the tool session name.
+ * @param toolContentID
+ * the tool content id specified.
+ * @throws ToolException
+ * if an error occurs e.g. defaultContent is missing.
*
*/
- public void createToolSession(Long toolSessionID, String toolSessionName, Long toolContentID) throws ToolException
- {
- logger.debug("start of createToolSession with ids: " + toolSessionID + " and " + toolContentID);
- logger.debug("toolSessionName: " + toolSessionName);
-
- if (toolSessionID == null)
- {
- logger.error("toolSessionID is null");
- throw new ToolException("toolSessionID is missing");
- }
-
- long defaultContentId=0;
- if (toolContentID == null)
- {
- logger.error("toolContentID is null.");
- logger.error("attempt retrieving tool's default content id with signatute : " + MY_SIGNATURE);
-
- try
- {
- defaultContentId=getToolDefaultContentIdBySignature(MY_SIGNATURE);
- toolContentID=new Long(defaultContentId);
- logger.debug("updated toolContentID to: " + toolContentID);
- }
- catch(Exception e)
- {
- logger.error("default content id has not been setup for signature: " + MY_SIGNATURE);
- throw new ToolException("WARNING! default content has not been setup for signature" + MY_SIGNATURE + " Can't continue!");
- }
- }
- logger.debug("final toolSessionID and toolContentID: " + toolSessionID + " " + toolContentID);
-
- VoteContent voteContent = voteContentDAO.findVoteContentById(toolContentID);
- logger.debug("retrieved voteContent: " + voteContent);
-
- if (voteContent == null)
- {
- logger.error("voteContent is null.");
- logger.error("attempt retrieving tool's default content id with signatute : " + MY_SIGNATURE);
-
- try
- {
- defaultContentId=getToolDefaultContentIdBySignature(MY_SIGNATURE);
- toolContentID=new Long(defaultContentId);
- logger.debug("updated toolContentID to: " + toolContentID);
- }
- catch(Exception e)
- {
- logger.error("default content id has not been setup for signature: " + MY_SIGNATURE);
- throw new ToolException("WARNING! default content has not been setup for signature" + MY_SIGNATURE + " Can't continue!");
- }
+ public void createToolSession(Long toolSessionID, String toolSessionName, Long toolContentID) throws ToolException {
+ VoteServicePOJO.logger.debug("start of createToolSession with ids: " + toolSessionID + " and " + toolContentID);
+ VoteServicePOJO.logger.debug("toolSessionName: " + toolSessionName);
- voteContent = voteContentDAO.findVoteContentById(toolContentID);
- }
- logger.debug("final - retrieved voteContent: " + voteContent);
+ if (toolSessionID == null) {
+ VoteServicePOJO.logger.error("toolSessionID is null");
+ throw new ToolException("toolSessionID is missing");
+ }
-
- /*
- * create a new a new tool session if it does not already exist in the tool session table
- */
- if (!existsSession(toolSessionID))
- {
- try
- {
- VoteSession voteSession = new VoteSession(toolSessionID,
- new Date(System.currentTimeMillis()),
- VoteSession.INCOMPLETE,
- toolSessionName,
- voteContent,
- new TreeSet());
+ long defaultContentId = 0;
+ if (toolContentID == null) {
+ VoteServicePOJO.logger.error("toolContentID is null.");
+ VoteServicePOJO.logger.error("attempt retrieving tool's default content id with signatute : "
+ + VoteAppConstants.MY_SIGNATURE);
- logger.debug("created voteSession: " + voteSession);
- voteSessionDAO.saveVoteSession(voteSession);
- logger.debug("created voteSession in the db: " + voteSession);
-
- }
- catch(Exception e)
- {
- logger.error("Error creating new toolsession in the db");
- throw new ToolException("Error creating new toolsession in the db: " + e);
- }
- }
- }
+ try {
+ defaultContentId = getToolDefaultContentIdBySignature(VoteAppConstants.MY_SIGNATURE);
+ toolContentID = new Long(defaultContentId);
+ VoteServicePOJO.logger.debug("updated toolContentID to: " + toolContentID);
+ } catch (Exception e) {
+ VoteServicePOJO.logger.error("default content id has not been setup for signature: "
+ + VoteAppConstants.MY_SIGNATURE);
+ throw new ToolException("WARNING! default content has not been setup for signature"
+ + VoteAppConstants.MY_SIGNATURE + " Can't continue!");
+ }
+ }
+ VoteServicePOJO.logger.debug("final toolSessionID and toolContentID: " + toolSessionID + " " + toolContentID);
+ VoteContent voteContent = voteContentDAO.findVoteContentById(toolContentID);
+ VoteServicePOJO.logger.debug("retrieved voteContent: " + voteContent);
+ if (voteContent == null) {
+ VoteServicePOJO.logger.error("voteContent is null.");
+ VoteServicePOJO.logger.error("attempt retrieving tool's default content id with signatute : "
+ + VoteAppConstants.MY_SIGNATURE);
+
+ try {
+ defaultContentId = getToolDefaultContentIdBySignature(VoteAppConstants.MY_SIGNATURE);
+ toolContentID = new Long(defaultContentId);
+ VoteServicePOJO.logger.debug("updated toolContentID to: " + toolContentID);
+ } catch (Exception e) {
+ VoteServicePOJO.logger.error("default content id has not been setup for signature: "
+ + VoteAppConstants.MY_SIGNATURE);
+ throw new ToolException("WARNING! default content has not been setup for signature"
+ + VoteAppConstants.MY_SIGNATURE + " Can't continue!");
+ }
+
+ voteContent = voteContentDAO.findVoteContentById(toolContentID);
+ }
+ VoteServicePOJO.logger.debug("final - retrieved voteContent: " + voteContent);
+
+ /*
+ * create a new a new tool session if it does not already exist in the tool session table
+ */
+ if (!existsSession(toolSessionID)) {
+ try {
+ VoteSession voteSession = new VoteSession(toolSessionID, new Date(System.currentTimeMillis()),
+ VoteSession.INCOMPLETE, toolSessionName, voteContent, new TreeSet());
+
+ VoteServicePOJO.logger.debug("created voteSession: " + voteSession);
+ voteSessionDAO.saveVoteSession(voteSession);
+ VoteServicePOJO.logger.debug("created voteSession in the db: " + voteSession);
+
+ } catch (Exception e) {
+ VoteServicePOJO.logger.error("Error creating new toolsession in the db");
+ throw new ToolException("Error creating new toolsession in the db: " + e);
+ }
+ }
+ }
+
/**
- * Implemented as part of the tool contract.
- * removeToolSession(Long toolSessionID) throws DataMissingException, ToolException
+ * Implemented as part of the tool contract. removeToolSession(Long toolSessionID) throws DataMissingException,
+ * ToolException
+ *
* @param toolSessionID
- * @param toolContentID
- * return
+ * @param toolContentID
+ * return
* @throws ToolException
*/
- public void removeToolSession(Long toolSessionID) throws DataMissingException, ToolException
- {
- logger.debug("start of removeToolSession with id: " + toolSessionID);
- if (toolSessionID == null)
- {
- logger.error("toolSessionID is null");
- throw new DataMissingException("toolSessionID is missing");
- }
-
-
- VoteSession voteSession=null;
- try
- {
- voteSession=retrieveVoteSession(toolSessionID);
- logger.debug("retrieved voteSession: " + voteSession);
- }
- catch(VoteApplicationException e)
- {
- throw new DataMissingException("error retrieving voteSession: " + e);
- }
- catch(Exception e)
- {
- throw new ToolException("error retrieving voteSession: " + e);
- }
-
- if (voteSession == null)
- {
- logger.error("voteSession is null");
- throw new DataMissingException("voteSession is missing");
- }
-
- try
- {
- voteSessionDAO.removeVoteSession(voteSession);
- logger.debug("voteSession " + voteSession + " has been deleted successfully.");
- }
- catch(VoteApplicationException e)
- {
- throw new ToolException("error deleting voteSession:" + e);
- }
+ public void removeToolSession(Long toolSessionID) throws DataMissingException, ToolException {
+ VoteServicePOJO.logger.debug("start of removeToolSession with id: " + toolSessionID);
+ if (toolSessionID == null) {
+ VoteServicePOJO.logger.error("toolSessionID is null");
+ throw new DataMissingException("toolSessionID is missing");
}
-
+ VoteSession voteSession = null;
+ try {
+ voteSession = retrieveVoteSession(toolSessionID);
+ VoteServicePOJO.logger.debug("retrieved voteSession: " + voteSession);
+ } catch (VoteApplicationException e) {
+ throw new DataMissingException("error retrieving voteSession: " + e);
+ } catch (Exception e) {
+ throw new ToolException("error retrieving voteSession: " + e);
+ }
+
+ if (voteSession == null) {
+ VoteServicePOJO.logger.error("voteSession is null");
+ throw new DataMissingException("voteSession is missing");
+ }
+
+ try {
+ voteSessionDAO.removeVoteSession(voteSession);
+ VoteServicePOJO.logger.debug("voteSession " + voteSession + " has been deleted successfully.");
+ } catch (VoteApplicationException e) {
+ throw new ToolException("error deleting voteSession:" + e);
+ }
+ }
+
/**
- * Implemtented as part of the tool contract.
- * leaveToolSession(Long toolSessionID,Long learnerId) throws DataMissingException, ToolException
+ * Implemtented as part of the tool contract. leaveToolSession(Long toolSessionID,Long learnerId) throws
+ * DataMissingException, ToolException
+ *
* @param toolSessionID
- * @param learnerId
- * return String
+ * @param learnerId
+ * return String
* @throws ToolException
*
*/
- public String leaveToolSession(Long toolSessionID,Long learnerId) throws DataMissingException, ToolException
- {
- logger.debug("start of leaveToolSession with toolSessionID:" + toolSessionID + " and learnerId:" + learnerId);
- logger.debug("make sure learnerService is available. Is it?" + learnerService);
-
- if (learnerService == null)
- return "dummyNextUrl";
-
- if (learnerId == null)
- {
- logger.error("learnerId is null");
- throw new DataMissingException("learnerId is missing");
- }
-
- if (toolSessionID == null)
- {
- logger.error("toolSessionID is null");
- throw new DataMissingException("toolSessionID is missing");
- }
-
- VoteSession voteSession=null;
- try
- {
- voteSession=retrieveVoteSession(toolSessionID);
- logger.debug("retrieved voteSession: " + voteSession);
- }
- catch(VoteApplicationException e)
- {
- throw new DataMissingException("error retrieving voteSession: " + e);
- }
- catch(Exception e)
- {
- throw new ToolException("error retrieving voteSession: " + e);
- }
- voteSession.setSessionStatus(COMPLETED);
- voteSessionDAO.updateVoteSession(voteSession);
- logger.debug("updated voteSession to COMPLETED" + voteSession);
-
- String nextUrl= learnerService.completeToolSession(toolSessionID,learnerId);
- logger.debug("nextUrl: " + nextUrl);
- if (nextUrl == null)
- {
- logger.error("nextUrl is null");
- throw new ToolException("nextUrl is null");
- }
- return nextUrl;
+ public String leaveToolSession(Long toolSessionID, Long learnerId) throws DataMissingException, ToolException {
+ VoteServicePOJO.logger.debug("start of leaveToolSession with toolSessionID:" + toolSessionID
+ + " and learnerId:" + learnerId);
+ VoteServicePOJO.logger.debug("make sure learnerService is available. Is it?" + learnerService);
+
+ if (learnerService == null) {
+ return "dummyNextUrl";
+ }
+
+ if (learnerId == null) {
+ VoteServicePOJO.logger.error("learnerId is null");
+ throw new DataMissingException("learnerId is missing");
+ }
+
+ if (toolSessionID == null) {
+ VoteServicePOJO.logger.error("toolSessionID is null");
+ throw new DataMissingException("toolSessionID is missing");
+ }
+
+ VoteSession voteSession = null;
+ try {
+ voteSession = retrieveVoteSession(toolSessionID);
+ VoteServicePOJO.logger.debug("retrieved voteSession: " + voteSession);
+ } catch (VoteApplicationException e) {
+ throw new DataMissingException("error retrieving voteSession: " + e);
+ } catch (Exception e) {
+ throw new ToolException("error retrieving voteSession: " + e);
+ }
+ voteSession.setSessionStatus(VoteAppConstants.COMPLETED);
+ voteSessionDAO.updateVoteSession(voteSession);
+ VoteServicePOJO.logger.debug("updated voteSession to COMPLETED" + voteSession);
+
+ String nextUrl = learnerService.completeToolSession(toolSessionID, learnerId);
+ VoteServicePOJO.logger.debug("nextUrl: " + nextUrl);
+ if (nextUrl == null) {
+ VoteServicePOJO.logger.error("nextUrl is null");
+ throw new ToolException("nextUrl is null");
+ }
+ return nextUrl;
}
-
/**
* exportToolSession(Long toolSessionID) throws DataMissingException, ToolException
+ *
* @param toolSessionID
- * return ToolSessionExportOutputData
+ * return ToolSessionExportOutputData
* @throws ToolException
*/
- public ToolSessionExportOutputData exportToolSession(Long toolSessionID) throws DataMissingException, ToolException
- {
- throw new ToolException("not yet implemented");
+ public ToolSessionExportOutputData exportToolSession(Long toolSessionID) throws DataMissingException, ToolException {
+ throw new ToolException("not yet implemented");
}
-
/**
* exportToolSession(Long toolSessionID) throws DataMissingException, ToolException
+ *
* @param toolSessionIDs
- * return ToolSessionExportOutputData
+ * return ToolSessionExportOutputData
* @throws ToolException
*/
- public ToolSessionExportOutputData exportToolSession(List toolSessionIDs) throws DataMissingException, ToolException
- {
- throw new ToolException("not yet implemented");
+ public ToolSessionExportOutputData exportToolSession(List toolSessionIDs) throws DataMissingException,
+ ToolException {
+ throw new ToolException("not yet implemented");
}
-
- public IToolVO getToolBySignature(String toolSignature) throws VoteApplicationException
- {
- logger.debug("attempt retrieving tool with signature : " + toolSignature);
- IToolVO tool=toolService.getToolBySignature(toolSignature);
- logger.debug("retrieved tool: " + tool);
- return tool;
+
+ public IToolVO getToolBySignature(String toolSignature) throws VoteApplicationException {
+ VoteServicePOJO.logger.debug("attempt retrieving tool with signature : " + toolSignature);
+ IToolVO tool = toolService.getToolBySignature(toolSignature);
+ VoteServicePOJO.logger.debug("retrieved tool: " + tool);
+ return tool;
}
-
- public long getToolDefaultContentIdBySignature(String toolSignature) throws VoteApplicationException
- {
- long contentId=0;
- contentId=toolService.getToolDefaultContentIdBySignature(toolSignature);
- logger.debug("tool default contentId : " + contentId);
- return contentId;
+
+ public long getToolDefaultContentIdBySignature(String toolSignature) throws VoteApplicationException {
+ long contentId = 0;
+ contentId = toolService.getToolDefaultContentIdBySignature(toolSignature);
+ VoteServicePOJO.logger.debug("tool default contentId : " + contentId);
+ return contentId;
}
- public VoteQueContent getToolDefaultQuestionContent(long contentId) throws VoteApplicationException
- {
- VoteQueContent voteQueContent=voteQueContentDAO.getToolDefaultQuestionContent(contentId);
- logger.debug("retrieved voteQueContent : " + voteQueContent);
- return voteQueContent;
+ public VoteQueContent getToolDefaultQuestionContent(long contentId) throws VoteApplicationException {
+ VoteQueContent voteQueContent = voteQueContentDAO.getToolDefaultQuestionContent(contentId);
+ VoteServicePOJO.logger.debug("retrieved voteQueContent : " + voteQueContent);
+ return voteQueContent;
}
-
- public List getToolSessionsForContent(VoteContent vote)
- {
- logger.debug("attempt retrieving listToolSessionIds for : " + vote);
- List listToolSessionIds=voteSessionDAO.getSessionsFromContent(vote);
- return listToolSessionIds;
+ public List getToolSessionsForContent(VoteContent vote) {
+ VoteServicePOJO.logger.debug("attempt retrieving listToolSessionIds for : " + vote);
+ List listToolSessionIds = voteSessionDAO.getSessionsFromContent(vote);
+ return listToolSessionIds;
}
-
- public void removeAttachment(VoteContent content, VoteUploadedFile attachment) throws RepositoryCheckedException
- {
- try
- {
- attachment.setVoteContent(null);
- content.getVoteAttachments().remove(attachment);
- voteToolContentHandler.deleteFile(new Long(attachment.getUuid()));
- saveVoteContent(content);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("EXCEPTION: An exception has occurred while trying to remove this attachment"
- + e.getMessage(), e);
- }
+ public void removeAttachment(VoteContent content, VoteUploadedFile attachment) throws RepositoryCheckedException {
+ try {
+ attachment.setVoteContent(null);
+ content.getVoteAttachments().remove(attachment);
+ voteToolContentHandler.deleteFile(new Long(attachment.getUuid()));
+ saveVoteContent(content);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException(
+ "EXCEPTION: An exception has occurred while trying to remove this attachment" + e.getMessage(), e);
}
-
-
- public NodeKey uploadFile(InputStream istream, String filename, String contentType, String fileType) throws RepositoryCheckedException
- {
- return voteToolContentHandler.uploadFile(istream, filename, contentType, fileType);
- }
-
-
- public NodeKey copyFile(Long uuid) throws RepositoryCheckedException
- {
- return voteToolContentHandler.copyFile(uuid);
- }
-
- /**
- * This method verifies the credentials of the SubmitFiles Tool and gives it
- * the Ticket to login and access the Content Repository.
- *
- * A valid ticket is needed in order to access the content from the
- * repository. This method would be called evertime the tool needs to
- * upload/download files from the content repository.
- *
- * @return ITicket The ticket for repostory access
- * @throws SubmitFilesException
- */
- public ITicket getRepositoryLoginTicket() throws VoteApplicationException {
- repositoryService = RepositoryProxy.getRepositoryService();
- logger.debug("retrieved repositoryService : " + repositoryService);
-
-
- ICredentials credentials = new SimpleCredentials(
- repositoryUser,
- repositoryId);
- try {
- ITicket ticket = repositoryService.login(credentials,
- repositoryWorkspaceName);
- logger.debug("retrieved ticket: " + ticket);
- return ticket;
- } catch (AccessDeniedException e) {
- throw new VoteApplicationException("Access Denied to repository."
- + e.getMessage());
- } catch (WorkspaceNotFoundException e) {
- throw new VoteApplicationException("Workspace not found."
- + e.getMessage());
- } catch (LoginException e) {
- throw new VoteApplicationException("Login failed." + e.getMessage());
- }
- }
-
-
-
- /**
- * This method deletes the content with the given uuid and
- * versionID from the content repository
- *
- * @param uuid
- * The uuid of the node to be deleted
- * @param versionID
- * The version_id of the node to be deleted.
- * @throws SubmitFilesException
- */
- public void deleteFromRepository(Long uuid, Long versionID)
- throws VoteApplicationException {
- ITicket ticket = getRepositoryLoginTicket();
- logger.debug("retrieved ticket: " + ticket);
- try {
- String files[] = repositoryService.deleteVersion(ticket, uuid,versionID);
- logger.debug("retrieved files: " + files);
- } catch (Exception e) {
- throw new VoteApplicationException(
- "Exception occured while deleting files from"
- + " the repository " + e.getMessage());
- }
- }
-
+ }
-
-
- /**
- * This method is called everytime a new content has to be added to the
- * repository. In order to do so first of all a valid ticket is obtained
- * from the Repository hence authenticating the tool(SubmitFiles) and then
- * the corresponding file is added to the repository.
- *
- * @param stream
- * The InputStream representing the data to be
- * added
- * @param fileName
- * The name of the file being added
- * @param mimeType
- * The MIME type of the file (eg. TXT, DOC, GIF etc)
- * @return NodeKey Represents the two part key - UUID and Version.
- * @throws SubmitFilesException
- */
- public NodeKey uploadFileToRepository(InputStream stream, String fileName) throws VoteApplicationException {
- logger.debug("attempt getting the ticket");
- ITicket ticket = getRepositoryLoginTicket();
- logger.debug("retrieved ticket: " + ticket);
-
- try {
- NodeKey nodeKey = repositoryService.addFileItem(ticket, stream,
- fileName, null, null);
- logger.debug("retrieved nodeKey from repository service: " + nodeKey);
- return nodeKey;
- } catch (Exception e) {
- throw new VoteApplicationException("Exception occured while trying to"
- + " upload file into the repository" + e.getMessage());
- }
- }
+ public NodeKey uploadFile(InputStream istream, String filename, String contentType, String fileType)
+ throws RepositoryCheckedException {
+ return voteToolContentHandler.uploadFile(istream, filename, contentType, fileType);
+ }
- public InputStream downloadFile(Long uuid, Long versionID)throws VoteApplicationException{
- ITicket ticket = getRepositoryLoginTicket();
- try{
- IVersionedNode node = repositoryService.getFileItem(ticket,uuid,null);
- logger.debug("retrieved node: " + node);
- return node.getFile();
- }catch(AccessDeniedException e){
- throw new VoteApplicationException("AccessDeniedException occured while trying to download file " + e.getMessage());
- }catch(FileException e){
- throw new VoteApplicationException("FileException occured while trying to download file " + e.getMessage());
- }catch(ItemNotFoundException e){
- throw new VoteApplicationException("ItemNotFoundException occured while trying to download file " + e.getMessage());
- }
+ public NodeKey copyFile(Long uuid) throws RepositoryCheckedException {
+ return voteToolContentHandler.copyFile(uuid);
+ }
+
+ /**
+ * This method verifies the credentials of the SubmitFiles Tool and gives it the Ticket to login and
+ * access the Content Repository.
+ *
+ * A valid ticket is needed in order to access the content from the repository. This method would be called evertime
+ * the tool needs to upload/download files from the content repository.
+ *
+ * @return ITicket The ticket for repostory access
+ * @throws SubmitFilesException
+ */
+ public ITicket getRepositoryLoginTicket() throws VoteApplicationException {
+ repositoryService = RepositoryProxy.getRepositoryService();
+ VoteServicePOJO.logger.debug("retrieved repositoryService : " + repositoryService);
+
+ ICredentials credentials = new SimpleCredentials(repositoryUser, repositoryId);
+ try {
+ ITicket ticket = repositoryService.login(credentials, VoteServicePOJO.repositoryWorkspaceName);
+ VoteServicePOJO.logger.debug("retrieved ticket: " + ticket);
+ return ticket;
+ } catch (AccessDeniedException e) {
+ throw new VoteApplicationException("Access Denied to repository." + e.getMessage());
+ } catch (WorkspaceNotFoundException e) {
+ throw new VoteApplicationException("Workspace not found." + e.getMessage());
+ } catch (LoginException e) {
+ throw new VoteApplicationException("Login failed." + e.getMessage());
}
-
-
-
-
- /**
- * adds a new entry to the uploaded files table
- */
- public void persistFile(String uuid, boolean isOnlineFile, String fileName, VoteContent voteContent) throws VoteApplicationException {
-
- logger.debug("attempt persisting file to the db: " + uuid + " " + isOnlineFile + " " + fileName + " " + voteContent);
- VoteUploadedFile voteUploadedFile= new VoteUploadedFile(uuid, isOnlineFile, fileName, voteContent);
- logger.debug("created voteUploadedFile: " + voteUploadedFile);
- voteUploadedFileDAO.saveUploadFile(voteUploadedFile);
- logger.debug("persisted voteUploadedFile: " + voteUploadedFile);
- }
+ }
- /**
- *
- * removes all the entries in the uploaded files table
- */
- public void cleanUploadedFilesMetaData() throws VoteApplicationException {
- logger.debug("attempt cleaning up uploaded file meta data table from the db");
- voteUploadedFileDAO.cleanUploadedFilesMetaData();
- logger.debug("files meta data has been cleaned up");
+ /**
+ * This method deletes the content with the given uuid and versionID from the content
+ * repository
+ *
+ * @param uuid
+ * The uuid of the node to be deleted
+ * @param versionID
+ * The version_id of the node to be deleted.
+ * @throws SubmitFilesException
+ */
+ public void deleteFromRepository(Long uuid, Long versionID) throws VoteApplicationException {
+ ITicket ticket = getRepositoryLoginTicket();
+ VoteServicePOJO.logger.debug("retrieved ticket: " + ticket);
+ try {
+ String files[] = repositoryService.deleteVersion(ticket, uuid, versionID);
+ VoteServicePOJO.logger.debug("retrieved files: " + files);
+ } catch (Exception e) {
+ throw new VoteApplicationException("Exception occured while deleting files from" + " the repository "
+ + e.getMessage());
}
-
+ }
-
- /** Get the definitions for possible output for an activity, based on the toolContentId. Currently we have one definition, which is whether
- * or not the user has selected a particular answer
+ /**
+ * This method is called everytime a new content has to be added to the repository. In order to do so first of all a
+ * valid ticket is obtained from the Repository hence authenticating the tool(SubmitFiles) and then the
+ * corresponding file is added to the repository.
+ *
+ * @param stream
+ * The InputStream representing the data to be added
+ * @param fileName
+ * The name of the file being added
+ * @param mimeType
+ * The MIME type of the file (eg. TXT, DOC, GIF etc)
+ * @return NodeKey Represents the two part key - UUID and Version.
+ * @throws SubmitFilesException
*/
- public SortedMap getToolOutputDefinitions(Long toolContentId) throws ToolException {
- VoteContent content = retrieveVote(toolContentId);
- if ( content == null ) {
- long defaultToolContentId = getToolDefaultContentIdBySignature(MY_SIGNATURE);
- content = retrieveVote(defaultToolContentId);
- }
- return getVoteOutputFactory().getToolOutputDefinitions(content);
+ public NodeKey uploadFileToRepository(InputStream stream, String fileName) throws VoteApplicationException {
+ VoteServicePOJO.logger.debug("attempt getting the ticket");
+ ITicket ticket = getRepositoryLoginTicket();
+ VoteServicePOJO.logger.debug("retrieved ticket: " + ticket);
+
+ try {
+ NodeKey nodeKey = repositoryService.addFileItem(ticket, stream, fileName, null, null);
+ VoteServicePOJO.logger.debug("retrieved nodeKey from repository service: " + nodeKey);
+ return nodeKey;
+ } catch (Exception e) {
+ throw new VoteApplicationException("Exception occured while trying to" + " upload file into the repository"
+ + e.getMessage());
}
-
- /**
- * Get the tool output for the given tool output names.
- * @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 voteOutputFactory.getToolOutput(names, this, toolSessionId, learnerId);
+ }
+
+ public InputStream downloadFile(Long uuid, Long versionID) throws VoteApplicationException {
+ ITicket ticket = getRepositoryLoginTicket();
+ try {
+ IVersionedNode node = repositoryService.getFileItem(ticket, uuid, null);
+ VoteServicePOJO.logger.debug("retrieved node: " + node);
+ return node.getFile();
+ } catch (AccessDeniedException e) {
+ throw new VoteApplicationException("AccessDeniedException occured while trying to download file "
+ + e.getMessage());
+ } catch (FileException e) {
+ throw new VoteApplicationException("FileException occured while trying to download file " + e.getMessage());
+ } catch (ItemNotFoundException e) {
+ throw new VoteApplicationException("ItemNotFoundException occured while trying to download file "
+ + e.getMessage());
}
+ }
- /**
- * 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 voteOutputFactory.getToolOutput(name, this, toolSessionId, learnerId);
+ /**
+ * adds a new entry to the uploaded files table
+ */
+ public void persistFile(String uuid, boolean isOnlineFile, String fileName, VoteContent voteContent)
+ throws VoteApplicationException {
+
+ VoteServicePOJO.logger.debug("attempt persisting file to the db: " + uuid + " " + isOnlineFile + " " + fileName
+ + " " + voteContent);
+ VoteUploadedFile voteUploadedFile = new VoteUploadedFile(uuid, isOnlineFile, fileName, voteContent);
+ VoteServicePOJO.logger.debug("created voteUploadedFile: " + voteUploadedFile);
+ voteUploadedFileDAO.saveUploadFile(voteUploadedFile);
+ VoteServicePOJO.logger.debug("persisted voteUploadedFile: " + voteUploadedFile);
+ }
+
+ /**
+ *
+ * removes all the entries in the uploaded files table
+ */
+ public void cleanUploadedFilesMetaData() throws VoteApplicationException {
+ VoteServicePOJO.logger.debug("attempt cleaning up uploaded file meta data table from the db");
+ voteUploadedFileDAO.cleanUploadedFilesMetaData();
+ VoteServicePOJO.logger.debug("files meta data has been cleaned up");
+ }
+
+ /**
+ * Get the definitions for possible output for an activity, based on the toolContentId. Currently we have one
+ * definition, which is whether or not the user has selected a particular answer
+ */
+ public SortedMap getToolOutputDefinitions(Long toolContentId) throws ToolException {
+ VoteContent content = retrieveVote(toolContentId);
+ if (content == null) {
+ long defaultToolContentId = getToolDefaultContentIdBySignature(VoteAppConstants.MY_SIGNATURE);
+ content = retrieveVote(defaultToolContentId);
}
+ return getVoteOutputFactory().getToolOutputDefinitions(content);
+ }
+ /**
+ * Get the tool output for the given tool output names.
+ *
+ * @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 voteOutputFactory.getToolOutput(names, this, toolSessionId, learnerId);
+ }
- /* ===============Methods implemented from ToolContentImport102Manager =============== */
-
+ /**
+ * 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 voteOutputFactory.getToolOutput(name, this, toolSessionId, learnerId);
+ }
+ /* ===============Methods implemented from ToolContentImport102Manager =============== */
+
/**
* Import the data for a 1.0.2 Vote
*/
- public void import102ToolContent(Long toolContentId, UserDTO user, Hashtable importValues)
- {
- Date now = new Date();
- VoteContent toolContentObj = new VoteContent();
- toolContentObj.setContentInUse(false);
- toolContentObj.setCreatedBy(user.getUserID().longValue());
- toolContentObj.setCreationDate(now);
- toolContentObj.setDefineLater(false);
- toolContentObj.setInstructions(WebUtil.convertNewlines((String)importValues.get(ToolContentImport102Manager.CONTENT_BODY)));
- toolContentObj.setOfflineInstructions(null);
- toolContentObj.setOnlineInstructions(null);
- toolContentObj.setReflectionSubject(null);
- toolContentObj.setReflect(false);
- toolContentObj.setRunOffline(false);
- toolContentObj.setTitle((String)importValues.get(ToolContentImport102Manager.CONTENT_TITLE));
-
- toolContentObj.setContent(null);
- toolContentObj.setUpdateDate(now);
- toolContentObj.setVoteContentId(toolContentId);
- toolContentObj.setLockOnFinish(false);
- toolContentObj.setShowResults(true);
-
- try {
- Boolean bool = WDDXProcessor.convertToBoolean(importValues, ToolContentImport102Manager.CONTENT_VOTE_ALLOW_POLL_NOMINATIONS);
- toolContentObj.setAllowText(bool!=null?bool:false);
+ public void import102ToolContent(Long toolContentId, UserDTO user, Hashtable importValues) {
+ Date now = new Date();
+ VoteContent toolContentObj = new VoteContent();
+ toolContentObj.setContentInUse(false);
+ toolContentObj.setCreatedBy(user.getUserID().longValue());
+ toolContentObj.setCreationDate(now);
+ toolContentObj.setDefineLater(false);
+ toolContentObj.setInstructions(WebUtil.convertNewlines((String) importValues
+ .get(ToolContentImport102Manager.CONTENT_BODY)));
+ toolContentObj.setOfflineInstructions(null);
+ toolContentObj.setOnlineInstructions(null);
+ toolContentObj.setReflectionSubject(null);
+ toolContentObj.setReflect(false);
+ toolContentObj.setRunOffline(false);
+ toolContentObj.setTitle((String) importValues.get(ToolContentImport102Manager.CONTENT_TITLE));
- bool = WDDXProcessor.convertToBoolean(importValues, ToolContentImport102Manager.CONTENT_REUSABLE);
- toolContentObj.setLockOnFinish(bool!=null?bool:true);
+ toolContentObj.setContent(null);
+ toolContentObj.setUpdateDate(now);
+ toolContentObj.setVoteContentId(toolContentId);
+ toolContentObj.setLockOnFinish(false);
+ toolContentObj.setShowResults(true);
- Integer maxCount = WDDXProcessor.convertToInteger(importValues, ToolContentImport102Manager.CONTENT_VOTE_MAXCHOOSE);
- toolContentObj.setMaxNominationCount(maxCount != null ? maxCount.toString() : "1");
-
- } catch (WDDXProcessorConversionException e) {
- logger.error("Unable to content for activity "+toolContentObj.getTitle()+"properly due to a WDDXProcessorConversionException.",e);
- throw new ToolException("Invalid import data format for activity "+toolContentObj.getTitle()+"- WDDX caused an exception. Some data from the design will have been lost. See log for more details.");
- }
-
- // leave as empty, no need to set them to anything.
- //setVoteUploadedFiles(Set voteAttachments);
- //setVoteSessions(Set voteSessions);
-
- // set up question from body
- Vector nominations = (Vector) importValues.get(CONTENT_VOTE_NOMINATIONS);
- if ( nominations != null ) {
- Iterator iter = nominations.iterator();
- int order = 1;
- while (iter.hasNext()) {
- String element = (String) iter.next();
- VoteQueContent nomination = new VoteQueContent(element, toolContentObj, null);
- nomination.setDisplayOrder(order++);
- toolContentObj.getVoteQueContents().add(nomination);
- }
- }
-
- voteContentDAO.saveVoteContent(toolContentObj);
+ try {
+ Boolean bool = WDDXProcessor.convertToBoolean(importValues,
+ ToolContentImport102Manager.CONTENT_VOTE_ALLOW_POLL_NOMINATIONS);
+ toolContentObj.setAllowText(bool != null ? bool : false);
+
+ bool = WDDXProcessor.convertToBoolean(importValues, ToolContentImport102Manager.CONTENT_REUSABLE);
+ toolContentObj.setLockOnFinish(bool != null ? bool : true);
+
+ Integer maxCount = WDDXProcessor.convertToInteger(importValues,
+ ToolContentImport102Manager.CONTENT_VOTE_MAXCHOOSE);
+ toolContentObj.setMaxNominationCount(maxCount != null ? maxCount.toString() : "1");
+
+ } catch (WDDXProcessorConversionException e) {
+ VoteServicePOJO.logger.error("Unable to content for activity " + toolContentObj.getTitle()
+ + "properly due to a WDDXProcessorConversionException.", e);
+ throw new ToolException(
+ "Invalid import data format for activity "
+ + toolContentObj.getTitle()
+ + "- WDDX caused an exception. Some data from the design will have been lost. See log for more details.");
+ }
+
+ // leave as empty, no need to set them to anything.
+ // setVoteUploadedFiles(Set voteAttachments);
+ // setVoteSessions(Set voteSessions);
+
+ // set up question from body
+ Vector nominations = (Vector) importValues.get(ToolContentImport102Manager.CONTENT_VOTE_NOMINATIONS);
+ if (nominations != null) {
+ Iterator iter = nominations.iterator();
+ int order = 1;
+ while (iter.hasNext()) {
+ String element = (String) iter.next();
+ VoteQueContent nomination = new VoteQueContent(element, toolContentObj, null);
+ nomination.setDisplayOrder(order++);
+ toolContentObj.getVoteQueContents().add(nomination);
+ }
+ }
+
+ voteContentDAO.saveVoteContent(toolContentObj);
}
/** Set the description, throws away the title value as this is not supported in 2.0 */
- public void setReflectiveData(Long toolContentId, String title, String description)
- throws ToolException, DataMissingException {
-
- VoteContent toolContentObj = null;
- if ( toolContentId != null ) {
- toolContentObj=retrieveVote(toolContentId);
- }
- if ( toolContentObj == null ) {
- throw new DataMissingException("Unable to set reflective data titled "+title
- +" on activity toolContentId "+toolContentId
- +" as the tool content does not exist.");
- }
-
- toolContentObj.setReflect(Boolean.TRUE.booleanValue());
- toolContentObj.setReflectionSubject(description);
+ public void setReflectiveData(Long toolContentId, String title, String description) throws ToolException,
+ DataMissingException {
+
+ VoteContent toolContentObj = null;
+ if (toolContentId != null) {
+ toolContentObj = retrieveVote(toolContentId);
+ }
+ if (toolContentObj == null) {
+ throw new DataMissingException("Unable to set reflective data titled " + title
+ + " on activity toolContentId " + toolContentId + " as the tool content does not exist.");
+ }
+
+ toolContentObj.setReflect(Boolean.TRUE.booleanValue());
+ toolContentObj.setReflectionSubject(description);
}
-
- public Long createNotebookEntry(Long id, Integer idType, String signature,
- Integer userID, String entry) {
- logger.debug("coreNotebookService: " + coreNotebookService);
- return coreNotebookService.createNotebookEntry(id, idType, signature, userID, "", entry);
+
+ public Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry) {
+ VoteServicePOJO.logger.debug("coreNotebookService: " + coreNotebookService);
+ return coreNotebookService.createNotebookEntry(id, idType, signature, userID, "", entry);
+ }
+
+ public NotebookEntry getEntry(Long id, Integer idType, String signature, Integer userID) {
+
+ List list = coreNotebookService.getEntry(id, idType, signature, userID);
+ if (list == null || list.isEmpty()) {
+ return null;
+ } else {
+ return list.get(0);
}
-
-
-
+ }
- public NotebookEntry getEntry(Long id, Integer idType, String signature,
- Integer userID) {
-
- List list = coreNotebookService.getEntry(id, idType, signature, userID);
- if (list == null || list.isEmpty()) {
- return null;
- } else {
- return list.get(0);
- }
+ public List getAllQuestionEntriesSorted(final long voteContentId) throws VoteApplicationException {
+ try {
+ return voteQueContentDAO.getAllQuestionEntriesSorted(voteContentId);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is getting all question entries: "
+ + e.getMessage(), e);
}
-
- public List getAllQuestionEntriesSorted(final long voteContentId) throws VoteApplicationException
- {
- try
- {
- return voteQueContentDAO.getAllQuestionEntriesSorted(voteContentId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is getting all question entries: "
- + e.getMessage(),
- e);
- }
- }
-
+ }
+
public void removeFile(Long submissionId) throws VoteApplicationException {
- voteUploadedFileDAO.removeUploadFile(submissionId);
- logger.debug("removed voteUploadedFile: " + submissionId);
+ voteUploadedFileDAO.removeUploadFile(submissionId);
+ VoteServicePOJO.logger.debug("removed voteUploadedFile: " + submissionId);
}
-
public void persistFile(VoteContent content, VoteUploadedFile file) throws VoteApplicationException {
- logger.debug("in persistFile: " + file);
- content.getVoteAttachments().add(file);
- file.setVoteContent(content);
- voteContentDAO.saveOrUpdateVote(content);
- logger.debug("persisted voteUploadedFile: " + file);
+ VoteServicePOJO.logger.debug("in persistFile: " + file);
+ content.getVoteAttachments().add(file);
+ file.setVoteContent(content);
+ voteContentDAO.saveOrUpdateVote(content);
+ VoteServicePOJO.logger.debug("persisted voteUploadedFile: " + file);
}
-
-
+
public List retrieveVoteUploadedFiles(VoteContent Vote) throws VoteApplicationException {
- try {
- return voteUploadedFileDAO.retrieveVoteUploadedFiles(Vote);
- }
- catch (DataAccessException e) {
- throw new VoteApplicationException("Exception occured when lams is loading Vote uploaded files: "
- + e.getMessage(),
- e);
- }
+ try {
+ return voteUploadedFileDAO.retrieveVoteUploadedFiles(Vote);
+ } catch (DataAccessException e) {
+ throw new VoteApplicationException("Exception occured when lams is loading Vote uploaded files: "
+ + e.getMessage(), e);
+ }
}
-
- /**
- * @return Returns the logger.
- */
- public static Logger getLogger() {
- return logger;
- }
+ /**
+ * @return Returns the logger.
+ */
+ public static Logger getLogger() {
+ return VoteServicePOJO.logger;
+ }
- /**
- * @return Returns the cred.
- */
- public ICredentials getCred() {
- return cred;
- }
- /**
- * @param cred The cred to set.
- */
- public void setCred(ICredentials cred) {
- this.cred = cred;
- }
-
- /**
- * @return Returns the repositoryId.
- */
- public char[] getRepositoryId() {
- return repositoryId;
- }
- /**
- * @return Returns the repositoryUser.
- */
- public String getRepositoryUser() {
- return repositoryUser;
- }
+ /**
+ * @return Returns the cred.
+ */
+ public ICredentials getCred() {
+ return cred;
+ }
- /**
- * @return Returns the toolService.
- */
- public ILamsToolService getToolService() {
- return toolService;
- }
- /**
- * @return Returns the userManagementService.
- */
- public IUserManagementService getUserManagementService() {
- return userManagementService;
- }
+ /**
+ * @param cred
+ * The cred to set.
+ */
+ public void setCred(ICredentials cred) {
+ this.cred = cred;
+ }
- /**
- * @return Returns the voteSessionDAO.
- */
- public IVoteSessionDAO getvoteSessionDAO() {
- return voteSessionDAO;
- }
- /**
- * @param voteSessionDAO The voteSessionDAO to set.
- */
- public void setvoteSessionDAO(IVoteSessionDAO voteSessionDAO) {
- this.voteSessionDAO = voteSessionDAO;
- }
- /**
- * @return Returns the voteUserDAO.
- */
- public IVoteUserDAO getvoteUserDAO() {
- return voteUserDAO;
- }
- /**
- * @param voteUserDAO The voteUserDAO to set.
- */
- public void setvoteUserDAO(IVoteUserDAO voteUserDAO) {
- this.voteUserDAO = voteUserDAO;
- }
- /**
- * @return Returns the voteUsrAttemptDAO.
- */
- public IVoteUsrAttemptDAO getvoteUsrAttemptDAO() {
- return voteUsrAttemptDAO;
- }
- /**
- * @param voteUsrAttemptDAO The voteUsrAttemptDAO to set.
- */
- public void setvoteUsrAttemptDAO(IVoteUsrAttemptDAO voteUsrAttemptDAO) {
- this.voteUsrAttemptDAO = voteUsrAttemptDAO;
- }
-
- /**
- * @return Returns the repositoryService.
- */
- public IRepositoryService getRepositoryService() {
- return repositoryService;
- }
- /**
- * @param repositoryService The repositoryService to set.
- */
- public void setRepositoryService(IRepositoryService repositoryService) {
- this.repositoryService = repositoryService;
- }
+ /**
+ * @return Returns the repositoryId.
+ */
+ public char[] getRepositoryId() {
+ return repositoryId;
+ }
- public void setUserManagementService(IUserManagementService userManagementService)
- {
- this.userManagementService = userManagementService;
+ /**
+ * @return Returns the repositoryUser.
+ */
+ public String getRepositoryUser() {
+ return repositoryUser;
}
-
- public void setToolService(ILamsToolService toolService)
- {
- this.toolService = toolService;
+
+ /**
+ * @return Returns the toolService.
+ */
+ public ILamsToolService getToolService() {
+ return toolService;
}
- /**
- * @return Returns the voteUploadedFileDAO.
- */
- public IVoteUploadedFileDAO getvoteUploadedFileDAO() {
- return voteUploadedFileDAO;
- }
- /**
- * @param voteUploadedFileDAO The voteUploadedFileDAO to set.
- */
- public void setvoteUploadedFileDAO(IVoteUploadedFileDAO voteUploadedFileDAO) {
- this.voteUploadedFileDAO = voteUploadedFileDAO;
- }
+ /**
+ * @return Returns the userManagementService.
+ */
+ public IUserManagementService getUserManagementService() {
+ return userManagementService;
+ }
- /**
- * @return Returns the voteToolContentHandler.
- */
- public IToolContentHandler getVoteToolContentHandler() {
- return voteToolContentHandler;
- }
- /**
- * @param voteToolContentHandler The voteToolContentHandler to set.
- */
- public void setVoteToolContentHandler(IToolContentHandler voteToolContentHandler) {
- this.voteToolContentHandler = voteToolContentHandler;
- }
- /**
- * @return Returns the learnerService.
- */
- public ILearnerService getLearnerService() {
- return learnerService;
- }
- /**
- * @param learnerService The learnerService to set.
- */
- public void setLearnerService(ILearnerService learnerService) {
- this.learnerService = learnerService;
- }
/**
+ * @return Returns the voteSessionDAO.
+ */
+ public IVoteSessionDAO getvoteSessionDAO() {
+ return voteSessionDAO;
+ }
+
+ /**
+ * @param voteSessionDAO
+ * The voteSessionDAO to set.
+ */
+ public void setvoteSessionDAO(IVoteSessionDAO voteSessionDAO) {
+ this.voteSessionDAO = voteSessionDAO;
+ }
+
+ /**
+ * @return Returns the voteUserDAO.
+ */
+ public IVoteUserDAO getvoteUserDAO() {
+ return voteUserDAO;
+ }
+
+ /**
+ * @param voteUserDAO
+ * The voteUserDAO to set.
+ */
+ public void setvoteUserDAO(IVoteUserDAO voteUserDAO) {
+ this.voteUserDAO = voteUserDAO;
+ }
+
+ /**
+ * @return Returns the voteUsrAttemptDAO.
+ */
+ public IVoteUsrAttemptDAO getvoteUsrAttemptDAO() {
+ return voteUsrAttemptDAO;
+ }
+
+ /**
+ * @param voteUsrAttemptDAO
+ * The voteUsrAttemptDAO to set.
+ */
+ public void setvoteUsrAttemptDAO(IVoteUsrAttemptDAO voteUsrAttemptDAO) {
+ this.voteUsrAttemptDAO = voteUsrAttemptDAO;
+ }
+
+ /**
+ * @return Returns the repositoryService.
+ */
+ public IRepositoryService getRepositoryService() {
+ return repositoryService;
+ }
+
+ /**
+ * @param repositoryService
+ * The repositoryService to set.
+ */
+ public void setRepositoryService(IRepositoryService repositoryService) {
+ this.repositoryService = repositoryService;
+ }
+
+ public void setUserManagementService(IUserManagementService userManagementService) {
+ this.userManagementService = userManagementService;
+ }
+
+ public void setToolService(ILamsToolService toolService) {
+ this.toolService = toolService;
+ }
+
+ /**
+ * @return Returns the voteUploadedFileDAO.
+ */
+ public IVoteUploadedFileDAO getvoteUploadedFileDAO() {
+ return voteUploadedFileDAO;
+ }
+
+ /**
+ * @param voteUploadedFileDAO
+ * The voteUploadedFileDAO to set.
+ */
+ public void setvoteUploadedFileDAO(IVoteUploadedFileDAO voteUploadedFileDAO) {
+ this.voteUploadedFileDAO = voteUploadedFileDAO;
+ }
+
+ /**
+ * @return Returns the voteToolContentHandler.
+ */
+ public IToolContentHandler getVoteToolContentHandler() {
+ return voteToolContentHandler;
+ }
+
+ /**
+ * @param voteToolContentHandler
+ * The voteToolContentHandler to set.
+ */
+ public void setVoteToolContentHandler(IToolContentHandler voteToolContentHandler) {
+ this.voteToolContentHandler = voteToolContentHandler;
+ }
+
+ /**
+ * @return Returns the learnerService.
+ */
+ public ILearnerService getLearnerService() {
+ return learnerService;
+ }
+
+ /**
+ * @param learnerService
+ * The learnerService to set.
+ */
+ public void setLearnerService(ILearnerService learnerService) {
+ this.learnerService = learnerService;
+ }
+
+ /**
* @return Returns the voteContentDAO.
*/
public IVoteContentDAO getvoteContentDAO() {
- return voteContentDAO;
+ return voteContentDAO;
}
+
/**
- * @param voteContentDAO The voteContentDAO to set.
+ * @param voteContentDAO
+ * The voteContentDAO to set.
*/
public void setvoteContentDAO(IVoteContentDAO voteContentDAO) {
- this.voteContentDAO = voteContentDAO;
+ this.voteContentDAO = voteContentDAO;
}
/**
* @return Returns the voteQueContentDAO.
*/
public IVoteQueContentDAO getvoteQueContentDAO() {
- return voteQueContentDAO;
+ return voteQueContentDAO;
}
+
/**
- * @param voteQueContentDAO The voteQueContentDAO to set.
+ * @param voteQueContentDAO
+ * The voteQueContentDAO to set.
*/
public void setvoteQueContentDAO(IVoteQueContentDAO voteQueContentDAO) {
- this.voteQueContentDAO = voteQueContentDAO;
+ this.voteQueContentDAO = voteQueContentDAO;
}
-
/**
* @return Returns the voteContentDAO.
*/
public IVoteContentDAO getVoteContentDAO() {
- return voteContentDAO;
+ return voteContentDAO;
}
+
/**
- * @param voteContentDAO The voteContentDAO to set.
+ * @param voteContentDAO
+ * The voteContentDAO to set.
*/
public void setVoteContentDAO(IVoteContentDAO voteContentDAO) {
- this.voteContentDAO = voteContentDAO;
+ this.voteContentDAO = voteContentDAO;
}
+
/**
* @return Returns the voteQueContentDAO.
*/
public IVoteQueContentDAO getVoteQueContentDAO() {
- return voteQueContentDAO;
+ return voteQueContentDAO;
}
+
/**
- * @param voteQueContentDAO The voteQueContentDAO to set.
+ * @param voteQueContentDAO
+ * The voteQueContentDAO to set.
*/
public void setVoteQueContentDAO(IVoteQueContentDAO voteQueContentDAO) {
- this.voteQueContentDAO = voteQueContentDAO;
+ this.voteQueContentDAO = voteQueContentDAO;
}
+
/**
* @return Returns the voteSessionDAO.
*/
public IVoteSessionDAO getVoteSessionDAO() {
- return voteSessionDAO;
+ return voteSessionDAO;
}
+
/**
- * @param voteSessionDAO The voteSessionDAO to set.
+ * @param voteSessionDAO
+ * The voteSessionDAO to set.
*/
public void setVoteSessionDAO(IVoteSessionDAO voteSessionDAO) {
- this.voteSessionDAO = voteSessionDAO;
+ this.voteSessionDAO = voteSessionDAO;
}
+
/**
* @return Returns the voteUploadedFileDAO.
*/
public IVoteUploadedFileDAO getVoteUploadedFileDAO() {
- return voteUploadedFileDAO;
+ return voteUploadedFileDAO;
}
+
/**
- * @param voteUploadedFileDAO The voteUploadedFileDAO to set.
+ * @param voteUploadedFileDAO
+ * The voteUploadedFileDAO to set.
*/
public void setVoteUploadedFileDAO(IVoteUploadedFileDAO voteUploadedFileDAO) {
- this.voteUploadedFileDAO = voteUploadedFileDAO;
+ this.voteUploadedFileDAO = voteUploadedFileDAO;
}
+
/**
* @return Returns the voteUserDAO.
*/
public IVoteUserDAO getVoteUserDAO() {
- return voteUserDAO;
+ return voteUserDAO;
}
+
/**
- * @param voteUserDAO The voteUserDAO to set.
+ * @param voteUserDAO
+ * The voteUserDAO to set.
*/
public void setVoteUserDAO(IVoteUserDAO voteUserDAO) {
- this.voteUserDAO = voteUserDAO;
+ this.voteUserDAO = voteUserDAO;
}
+
/**
* @return Returns the voteUsrAttemptDAO.
*/
public IVoteUsrAttemptDAO getVoteUsrAttemptDAO() {
- return voteUsrAttemptDAO;
+ return voteUsrAttemptDAO;
}
+
/**
- * @param voteUsrAttemptDAO The voteUsrAttemptDAO to set.
+ * @param voteUsrAttemptDAO
+ * The voteUsrAttemptDAO to set.
*/
public void setVoteUsrAttemptDAO(IVoteUsrAttemptDAO voteUsrAttemptDAO) {
- this.voteUsrAttemptDAO = voteUsrAttemptDAO;
+ this.voteUsrAttemptDAO = voteUsrAttemptDAO;
}
+
/**
- * @param logger The logger to set.
+ * @param logger
+ * The logger to set.
*/
public static void setLogger(Logger logger) {
- VoteServicePOJO.logger = logger;
+ VoteServicePOJO.logger = logger;
}
+
/**
* @return Returns the auditService.
*/
public IAuditService getAuditService() {
- return auditService;
+ return auditService;
}
+
/**
- * @param auditService The auditService to set.
+ * @param auditService
+ * The auditService to set.
*/
public void setAuditService(IAuditService auditService) {
- this.auditService = auditService;
+ this.auditService = auditService;
}
-
- public IExportToolContentService getExportContentService() {
- return exportContentService;
- }
+ public IExportToolContentService getExportContentService() {
+ return exportContentService;
+ }
- public void setExportContentService(IExportToolContentService exportContentService) {
- this.exportContentService = exportContentService;
- }
+ public void setExportContentService(IExportToolContentService exportContentService) {
+ this.exportContentService = exportContentService;
+ }
-
/**
* @return Returns the coreNotebookService.
*/
public ICoreNotebookService getCoreNotebookService() {
- return coreNotebookService;
+ return coreNotebookService;
}
+
/**
- * @param coreNotebookService The coreNotebookService to set.
+ * @param coreNotebookService
+ * The coreNotebookService to set.
*/
public void setCoreNotebookService(ICoreNotebookService coreNotebookService) {
- this.coreNotebookService = coreNotebookService;
+ this.coreNotebookService = coreNotebookService;
}
- public VoteOutputFactory getVoteOutputFactory() {
- return voteOutputFactory;
- }
+ public VoteOutputFactory getVoteOutputFactory() {
+ return voteOutputFactory;
+ }
- public void setVoteOutputFactory(VoteOutputFactory voteOutputFactory) {
- this.voteOutputFactory = voteOutputFactory;
- }
-
- /**
+ public void setVoteOutputFactory(VoteOutputFactory voteOutputFactory) {
+ this.voteOutputFactory = voteOutputFactory;
+ }
+
+ /**
* @return Returns the MessageService.
*/
public MessageService getMessageService() {
- return messageService;
+ return messageService;
}
+
/**
- * @param messageService The MessageService to set.
+ * @param messageService
+ * The MessageService to set.
*/
public void setMessageService(MessageService messageService) {
- this.messageService = messageService;
+ this.messageService = messageService;
}
+
+ public void removeNominationsFromCache(VoteContent voteContent) {
+ voteContentDAO.removeNominationsFromCache(voteContent);
+ }
}
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VotePedagogicalPlannerAction.java
===================================================================
diff -u
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VotePedagogicalPlannerAction.java (revision 0)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VotePedagogicalPlannerAction.java (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -0,0 +1,128 @@
+/****************************************************************
+ * 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$$ */
+
+package org.lamsfoundation.lams.tool.vote.web;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessages;
+import org.lamsfoundation.lams.tool.vote.VoteAppConstants;
+import org.lamsfoundation.lams.tool.vote.pojos.VoteContent;
+import org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent;
+import org.lamsfoundation.lams.tool.vote.service.IVoteService;
+import org.lamsfoundation.lams.tool.vote.service.VoteServiceProxy;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.action.LamsDispatchAction;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+public class VotePedagogicalPlannerAction extends LamsDispatchAction {
+
+ private static Logger logger = Logger.getLogger(VotePedagogicalPlannerAction.class);
+
+ @Override
+ protected ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ return initPedagogicalPlannerForm(mapping, form, request, response);
+ }
+
+ public ActionForward initPedagogicalPlannerForm(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ VotePedagogicalPlannerForm plannerForm = (VotePedagogicalPlannerForm) form;
+ Long toolContentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID);
+ VoteContent voteContent = getVoteService().retrieveVote(toolContentID);
+ plannerForm.fillForm(voteContent);
+
+ return mapping.findForward(VoteAppConstants.SUCCESS);
+ }
+
+ public ActionForward saveOrUpdatePedagogicalPlannerForm(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response) throws IOException {
+ VotePedagogicalPlannerForm plannerForm = (VotePedagogicalPlannerForm) form;
+ ActionMessages errors = plannerForm.validate();
+ if (errors.isEmpty()) {
+
+ VoteContent voteContent = getVoteService().retrieveVote(plannerForm.getToolContentID());
+
+ int nominationIndex = 1;
+ String nomination = null;
+
+ do {
+ nomination = plannerForm.getNomination(nominationIndex - 1);
+ if (StringUtils.isEmpty(nomination)) {
+ plannerForm.removeNomination(nominationIndex - 1);
+ } else {
+ if (nominationIndex <= voteContent.getVoteQueContents().size()) {
+ VoteQueContent voteQueContent = getVoteService().getQuestionContentByDisplayOrder(
+ (long) nominationIndex, voteContent.getUid());
+ voteQueContent.setQuestion(nomination);
+ getVoteService().saveOrUpdateVoteQueContent(voteQueContent);
+
+ } else {
+ VoteQueContent voteQueContent = new VoteQueContent();
+ voteQueContent.setDisplayOrder(nominationIndex);
+ voteQueContent.setVoteContent(voteContent);
+ voteQueContent.setVoteContentId(voteContent.getVoteContentId());
+ voteQueContent.setQuestion(nomination);
+ getVoteService().saveOrUpdateVoteQueContent(voteQueContent);
+ }
+ nominationIndex++;
+ }
+ } while (nominationIndex <= plannerForm.getNominationCount());
+ if (nominationIndex <= voteContent.getVoteQueContents().size()) {
+ getVoteService().removeNominationsFromCache(voteContent);
+ for (; nominationIndex <= voteContent.getVoteQueContents().size(); nominationIndex++) {
+ VoteQueContent voteQueContent = getVoteService().getQuestionContentByDisplayOrder(
+ (long) nominationIndex, voteContent.getUid());
+ getVoteService().removeVoteQueContent(voteQueContent);
+ }
+ }
+ } else {
+ saveErrors(request, errors);
+ }
+ return mapping.findForward(VoteAppConstants.SUCCESS);
+ }
+
+ public ActionForward createPedagogicalPlannerQuestion(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response) {
+ VotePedagogicalPlannerForm plannerForm = (VotePedagogicalPlannerForm) form;
+ plannerForm.setNomination(plannerForm.getNominationCount().intValue(), "");
+ return mapping.findForward(VoteAppConstants.SUCCESS);
+ }
+
+ private IVoteService getVoteService() {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
+ .getServletContext());
+ return VoteServiceProxy.getVoteService(getServlet().getServletContext());
+ }
+}
\ No newline at end of file
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VotePedagogicalPlannerForm.java
===================================================================
diff -u
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VotePedagogicalPlannerForm.java (revision 0)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VotePedagogicalPlannerForm.java (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -0,0 +1,108 @@
+/****************************************************************
+ * 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 version 2.0
+ * 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$ */
+package org.lamsfoundation.lams.tool.vote.web;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.lamsfoundation.lams.tool.vote.pojos.VoteContent;
+import org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.planner.PedagogicalPlannerForm;
+
+public class VotePedagogicalPlannerForm extends PedagogicalPlannerForm {
+ private List nomination;
+
+ @Override
+ public ActionMessages validate() {
+ ActionMessages errors = new ActionMessages();
+ boolean valid = true;
+ boolean allEmpty = true;
+ if (nomination != null && !nomination.isEmpty()) {
+ for (String item : nomination) {
+ if (!StringUtils.isEmpty(item)) {
+ allEmpty = false;
+ break;
+ }
+ }
+ }
+ if (allEmpty) {
+ ActionMessage error = new ActionMessage("nominations.none.submitted");
+ errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ valid = false;
+ nomination = null;
+ }
+
+ setValid(valid);
+ return errors;
+ }
+
+ public void fillForm(VoteContent voteContent) {
+ if (voteContent != null) {
+ setToolContentID(voteContent.getVoteContentId());
+
+ nomination = new ArrayList();
+ Set questions = voteContent.getVoteQueContents();
+ if (questions != null) {
+ int topicIndex = 0;
+ for (VoteQueContent message : (Set) questions) {
+ setNomination(topicIndex++, WebUtil.removeHTMLtags(message.getQuestion()));
+ }
+ }
+ }
+ }
+
+ public void setNomination(int number, String nomination) {
+ if (this.nomination == null) {
+ this.nomination = new ArrayList();
+ }
+ while (number >= this.nomination.size()) {
+ this.nomination.add(null);
+ }
+ this.nomination.set(number, nomination);
+ }
+
+ public String getNomination(int number) {
+ if (nomination == null || number >= nomination.size()) {
+ return null;
+ }
+ return nomination.get(number);
+ }
+
+ public Integer getNominationCount() {
+ return nomination == null ? 0 : nomination.size();
+ }
+
+ public boolean removeNomination(int number) {
+ if (nomination == null || number >= nomination.size()) {
+ return false;
+ }
+ nomination.remove(number);
+ return true;
+ }
+}
\ No newline at end of file
Index: lams_tool_vote/web/WEB-INF/struts-config.xml
===================================================================
diff -u -r23957c919309e85a064474ab19c09373cbe0e03b -r05db875c7974d705f89231416ff6dfe91a5e70f1
--- lams_tool_vote/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 23957c919309e85a064474ab19c09373cbe0e03b)
+++ lams_tool_vote/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
@@ -7,7 +7,8 @@
-
+
+
@@ -153,7 +154,22 @@
/>
-
+
+
+
+
+
+<%@ include file="/common/taglibs.jsp"%>
+
+
+
+
+
+
+
+
+
+
+ <%@ include file="/common/messages.jsp"%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file