Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java
===================================================================
diff -u -rf37e902802cd59114b62435f47e9106df830496d -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision f37e902802cd59114b62435f47e9106df830496d)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7)
@@ -24,33 +24,32 @@
/**
* @author Ozgur Demirtas
- *
- * TODO: Check back the constants with "Attention"
- * Holds constants used throughout the application
- *
+ * Defines constants used throughout the application
*/
public interface McAppConstants {
- /**
+ /*
* Currently we are hardcoding the default content id.
* This will be replaced when the deploy logic automatically assigns a default content id in the deploy script.
*/
-
-
+
+ public static final String MY_SIGNATURE ="lamc11";
+ public static final long DEFAULT_CONTENT_ID =0;
+ public static final long DEFAULT_QUE_CONTENT_ID =1;
+
public static final String ROOT ="root";
public static final String ROOT_PATH ="rootPath";
public static final String PATH_TO_LAMS ="pathToLams";
- public static final String MY_SIGNATURE ="lamc11";
- public static final long DEFAULT_CONTENT_ID =0;
- public static final long DEFAULT_QUE_CONTENT_ID =1;
-
- /**
+ /*
* temporarily refers to an existing content id for an incoming tool session id, won't need it in deployment environment
*/
public static final long THE_MOCKED_CONTENT_ID =1803739427456570536L;
public static final String TOOL_SERVICE ="tool_service";
- /**
+ public static final String ERROR ="error";
+ public static final String ERROR_LIST ="errorList";
+
+ /*
* indicates which mode the tool runs under between Authoring, Learning, Monitoring
*/
public static final String TARGET_MODE ="targetMode";
@@ -63,8 +62,7 @@
public static final String LEARNING_STARTER ="learningStarter";
public static final String MONITORING_STARTER ="monitoringStarter";
-
- /** these constants are from org.lamsfoundation.lams.web.util.AttributeNames */
+ /* these constants are from org.lamsfoundation.lams.web.util.AttributeNames */
public static final String USER = "user";
public static final String TOOL_CONTENT_ID = "toolContentID";
public static final String TOOL_SESSION_ID = "toolSessionID";
@@ -75,24 +73,23 @@
public static final String MAX_QUESTION_INDEX = "maxQuestionIndex";
- /**
+ /*
* Mock constants below are temporary until the tool gets a User object from the container.
*/
public static final Integer MOCK_USER_ID = new Integer(111);
public static final String MOCK_USER_NAME ="Ozgur";
public static final String MOCK_USER_LASTNAME ="Demirtas";
public static final String MOCK_LOGIN_NAME ="ozgur";
- /**
+ /*
* 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;
-
- /**
+ /*
* Struts level constants
*/
public static final String LOAD ="load";
@@ -110,7 +107,7 @@
public static final String DISABLE_TOOL ="disabled";
public static final String IS_DEFINE_LATER ="isDefineLater";
- /**
+ /*
* authoring mode controllers
*/
public static final String IS_ADD_QUESTION ="isAddQuestion";
@@ -119,7 +116,7 @@
public static final String QUESTIONS_SEQUENCED ="questionsSequenced";
- /**
+ /*
* tab controllers, constants for authoring page html tabs, used within jsp
*/
public static final String CHOICE ="choice";
@@ -134,8 +131,7 @@
public static final String FILE_NAME ="fileName";
-
- /**
+ /*
* authoring mode constants
*/
public static final String MAP_QUESTIONS_CONTENT ="mapQuestionsContent";
@@ -158,7 +154,6 @@
public static final String DEFAULT_QUESTION_UID ="defaultQuestionUid";
-
public static final String MAP_QUESTION_CONTENT ="mapQuestionContent";
public static final String DEFAULT_QUESTION_CONTENT ="defaultQuestionContent";
public static final String TITLE ="title";
@@ -173,7 +168,6 @@
public static final String PASSMARK ="passMark";
public static final String SHOW_FEEDBACK ="showFeedback";
-
public static final String ONLINE_INSTRUCTIONS ="onlineInstructions";
public static final String OFFLINE_INSTRUCTIONS ="offlineInstructions";
public static final String END_LEARNING_MESSSAGE ="endLearningMessage";
@@ -186,7 +180,6 @@
public static final String IS_QUESTIONS_SEQUENCED_MONITORING ="isQuestionsSequencedMonitoring";
-
public static final String RICHTEXT_FEEDBACK_CORRECT ="richTextFeedbackCorrect";
public static final String RICHTEXT_FEEDBACK_INCORRECT ="richTextFeedbackInCorrect";
public static final String RICHTEXT_OFFLINEINSTRUCTIONS ="richTextOfflineInstructions";
@@ -213,15 +206,14 @@
public static final String POPULATED_UPLOADED_FILESDATA ="populateUploadedFilesData";
- /**
+ /*
* the author's current content id
*/
- //public static final String TOOL_CONTENT_ID ="toolContentId";
+
- /**
+ /*
* the learner or monitoring environment provides toolSessionId
*/
- //public static final String TOOL_SESSION_ID ="toolSessionId";
public final long ONE_DAY =60 * 60 * 1000 * 24;
public final static String NOT_ATTEMPTED ="NOT_ATTEMPTED";
public final static String INCOMPLETE ="INCOMPLETE";
@@ -251,7 +243,7 @@
public static final String USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP ="userExceptionDefaultContentNotSetup";
public static final String USER_EXCEPTION_NO_TOOL_SESSIONS ="userExceptionNoToolSessions";
- /**
+ /*
* export portfolio constants
*/
public static final String LEARNER ="learner";
@@ -261,7 +253,7 @@
public static final String PORTFOLIO_REQUEST ="portfolioRequest";
public static final int MAX_GROUPS_COUNT =250;
- /**
+ /*
* user actions
*/
public static final String ADD_NEW_QUESTION ="addNewQuestion";
@@ -272,7 +264,7 @@
public static final String OPTION_OFF ="false";
- //LEARNER mode contants
+ /* 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";
@@ -297,7 +289,7 @@
public static final String ACTIVITY_TITLE ="activityTitle";
public static final String ACTIVITY_INSTRUCTIONS ="activityInstructions";
- /**
+ /*
* Monitoring Mode constants
*/
public static final String REPORT_TITLE_MONITOR ="reportTitleMonitor";
@@ -334,7 +326,7 @@
public static final String MONITORED_ONLINE_INSTRUCTIONS ="monitoredOnlineInstructions";
public static final String MONITORING_INSTRUCTIONS_UPDATE_MESSAGE ="monitoringInstructionsUpdateMessage";
- /**
+ /*
* Monitor and Learning common constants - used in jsp reporting
*/
public static final String FULLNAME ="fullName";
@@ -348,7 +340,7 @@
public static final String TIMEZONE ="timeZone";
public static final String TIMEZONE_ID ="timeZoneId";
- /**
+ /*
* following tell whether author prefers to have the questions listed all in one page or listed sequentially. The default is all in one page.
*/
public static final String QUESTION_LISTING_MODE ="questionListingMode";
@@ -359,7 +351,7 @@
public static final String FEEDBACK_TYPE_COMBINED ="You are being presented a total of : ";
public static final String QUESTIONS =" questions.";
- /**
+ /*
* constants redundant for the moment
*/
public static final String DISPLAY_QUESTIONS ="display";
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McContent.java
===================================================================
diff -u -r62fed58c7feaf586a7f6ae9b6f2aa91fad04e1d3 -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McContent.java (.../McContent.java) (revision 62fed58c7feaf586a7f6ae9b6f2aa91fad04e1d3)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McContent.java (.../McContent.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7)
@@ -31,7 +31,7 @@
import org.apache.commons.lang.builder.ToStringBuilder;
-/** @author Hibernate CodeGenerator */
+/** @author Ozgur Demirtas */
public class McContent implements Serializable {
/** identifier field */
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McOptsContent.java
===================================================================
diff -u -r8742c4d01b2ac066988448e0c64d76998d5f4f5b -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McOptsContent.java (.../McOptsContent.java) (revision 8742c4d01b2ac066988448e0c64d76998d5f4f5b)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McOptsContent.java (.../McOptsContent.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7)
@@ -29,7 +29,7 @@
import org.apache.commons.lang.builder.ToStringBuilder;
-/** @author Hibernate CodeGenerator */
+/** @author Ozgur Demirtas */
public class McOptsContent implements Serializable {
/** identifier field */
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McQueContent.java
===================================================================
diff -u -r7178c958439c0def43ca0f2e33515c76b4d6d051 -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McQueContent.java (.../McQueContent.java) (revision 7178c958439c0def43ca0f2e33515c76b4d6d051)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McQueContent.java (.../McQueContent.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7)
@@ -24,14 +24,13 @@
import java.io.Serializable;
import java.util.HashSet;
-import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import org.apache.commons.lang.builder.ToStringBuilder;
-/** @author Hibernate CodeGenerator */
+/** @author Ozgur Demirtas */
public class McQueContent implements Serializable {
/** identifier field */
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McQueUsr.java
===================================================================
diff -u -rb7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3 -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McQueUsr.java (.../McQueUsr.java) (revision b7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McQueUsr.java (.../McQueUsr.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7)
@@ -29,7 +29,7 @@
import org.apache.commons.lang.builder.ToStringBuilder;
-/** @author Hibernate CodeGenerator */
+/** @author Ozgur Demirtas */
public class McQueUsr implements Serializable {
/** identifier field */
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties
===================================================================
diff -u -r7018cf59202a9562124f6ea36ea1b2a95f5897bb -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties (.../McResources.properties) (revision 7018cf59202a9562124f6ea36ea1b2a95f5897bb)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties (.../McResources.properties) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7)
@@ -71,6 +71,7 @@
feedback =Please address the following issues before submit.
+error.default.content.notSetup =The tool initialization error: The tool default content has not been set up properly.
error.question.empty =Please correct this: The question text can not be empty.
error.weights.empty =Please correct this: The question weights can not be empty.
error.checkBoxes.empty =Please correct this: No candidate answer has been selected.
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McSession.java
===================================================================
diff -u -rb7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3 -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McSession.java (.../McSession.java) (revision b7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McSession.java (.../McSession.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7)
@@ -30,7 +30,7 @@
import org.apache.commons.lang.builder.ToStringBuilder;
-/** @author Hibernate CodeGenerator */
+/** @author Ozgur Demirtas */
public class McSession implements Serializable {
public final static String INCOMPLETE = "INCOMPLETE";
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUploadedFile.java
===================================================================
diff -u -r91a0b9b037fb6c122cc88b7a20f78c826089dbdc -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUploadedFile.java (.../McUploadedFile.java) (revision 91a0b9b037fb6c122cc88b7a20f78c826089dbdc)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUploadedFile.java (.../McUploadedFile.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7)
@@ -27,15 +27,8 @@
/**
*
* @author Ozgur Demirtas
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
*/
-/**
- * Holds uploaded file information
- */
-
public class McUploadedFile implements Serializable
{
/** identifier field */
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUsrAttempt.java
===================================================================
diff -u -rb7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3 -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUsrAttempt.java (.../McUsrAttempt.java) (revision b7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUsrAttempt.java (.../McUsrAttempt.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7)
@@ -27,7 +27,7 @@
import org.apache.commons.lang.builder.ToStringBuilder;
-/** @author Hibernate CodeGenerator */
+/** @author Ozgur Demirtas */
public class McUsrAttempt implements Serializable {
/** identifier field */
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java
===================================================================
diff -u -r91a0b9b037fb6c122cc88b7a20f78c826089dbdc -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java (.../McUtils.java) (revision 91a0b9b037fb6c122cc88b7a20f78c826089dbdc)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java (.../McUtils.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7)
@@ -143,9 +143,6 @@
*/
public static boolean existsContent(Long toolContentId, HttpServletRequest request)
{
- /**
- * retrive the service
- */
IMcService mcService =McUtils.getToolService(request);
McContent mcContent=mcService.retrieveMc(toolContentId);
@@ -164,9 +161,6 @@
*/
public static boolean existsSession(Long toolSessionId, HttpServletRequest request)
{
- /**
- * get the service
- */
logger.debug("existsSession");
IMcService mcService =McUtils.getToolService(request);
McSession mcSession=mcService.retrieveMcSession(toolSessionId);
@@ -180,7 +174,7 @@
public static void setDefaultSessionAttributes(HttpServletRequest request, McContent defaultMcContent, McAuthoringForm mcAuthoringForm)
{
- /**should never be null anyway as default content MUST exist in the db*/
+ /*should never be null anyway as default content MUST exist in the db*/
if (defaultMcContent != null)
{
mcAuthoringForm.setTitle(defaultMcContent.getTitle());
@@ -428,7 +422,7 @@
if (isOfflineFile)
{
- /** read uploaded file informtion - offline file*/
+ /* read uploaded file informtion - offline file*/
logger.debug("retrieve theOfflineFile.");
FormFile theOfflineFile = mcAuthoringForm.getTheOfflineFile();
logger.debug("retrieved theOfflineFile: " + theOfflineFile);
@@ -473,7 +467,7 @@
}
else
{
- /** read uploaded file information - online file*/
+ /* read uploaded file information - online file*/
logger.debug("retrieve theOnlineFile");
FormFile theOnlineFile = mcAuthoringForm.getTheOnlineFile();
logger.debug("retrieved theOnlineFile: " + theOnlineFile);
@@ -722,6 +716,5 @@
}
}
-
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcContentDAO.java
===================================================================
diff -u -rb7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3 -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcContentDAO.java (.../IMcContentDAO.java) (revision b7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcContentDAO.java (.../IMcContentDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7)
@@ -100,8 +100,6 @@
*
* @param mcContent The instance of McContent in which corresponding instances of McSession should be deleted.
*/
-
-
public void removeMcSessions(McContent mcContent);
/**
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java
===================================================================
diff -u -re8526e7f760e36faf92d8c56da58cf04d7e2b3db -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java (.../IMcOptionsContentDAO.java) (revision e8526e7f760e36faf92d8c56da58cf04d7e2b3db)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java (.../IMcOptionsContentDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7)
@@ -34,24 +34,73 @@
*/
public interface IMcOptionsContentDAO
{
+ /**
+ * *
Return the persistent instance of a McOptsContent
+ * with the given identifier uid
, returns null if not found.
Return a list of a McOptsContents
+ * with the given identifier mcQueContentId
, returns null if not found.
Return the persistent instance of a McOptsContent
+ * with the given identifiers option
, mcQueContentUid
returns null if not found.
Return a list of a persisted McOptsContents
+ * with the given identifier mcQueContentId
, returns null if not found.
saves McOptsContent
+ * @param mcOptionsContent + */ public void saveMcOptionsContent(McOptsContent mcOptionsContent); + /** + *updates McOptsContent
+ * @param mcOptionsContent + */ public void updateMcOptionsContent(McOptsContent mcOptionsContent); + /** + *removes McOptsContent
+ * @param mcOptionsContent + */ public void removeMcOptionsContentByUID(Long uid); - + + /** + *removes McOptsContent
+ * @param mcOptionsContent + */ public void removeMcOptionsContentByQueId(Long mcQueContentId); - + + /** + *removes McOptsContent
+ * @param mcOptionsContent + */ public void removeMcOptionsContent(McOptsContent mcOptsContent); - } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java =================================================================== diff -u -r7178c958439c0def43ca0f2e33515c76b4d6d051 -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java (.../IMcQueContentDAO.java) (revision 7178c958439c0def43ca0f2e33515c76b4d6d051) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java (.../IMcQueContentDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) @@ -34,31 +34,122 @@ */ public interface IMcQueContentDAO { + /** + * *Return the persistent instance of a McQueContent
+ * with the given identifier uid
, returns null if not found.
Return the persistent instance of a McQueContent
+ * with the given identifier mcContentId
, returns null if not found.
Return the persistent instance of a McQueContent
+ * with the given identifier question
and mcContentUid
, returns null if not found.
Return a list of McQueContent
+ * with the given identifier question
and mcContentUid
, returns null if not found.
Return a list of McQueContent
+ * with the given identifier question
and mcContentUid
, returns null if not found.
removes McQueContent
+ * with the given identifier question
and mcContentUid
, returns null if not found.
removes McQueContent
+ * with the given identifier mcContentUid
resets McQueContent
+ * with the given identifier mcContentUid
removes McQueContent
+ * with the given identifier mcContentUid
saves McQueContent
+ * with the given identifier mcQueContent
updates McQueContent
+ * with the given identifier mcQueContent
saves McQueContent
+ * with the given identifier mcQueContent
removes McQueContent
+ * with the given identifier uid
removes McQueContent
+ * with the given identifier mcQueContent
Return the persistent instance of a McUploadedFile
+ * with the given identifier submissionId
, returns null if not found.
updates McUploadedFile
+ * with the given identifier mcUploadedFile
saves McUploadedFile
+ * with the given identifier mcUploadedFile
creates McUploadedFile
+ * with the given identifier mcUploadedFile
Updates McUploadedFile
+ * with the given identifier mcUploadedFile
removes McUploadedFile
+ * with the given identifier mcUploadedFile
deletes McUploadedFile
+ * with the given identifier mcUploadedFile
returns file's uuid
+ * with the given identifier filename
returns a list of McUploadedFiles
+ * with the given identifier mcContentId
and fileOnline
returns a list of offline McUploadedFiles
+ * with the given identifier mcContentId
returns a list of online McUploadedFiles
+ * with the given identifier mcContentId
returns a list of offline McUploadedFile filenames
+ * with the given identifier mcContentId
returns a list of online McUploadedFile filenames
+ * with the given identifier mcContentId
returns a list of offline McUploadedFile uuid and filenames
+ * with the given identifier mcContentId
removes files meta data + * + * @param mcContentId + * @return List + */ public void cleanUploadedFilesMetaData(); public void flush(); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java =================================================================== diff -u -rb7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3 -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java (.../IMcUserDAO.java) (revision b7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java (.../IMcUserDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) @@ -53,15 +53,8 @@ */ public McQueUsr findMcUserById(Long userId); - /** - *
Persist the given persistent instance of McQueUsr.
- * - * @param nbUser The instance of McQueUsr to persist. - */ - public McQueUsr getMcUserBySession(Long userId, Long sessionId); - public void saveMcUser(McQueUsr mcUser); /** Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java =================================================================== diff -u -rb7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3 -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java (.../IMcUsrAttemptDAO.java) (revision b7e4d4f379a4a90d25f4af4a5d421310cb6bf8e3) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java (.../IMcUsrAttemptDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) @@ -32,14 +32,49 @@ */ public interface IMcUsrAttemptDAO { + /** + * *Return the persistent instance of a McUsrAttempt
+ * with the given identifier uid
, returns null if not found.
saves McUsrAttempt
+ * with the given identifier mcUsrAttempt
updates McUsrAttempt
+ * with the given identifier mcUsrAttempt
removes McUsrAttempt
+ * with the given identifier uid
removes McUsrAttempt
+ * with the given identifier mcUsrAttempt
Hibernate implementation for database access to Mc content for the mc tool.
+ *Hibernate implementation for database access to McContent for the mc tool.
*/ public class McContentDAO extends HibernateDaoSupport implements IMcContentDAO { @@ -46,9 +45,6 @@ private static final String LOAD_MC_BY_SESSION = "select mc from McContent mc left join fetch " + "mc.mcSessions session where session.mcSessionId=:sessionId"; - - - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcContentDAO#getMcContentByUID(java.lang.Long) */ public McContent getMcContentByUID(Long uid) { return (McContent) this.getHibernateTemplate().get(McContent.class, uid); @@ -58,16 +54,9 @@ /** Finds a package via the tool content id. Returns * null if not found */ - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcContentDAO#findMcContentById(java.lang.Long) */ public McContent findMcContentById(Long mcContentId) { String query = "from McContent as mc where mc.mcContentId = ?"; - /* - return (McContent) getSession().createQuery(query) - .setLong(0,mcContentId.longValue()) - .uniqueResult(); - */ - HibernateTemplate templ = this.getHibernateTemplate(); List list = getSession().createQuery(query) .setLong(0,mcContentId.longValue()) @@ -80,7 +69,7 @@ return null; } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcContentDAO#getMcContentBySession(java.lang.Long) */ + public McContent getMcContentBySession(final Long mcSessionId) { return (McContent) getHibernateTemplate().execute(new HibernateCallback() @@ -97,20 +86,19 @@ } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcContentDAO#saveMcContent(org.lamsfoundation.lams.tool.mc.McContent) */ + public void saveMcContent(McContent mcContent) { this.getHibernateTemplate().save(mcContent); } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcContentDAO#updateMcContent(org.lamsfoundation.lams.tool.mc.McContent) */ + public void updateMcContent(McContent mcContent) { this.getHibernateTemplate().update(mcContent); } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcContentDAO#removeMc(java.lang.Long)*/ public void removeMcById(Long mcContentId) { HibernateTemplate templ = this.getHibernateTemplate(); @@ -128,21 +116,18 @@ } } - - - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcContentDAO#removeMc(org.lamsfoundation.lams.tool.mc.McContent)*/ public void removeMc(McContent mcContent) { this.getHibernateTemplate().delete(mcContent); } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcContentDAO#removeMcSessions(org.lamsfoundation.lams.tool.mc.McContent)*/ + public void removeMcSessions(McContent mcContent) { this.getHibernateTemplate().deleteAll(mcContent.getMcSessions()); } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcContentDAO#addMcSession(java.lang.Long, org.lamsfoundation.lams.tool.mc.McSession) */ + public void addMcSession(Long mcContentId, McSession mcSession) { McContent content = findMcContentById(mcContentId); @@ -161,6 +146,4 @@ { this.getHibernateTemplate().flush(); } - - } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java =================================================================== diff -u -re8526e7f760e36faf92d8c56da58cf04d7e2b3db -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java (.../McOptionsContentDAO.java) (revision e8526e7f760e36faf92d8c56da58cf04d7e2b3db) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java (.../McOptionsContentDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) @@ -26,20 +26,16 @@ import org.apache.log4j.Logger; import org.hibernate.FlushMode; -import org.lamsfoundation.lams.tool.mc.McContent; import org.lamsfoundation.lams.tool.mc.McOptsContent; -import org.lamsfoundation.lams.tool.mc.McQueContent; import org.lamsfoundation.lams.tool.mc.dao.IMcOptionsContentDAO; import org.springframework.orm.hibernate3.HibernateTemplate; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; - /** * @author ozgurd - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * + *Hibernate implementation for database access to McOptionsContent for the mc tool.
*/ public class McOptionsContentDAO extends HibernateDaoSupport implements IMcOptionsContentDAO { Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java =================================================================== diff -u -r7178c958439c0def43ca0f2e33515c76b4d6d051 -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java (.../McQueContentDAO.java) (revision 7178c958439c0def43ca0f2e33515c76b4d6d051) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java (.../McQueContentDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) @@ -22,7 +22,6 @@ package org.lamsfoundation.lams.tool.mc.dao.hibernate; import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import org.apache.log4j.Logger; @@ -33,15 +32,11 @@ import org.springframework.orm.hibernate3.support.HibernateDaoSupport; - - /** * @author ozgurd - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * + *Hibernate implementation for database access to McQueContent for the mc tool.
*/ - public class McQueContentDAO extends HibernateDaoSupport implements IMcQueContentDAO { static Logger logger = Logger.getLogger(McQueContentDAO.class.getName()); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McSessionDAO.java =================================================================== diff -u -r8742c4d01b2ac066988448e0c64d76998d5f4f5b -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McSessionDAO.java (.../McSessionDAO.java) (revision 8742c4d01b2ac066988448e0c64d76998d5f4f5b) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McSessionDAO.java (.../McSessionDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) @@ -49,22 +49,15 @@ private static final String GET_SESSIONS_FROM_CONTENT = "select ms.mcSessionId from McSession ms where ms.mcContent= :mcContent"; - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcSessionDAO#getMcSessionByUID(java.lang.Long) */ public McSession getMcSessionByUID(Long uid) { return (McSession) this.getHibernateTemplate() .get(McSession.class, uid); } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcSessionDAO#findMcSessionById(java.lang.Long) */ public McSession findMcSessionById(Long mcSessionId) { String query = "from McSession mcs where mcs.mcSessionId=?"; - /* - return (McSession) getSession().createQuery(query) - .setLong(0,mcSessionId.longValue()) - .uniqueResult(); - */ HibernateTemplate templ = this.getHibernateTemplate(); List list = getSession().createQuery(query) @@ -79,28 +72,24 @@ } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcSessionDAO#saveMcSession(org.lamsfoundation.lams.tool.mc.McSession) */ public void saveMcSession(McSession mcSession) { this.getHibernateTemplate().save(mcSession); } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcSessionDAO#updateMcSession(org.lamsfoundation.lams.tool.mc.McSession) */ public void updateMcSession(McSession mcSession) { this.getHibernateTemplate().update(mcSession); } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcSessionDAO#removeMcSessionByUID(java.lang.Long) */ public void removeMcSessionByUID(Long uid) { McSession ms = (McSession)getHibernateTemplate().get(McSession.class, uid); this.getHibernateTemplate().delete(ms); } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcSessionDAO#removeMcSession(java.lang.Long) */ public void removeMcSessionById(Long mcSessionId) { String query = "from McSession as mcs where mcs.mcSessionId ="; @@ -121,15 +110,15 @@ } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcSessionDAO#removeMcSession(org.lamsfoundation.lams.tool.mc.McSession) */ + public void removeMcSession(McSession mcSession) { this.getSession().setFlushMode(FlushMode.AUTO); this.getHibernateTemplate().delete(mcSession); } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcSessionDAO#getMcSessionByUser(java.lang.Long) */ + public McSession getMcSessionByUser(final Long userId) { return (McSession) getHibernateTemplate().execute(new HibernateCallback() @@ -146,14 +135,12 @@ } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcSessionDAO#removeMcUsers(org.lamsfoundation.lams.tool.mc.McSession) */ public void removeMcUsers(McSession mcSession) { this.getHibernateTemplate().deleteAll(mcSession.getMcQueUsers()); } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcSessionDAO#addMcUsers(java.lang.Long, org.lamsfoundation.lams.tool.mc.McSession) */ public void addMcUsers(Long mcSessionId, McQueUsr user) { McSession session = findMcSessionById(mcSessionId); @@ -164,12 +151,11 @@ } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcSessionDAO#getSessionsFromContent(org.lamsfoundation.lams.tool.mc.McSession) */ + public List getSessionsFromContent(McContent mcContent) { return (getHibernateTemplate().findByNamedParam(GET_SESSIONS_FROM_CONTENT, "mcContent", mcContent)); } - } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUploadedFileDAO.java =================================================================== diff -u -r7018cf59202a9562124f6ea36ea1b2a95f5897bb -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUploadedFileDAO.java (.../McUploadedFileDAO.java) (revision 7018cf59202a9562124f6ea36ea1b2a95f5897bb) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUploadedFileDAO.java (.../McUploadedFileDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) @@ -27,227 +27,222 @@ import org.apache.log4j.Logger; import org.hibernate.FlushMode; -import org.lamsfoundation.lams.tool.mc.McQueContent; + import org.lamsfoundation.lams.tool.mc.McUploadedFile; import org.lamsfoundation.lams.tool.mc.dao.IMcUploadedFileDAO; 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 + * @author ozgurd + *Hibernate implementation for database access to McUploadedFile for the mc tool.
*/ - public class McUploadedFileDAO extends HibernateDaoSupport implements IMcUploadedFileDAO { - static Logger logger = Logger.getLogger(McUploadedFileDAO.class.getName()); - - private static final String GET_ONLINE_FILENAMES_FOR_CONTENT = "select mcUploadedFile.filename from McUploadedFile mcUploadedFile where mcUploadedFile.mcContentId = :mcContentId and mcUploadedFile.fileOnline=1"; - private static final String GET_OFFLINE_FILENAMES_FOR_CONTENT = "select mcUploadedFile.filename from McUploadedFile mcUploadedFile where mcUploadedFile.mcContentId = :mcContentId and mcUploadedFile.fileOnline=0"; - - private static final String GET_ONLINE_FILES_UUID = "select mcUploadedFile.uuid from McUploadedFile mcUploadedFile where mcUploadedFile.mcContentId = :mcContentId and mcUploadedFile.fileOnline=1"; - private static final String GET_ONLINE_FILES_NAME ="select mcUploadedFile.filename from McUploadedFile mcUploadedFile where mcUploadedFile.mcContentId = :mcContentId and mcUploadedFile.fileOnline=1 order by mcUploadedFile.uuid"; - - private static final String GET_OFFLINE_FILES_UUID = "select mcUploadedFile.uuid from McUploadedFile mcUploadedFile where mcUploadedFile.mcContentId = :mcContentId and mcUploadedFile.fileOnline=0"; - private static final String GET_OFFLINE_FILES_NAME ="select mcUploadedFile.filename from McUploadedFile mcUploadedFile where mcUploadedFile.mcContentId = :mcContentId and mcUploadedFile.fileOnline=0 order by mcUploadedFile.uuid"; - - private static final String GET_FILES_UUID ="select mcUploadedFile.uuid from McUploadedFile mcUploadedFile where mcUploadedFile.filename=:filename"; - - - private static final String GET_OFFLINE_FILES_UUIDPLUSFILENAME = "select (mcUploadedFile.uuid + '~' + mcUploadedFile.filename) from McUploadedFile mcUploadedFile where mcUploadedFile.mcContentId = :mcContentId and mcUploadedFile.fileOnline=0"; - - private static final String FIND_ALL_UPLOADED_FILE_DATA = "from mcUploadedFile in class McUploadedFile"; - - - public McUploadedFile getUploadedFileById(long submissionId) - { - return (McUploadedFile) this.getHibernateTemplate() - .load(McUploadedFile.class, new Long(submissionId)); - } - - /** - * - * return null if not found - */ - public McUploadedFile loadUploadedFileById(long uid) - { - return (McUploadedFile) this.getHibernateTemplate().get(McUploadedFile.class, new Long(uid)); - } + static Logger logger = Logger.getLogger(McUploadedFileDAO.class.getName()); + + private static final String GET_ONLINE_FILENAMES_FOR_CONTENT = "select mcUploadedFile.filename from McUploadedFile mcUploadedFile where mcUploadedFile.mcContentId = :mcContentId and mcUploadedFile.fileOnline=1"; + private static final String GET_OFFLINE_FILENAMES_FOR_CONTENT = "select mcUploadedFile.filename from McUploadedFile mcUploadedFile where mcUploadedFile.mcContentId = :mcContentId and mcUploadedFile.fileOnline=0"; + + private static final String GET_ONLINE_FILES_UUID = "select mcUploadedFile.uuid from McUploadedFile mcUploadedFile where mcUploadedFile.mcContentId = :mcContentId and mcUploadedFile.fileOnline=1"; + private static final String GET_ONLINE_FILES_NAME ="select mcUploadedFile.filename from McUploadedFile mcUploadedFile where mcUploadedFile.mcContentId = :mcContentId and mcUploadedFile.fileOnline=1 order by mcUploadedFile.uuid"; + + private static final String GET_OFFLINE_FILES_UUID = "select mcUploadedFile.uuid from McUploadedFile mcUploadedFile where mcUploadedFile.mcContentId = :mcContentId and mcUploadedFile.fileOnline=0"; + private static final String GET_OFFLINE_FILES_NAME ="select mcUploadedFile.filename from McUploadedFile mcUploadedFile where mcUploadedFile.mcContentId = :mcContentId and mcUploadedFile.fileOnline=0 order by mcUploadedFile.uuid"; + + private static final String GET_FILES_UUID ="select mcUploadedFile.uuid from McUploadedFile mcUploadedFile where mcUploadedFile.filename=:filename"; + + + private static final String GET_OFFLINE_FILES_UUIDPLUSFILENAME = "select (mcUploadedFile.uuid + '~' + mcUploadedFile.filename) from McUploadedFile mcUploadedFile where mcUploadedFile.mcContentId = :mcContentId and mcUploadedFile.fileOnline=0"; + + private static final String FIND_ALL_UPLOADED_FILE_DATA = "from mcUploadedFile in class McUploadedFile"; + + + public McUploadedFile getUploadedFileById(long submissionId) + { + return (McUploadedFile) this.getHibernateTemplate() + .load(McUploadedFile.class, new Long(submissionId)); + } + + /** + * + * return null if not found + */ + public McUploadedFile loadUploadedFileById(long uid) + { + return (McUploadedFile) this.getHibernateTemplate().get(McUploadedFile.class, new Long(uid)); + } - - - public void updateUploadFile(McUploadedFile mcUploadedFile) - { - this.getHibernateTemplate().update(mcUploadedFile); - this.getSession().setFlushMode(FlushMode.AUTO); - } - - - public void saveUploadFile(McUploadedFile mcUploadedFile) - { - this.getHibernateTemplate().save(mcUploadedFile); - this.getSession().setFlushMode(FlushMode.AUTO); - } - - public void createUploadFile(McUploadedFile mcUploadedFile) - { - this.getHibernateTemplate().save(mcUploadedFile); - } - - public void UpdateUploadFile(McUploadedFile mcUploadedFile) - { - this.getHibernateTemplate().update(mcUploadedFile); - } + + + public void updateUploadFile(McUploadedFile mcUploadedFile) + { + this.getHibernateTemplate().update(mcUploadedFile); + this.getSession().setFlushMode(FlushMode.AUTO); + } + + + public void saveUploadFile(McUploadedFile mcUploadedFile) + { + this.getHibernateTemplate().save(mcUploadedFile); + this.getSession().setFlushMode(FlushMode.AUTO); + } + + public void createUploadFile(McUploadedFile mcUploadedFile) + { + this.getHibernateTemplate().save(mcUploadedFile); + } + + public void UpdateUploadFile(McUploadedFile mcUploadedFile) + { + this.getHibernateTemplate().update(mcUploadedFile); + } - - public void cleanUploadedFilesMetaData() - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(FIND_ALL_UPLOADED_FILE_DATA) - .list(); + + public void cleanUploadedFilesMetaData() + { + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(FIND_ALL_UPLOADED_FILE_DATA) + .list(); - if(list != null && list.size() > 0){ - Iterator listIterator=list.iterator(); - while (listIterator.hasNext()) - { - McUploadedFile mcFile=(McUploadedFile)listIterator.next(); - this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(mcFile); - templ.flush(); - } - } - } - - - public String getFileUuid(String filename) - { - - logger.debug("starting getFileUuid :" + filename); - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_FILES_UUID) - .setString("filename", filename) - .list(); - - logger.debug("list getFileUuid :" + list); - - if (list != null && list.size() > 0){ - Iterator listIterator=list.iterator(); + if(list != null && list.size() > 0){ + Iterator listIterator=list.iterator(); while (listIterator.hasNext()) { - String uuid=(String)listIterator.next(); - logger.debug("uuid :" + uuid); - return uuid; - } - } - else - { - return null; - } - return null; + McUploadedFile mcFile=(McUploadedFile)listIterator.next(); + this.getSession().setFlushMode(FlushMode.AUTO); + templ.delete(mcFile); + templ.flush(); + } } + } + + + public String getFileUuid(String filename) + { - - public void removeUploadFile(Long uid) - { - if (uid != null ) { - - String query = "from uploadedFile in class org.lamsfoundation.lams.tool.mc.McUploadedFile" - + " where uploadedFile.uid = ?"; - Object obj = this.getSession().createQuery(query) - .setLong(0,uid.longValue()) - .uniqueResult(); - if ( obj != null ) { - this.getHibernateTemplate().delete(obj); - } - } + logger.debug("starting getFileUuid :" + filename); + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(GET_FILES_UUID) + .setString("filename", filename) + .list(); + + logger.debug("list getFileUuid :" + list); + + if (list != null && list.size() > 0){ + Iterator listIterator=list.iterator(); + while (listIterator.hasNext()) + { + String uuid=(String)listIterator.next(); + logger.debug("uuid :" + uuid); + return uuid; + } + } + else + { + return null; + } + return null; + } + + + public void removeUploadFile(Long uid) + { + if (uid != null ) { + + String query = "from uploadedFile in class org.lamsfoundation.lams.tool.mc.McUploadedFile" + + " where uploadedFile.uid = ?"; + Object obj = this.getSession().createQuery(query) + .setLong(0,uid.longValue()) + .uniqueResult(); + if ( obj != null ) { + this.getHibernateTemplate().delete(obj); + } } - - public List retrieveMcUploadedFiles(Long mcContentId, boolean fileOnline) - { - List listFilenames=null; - - if (fileOnline) - { - listFilenames=(getHibernateTemplate().findByNamedParam(GET_ONLINE_FILENAMES_FOR_CONTENT, - "mcContentId", - mcContentId)); - } - else - { - listFilenames=(getHibernateTemplate().findByNamedParam(GET_OFFLINE_FILENAMES_FOR_CONTENT, - "mcContentId", - mcContentId)); - } - return listFilenames; - } - - - public List retrieveMcUploadedOfflineFilesUuid(Long mcContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_OFFLINE_FILES_UUID) - .setLong("mcContentId", mcContentId.longValue()) - .list(); - - - return list; - } - - public List retrieveMcUploadedOnlineFilesUuid(Long mcContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_ONLINE_FILES_UUID) - .setLong("mcContentId", mcContentId.longValue()) - .list(); - - return list; - } - - public List retrieveMcUploadedOfflineFilesUuidPlusFilename(Long mcContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_OFFLINE_FILES_UUIDPLUSFILENAME) - .setLong("mcContentId", mcContentId.longValue()) - .list(); - - return list; - } - - - - - public List retrieveMcUploadedOfflineFilesName(Long mcContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_OFFLINE_FILES_NAME) - .setLong("mcContentId", mcContentId.longValue()) - .list(); - - return list; - } + } + + public List retrieveMcUploadedFiles(Long mcContentId, boolean fileOnline) + { + List listFilenames=null; + + if (fileOnline) + { + listFilenames=(getHibernateTemplate().findByNamedParam(GET_ONLINE_FILENAMES_FOR_CONTENT, + "mcContentId", + mcContentId)); + } + else + { + listFilenames=(getHibernateTemplate().findByNamedParam(GET_OFFLINE_FILENAMES_FOR_CONTENT, + "mcContentId", + mcContentId)); + } + return listFilenames; + } + + + public List retrieveMcUploadedOfflineFilesUuid(Long mcContentId) + { + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(GET_OFFLINE_FILES_UUID) + .setLong("mcContentId", mcContentId.longValue()) + .list(); + + + return list; + } + + public List retrieveMcUploadedOnlineFilesUuid(Long mcContentId) + { + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(GET_ONLINE_FILES_UUID) + .setLong("mcContentId", mcContentId.longValue()) + .list(); + + return list; + } + + public List retrieveMcUploadedOfflineFilesUuidPlusFilename(Long mcContentId) + { + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(GET_OFFLINE_FILES_UUIDPLUSFILENAME) + .setLong("mcContentId", mcContentId.longValue()) + .list(); + + return list; + } + + + public List retrieveMcUploadedOfflineFilesName(Long mcContentId) + { + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(GET_OFFLINE_FILES_NAME) + .setLong("mcContentId", mcContentId.longValue()) + .list(); + + return list; + } + + public List retrieveMcUploadedOnlineFilesName(Long mcContentId) + { + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(GET_ONLINE_FILES_NAME) + .setLong("mcContentId", mcContentId.longValue()) + .list(); + + return list; + } + + + public void deleteUploadFile(McUploadedFile mcUploadedFile) + { + this.getHibernateTemplate().delete(mcUploadedFile); + } + + public void flush() + { + this.getHibernateTemplate().flush(); + } - public List retrieveMcUploadedOnlineFilesName(Long mcContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_ONLINE_FILES_NAME) - .setLong("mcContentId", mcContentId.longValue()) - .list(); - - return list; - } - - - public void deleteUploadFile(McUploadedFile mcUploadedFile) - { - this.getHibernateTemplate().delete(mcUploadedFile); - } - - public void flush() - { - this.getHibernateTemplate().flush(); - } - } \ No newline at end of file Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java =================================================================== diff -u -r8742c4d01b2ac066988448e0c64d76998d5f4f5b -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java (.../McUserDAO.java) (revision 8742c4d01b2ac066988448e0c64d76998d5f4f5b) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java (.../McUserDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) @@ -44,25 +44,17 @@ private static final String COUNT_USERS_IN_SESSION = "select mu.queUsrId from McQueUsr mu where mu.mcSession= :mcSession"; - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcUserDAO#getMcUserByUID(java.lang.Long) */ - public McQueUsr getMcUserByUID(Long uid) + public McQueUsr getMcUserByUID(Long uid) { return (McQueUsr) this.getHibernateTemplate() .get(McQueUsr.class, uid); } - - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcUserDAO#getMcUserByID(java.lang.Long) */ public McQueUsr findMcUserById(Long userId) { String query = "from McQueUsr user where user.queUsrId=?"; - /* - return (McQueUsr) getSession().createQuery(query) - .setLong(0,userId.longValue()) - .uniqueResult(); - */ - + HibernateTemplate templ = this.getHibernateTemplate(); List list = getSession().createQuery(query) .setLong(0,userId.longValue()) @@ -76,7 +68,6 @@ } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcUserDAO#getMcUserBySession(java.lang.Long, java.lang.Long)*/ public McQueUsr getMcUserBySession(Long userId, Long sessionId) { /* @@ -99,19 +90,18 @@ } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcUserDAO#saveMcUser(org.lamsfoundation.lams.tool.mc.McUser) */ public void saveMcUser(McQueUsr mcUser) { this.getHibernateTemplate().save(mcUser); } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcUserDAO#updateMcUser(org.lamsfoundation.lams.tool.mc.McUser) */ + public void updateMcUser(McQueUsr mcUser) { this.getHibernateTemplate().update(mcUser); } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcUserDAO#removeMcUser(java.lang.Long) */ + public void removeMcUserById(Long userId) { HibernateTemplate templ = this.getHibernateTemplate(); @@ -130,20 +120,19 @@ } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcUserDAO#removeMcUser(org.lamsfoundation.lams.tool.mc.McUser) */ + public void removeMcUser(McQueUsr mcUser) { this.getSession().setFlushMode(FlushMode.AUTO); this.getHibernateTemplate().delete(mcUser); } - /** @see org.lamsfoundation.lams.tool.mc.dao.IMcUserDAO#getNumberOfUsers((org.lamsfoundation.lams.tool.mc.McSession) */ + public int getNumberOfUsers(McSession mcSession) { return (getHibernateTemplate().findByNamedParam(COUNT_USERS_IN_SESSION, "mcSession", mcSession)).size(); - } + } - } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUsrAttemptDAO.java =================================================================== diff -u -r8742c4d01b2ac066988448e0c64d76998d5f4f5b -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUsrAttemptDAO.java (.../McUsrAttemptDAO.java) (revision 8742c4d01b2ac066988448e0c64d76998d5f4f5b) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUsrAttemptDAO.java (.../McUsrAttemptDAO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) @@ -28,16 +28,10 @@ import org.lamsfoundation.lams.tool.mc.dao.IMcUsrAttemptDAO; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; - - - /** * @author ozgurd - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + *Hibernate implementation for database access to McUsrAttempt for the mc tool.
*/ - public class McUsrAttemptDAO extends HibernateDaoSupport implements IMcUsrAttemptDAO { static Logger logger = Logger.getLogger(McUsrAttemptDAO.class.getName()); @@ -47,7 +41,6 @@ .get(McUsrAttempt.class, uid); } - public void saveMcUsrAttempt(McUsrAttempt mcUsrAttempt) { this.getHibernateTemplate().save(mcUsrAttempt); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java =================================================================== diff -u -r7178c958439c0def43ca0f2e33515c76b4d6d051 -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision 7178c958439c0def43ca0f2e33515c76b4d6d051) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) @@ -44,7 +44,7 @@ /** - * This interface define the contract that all Survey service provider must + * This interface define the contract that all MCQ service provider must * follow. * * @author ozgurd Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java =================================================================== diff -u -r7178c958439c0def43ca0f2e33515c76b4d6d051 -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision 7178c958439c0def43ca0f2e33515c76b4d6d051) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) @@ -78,11 +78,6 @@ * are implemented in this class. It translate the request from presentation * layer and perform approporiate database operation. * - * Two construtors are provided in this class. The constuctor with Hibernate - * session object allows survey tool to handle long run application transaction. - * The developer can store Hibernate session in http session and pass across - * different http request. This implementation also make the testing out side - * JBoss container much easier. * * Every method is implemented as a Hibernate session transaction. It open an * new persistent session or connect to existing persistent session in the Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java =================================================================== diff -u -r7178c958439c0def43ca0f2e33515c76b4d6d051 -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 7178c958439c0def43ca0f2e33515c76b4d6d051) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) @@ -218,7 +218,9 @@ * if the passed toolContentId exists in the db, we need to get the relevant data into the Map * if not, create the default Map */ + + public ActionForward loadQ(ActionMapping mapping, ActionForm form, HttpServletRequest request, @@ -563,7 +565,7 @@ Map mapSelectedOptions=(Map)request.getSession().getAttribute(MAP_SELECTED_OPTIONS); mapSelectedOptions.clear(); - /** options have been persisted before */ + /* options have been persisted before */ if (listOptionsContent != null) { logger.debug("listOptionsContent not null" ); @@ -580,7 +582,7 @@ logger.debug("MAP_OPTIONS_CONTENT reconstructed from db" ); - /** we have to assume that some of the optons are selected as this is forced in the ui. + /* we have to assume that some of the optons are selected as this is forced in the ui. * retrieve and present the selected options from the db * */ List listSelectedOptions=mcService.getPersistedSelectedOptions(mcQueContent.getUid()); @@ -638,7 +640,7 @@ logger.debug("MAP_SELECTED_OPTIONS set as empty list :" + mapSelectedOptions); } - /** present the feedback content the same way for the conditions above*/ + /* present the feedback content the same way for the conditions above*/ String richTextFeedbackInCorrect=mcQueContent.getFeedbackIncorrect(); logger.debug("richTextFeedbackInCorrect: " + richTextFeedbackInCorrect); if (richTextFeedbackInCorrect == null) richTextFeedbackInCorrect=""; @@ -666,7 +668,7 @@ Map mapGsoc=(Map)request.getSession().getAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT); logger.debug("mapGsoc from the cache: " + mapGsoc); - /** extract the relavent question's option from the larger Map */ + /* extract the relavent question's option from the larger Map */ while (itMapGeneral.hasNext()) { Map.Entry pairs = (Map.Entry)itMapGeneral.next(); @@ -710,7 +712,7 @@ } - /** present the default content*/ + /* present the default content*/ if (optionsPresentationValid == false) { logger.debug("optionsPresentationValid is false, present default content"); @@ -721,7 +723,7 @@ List listDefaultOption=mcService.findMcOptionsContentByQueId(queContentUID); logger.debug("listDefaultOption: " + listDefaultOption); - /** normally iterates only once */ + /* normally iterates only once */ Iterator itDefaultOption=listDefaultOption.iterator(); Long mapIndex=new Long(1); while (itDefaultOption.hasNext()) @@ -923,7 +925,7 @@ request.getSession().setAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT, mapGeneralSelectedOptionsContent); logger.debug("updated MAP_GENERAL_SELECTED_OPTIONS_CONTENT after add: " + mapGeneralSelectedOptionsContent); - /** update feedback Maps*/ + /* update feedback Maps*/ Map mapFeedbackIncorrect =(Map)request.getSession().getAttribute(MAP_FEEDBACK_INCORRECT); logger.debug("current mapFeedbackIncorrect:" + mapFeedbackIncorrect); String richTextFeedbackInCorrect=(String) request.getSession().getAttribute(RICHTEXT_FEEDBACK_INCORRECT); @@ -1029,7 +1031,7 @@ logger.debug("updated MAP_GENERAL_SELECTED_OPTIONS_CONTENT after add: " + mapGeneralSelectedOptionsContent); - /** update feedback Maps*/ + /* update feedback Maps*/ Map mapFeedbackIncorrect =(Map)request.getSession().getAttribute(MAP_FEEDBACK_INCORRECT); logger.debug("current mapFeedbackIncorrect:" + mapFeedbackIncorrect); String richTextFeedbackInCorrect=(String) request.getSession().getAttribute(RICHTEXT_FEEDBACK_INCORRECT); @@ -1131,7 +1133,7 @@ logger.debug("updated MAP_GENERAL_SELECTED_OPTIONS_CONTENT after add: " + mapGeneralSelectedOptionsContent); - /** update feedback Maps*/ + /* update feedback Maps*/ Map mapFeedbackIncorrect =(Map)request.getSession().getAttribute(MAP_FEEDBACK_INCORRECT); logger.debug("current mapFeedbackIncorrect:" + mapFeedbackIncorrect); String richTextFeedbackInCorrect=(String) request.getSession().getAttribute(RICHTEXT_FEEDBACK_INCORRECT); @@ -1234,7 +1236,7 @@ } else if (mcAuthoringForm.getSubmitQuestions() != null) { - /** persist the final Questions Map */ + /* persist the final Questions Map */ userAction="submitQuestions"; request.setAttribute(USER_ACTION, userAction); logger.debug("userAction:" + userAction); @@ -1472,9 +1474,6 @@ logger.debug("mcContent created"); } - //mcService.resetAllQuestions(mcContent.getUid()); - //logger.debug("all question reset for :" + mcContent.getUid()); - mapQuestionsContent=(Map) request.getSession().getAttribute(MAP_QUESTIONS_CONTENT); logger.debug("Submit final MAP_QUESTIONS_CONTENT :" + mapQuestionsContent); @@ -1491,72 +1490,17 @@ persistQuestions(request, mapQuestionsContent, mapFeedbackIncorrect, mapFeedbackCorrect, mcContent); logger.debug("post persistQuestions"); - - - - -/* - Map mapWeights=repopulateCurrentWeightsMap(request, "questionWeight"); - logger.debug("final mapWeights :" + mapWeights); - request.getSession().setAttribute(MAP_WEIGHTS, mapWeights); - System.out.print("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS)); - - Iterator itMap = mapQuestionsContent.entrySet().iterator(); - while (itMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itMap.next(); - if ((pairs.getValue() != null) && (!pairs.getValue().equals(""))) - { - McQueContent mcQueContent = mcService.getQuestionContentByQuestionText(pairs.getValue().toString(), mcContent.getUid()); - logger.debug("retrieved mcQueContent: " + mcQueContent); - - Integer currentWeight= new Integer(mapWeights.get(pairs.getKey()).toString()); - logger.debug("currentWeight:" + currentWeight); - - if (mcQueContent != null) - { - mcQueContent.setDisabled(false); - mcQueContent.setWeight(currentWeight); - mcQueContent.setDisplayOrder(new Integer(pairs.getKey().toString())); - logger.debug("enabled mcQueContent for question: " + pairs.getValue().toString()); - mcService.saveOrUpdateMcQueContent(mcQueContent); - } - else - { - logger.debug("create the question on the fly for submit : " + pairs.getValue().toString()); - mcQueContent= new McQueContent(pairs.getValue().toString(), - new Integer(pairs.getKey().toString()), - currentWeight, - false, - mcContent, - new HashSet(), - new HashSet() - ); - mcService.saveOrUpdateMcQueContent(mcQueContent); - } - } - } - */ - - /** attend here later again, for the moment we are not deleting unused question physically from the DB, - * we are just marking them as disabled */ - //mcService.cleanAllQuestions(mcContent.getUid()); - //logger.debug("all questions cleaned for :" + mcContent.getUid()); - - logger.debug("will do addUploadedFilesMetaData"); McUtils.addUploadedFilesMetaData(request,mcContent); logger.debug("done addUploadedFilesMetaData"); - - errors.clear(); errors.add(Globals.ERROR_KEY,new ActionMessage("submit.successful")); logger.debug("add submit.successful to ActionMessages"); saveErrors(request,errors); request.setAttribute(SUBMIT_SUCCESS, new Integer(1)); logger.debug("set SUBMIT_SUCCESS to 1"); - request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); logger.debug("setting EDIT_OPTIONS_MODE to 0"); @@ -1715,12 +1659,6 @@ if ((pairs.getValue() != null) && (!pairs.getValue().equals(""))) { logger.debug("checking existing question text: " + pairs.getValue().toString() + " and mcContent uid():" + mcContent.getUid()); - /* - McQueContent mcQueContent=mcService.getQuestionContentByQuestionText(pairs.getValue().toString(), mcContent.getUid()); - logger.debug("mcQueContent: " + mcQueContent); - Integer currentWeight= new Integer(mapWeights.get(pairs.getKey()).toString()); - logger.debug("currentWeight:" + currentWeight); - */ String currentFeedbackIncorrect=(String)mapFeedbackIncorrect.get(pairs.getKey()); logger.debug("currentFeedbackIncorrect: " + currentFeedbackIncorrect); @@ -1743,21 +1681,20 @@ new HashSet(), new HashSet() ); - mcService.createMcQue(mcQueContent); - logger.debug("persisted mcQueContent: " + mcQueContent); + mcService.createMcQue(mcQueContent); + logger.debug("persisted mcQueContent: " + mcQueContent); - logger.debug("remove existing options for mcQueContent : " + mcQueContent.getUid()); - mcService.removeMcOptionsContentByQueId(mcQueContent.getUid()); - logger.debug("removed all mcOptionsContents for mcQueContentId :" + mcQueContent.getUid()); + logger.debug("remove existing options for mcQueContent : " + mcQueContent.getUid()); + mcService.removeMcOptionsContentByQueId(mcQueContent.getUid()); + logger.debug("removed all mcOptionsContents for mcQueContentId :" + mcQueContent.getUid()); - - if (mcQueContent != null) - { - logger.debug("pre persistOptions for: " + mcQueContent); - logger.debug("sending :" + pairs.getKey().toString()); - persistOptions(request, mapGeneralOptionsContent, mapGeneralSelectedOptionsContent, mcQueContent, pairs.getKey().toString()); - logger.debug("post persistOptions"); - } + if (mcQueContent != null) + { + logger.debug("pre persistOptions for: " + mcQueContent); + logger.debug("sending :" + pairs.getKey().toString()); + persistOptions(request, mapGeneralOptionsContent, mapGeneralSelectedOptionsContent, mcQueContent, pairs.getKey().toString()); + logger.debug("post persistOptions"); + } } } @@ -1841,12 +1778,12 @@ { IMcService mcService =McUtils.getToolService(request); - /** the tool content id is passed from the container to the tool and placed into session in the McStarterAction */ + /* the tool content id is passed from the container to the tool and placed into session in the McStarterAction */ Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); if ((toolContentId != null) && (toolContentId.longValue() != 0)) { logger.debug("passed TOOL_CONTENT_ID : " + toolContentId); - /**delete the existing content in the database before applying new content*/ + /*delete the existing content in the database before applying new content*/ mcService.deleteMcById(toolContentId); logger.debug("post-deletion existing content"); } @@ -1938,9 +1875,9 @@ creationDate=new Date(System.currentTimeMillis()).toString(); - /**obtain user object from the session*/ + /*obtain user object from the session*/ HttpSession ss = SessionManager.getSession(); - //get back login user DTO + /* get back login user DTO */ UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); logger.debug("retrieving toolUser: " + toolUser); logger.debug("retrieving toolUser userId: " + toolUser.getUserID()); @@ -1949,16 +1886,16 @@ long userId=toolUser.getUserID().longValue(); logger.debug("userId: " + userId); - /** create a new qa content and leave the default content intact*/ + /* create a new qa content and leave the default content intact*/ McContent mc = new McContent(); mc.setMcContentId(toolContentId); mc.setTitle(richTextTitle); mc.setInstructions(richTextInstructions); - mc.setCreationDate(creationDate); /**preserve this from the db*/ - mc.setUpdateDate(new Date(System.currentTimeMillis())); /**keep updating this one*/ - mc.setCreatedBy(userId); /**make sure we are setting the userId from the User object above*/ + mc.setCreationDate(creationDate); /*preserve this from the db*/ + mc.setUpdateDate(new Date(System.currentTimeMillis())); /* keep updating this one*/ + mc.setCreatedBy(userId); /* make sure we are setting the userId from the User object above*/ mc.setUsernameVisible(isUsernameVisible); - mc.setQuestionsSequenced(isQuestionsSequenced); /**the default question listing in learner mode will be all in the same page*/ + mc.setQuestionsSequenced(isQuestionsSequenced); /* the default question listing in learner mode will be all in the same page*/ mc.setOnlineInstructions(richTextOnlineInstructions); mc.setOfflineInstructions(richTextOfflineInstructions); mc.setRunOffline(false); @@ -1977,7 +1914,7 @@ mc.setMcSessions(new TreeSet()); logger.debug("mc content :" + mc); - /**create the content in the db*/ + /*create the content in the db*/ mcService.createMc(mc); logger.debug("mc created with content id: " + toolContentId); @@ -2046,8 +1983,7 @@ Map mapWeights=repopulateCurrentWeightsMap(request,"questionWeight"); logger.debug("mapWeights for add Question: " + mapWeights); - - /** iterate the questions Map and persist the questions into the DB*/ + /* iterate the questions Map and persist the questions into the DB*/ Iterator itQuestionsMap = mapQuestionsContent.entrySet().iterator(); while (itQuestionsMap.hasNext()) { Map.Entry pairs = (Map.Entry)itQuestionsMap.next(); @@ -2096,8 +2032,6 @@ McContent mcContent=mcService.retrieveMc(toolContentId); logger.debug("mcContent:" + mcContent); - //List list=mcService.refreshQuestionContent(mcContent.getUid()); - List list=mcService.getAllQuestionEntries(mcContent.getUid()); logger.debug("list:" + list); @@ -2289,8 +2223,7 @@ protected Map shiftMap(Map mapQuestionsContent, String questionIndex , String movableQuestionEntry, String direction) { logger.debug("movableQuestionEntry: " + movableQuestionEntry); - - /** map to be returned */ + /* map to be returned */ Map mapTempQuestionsContent= new TreeMap(new McComparator()); Iterator itMap = mapQuestionsContent.entrySet().iterator(); @@ -2309,43 +2242,43 @@ } - logger.debug("shiftableIndex: " + shiftableIndex); - shiftableEntry=(String)mapQuestionsContent.get(new Integer(shiftableIndex).toString()); - logger.debug("shiftable entry: " + shiftableEntry); - - if (shiftableEntry != null) - { - Iterator itQuestionsMap = mapQuestionsContent.entrySet().iterator(); - long mapCounter=0; - while (itQuestionsMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itQuestionsMap.next(); - logger.debug("comparing the pair: " + pairs.getKey() + " = " + pairs.getValue()); - mapCounter++; - logger.debug("mapCounter: " + mapCounter); - - if (!pairs.getKey().equals(questionIndex) && !pairs.getKey().equals(new Integer(shiftableIndex).toString())) - { - logger.debug("normal copy " + questionIndex); - mapTempQuestionsContent.put(new Long(mapCounter).toString(), pairs.getValue()); - } - else if (pairs.getKey().equals(questionIndex)) - { - logger.debug("move type 1 " + questionIndex); - mapTempQuestionsContent.put(new Long(mapCounter).toString(), shiftableEntry); - } - else if (pairs.getKey().equals(new Integer(shiftableIndex).toString())) - { - logger.debug("move type 2 " + shiftableIndex); - mapTempQuestionsContent.put(new Long(mapCounter).toString(), movableQuestionEntry); - } + logger.debug("shiftableIndex: " + shiftableIndex); + shiftableEntry=(String)mapQuestionsContent.get(new Integer(shiftableIndex).toString()); + logger.debug("shiftable entry: " + shiftableEntry); + + if (shiftableEntry != null) + { + Iterator itQuestionsMap = mapQuestionsContent.entrySet().iterator(); + long mapCounter=0; + while (itQuestionsMap.hasNext()) { + Map.Entry pairs = (Map.Entry)itQuestionsMap.next(); + logger.debug("comparing the pair: " + pairs.getKey() + " = " + pairs.getValue()); + mapCounter++; + logger.debug("mapCounter: " + mapCounter); + + if (!pairs.getKey().equals(questionIndex) && !pairs.getKey().equals(new Integer(shiftableIndex).toString())) + { + logger.debug("normal copy " + questionIndex); + mapTempQuestionsContent.put(new Long(mapCounter).toString(), pairs.getValue()); } - } - else - { - logger.debug("no change to map"); - mapTempQuestionsContent=mapQuestionsContent; - } - return mapTempQuestionsContent; + else if (pairs.getKey().equals(questionIndex)) + { + logger.debug("move type 1 " + questionIndex); + mapTempQuestionsContent.put(new Long(mapCounter).toString(), shiftableEntry); + } + else if (pairs.getKey().equals(new Integer(shiftableIndex).toString())) + { + logger.debug("move type 2 " + shiftableIndex); + mapTempQuestionsContent.put(new Long(mapCounter).toString(), movableQuestionEntry); + } + } + } + else + { + logger.debug("no change to map"); + mapTempQuestionsContent=mapQuestionsContent; + } + return mapTempQuestionsContent; } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAuthoringForm.java =================================================================== diff -u -r7018cf59202a9562124f6ea36ea1b2a95f5897bb -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAuthoringForm.java (.../McAuthoringForm.java) (revision 7018cf59202a9562124f6ea36ea1b2a95f5897bb) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAuthoringForm.java (.../McAuthoringForm.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) @@ -1,28 +1,17 @@ -/* - * ozgurd - * Created on 26/04/2005 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ package org.lamsfoundation.lams.tool.mc.web; -/** - * ActionForm for the Authoring environment - */ + import org.apache.struts.action.ActionForm; import org.lamsfoundation.lams.tool.mc.McAppConstants; import org.apache.struts.upload.FormFile; /** * @author ozgurd * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * ActionForm for the Authoring environment */ public class McAuthoringForm extends ActionForm implements McAppConstants { - /** form controllers */ - + /* form controllers */ protected String addOptionContent; protected String addQuestion; protected String removeQuestion; @@ -58,19 +47,19 @@ protected String submitOnlineFile; - /** tab controller, these may go away once the Flash wraps the jsp */ + /* tab controller, these may go away once the Flash wraps the jsp */ protected String choice; protected String choiceBasic; protected String choiceAdvanced; protected String choiceInstructions; - /** basic content */ + /* basic content */ protected String title; protected String instructions; protected String isRemoveContent; protected String toolContentId; - /** instructions content */ + /* instructions content */ protected String onlineInstructions; protected String offlineInstructions; protected FormFile theOfflineFile; @@ -79,15 +68,14 @@ protected String richTextOfflineInstructions; protected String richTextOnlineInstructions; - /** advanced content */ + /* advanced content */ protected String synchInMonitor; protected String showFeedback; protected String retries; protected String sln; protected String passmark; - protected String reportTitle; protected String monitoringReportTitle; protected String endLearningMessage; Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java =================================================================== diff -u -rf37e902802cd59114b62435f47e9106df830496d -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java (.../McStarterAction.java) (revision f37e902802cd59114b62435f47e9106df830496d) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java (.../McStarterAction.java) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) @@ -100,32 +100,9 @@ public class McStarterAction extends Action implements McAppConstants { static Logger logger = Logger.getLogger(McStarterAction.class.getName()); - - /** - * A Map data structure is used to present the UI. - * It is fetched by subsequent Action classes to manipulate its content and gets parsed in the presentation layer for display. - */ + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, McApplicationException { - - - String protocol = request.getProtocol(); - if(protocol.startsWith("HTTPS")){ - protocol = "https://"; - }else{ - protocol = "http://"; - } - String root = protocol+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/"; - String pathToLams = protocol+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/../.."; - request.getSession().setAttribute(ROOT, root); - request.getSession().setAttribute(ROOT_PATH, root); - request.getSession().setAttribute(PATH_TO_LAMS, pathToLams); - - logger.debug("setting root to: " + request.getSession().getAttribute(ROOT)); - - /** - * retrive the service - */ IMcService mcService = McUtils.getToolService(request); logger.debug("retrieving mcService from session: " + mcService); if (mcService == null) @@ -134,72 +111,78 @@ logger.debug("retrieving mcService from proxy: " + mcService); request.getSession().setAttribute(TOOL_SERVICE, mcService); } - - /** CURRENT_TAB == 1 defines Basic Tab - * CURRENT_TAB == 2 defines Avanced Tab - * CURRENT_TAB == 3 defines Instructions Tab - * */ - request.getSession().setAttribute(CURRENT_TAB, new Long(1)); - request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); - - /** needs to run only once per tool*/ - /** McUtils.configureContentRepository(request, mcService); */ - - /** these two are for repository access */ - /**holds the final offline files list */ - LinkedList listUploadedOfflineFiles= new LinkedList(); - LinkedList listUploadedOnlineFiles= new LinkedList(); - - /** these two are for jsp */ - LinkedList listUploadedOfflineFileNames= new LinkedList(); - LinkedList listUploadedOnlineFileNames= new LinkedList(); - - request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILES,listUploadedOfflineFiles); - request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILENAMES,listUploadedOfflineFileNames); - - request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILES,listUploadedOnlineFiles); - request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILENAMES,listUploadedOnlineFileNames); - - - Map mapQuestionsContent= new TreeMap(new McComparator()); - Map mapOptionsContent= new TreeMap(new McComparator()); - Map mapDefaultOptionsContent= new TreeMap(new McComparator()); - - Map mapGeneralOptionsContent= new TreeMap(new McComparator()); - request.getSession().setAttribute(MAP_GENERAL_OPTIONS_CONTENT, mapGeneralOptionsContent); - - Map mapGeneralSelectedOptionsContent= new TreeMap(new McComparator()); - request.getSession().setAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT, mapGeneralSelectedOptionsContent); - - Map mapDisabledQuestions= new TreeMap(new McComparator()); - request.getSession().setAttribute(MAP_DISABLED_QUESTIONS, mapDisabledQuestions); - - Map mapWeights= new TreeMap(new McComparator()); - request.getSession().setAttribute(MAP_WEIGHTS, mapWeights); - - Map mapCheckBoxStates= new TreeMap(new McComparator()); - mapCheckBoxStates.put("1" ,"INCORRECT"); - mapCheckBoxStates.put("2" ,"CORRECT"); - request.getSession().setAttribute(MAP_CHECKBOX_STATES, mapCheckBoxStates); - Map mapSelectedOptions= new TreeMap(new McComparator()); - request.getSession().setAttribute(MAP_SELECTED_OPTIONS, mapSelectedOptions); + setupPaths(request); + initialiseAttributes(request); - Map mapFeedbackIncorrect= new TreeMap(new McComparator()); - request.getSession().setAttribute(MAP_FEEDBACK_INCORRECT, mapFeedbackIncorrect); - - Map mapFeedbackCorrect= new TreeMap(new McComparator()); - request.getSession().setAttribute(MAP_FEEDBACK_CORRECT, mapFeedbackCorrect); - - request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); - logger.debug("resetting EDIT_OPTIONS_MODE to 0"); - McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; mcAuthoringForm.resetRadioBoxes(); - /** - * retrieve the default content id based on tool signature - */ + ActionForward validateParameters=populateParameters(request,mapping); + logger.debug("validateParameters: " + validateParameters); + if (validateParameters != null) + { + logger.debug("validateParameters not null : " + validateParameters); + return validateParameters; + } + else + { + /* mark the http session as an authoring activity */ + request.getSession().setAttribute(TARGET_MODE,TARGET_MODE_AUTHORING); + + /* define tab controllers for jsp */ + request.getSession().setAttribute(CHOICE_TYPE_BASIC,CHOICE_TYPE_BASIC); + request.getSession().setAttribute(CHOICE_TYPE_ADVANCED,CHOICE_TYPE_ADVANCED); + request.getSession().setAttribute(CHOICE_TYPE_INSTRUCTIONS,CHOICE_TYPE_INSTRUCTIONS); + + logger.debug("will render authoring screen"); + String strToolContentId=""; + strToolContentId=request.getParameter(TOOL_CONTENT_ID); + + /* Process incoming tool content id. + * Either exists or not exists in the db yet, a toolContentId must be passed to the tool from the container */ + long toolContentId=0; + try + { + toolContentId=new Long(strToolContentId).longValue(); + logger.debug("passed TOOL_CONTENT_ID : " + toolContentId); + request.getSession().setAttribute(TOOL_CONTENT_ID, new Long(strToolContentId)); + } + catch(NumberFormatException e) + { + persistError(request,"error.numberFormatException"); + request.setAttribute(USER_EXCEPTION_NUMBERFORMAT, new Boolean(true)); + logger.debug("forwarding to: " + LOAD_QUESTIONS); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + /* + * find out if the passed tool content id exists in the db + * present user either a first timer screen with default content data or fetch the existing content. + * + * if the toolcontentid does not exist in the db, create the default Map, + * there is no need to check if the content is in use in this case. + * It is always unlocked -> not in use since it is the default content. + */ + if (!existsContent(toolContentId, request)) + { + System.out.print("retrieving default content"); + retrieveDefaultContent(request, mcAuthoringForm); + } + else + { + System.out.print("retrieving existing content for: " + toolContentId); + retrieveExistingContent(request, mcAuthoringForm, toolContentId); + } + } + mcAuthoringForm.resetUserAction(); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + public ActionForward populateParameters(HttpServletRequest request, ActionMapping mapping) + { + IMcService mcService =McUtils.getToolService(request); + /* retrieve the default content id based on tool signature */ long contentId=0; try { @@ -211,21 +194,18 @@ logger.debug("default content id has not been setup"); request.setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true)); persistError(request,"error.defaultContent.notSetup"); - return (mapping.findForward(LOAD_QUESTIONS)); + return (mapping.findForward(ERROR_LIST)); } } catch(Exception e) { logger.debug("error getting the default content id: " + e.getMessage()); request.setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true)); persistError(request,"error.defaultContent.notSetup"); - return (mapping.findForward(LOAD_QUESTIONS)); + return (mapping.findForward(ERROR_LIST)); } - - /** - * retrieve uid of the content based on default content id determined above - */ + /* retrieve uid of the content based on default content id determined above */ long contentUID=0; try { @@ -236,7 +216,7 @@ logger.debug("Exception occured: No default content"); request.setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true)); persistError(request,"error.defaultContent.notSetup"); - return (mapping.findForward(LOAD_QUESTIONS)); + return (mapping.findForward(ERROR_LIST)); } logger.debug("using mcContent: " + mcContent); logger.debug("using mcContent uid: " + mcContent.getUid()); @@ -247,13 +227,11 @@ logger.debug("Exception occured: No default question content"); request.setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true)); persistError(request,"error.defaultContent.notSetup"); - return (mapping.findForward(LOAD_QUESTIONS)); + return (mapping.findForward(ERROR_LIST)); } - /** - * retrieve uid of the default question content - */ + /* retrieve uid of the default question content */ long queContentUID=0; try { @@ -265,7 +243,7 @@ logger.debug("Exception occured: No default question content"); request.setAttribute(USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE, new Boolean(true)); persistError(request,"error.defaultQuestionContent.notAvailable"); - return (mapping.findForward(LOAD_QUESTIONS)); + return (mapping.findForward(ERROR_LIST)); } logger.debug("using mcQueContent uid: " + mcQueContent.getUid()); queContentUID=mcQueContent.getUid().longValue(); @@ -277,13 +255,11 @@ logger.debug("Exception occured: No default question content"); request.setAttribute(USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE, new Boolean(true)); persistError(request,"error.defaultQuestionContent.notAvailable"); - return (mapping.findForward(LOAD_QUESTIONS)); + return (mapping.findForward(ERROR_LIST)); } - /** - * retrieve default options content - */ + /* retrieve default options content */ try { logger.debug("retrieve the default options content based on default question content UID: " + queContentUID); @@ -294,7 +270,7 @@ logger.debug("Exception occured: No default options content"); request.setAttribute(USER_EXCEPTION_DEFAULTOPTIONSCONTENT_NOT_AVAILABLE, new Boolean(true)); persistError(request,"error.defaultOptionsContent.notAvailable"); - return (mapping.findForward(LOAD_QUESTIONS)); + return (mapping.findForward(ERROR_LIST)); } } @@ -303,310 +279,13 @@ logger.debug("Exception occured: No default options content"); request.setAttribute(USER_EXCEPTION_DEFAULTOPTIONSCONTENT_NOT_AVAILABLE, new Boolean(true)); persistError(request,"error.defaultOptionsContent.notAvailable"); - return (mapping.findForward(LOAD_QUESTIONS)); - } + return (mapping.findForward(ERROR_LIST)); + } + return null; + } - - /** - * mark the http session as an authoring activity - */ - request.getSession().setAttribute(TARGET_MODE,TARGET_MODE_AUTHORING); - - /** - * define tab controllers for jsp - */ - request.getSession().setAttribute(CHOICE_TYPE_BASIC,CHOICE_TYPE_BASIC); - request.getSession().setAttribute(CHOICE_TYPE_ADVANCED,CHOICE_TYPE_ADVANCED); - request.getSession().setAttribute(CHOICE_TYPE_INSTRUCTIONS,CHOICE_TYPE_INSTRUCTIONS); - - - logger.debug("will render authoring screen"); - String strToolContentId=""; - strToolContentId=request.getParameter(TOOL_CONTENT_ID); - - /** - * Process incoming tool content id - * Either exists or not exists in the db yet, a toolContentId must be passed to the tool from the container - */ - long toolContentId=0; - try - { - toolContentId=new Long(strToolContentId).longValue(); - logger.debug("passed TOOL_CONTENT_ID : " + toolContentId); - request.getSession().setAttribute(TOOL_CONTENT_ID, new Long(strToolContentId)); - - } - catch(NumberFormatException e) - { - persistError(request,"error.numberFormatException"); - request.setAttribute(USER_EXCEPTION_NUMBERFORMAT, new Boolean(true)); - logger.debug("forwarding to: " + LOAD_QUESTIONS); - return (mapping.findForward(LOAD_QUESTIONS)); - } - - /** - * find out if the passed tool content id exists in the db - * present user either a first timer screen with default content data or fetch the existing content. - * - * if the toolcontentid does not exist in the db, create the default Map, - * there is no need to check if the content is in use in this case. - * It is always unlocked -> not in use since it is the default content. - */ - if (!existsContent(toolContentId, request)) - { - logger.debug("getting default content"); - contentId=mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE); - McContent mcContent=mcService.retrieveMc(new Long(contentId)); - logger.debug("mcContent:" + mcContent); - - /** reset all radioboxes to false*/ - mcAuthoringForm.resetRadioBoxes(); - logger.debug("all radioboxes arec reset"); - - - if (mcContent == null) - { - logger.debug("Exception occured: No default content"); - request.setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOT_AVAILABLE, new Boolean(true)); - persistError(request,"error.defaultContent.notAvailable"); - return (mapping.findForward(LOAD_QUESTIONS)); - } - - request.getSession().setAttribute(RICHTEXT_TITLE,mcContent.getTitle()); - request.getSession().setAttribute(RICHTEXT_INSTRUCTIONS,mcContent.getInstructions()); - request.getSession().setAttribute(QUESTIONS_SEQUENCED,new Boolean(mcContent.isQuestionsSequenced())); - request.getSession().setAttribute(USERNAME_VISIBLE,new Boolean(mcContent.isUsernameVisible())); - request.getSession().setAttribute(CREATED_BY, new Long(mcContent.getCreatedBy())); - request.getSession().setAttribute(MONITORING_REPORT_TITLE,mcContent.getMonitoringReportTitle()); - request.getSession().setAttribute(REPORT_TITLE,mcContent.getReportTitle()); - request.getSession().setAttribute(RUN_OFFLINE, new Boolean(mcContent.isRunOffline())); - request.getSession().setAttribute(DEFINE_LATER, new Boolean(mcContent.isDefineLater())); - request.getSession().setAttribute(SYNCH_IN_MONITOR, new Boolean(mcContent.isSynchInMonitor())); - request.getSession().setAttribute(OFFLINE_INSTRUCTIONS,mcContent.getOfflineInstructions()); - request.getSession().setAttribute(ONLINE_INSTRUCTIONS,mcContent.getOnlineInstructions()); - request.getSession().setAttribute(RICHTEXT_OFFLINEINSTRUCTIONS,mcContent.getOfflineInstructions()); - request.getSession().setAttribute(RICHTEXT_ONLINEINSTRUCTIONS,mcContent.getOnlineInstructions()); - request.getSession().setAttribute(END_LEARNING_MESSAGE,mcContent.getEndLearningMessage()); - request.getSession().setAttribute(CONTENT_IN_USE, new Boolean(mcContent.isContentInUse())); - request.getSession().setAttribute(RETRIES, new Boolean(mcContent.isRetries())); - request.getSession().setAttribute(PASSMARK, mcContent.getPassMark()); //Integer - request.getSession().setAttribute(SHOW_FEEDBACK, new Boolean(mcContent.isShowFeedback())); - request.getSession().setAttribute(RICHTEXT_REPORT_TITLE,mcContent.getReportTitle()); - request.getSession().setAttribute(RICHTEXT_END_LEARNING_MSG,mcContent.getEndLearningMessage()); - - McUtils.setDefaultSessionAttributes(request, mcContent, mcAuthoringForm); - - logger.debug("PASSMARK:" + request.getSession().getAttribute(PASSMARK)); - - logger.debug("RICHTEXT_TITLE:" + request.getSession().getAttribute(RICHTEXT_TITLE)); - logger.debug("getting default content"); - /** - * this is a new content creation, the content must not be in use. - * relevant attribute: CONTENT_IN_USE - */ - request.getSession().setAttribute(CONTENT_IN_USE, new Boolean(false)); - logger.debug("CONTENT_IN_USE: " + request.getSession().getAttribute(CONTENT_IN_USE)); - - /* this is already done in mcAuthoringForm.resetRadioBoxes()*/ - mcAuthoringForm.setUsernameVisible(OFF); - mcAuthoringForm.setQuestionsSequenced(OFF); - mcAuthoringForm.setSynchInMonitor(OFF); - mcAuthoringForm.setRetries(OFF); - mcAuthoringForm.setShowFeedback(OFF); - mcAuthoringForm.setSln(OFF); - logger.debug("sln set to OFF"); - - - /** collect options for the default question content into a Map*/ - McQueContent mcQueContent=mcService.getToolDefaultQuestionContent(mcContent.getUid().longValue()); - System.out.print("mcQueContent:" + mcQueContent); - if (mcQueContent == null) - { - logger.debug("Exception occured: No default question content"); - request.setAttribute(USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE, new Boolean(true)); - persistError(request,"error.defaultQuestionContent.notAvailable"); - return (mapping.findForward(LOAD_QUESTIONS)); - } - /** - * display a single sample question - */ - request.getSession().setAttribute(DEFAULT_QUESTION_CONTENT, mcQueContent.getQuestion()); - mapQuestionsContent.put(new Long(1).toString(), mcQueContent.getQuestion()); - request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent); - logger.debug("starter initialized the Questions Map: " + request.getSession().getAttribute(MAP_QUESTIONS_CONTENT)); - - - /** hold all he options for this question*/ - List list=mcService.findMcOptionsContentByQueId(mcQueContent.getUid()); - logger.debug("options list:" + list); - Iterator listIterator=list.iterator(); - Long mapIndex=new Long(1); - while (listIterator.hasNext()) - { - McOptsContent mcOptsContent=(McOptsContent)listIterator.next(); - logger.debug("option text:" + mcOptsContent.getMcQueOptionText()); - mapOptionsContent.put(mapIndex.toString(),mcOptsContent.getMcQueOptionText()); - mapIndex=new Long(mapIndex.longValue()+1); - } - request.getSession().setAttribute(MAP_OPTIONS_CONTENT, mapOptionsContent); - mapDefaultOptionsContent=mapOptionsContent; - request.getSession().setAttribute(MAP_DEFAULTOPTIONS_CONTENT, mapDefaultOptionsContent); - logger.debug("starter initialized the Options Map: " + request.getSession().getAttribute(MAP_OPTIONS_CONTENT)); - logger.debug("starter initialized the Default Options Map: " + request.getSession().getAttribute(MAP_DEFAULTOPTIONS_CONTENT)); - - /** reset all the weights to 0*/ - long mapCounter=0; - for (long i=1; i <= MAX_QUESTION_COUNT ; i++) - { - mapCounter++; - mapWeights.put(new Long(mapCounter).toString(), new Integer(0)); - } - request.getSession().setAttribute(MAP_WEIGHTS, mapWeights); - System.out.print("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS)); - - } - else - { - logger.debug("getting existing content with id:" + toolContentId); - McContent mcContent=mcService.retrieveMc(new Long(toolContentId)); - logger.debug("existing mcContent:" + mcContent); - - request.getSession().setAttribute(RICHTEXT_TITLE,mcContent.getTitle()); - request.getSession().setAttribute(RICHTEXT_INSTRUCTIONS,mcContent.getInstructions()); - request.getSession().setAttribute(QUESTIONS_SEQUENCED,new Boolean(mcContent.isQuestionsSequenced())); - request.getSession().setAttribute(USERNAME_VISIBLE,new Boolean(mcContent.isUsernameVisible())); - request.getSession().setAttribute(CREATED_BY, new Long(mcContent.getCreatedBy())); - request.getSession().setAttribute(MONITORING_REPORT_TITLE,mcContent.getMonitoringReportTitle()); - request.getSession().setAttribute(REPORT_TITLE,mcContent.getReportTitle()); - request.getSession().setAttribute(RUN_OFFLINE, new Boolean(mcContent.isRunOffline())); - request.getSession().setAttribute(DEFINE_LATER, new Boolean(mcContent.isDefineLater())); - request.getSession().setAttribute(SYNCH_IN_MONITOR, new Boolean(mcContent.isSynchInMonitor())); - request.getSession().setAttribute(OFFLINE_INSTRUCTIONS,mcContent.getOfflineInstructions()); - request.getSession().setAttribute(ONLINE_INSTRUCTIONS,mcContent.getOnlineInstructions()); - request.getSession().setAttribute(RICHTEXT_OFFLINEINSTRUCTIONS,mcContent.getOfflineInstructions()); - request.getSession().setAttribute(RICHTEXT_ONLINEINSTRUCTIONS,mcContent.getOnlineInstructions()); - request.getSession().setAttribute(END_LEARNING_MESSAGE,mcContent.getEndLearningMessage()); - request.getSession().setAttribute(CONTENT_IN_USE, new Boolean(mcContent.isContentInUse())); - request.getSession().setAttribute(RETRIES, new Boolean(mcContent.isRetries())); - request.getSession().setAttribute(PASSMARK, mcContent.getPassMark()); //Integer - request.getSession().setAttribute(SHOW_FEEDBACK, new Boolean(mcContent.isShowFeedback())); - - - McUtils.setDefaultSessionAttributes(request, mcContent, mcAuthoringForm); - logger.debug("RICHTEXT_TITLE:" + request.getSession().getAttribute(RICHTEXT_TITLE)); - - mcAuthoringForm.setPassmark((mcContent.getPassMark()).toString()); - logger.debug("PASSMARK:" + mcAuthoringForm.getPassmark()); - - logger.debug("getting name lists based on uid:" + mcContent.getUid()); - - List listUploadedOffFiles= mcService.retrieveMcUploadedOfflineFilesName(mcContent.getUid()); - logger.debug("existing listUploadedOfflineFileNames:" + listUploadedOffFiles); - request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILENAMES,listUploadedOffFiles); - - List listUploadedOnFiles= mcService.retrieveMcUploadedOnlineFilesName(mcContent.getUid()); - logger.debug("existing listUploadedOnlineFileNames:" + listUploadedOnFiles); - request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILENAMES,listUploadedOnFiles); - - List listUploadedOffFilesUuidPlusFilename= mcService.retrieveMcUploadedOfflineFilesUuidPlusFilename(mcContent.getUid()); - logger.debug("existing listUploadedOffFilesUuidPlusFilename:" + listUploadedOffFilesUuidPlusFilename); - request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILES,listUploadedOffFilesUuidPlusFilename); - - - if (mcContent.isUsernameVisible()) - { - mcAuthoringForm.setUsernameVisible(ON); - logger.debug("setting userNameVisible to true"); - } - else - { - mcAuthoringForm.setUsernameVisible(OFF); - logger.debug("setting userNameVisible to false"); - } - - - if (mcContent.isQuestionsSequenced()) - { - mcAuthoringForm.setQuestionsSequenced(ON); - logger.debug("setting questionsSequenced to true"); - } - else - { - mcAuthoringForm.setQuestionsSequenced(OFF); - logger.debug("setting questionsSequenced to false"); - } - - - if (mcContent.isSynchInMonitor()) - { - mcAuthoringForm.setSynchInMonitor(ON); - logger.debug("setting SynchInMonitor to true"); - } - else - { - mcAuthoringForm.setSynchInMonitor(OFF); - logger.debug("setting SynchInMonitor to false"); - } - - if (mcContent.isRetries()) - { - mcAuthoringForm.setRetries(ON); - logger.debug("setting retries to true"); - } - else - { - mcAuthoringForm.setRetries(OFF); - logger.debug("setting retries to false"); - } - - if (mcContent.isShowFeedback()) - { - mcAuthoringForm.setShowFeedback(ON); - logger.debug("setting showFeedback to false"); - } - else - { - mcAuthoringForm.setShowFeedback(OFF); - logger.debug("setting showFeedback to false"); - } - - McUtils.populateUploadedFilesData(request, mcContent); - logger.debug("populated UploadedFilesData"); - - AuthoringUtil authoringUtil = new AuthoringUtil(); - mapQuestionsContent=authoringUtil.rebuildQuestionMapfromDB(request, new Long(toolContentId)); - System.out.print("mapQuestionsContent:" + mapQuestionsContent); - - - request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent); - logger.debug("starter initialized the existing Questions Map: " + request.getSession().getAttribute(MAP_QUESTIONS_CONTENT)); - - mapWeights=authoringUtil.rebuildWeightsMapfromDB(request, new Long(toolContentId)); - System.out.print("mapWeights:" + mapWeights); - - /** set the mapWeights */ - Iterator itWeightsMap = mapWeights.entrySet().iterator(); - long mapWeightsCounter=0; - while (itWeightsMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itWeightsMap.next(); - if (pairs.getValue() != null) - { - System.out.print("the weight is:" + pairs.getValue()); - mapWeightsCounter++; - mapWeights.put(new Long(mapWeightsCounter).toString(), new Integer(pairs.getValue().toString())); - } - } - request.getSession().setAttribute(MAP_WEIGHTS, mapWeights); - System.out.print("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS)); - } - - mcAuthoringForm.resetUserAction(); - return (mapping.findForward(LOAD_QUESTIONS)); - } - - /** * existsContent(long toolContentId) * @param long toolContentId @@ -615,9 +294,6 @@ */ protected boolean existsContent(long toolContentId, HttpServletRequest request) { - /** - * retrive the service - */ IMcService mcService =McUtils.getToolService(request); McContent mcContent=mcService.retrieveMc(new Long(toolContentId)); if (mcContent == null) @@ -640,8 +316,352 @@ } + /** + * sets up ROOT_PATH and PATH_TO_LAMS attributes for presentation purposes + * setupPaths(HttpServletRequest request) + * @param request + */ + protected void setupPaths(HttpServletRequest request) + { + String protocol = request.getProtocol(); + if(protocol.startsWith("HTTPS")){ + protocol = "https://"; + }else{ + protocol = "http://"; + } + String root = protocol+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/"; + String pathToLams = protocol+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/../.."; + request.getSession().setAttribute(ROOT, root); + request.getSession().setAttribute(ROOT_PATH, root); + request.getSession().setAttribute(PATH_TO_LAMS, pathToLams); + + logger.debug("setting root to: " + request.getSession().getAttribute(ROOT)); + } + /** + * retrieves the contents of an existing content from the db and prepares it for presentation + * retrieveExistingContent(HttpServletRequest request, McAuthoringForm mcAuthoringForm, long toolContentId) + * + * @param request + * @param mcAuthoringForm + * @param toolContentId + */ + protected void retrieveExistingContent(HttpServletRequest request, McAuthoringForm mcAuthoringForm, long toolContentId) + { + IMcService mcService =McUtils.getToolService(request); + + logger.debug("getting existing content with id:" + toolContentId); + McContent mcContent=mcService.retrieveMc(new Long(toolContentId)); + logger.debug("existing mcContent:" + mcContent); + + request.getSession().setAttribute(RICHTEXT_TITLE,mcContent.getTitle()); + request.getSession().setAttribute(RICHTEXT_INSTRUCTIONS,mcContent.getInstructions()); + request.getSession().setAttribute(QUESTIONS_SEQUENCED,new Boolean(mcContent.isQuestionsSequenced())); + request.getSession().setAttribute(USERNAME_VISIBLE,new Boolean(mcContent.isUsernameVisible())); + request.getSession().setAttribute(CREATED_BY, new Long(mcContent.getCreatedBy())); + request.getSession().setAttribute(MONITORING_REPORT_TITLE,mcContent.getMonitoringReportTitle()); + request.getSession().setAttribute(REPORT_TITLE,mcContent.getReportTitle()); + request.getSession().setAttribute(RUN_OFFLINE, new Boolean(mcContent.isRunOffline())); + request.getSession().setAttribute(DEFINE_LATER, new Boolean(mcContent.isDefineLater())); + request.getSession().setAttribute(SYNCH_IN_MONITOR, new Boolean(mcContent.isSynchInMonitor())); + request.getSession().setAttribute(OFFLINE_INSTRUCTIONS,mcContent.getOfflineInstructions()); + request.getSession().setAttribute(ONLINE_INSTRUCTIONS,mcContent.getOnlineInstructions()); + request.getSession().setAttribute(RICHTEXT_OFFLINEINSTRUCTIONS,mcContent.getOfflineInstructions()); + request.getSession().setAttribute(RICHTEXT_ONLINEINSTRUCTIONS,mcContent.getOnlineInstructions()); + request.getSession().setAttribute(END_LEARNING_MESSAGE,mcContent.getEndLearningMessage()); + request.getSession().setAttribute(CONTENT_IN_USE, new Boolean(mcContent.isContentInUse())); + request.getSession().setAttribute(RETRIES, new Boolean(mcContent.isRetries())); + request.getSession().setAttribute(PASSMARK, mcContent.getPassMark()); //Integer + request.getSession().setAttribute(SHOW_FEEDBACK, new Boolean(mcContent.isShowFeedback())); + + McUtils.setDefaultSessionAttributes(request, mcContent, mcAuthoringForm); + logger.debug("RICHTEXT_TITLE:" + request.getSession().getAttribute(RICHTEXT_TITLE)); + + mcAuthoringForm.setPassmark((mcContent.getPassMark()).toString()); + logger.debug("PASSMARK:" + mcAuthoringForm.getPassmark()); + + logger.debug("getting name lists based on uid:" + mcContent.getUid()); + + List listUploadedOffFiles= mcService.retrieveMcUploadedOfflineFilesName(mcContent.getUid()); + logger.debug("existing listUploadedOfflineFileNames:" + listUploadedOffFiles); + request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILENAMES,listUploadedOffFiles); + + List listUploadedOnFiles= mcService.retrieveMcUploadedOnlineFilesName(mcContent.getUid()); + logger.debug("existing listUploadedOnlineFileNames:" + listUploadedOnFiles); + request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILENAMES,listUploadedOnFiles); + + List listUploadedOffFilesUuidPlusFilename= mcService.retrieveMcUploadedOfflineFilesUuidPlusFilename(mcContent.getUid()); + logger.debug("existing listUploadedOffFilesUuidPlusFilename:" + listUploadedOffFilesUuidPlusFilename); + request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILES,listUploadedOffFilesUuidPlusFilename); + + if (mcContent.isUsernameVisible()) + { + mcAuthoringForm.setUsernameVisible(ON); + logger.debug("setting userNameVisible to true"); + } + else + { + mcAuthoringForm.setUsernameVisible(OFF); + logger.debug("setting userNameVisible to false"); + } + + + if (mcContent.isQuestionsSequenced()) + { + mcAuthoringForm.setQuestionsSequenced(ON); + logger.debug("setting questionsSequenced to true"); + } + else + { + mcAuthoringForm.setQuestionsSequenced(OFF); + logger.debug("setting questionsSequenced to false"); + } + + if (mcContent.isSynchInMonitor()) + { + mcAuthoringForm.setSynchInMonitor(ON); + logger.debug("setting SynchInMonitor to true"); + } + else + { + mcAuthoringForm.setSynchInMonitor(OFF); + logger.debug("setting SynchInMonitor to false"); + } + + if (mcContent.isRetries()) + { + mcAuthoringForm.setRetries(ON); + logger.debug("setting retries to true"); + } + else + { + mcAuthoringForm.setRetries(OFF); + logger.debug("setting retries to false"); + } + + if (mcContent.isShowFeedback()) + { + mcAuthoringForm.setShowFeedback(ON); + logger.debug("setting showFeedback to false"); + } + else + { + mcAuthoringForm.setShowFeedback(OFF); + logger.debug("setting showFeedback to false"); + } + + McUtils.populateUploadedFilesData(request, mcContent); + logger.debug("populated UploadedFilesData"); + + AuthoringUtil authoringUtil = new AuthoringUtil(); + Map mapQuestionsContent=authoringUtil.rebuildQuestionMapfromDB(request, new Long(toolContentId)); + System.out.print("mapQuestionsContent:" + mapQuestionsContent); + + request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent); + logger.debug("starter initialized the existing Questions Map: " + request.getSession().getAttribute(MAP_QUESTIONS_CONTENT)); + + Map mapWeights=authoringUtil.rebuildWeightsMapfromDB(request, new Long(toolContentId)); + System.out.print("mapWeights:" + mapWeights); + + /*set the mapWeights */ + Iterator itWeightsMap = mapWeights.entrySet().iterator(); + long mapWeightsCounter=0; + while (itWeightsMap.hasNext()) { + Map.Entry pairs = (Map.Entry)itWeightsMap.next(); + if (pairs.getValue() != null) + { + System.out.print("the weight is:" + pairs.getValue()); + mapWeightsCounter++; + mapWeights.put(new Long(mapWeightsCounter).toString(), new Integer(pairs.getValue().toString())); + } + } + request.getSession().setAttribute(MAP_WEIGHTS, mapWeights); + System.out.print("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS)); + } + + + /** + * retrieves the contents of the default content from the db and prepares it for presentation + * retrieveDefaultContent(HttpServletRequest request, McAuthoringForm mcAuthoringForm) + * + * @param request + * @param mcAuthoringForm + */ + protected void retrieveDefaultContent(HttpServletRequest request, McAuthoringForm mcAuthoringForm) + { + IMcService mcService =McUtils.getToolService(request); + + long contentId=0; + logger.debug("getting default content"); + contentId=mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE); + McContent mcContent=mcService.retrieveMc(new Long(contentId)); + logger.debug("mcContent:" + mcContent); + + /* reset all radioboxes to false*/ + mcAuthoringForm.resetRadioBoxes(); + logger.debug("all radioboxes arec reset"); + + request.getSession().setAttribute(RICHTEXT_TITLE,mcContent.getTitle()); + request.getSession().setAttribute(RICHTEXT_INSTRUCTIONS,mcContent.getInstructions()); + request.getSession().setAttribute(QUESTIONS_SEQUENCED,new Boolean(mcContent.isQuestionsSequenced())); + request.getSession().setAttribute(USERNAME_VISIBLE,new Boolean(mcContent.isUsernameVisible())); + request.getSession().setAttribute(CREATED_BY, new Long(mcContent.getCreatedBy())); + request.getSession().setAttribute(MONITORING_REPORT_TITLE,mcContent.getMonitoringReportTitle()); + request.getSession().setAttribute(REPORT_TITLE,mcContent.getReportTitle()); + request.getSession().setAttribute(RUN_OFFLINE, new Boolean(mcContent.isRunOffline())); + request.getSession().setAttribute(DEFINE_LATER, new Boolean(mcContent.isDefineLater())); + request.getSession().setAttribute(SYNCH_IN_MONITOR, new Boolean(mcContent.isSynchInMonitor())); + request.getSession().setAttribute(OFFLINE_INSTRUCTIONS,mcContent.getOfflineInstructions()); + request.getSession().setAttribute(ONLINE_INSTRUCTIONS,mcContent.getOnlineInstructions()); + request.getSession().setAttribute(RICHTEXT_OFFLINEINSTRUCTIONS,mcContent.getOfflineInstructions()); + request.getSession().setAttribute(RICHTEXT_ONLINEINSTRUCTIONS,mcContent.getOnlineInstructions()); + request.getSession().setAttribute(END_LEARNING_MESSAGE,mcContent.getEndLearningMessage()); + request.getSession().setAttribute(CONTENT_IN_USE, new Boolean(mcContent.isContentInUse())); + request.getSession().setAttribute(RETRIES, new Boolean(mcContent.isRetries())); + request.getSession().setAttribute(PASSMARK, mcContent.getPassMark()); //Integer + request.getSession().setAttribute(SHOW_FEEDBACK, new Boolean(mcContent.isShowFeedback())); + request.getSession().setAttribute(RICHTEXT_REPORT_TITLE,mcContent.getReportTitle()); + request.getSession().setAttribute(RICHTEXT_END_LEARNING_MSG,mcContent.getEndLearningMessage()); + + McUtils.setDefaultSessionAttributes(request, mcContent, mcAuthoringForm); + + logger.debug("PASSMARK:" + request.getSession().getAttribute(PASSMARK)); + + logger.debug("RICHTEXT_TITLE:" + request.getSession().getAttribute(RICHTEXT_TITLE)); + logger.debug("getting default content"); + /* + * this is a new content creation, the content must not be in use. + * relevant attribute: CONTENT_IN_USE + */ + request.getSession().setAttribute(CONTENT_IN_USE, new Boolean(false)); + logger.debug("CONTENT_IN_USE: " + request.getSession().getAttribute(CONTENT_IN_USE)); + + /* this is already done in mcAuthoringForm.resetRadioBoxes()*/ + mcAuthoringForm.setUsernameVisible(OFF); + mcAuthoringForm.setQuestionsSequenced(OFF); + mcAuthoringForm.setSynchInMonitor(OFF); + mcAuthoringForm.setRetries(OFF); + mcAuthoringForm.setShowFeedback(OFF); + mcAuthoringForm.setSln(OFF); + logger.debug("sln set to OFF"); + + /* collect options for the default question content into a Map*/ + McQueContent mcQueContent=mcService.getToolDefaultQuestionContent(mcContent.getUid().longValue()); + System.out.print("mcQueContent:" + mcQueContent); + + /* mcQueContent can not be null since here it was verified before*/ + /* display a single sample question */ + request.getSession().setAttribute(DEFAULT_QUESTION_CONTENT, mcQueContent.getQuestion()); + + Map mapQuestionsContent= new TreeMap(new McComparator()); + mapQuestionsContent.put(new Long(1).toString(), mcQueContent.getQuestion()); + request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent); + logger.debug("starter initialized the Questions Map: " + request.getSession().getAttribute(MAP_QUESTIONS_CONTENT)); + + /* hold all he options for this question*/ + List list=mcService.findMcOptionsContentByQueId(mcQueContent.getUid()); + logger.debug("options list:" + list); + + Map mapOptionsContent= new TreeMap(new McComparator()); + Iterator listIterator=list.iterator(); + Long mapIndex=new Long(1); + while (listIterator.hasNext()) + { + McOptsContent mcOptsContent=(McOptsContent)listIterator.next(); + logger.debug("option text:" + mcOptsContent.getMcQueOptionText()); + mapOptionsContent.put(mapIndex.toString(),mcOptsContent.getMcQueOptionText()); + mapIndex=new Long(mapIndex.longValue()+1); + } + request.getSession().setAttribute(MAP_OPTIONS_CONTENT, mapOptionsContent); + Map mapDefaultOptionsContent=mapOptionsContent; + request.getSession().setAttribute(MAP_DEFAULTOPTIONS_CONTENT, mapDefaultOptionsContent); + logger.debug("starter initialized the Options Map: " + request.getSession().getAttribute(MAP_OPTIONS_CONTENT)); + logger.debug("starter initialized the Default Options Map: " + request.getSession().getAttribute(MAP_DEFAULTOPTIONS_CONTENT)); + + Map mapWeights= new TreeMap(new McComparator()); + /* reset all the weights to 0*/ + long mapCounter=0; + for (long i=1; i <= MAX_QUESTION_COUNT ; i++) + { + mapCounter++; + mapWeights.put(new Long(mapCounter).toString(), new Integer(0)); + } + request.getSession().setAttribute(MAP_WEIGHTS, mapWeights); + System.out.print("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS)); + } + + + /** + * initialisation + * initialiseAttributes(HttpServletRequest request) + * + * @param request + */ + protected void initialiseAttributes(HttpServletRequest request) + { + System.out.print("starting initialiseAttributes..."); + /* CURRENT_TAB == 1 defines Basic Tab + * CURRENT_TAB == 2 defines Avanced Tab + * CURRENT_TAB == 3 defines Instructions Tab + */ + request.getSession().setAttribute(CURRENT_TAB, new Long(1)); + request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); + + /* needs to run only once per tool*/ + /* McUtils.configureContentRepository(request, mcService); */ + + /* these two are for repository access */ + /* holds the final offline files list */ + LinkedList listUploadedOfflineFiles= new LinkedList(); + LinkedList listUploadedOnlineFiles= new LinkedList(); + + /* these two are for jsp */ + LinkedList listUploadedOfflineFileNames= new LinkedList(); + LinkedList listUploadedOnlineFileNames= new LinkedList(); + + request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILES,listUploadedOfflineFiles); + request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILENAMES,listUploadedOfflineFileNames); + + request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILES,listUploadedOnlineFiles); + request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILENAMES,listUploadedOnlineFileNames); + + Map mapQuestionsContent= new TreeMap(new McComparator()); + Map mapOptionsContent= new TreeMap(new McComparator()); + Map mapDefaultOptionsContent= new TreeMap(new McComparator()); + + Map mapGeneralOptionsContent= new TreeMap(new McComparator()); + request.getSession().setAttribute(MAP_GENERAL_OPTIONS_CONTENT, mapGeneralOptionsContent); + + Map mapGeneralSelectedOptionsContent= new TreeMap(new McComparator()); + request.getSession().setAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT, mapGeneralSelectedOptionsContent); + + Map mapDisabledQuestions= new TreeMap(new McComparator()); + request.getSession().setAttribute(MAP_DISABLED_QUESTIONS, mapDisabledQuestions); + + Map mapWeights= new TreeMap(new McComparator()); + request.getSession().setAttribute(MAP_WEIGHTS, mapWeights); + + Map mapCheckBoxStates= new TreeMap(new McComparator()); + mapCheckBoxStates.put("1" ,"INCORRECT"); + mapCheckBoxStates.put("2" ,"CORRECT"); + request.getSession().setAttribute(MAP_CHECKBOX_STATES, mapCheckBoxStates); + + Map mapSelectedOptions= new TreeMap(new McComparator()); + request.getSession().setAttribute(MAP_SELECTED_OPTIONS, mapSelectedOptions); + + Map mapFeedbackIncorrect= new TreeMap(new McComparator()); + request.getSession().setAttribute(MAP_FEEDBACK_INCORRECT, mapFeedbackIncorrect); + + Map mapFeedbackCorrect= new TreeMap(new McComparator()); + request.getSession().setAttribute(MAP_FEEDBACK_CORRECT, mapFeedbackCorrect); + + request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); + logger.debug("resetting EDIT_OPTIONS_MODE to 0"); + } + + + /** * persists error messages to request scope * @param request * @param message Index: lams_tool_lamc/web/WEB-INF/struts-config.xml =================================================================== diff -u -r91a0b9b037fb6c122cc88b7a20f78c826089dbdc -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 --- lams_tool_lamc/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 91a0b9b037fb6c122cc88b7a20f78c826089dbdc) +++ lams_tool_lamc/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7) @@ -50,6 +50,19 @@ path=".questions" redirect="true" /> + +- <%@ include file="errorbox.jsp" %> - | -
+ <%@ include file="errorbox.jsp" %> + | +
+ ![]() |