Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java,v
diff -u -r1.15 -r1.16
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java 19 Nov 2005 12:52:16 -0000 1.15
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java 25 Nov 2005 12:02:19 -0000 1.16
@@ -165,4 +165,14 @@
* @return
*/
public void removeMcQueContent(McQueContent mcQueContent);
+
+ /**
+ * *
used to get the next available display order
+ * with the given identifier mcContentId
+ *
+ * @param mcQueContent
+ * @return
+ */
+ public List getNextAvailableDisplayOrder(final long mcContentId);
+
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java,v
diff -u -r1.21 -r1.22
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java 19 Nov 2005 12:52:16 -0000 1.21
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java 25 Nov 2005 12:02:19 -0000 1.22
@@ -52,7 +52,7 @@
private static final String LOAD_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from mcQueContent in class McQueContent where mcQueContent.displayOrder=:displayOrder and mcQueContent.mcContentId=:mcContentUid";
-
+ private static final String GET_NEXT_AVAILABLE_DISPLAY_ORDER = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId";
public McQueContent getMcQueContentByUID(Long uid)
@@ -190,6 +190,7 @@
}
}
+
public void cleanAllQuestionsSimple(final Long mcContentUid)
{
HibernateTemplate templ = this.getHibernateTemplate();
@@ -209,7 +210,18 @@
}
}
}
+
+ public List getNextAvailableDisplayOrder(final long mcContentId)
+ {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(GET_NEXT_AVAILABLE_DISPLAY_ORDER)
+ .setLong("mcContentId", mcContentId)
+ .list();
+
+ return list;
+ }
+
public void saveMcQueContent(McQueContent mcQueContent)
{
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java,v
diff -u -r1.26 -r1.27
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java 22 Nov 2005 20:38:06 -0000 1.26
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java 25 Nov 2005 12:02:19 -0000 1.27
@@ -94,6 +94,8 @@
public List getPersistedSelectedOptions(Long mcQueContentId);
+ public void removeMcQueContentByUID(Long uid) throws McApplicationException;
+
public List getCorrectOption(Long mcQueContentId);
public List getAllQuestionEntries(final Long mcContentId) throws McApplicationException;
@@ -215,5 +217,7 @@
public int countSessionComplete() throws McApplicationException;
public int countSessionIncomplete() throws McApplicationException;
+
+ public List getNextAvailableDisplayOrder(final long mcContentId) throws McApplicationException;
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java,v
diff -u -r1.29 -r1.30
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java 22 Nov 2005 20:38:06 -0000 1.29
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java 25 Nov 2005 12:02:19 -0000 1.30
@@ -246,6 +246,21 @@
}
}
+
+ public List getNextAvailableDisplayOrder(final long mcContentId) throws McApplicationException
+ {
+ try
+ {
+ return mcQueContentDAO.getNextAvailableDisplayOrder(mcContentId);
+ }
+ catch (DataAccessException e)
+ {
+ throw new McApplicationException("Exception occured when lams is getting the next available display order: "
+ + e.getMessage(),
+ e);
+ }
+ }
+
public void createMcSession(McSession mcSession) throws McApplicationException
{
@@ -414,17 +429,32 @@
public List getAllQuestionEntries(final Long uid) throws McApplicationException
{
- try
- {
- return mcQueContentDAO.getAllQuestionEntries(uid.longValue());
- }
- catch (DataAccessException e)
- {
- throw new McApplicationException("Exception occured when lams is getting by uid mc question content: "
- + e.getMessage(),
- e);
- }
+ try
+ {
+ return mcQueContentDAO.getAllQuestionEntries(uid.longValue());
+ }
+ catch (DataAccessException e)
+ {
+ throw new McApplicationException("Exception occured when lams is getting by uid mc question content: "
+ + e.getMessage(),
+ e);
+ }
}
+
+
+ public void removeMcQueContentByUID(Long uid) throws McApplicationException
+ {
+ try
+ {
+ mcQueContentDAO.removeMcQueContentByUID(uid);
+ }
+ catch (DataAccessException e)
+ {
+ throw new McApplicationException("Exception occured when lams is removing by uid mc question content: "
+ + e.getMessage(),
+ e);
+ }
+ }
public List refreshQuestionContent(final Long mcContentId) throws McApplicationException
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java,v
diff -u -r1.10 -r1.11
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java 24 Nov 2005 11:59:12 -0000 1.10
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java 25 Nov 2005 12:02:19 -0000 1.11
@@ -17,6 +17,7 @@
import org.apache.log4j.Logger;
import org.lamsfoundation.lams.tool.exception.ToolException;
import org.lamsfoundation.lams.tool.mc.McAppConstants;
+import org.lamsfoundation.lams.tool.mc.McApplicationException;
import org.lamsfoundation.lams.tool.mc.McComparator;
import org.lamsfoundation.lams.tool.mc.McContent;
import org.lamsfoundation.lams.tool.mc.McOptsContent;
@@ -113,267 +114,264 @@
}
- public static Map repopulateCurrentCheckBoxStatesMap(HttpServletRequest request)
- {
- Map mapTempContent= new TreeMap(new McComparator());
-
- long mapCounter=0;
- for (long i=1; i <= MAX_OPTION_COUNT ; i++)
- {
- String candidateEntry =request.getParameter("checkBoxSelected" + i);
- String optionText =request.getParameter("optionContent" + i);
-
- if (
- (candidateEntry != null) &&
- (candidateEntry.length() > 0)
- )
+ public static Map repopulateCurrentCheckBoxStatesMap(HttpServletRequest request)
+ {
+ Map mapTempContent= new TreeMap(new McComparator());
+
+ long mapCounter=0;
+ for (long i=1; i <= MAX_OPTION_COUNT ; i++)
+ {
+ String candidateEntry =request.getParameter("checkBoxSelected" + i);
+ String optionText =request.getParameter("optionContent" + i);
+
+ if (
+ (candidateEntry != null) &&
+ (candidateEntry.length() > 0)
+ )
+ {
+ if (candidateEntry.equals("Correct"))
{
- if (candidateEntry.equals("Correct"))
- {
- mapCounter++;
- mapTempContent.put(new Long(mapCounter).toString(), optionText);
- }
+ mapCounter++;
+ mapTempContent.put(new Long(mapCounter).toString(), optionText);
}
- }
- logger.debug("return repopulated currentCheckBoxStatesMap: " + mapTempContent);
- return mapTempContent;
- }
+ }
+ }
+ logger.debug("return repopulated currentCheckBoxStatesMap: " + mapTempContent);
+ return mapTempContent;
+ }
- public static boolean verifyDuplicatesOptionsMap(Map mapOptionsContent)
+ public static boolean verifyDuplicatesOptionsMap(Map mapOptionsContent)
+ {
+ Map originalMapOptionsContent=mapOptionsContent;
+ Map backupMapOptionsContent=mapOptionsContent;
+
+ int optionCount=0;
+ for (long i=1; i <= MAX_OPTION_COUNT ; i++)
{
- Map originalMapOptionsContent=mapOptionsContent;
- Map backupMapOptionsContent=mapOptionsContent;
-
- int optionCount=0;
- for (long i=1; i <= MAX_OPTION_COUNT ; i++)
- {
- String currentOption=(String)originalMapOptionsContent.get(new Long(i).toString());
- logger.debug("verified currentOption " + currentOption);
-
- optionCount=0;
- for (long j=1; j <= MAX_OPTION_COUNT ; j++)
- {
- String backedOption=(String)backupMapOptionsContent.get(new Long(j).toString());
-
- if ((currentOption != null) && (backedOption !=null))
- {
- if (currentOption.equals(backedOption))
- {
- optionCount++;
- logger.debug("optionCount for " + currentOption + " is: " + optionCount);
- }
-
- if (optionCount > 1)
- return false;
- }
- }
- }
- return true;
+ String currentOption=(String)originalMapOptionsContent.get(new Long(i).toString());
+ logger.debug("verified currentOption " + currentOption);
+
+ optionCount=0;
+ for (long j=1; j <= MAX_OPTION_COUNT ; j++)
+ {
+ String backedOption=(String)backupMapOptionsContent.get(new Long(j).toString());
+
+ if ((currentOption != null) && (backedOption !=null))
+ {
+ if (currentOption.equals(backedOption))
+ {
+ optionCount++;
+ logger.debug("optionCount for " + currentOption + " is: " + optionCount);
+ }
+
+ if (optionCount > 1)
+ return false;
+ }
+ }
}
+ return true;
+ }
- public static boolean validateQuestionsNotEmpty(Map mapQuestionsContent)
- {
- Iterator itMap = mapQuestionsContent.entrySet().iterator();
- while (itMap.hasNext()) {
- Map.Entry pairs = (Map.Entry)itMap.next();
- logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue());
-
- if ((pairs.getValue() != null) && (pairs.getValue().toString().length() == 0))
- return false;
-
- }
- return true;
- }
+ public static boolean validateQuestionsNotEmpty(Map mapQuestionsContent)
+ {
+ Iterator itMap = mapQuestionsContent.entrySet().iterator();
+ while (itMap.hasNext()) {
+ Map.Entry pairs = (Map.Entry)itMap.next();
+ logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue());
+
+ if ((pairs.getValue() != null) && (pairs.getValue().toString().length() == 0))
+ return false;
+
+ }
+ return true;
+ }
- public static Map repopulateCurrentWeightsMap(HttpServletRequest request, String parameterType)
- {
- Map mapTempQuestionsContent= new TreeMap(new McComparator());
- logger.debug("parameterType: " + parameterType);
-
- long mapCounter=0;
- for (long i=1; i <= MAX_QUESTION_COUNT ; i++)
+
+ public static Map repopulateCurrentWeightsMap(HttpServletRequest request, String parameterType)
+ {
+ Map mapTempQuestionsContent= new TreeMap(new McComparator());
+ logger.debug("parameterType: " + parameterType);
+
+ long mapCounter=0;
+ for (long i=1; i <= MAX_QUESTION_COUNT ; i++)
+ {
+ String candidateEntry =request.getParameter(parameterType + i);
+ String questionText =request.getParameter("questionContent" + i);
+ if ((questionText != null) && (questionText.length() > 0))
{
- String candidateEntry =request.getParameter(parameterType + i);
- String questionText =request.getParameter("questionContent" + i);
- if ((questionText != null) && (questionText.length() > 0))
+ logger.debug("questionText: " + questionText);
+ if (candidateEntry != null)
{
- logger.debug("questionText: " + questionText);
- if (candidateEntry != null)
- {
- mapCounter++;
- mapTempQuestionsContent.put(new Long(mapCounter).toString(), candidateEntry);
- }
- }
-
+ mapCounter++;
+ mapTempQuestionsContent.put(new Long(mapCounter).toString(), candidateEntry);
+ }
}
- logger.debug("return repopulated Map: " + mapTempQuestionsContent);
- return mapTempQuestionsContent;
- }
+ }
+ logger.debug("return repopulated Map: " + mapTempQuestionsContent);
+ return mapTempQuestionsContent;
+ }
- /**
- * shrinks the size of the Map to only used entries
- *
- * @param mapQuestionContent
- * @param request
- * @return
- */
- public static Map repopulateMap(HttpServletRequest request, String parameterType)
- {
- Map mapTempQuestionsContent= new TreeMap(new McComparator());
- logger.debug("parameterType: " + parameterType);
-
- long mapCounter=0;
- for (long i=1; i <= MAX_QUESTION_COUNT ; i++)
+ /**
+ * shrinks the size of the Map to only used entries
+ *
+ * @param mapQuestionContent
+ * @param request
+ * @return
+ */
+ public static Map repopulateMap(HttpServletRequest request, String parameterType)
+ {
+ Map mapTempQuestionsContent= new TreeMap(new McComparator());
+ logger.debug("parameterType: " + parameterType);
+
+ long mapCounter=0;
+ for (long i=1; i <= MAX_QUESTION_COUNT ; i++)
+ {
+ String candidateEntry =request.getParameter(parameterType + i);
+ if (
+ (candidateEntry != null) &&
+ (candidateEntry.length() > 0)
+ )
{
- String candidateEntry =request.getParameter(parameterType + i);
- if (
- (candidateEntry != null) &&
- (candidateEntry.length() > 0)
- )
- {
- mapCounter++;
- mapTempQuestionsContent.put(new Long(mapCounter).toString(), candidateEntry);
- }
+ mapCounter++;
+ mapTempQuestionsContent.put(new Long(mapCounter).toString(), candidateEntry);
}
- logger.debug("return repopulated Map: " + mapTempQuestionsContent);
- return mapTempQuestionsContent;
- }
+ }
+ logger.debug("return repopulated Map: " + mapTempQuestionsContent);
+ return mapTempQuestionsContent;
+ }
- public static Map shiftMap(Map mapQuestionsContent, String questionIndex , String movableQuestionEntry, String direction)
- {
- logger.debug("movableQuestionEntry: " + movableQuestionEntry);
- /* map to be returned */
- Map mapTempQuestionsContent= new TreeMap(new McComparator());
-
- Iterator itMap = mapQuestionsContent.entrySet().iterator();
- String shiftableEntry=null;
-
- int shiftableIndex=0;
- if (direction.equals("down"))
- {
- logger.debug("moving map down");
- shiftableIndex=new Integer(questionIndex).intValue() + 1;
- }
- else
- {
- logger.debug("moving map up");
- shiftableIndex=new Integer(questionIndex).intValue() - 1;
-
- }
-
- 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);
- }
- }
- }
- else
- {
- logger.debug("no change to map");
- mapTempQuestionsContent=mapQuestionsContent;
- }
- return mapTempQuestionsContent;
- }
+ public static Map shiftMap(Map mapQuestionsContent, String questionIndex , String movableQuestionEntry, String direction)
+ {
+ logger.debug("movableQuestionEntry: " + movableQuestionEntry);
+ /* map to be returned */
+ Map mapTempQuestionsContent= new TreeMap(new McComparator());
+
+ Iterator itMap = mapQuestionsContent.entrySet().iterator();
+ String shiftableEntry=null;
+
+ int shiftableIndex=0;
+ if (direction.equals("down"))
+ {
+ logger.debug("moving map down");
+ shiftableIndex=new Integer(questionIndex).intValue() + 1;
+ }
+ else
+ {
+ logger.debug("moving map up");
+ shiftableIndex=new Integer(questionIndex).intValue() - 1;
+ }
+
+ 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);
+ }
+ }
+ }
+ else
+ {
+ logger.debug("no change to map");
+ mapTempQuestionsContent=mapQuestionsContent;
+ }
+ return mapTempQuestionsContent;
+ }
- public static boolean validateTotalWeight(HttpServletRequest request)
- {
- Map mapWeights= repopulateCurrentWeightsMap(request, "questionWeight");
- logger.debug("mapWeights: " + mapWeights);
-
- Iterator itMap = mapWeights.entrySet().iterator();
- int totalWeight=0;
- while (itMap.hasNext()) {
- Map.Entry pairs = (Map.Entry)itMap.next();
- logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue());
-
- if ((pairs.getValue() != null) || (pairs.getValue().toString().length() > 0))
- {
- totalWeight=totalWeight+ new Integer(pairs.getValue().toString()).intValue();
- }
- }
+ public static boolean validateTotalWeight(HttpServletRequest request)
+ {
+ Map mapWeights= repopulateCurrentWeightsMap(request, "questionWeight");
+ logger.debug("mapWeights: " + mapWeights);
+
+ Iterator itMap = mapWeights.entrySet().iterator();
+ int totalWeight=0;
+ while (itMap.hasNext()) {
+ Map.Entry pairs = (Map.Entry)itMap.next();
+ logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue());
+
+ if ((pairs.getValue() != null) || (pairs.getValue().toString().length() > 0))
+ {
+ totalWeight=totalWeight+ new Integer(pairs.getValue().toString()).intValue();
+ }
+ }
- logger.debug("totalWeight: " + totalWeight);
-
- if (totalWeight != 100)
- {
- return false;
- }
+ logger.debug("totalWeight: " + totalWeight);
+ if (totalWeight != 100)
+ {
+ return false;
+ }
+ return true;
+ }
- return true;
- }
-
- public static boolean validateSubTotalWeights(HttpServletRequest request, McAuthoringForm mcAuthoringForm)
- {
- Map mapWeights= repopulateCurrentWeightsMap(request, "questionWeight");
- logger.debug("mapWeights: " + mapWeights);
-
- int totalWeight=0;
- Iterator itMap = mapWeights.entrySet().iterator();
- while (itMap.hasNext()) {
- Map.Entry pairs = (Map.Entry)itMap.next();
- logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue());
-
- int currentWeight=new Integer(pairs.getValue().toString()).intValue();
- totalWeight= totalWeight + currentWeight;
- logger.debug("sub totalWeight: " + totalWeight);
- }
- logger.debug("final totalWeight: " + totalWeight);
-
- if (totalWeight > 100)
- return false;
- else
- return true;
- }
+ public static boolean validateSubTotalWeights(HttpServletRequest request, McAuthoringForm mcAuthoringForm)
+ {
+ Map mapWeights= repopulateCurrentWeightsMap(request, "questionWeight");
+ logger.debug("mapWeights: " + mapWeights);
+
+ int totalWeight=0;
+ Iterator itMap = mapWeights.entrySet().iterator();
+ while (itMap.hasNext()) {
+ Map.Entry pairs = (Map.Entry)itMap.next();
+ logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue());
+
+ int currentWeight=new Integer(pairs.getValue().toString()).intValue();
+ totalWeight= totalWeight + currentWeight;
+ logger.debug("sub totalWeight: " + totalWeight);
+ }
+ logger.debug("final totalWeight: " + totalWeight);
+
+ if (totalWeight > 100)
+ return false;
+ else
+ return true;
+ }
- public static boolean validateOptions(HttpServletRequest request)
- {
- logger.debug("will validateOptions");
- String parameterType="checkBoxSelected";
- for (int i=1; i <= MAX_OPTION_COUNT ; i++)
- {
- String isCorrect=request.getParameter(parameterType + i);
- logger.debug("isCorrect: " + isCorrect);
-
- if (isCorrect != null)
- {
- if (isCorrect.equals("Correct"))
- return true;
- }
- }
- return false;
- }
+ public static boolean validateOptions(HttpServletRequest request)
+ {
+ logger.debug("will validateOptions");
+ String parameterType="checkBoxSelected";
+ for (int i=1; i <= MAX_OPTION_COUNT ; i++)
+ {
+ String isCorrect=request.getParameter(parameterType + i);
+ logger.debug("isCorrect: " + isCorrect);
+
+ if (isCorrect != null)
+ {
+ if (isCorrect.equals("Correct"))
+ return true;
+ }
+ }
+ return false;
+ }
public static Map rebuildQuestionMapfromDB(HttpServletRequest request, Long toolContentId)
@@ -432,8 +430,6 @@
}
-
-
/**
* returns all the options for all the questions for a content
* generateGeneralOptionsContentMap(HttpServletRequest request, McContent mcContent)
@@ -470,7 +466,7 @@
}
- public Map rebuildWeightsMapfromDB(HttpServletRequest request, Long toolContentId)
+ public static Map rebuildWeightsMapfromDB(HttpServletRequest request, Long toolContentId)
{
Map mapWeightsContent= new TreeMap(new McComparator());
@@ -489,7 +485,7 @@
{
McQueContent mcQueContent=(McQueContent)listIterator.next();
logger.debug("mcQueContent:" + mcQueContent);
- mapWeightsContent.put(mapIndex.toString(),mcQueContent.getWeight());
+ mapWeightsContent.put(mapIndex.toString(),mcQueContent.getWeight().toString());
mapIndex=new Long(mapIndex.longValue()+1);
}
@@ -518,7 +514,6 @@
mapIncorrectFeedback.put(mapIndex.toString(),mcQueContent.getFeedbackIncorrect());
mapIndex=new Long(mapIndex.longValue()+1);
}
-
return mapIncorrectFeedback;
}
@@ -543,7 +538,6 @@
mapCorrectFeedback.put(mapIndex.toString(),mcQueContent.getFeedbackCorrect());
mapIndex=new Long(mapIndex.longValue()+1);
}
-
return mapCorrectFeedback;
}
@@ -560,13 +554,10 @@
public static void persistOptionsFinal(HttpServletRequest request, Map currentOptions, Map selectedOptions, McQueContent mcQueContent)
{
IMcService mcService =McUtils.getToolService(request);
-
logger.debug("passed currentOptions: " + currentOptions);
logger.debug("passed selectedOptions: " + selectedOptions);
Iterator itCurrentOptions = currentOptions.entrySet().iterator();
-
-
boolean selected=false;
while (itCurrentOptions.hasNext())
{
@@ -612,7 +603,6 @@
public static void persistOptions(HttpServletRequest request, Map mapGeneralOptionsContent, Map mapGeneralSelectedOptionsContent, McQueContent mcQueContent, String questionIndex)
{
IMcService mcService =McUtils.getToolService(request);
-
logger.debug("passed questionIndex: " + questionIndex);
Iterator itOptionsMap = mapGeneralOptionsContent.entrySet().iterator();
@@ -652,6 +642,7 @@
*/
public static McContent createContent(HttpServletRequest request, McAuthoringForm mcAuthoringForm)
{
+ logger.debug("called createContent");
IMcService mcService =McUtils.getToolService(request);
/* the tool content id is passed from the container to the tool and placed into session in the McStarterAction */
@@ -702,7 +693,6 @@
if (mcAuthoringForm.getRetries().equalsIgnoreCase(ON))
isRetries=true;
-
logger.debug("isSln" + mcAuthoringForm.getSln());
if (mcAuthoringForm.getSln().equalsIgnoreCase(ON))
isSln=true;
@@ -817,8 +807,184 @@
logger.debug("remove questions by mcQueContent uid : " + mcContent.getUid());
mcService.cleanAllQuestionsSimple(mcContent.getUid());
}
+
+ public static void cleanupRedundantQuestions(HttpServletRequest request, List existingQuestions, Map mapQuestionsContent, McContent mcContent)
+ {
+ logger.debug("will cleanupRedundantQuestions... ");
+ IMcService mcService =McUtils.getToolService(request);
+
+ /*remove ununsed question entries from the db */
+ boolean questionFound=false;
+ Iterator itExistingQuestions = existingQuestions.iterator();
+ while (itExistingQuestions.hasNext())
+ {
+ McQueContent mcQueContent=(McQueContent)itExistingQuestions.next();
+ logger.debug("mcQueContent:" + mcQueContent);
+
+ Iterator itNewQuestionsMap = mapQuestionsContent.entrySet().iterator();
+ questionFound=false;
+ while (itNewQuestionsMap.hasNext())
+ {
+ Map.Entry pairs = (Map.Entry)itNewQuestionsMap.next();
+ logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue());
+ logger.debug("mcQueContent.getQuestion(): " + mcQueContent.getQuestion() + "--" + pairs.getValue());
+
+ if (mcQueContent.getQuestion().equals(pairs.getValue().toString()))
+ {
+ logger.debug("equals mcQueContent.getQuestion(): " + mcQueContent.getQuestion() + "--" + pairs.getValue());
+ questionFound=true;
+ break;
+ }
+ }
+
+ if (questionFound == false)
+ {
+ String deletableQuestion=mcQueContent.getQuestion();
+ logger.debug("found is false, delete this question " + deletableQuestion);
+ mcQueContent=mcService.getQuestionContentByQuestionText(deletableQuestion, mcContent.getUid());
+ logger.debug("found is false, delete this question " + mcQueContent);
+ if (mcQueContent != null)
+ {
+ mcService.removeMcQueContent(mcQueContent);
+ logger.debug("removed mcQueContent from the db: " + mcQueContent);
+ }
+ }
+ }
+ }
+
+ public static void selectAndPersistQuestions(HttpServletRequest request, List existingQuestions, Map mapQuestionsContent, Map mapFeedbackIncorrect, Map mapFeedbackCorrect, McContent mcContent)
+ {
+ IMcService mcService =McUtils.getToolService(request);
+
+ Iterator itQuestionsMap = mapQuestionsContent.entrySet().iterator();
+ boolean questionContentFound=false;
+ while (itQuestionsMap.hasNext())
+ {
+ Map.Entry pairs = (Map.Entry)itQuestionsMap.next();
+ logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue());
+
+ questionContentFound = false;
+ String displayOrder="1";
+ McQueContent mcQueContent=null;
+ Iterator itExistingQuestions = existingQuestions.iterator();
+ while (itExistingQuestions.hasNext())
+ {
+ mcQueContent=(McQueContent)itExistingQuestions.next();
+ logger.debug("mcQueContent:" + mcQueContent);
+
+ if (mcQueContent.getQuestion().equals(pairs.getValue()))
+ {
+ logger.debug("existing mcQueContent found :" + mcQueContent);
+ questionContentFound=true;
+ displayOrder=pairs.getKey().toString();
+ logger.debug("new display order for " + mcQueContent.getQuestion()+ " will be: " + displayOrder);
+ break;
+ }
+ }
+
+ if (questionContentFound == true)
+ {
+ logger.debug("questionContentFound is true: " + mcQueContent);
+ updateExistingQuestionContent(request,mapFeedbackIncorrect, mapFeedbackCorrect, mcQueContent, displayOrder);
+ }
+ else
+ {
+ logger.debug("questionContentFound is false: " + mcQueContent);
+ createQuestionContent(request,mapQuestionsContent, mapFeedbackIncorrect, mapFeedbackCorrect, pairs.getValue().toString(), mcContent);
+ }
+ }
+ }
+
+
+ public static void updateExistingQuestionContent(HttpServletRequest request, Map mapFeedbackIncorrect, Map mapFeedbackCorrect, McQueContent mcQueContent, String displayOrder)
+ {
+ logger.debug("using updateExisitingQuestionContent: " + mcQueContent);
+ logger.debug("using displayOrder: " + displayOrder);
+
+ Map mapWeights= (Map)request.getSession().getAttribute(MAP_WEIGHTS);
+ logger.debug("MAP_WEIGHTS:" + mapWeights);
+
+ String incorrectFeedback=(String)mapFeedbackIncorrect.get(displayOrder);
+ logger.debug("new incorrectFeedback will be :" + incorrectFeedback);
+ String correctFeedback=(String)mapFeedbackCorrect.get(displayOrder);
+ logger.debug("new correctFeedback will be :" + correctFeedback);
+
+ String weight=(String)mapWeights.get(displayOrder);
+ logger.debug("new weight will be:" + weight);
+
+ IMcService mcService =McUtils.getToolService(request);
+ mcQueContent.setDisplayOrder(new Integer(displayOrder));
+ mcQueContent.setDisabled(false);
+ mcQueContent.setWeight(new Integer(weight));
+
+ if ((incorrectFeedback != null) && !(incorrectFeedback.equals("")))
+ mcQueContent.setFeedbackIncorrect(incorrectFeedback);
+
+ if ((correctFeedback != null) && !(correctFeedback.equals("")))
+ mcQueContent.setFeedbackCorrect(correctFeedback);
+
+ mcService.saveOrUpdateMcQueContent(mcQueContent);
+ logger.debug("updated mcQueContent in the db: " + mcQueContent);
+ }
+
+
+ public static void createQuestionContent(HttpServletRequest request, Map mapQuestionsContent, Map mapFeedbackIncorrect, Map mapFeedbackCorrect, String question, McContent mcContent)
+ {
+ logger.debug("using createQuestionContent with question: " + question);
+ IMcService mcService =McUtils.getToolService(request);
+
+ int displayOrder= getNewDisplayOrder(mapQuestionsContent, question);
+ logger.debug("displayOrder: " + displayOrder);
+
+ Map mapWeights= (Map)request.getSession().getAttribute(MAP_WEIGHTS);
+ logger.debug("MAP_WEIGHTS: " + MAP_WEIGHTS);
+
+ String weight=(String)mapWeights.get(new Integer(displayOrder).toString());
+ logger.debug("new weight will be:" + weight);
+
+ String incorrectFeedback=(String)mapFeedbackIncorrect.get(new Integer(displayOrder).toString());
+ logger.debug("new incorrectFeedback will be :" + incorrectFeedback);
+
+ String correctFeedback=(String)mapFeedbackCorrect.get(new Integer(displayOrder).toString());
+ logger.debug("new correctFeedback will be :" + correctFeedback);
+
+ McQueContent mcQueContent= new McQueContent(question,
+ new Integer(displayOrder),
+ new Integer(weight),
+ false,
+ incorrectFeedback,
+ correctFeedback,
+ mcContent,
+ new HashSet(),
+ new HashSet()
+ );
+
+ mcService.saveOrUpdateMcQueContent(mcQueContent);
+ logger.debug("created a new mcQueContent in the db: " + mcQueContent);
+ }
+
+
+ public static int getNewDisplayOrder(Map mapQuestionsContent, String question)
+ {
+ Iterator itQuestionsMap = mapQuestionsContent.entrySet().iterator();
+ int displayOrder=0;
+ while (itQuestionsMap.hasNext())
+ {
+ Map.Entry pairs = (Map.Entry)itQuestionsMap.next();
+ logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue());
+ if (pairs.getValue().equals(question))
+ {
+ logger.debug("question found:" + question);
+ displayOrder=new Integer(pairs.getKey().toString()).intValue();
+ logger.debug("displayOrder:" + displayOrder);
+ }
+ }
+ return displayOrder;
+ }
+
+
/**
* creates the questions from the user in the db and makes a call to persist options.
* persistQuestions(HttpServletRequest request, Map mapQuestionsContent, Map mapFeedbackIncorrect, Map mapFeedbackCorrect, McContent mcContent)
@@ -836,18 +1002,16 @@
logger.debug("mapFeedbackIncorrect :" + mapFeedbackIncorrect);
logger.debug("mapFeedbackCorrect :" + mapFeedbackCorrect);
-
- Map mapGeneralOptionsContent=(Map)request.getSession().getAttribute(MAP_GENERAL_OPTIONS_CONTENT);
+ Map mapGeneralOptionsContent=(Map)request.getSession().getAttribute(MAP_GENERAL_OPTIONS_CONTENT);
logger.debug("final MAP_GENERAL_OPTIONS_CONTENT :" + mapGeneralOptionsContent);
Map mapGeneralSelectedOptionsContent=(Map)request.getSession().getAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT);
logger.debug("final MAP_GENERAL_SELECTED_OPTIONS_CONTENT :" + mapGeneralSelectedOptionsContent);
Map mapWeights= AuthoringUtil.repopulateMap(request, "questionWeight");
request.getSession().setAttribute(MAP_WEIGHTS, mapWeights);
- System.out.print("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS));
+ logger.debug("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS));
-
Iterator itQuestionsMap = mapQuestionsContent.entrySet().iterator();
while (itQuestionsMap.hasNext()) {
Map.Entry pairs = (Map.Entry)itQuestionsMap.next();
@@ -893,7 +1057,6 @@
}
}
}
-
}
@@ -916,7 +1079,6 @@
request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent);
logger.debug("updated Questions Map: " + request.getSession().getAttribute(MAP_QUESTIONS_CONTENT));
-
Map mapWeights = (Map) request.getSession().getAttribute(MAP_WEIGHTS);
logger.debug("current mapWeights: " + mapWeights);
int mapWeightsSize=mapWeights.size();
@@ -928,17 +1090,37 @@
}
+ public static int getNextAvailableDisplayOrder(HttpServletRequest request, Long mcContentId)
+ {
+ IMcService mcService =McUtils.getToolService(request);
+ List listDisplayOrder=mcService.getNextAvailableDisplayOrder(mcContentId.longValue());
+
+ Iterator itListDisplayOrder = listDisplayOrder.iterator();
+ int maxDisplayOrder=1;
+ while (itListDisplayOrder.hasNext())
+ {
+ McQueContent mcQueContent=(McQueContent)itListDisplayOrder.next();
+ logger.debug("mcQueContent:" + mcQueContent);
+ int currentDisplayOrder=mcQueContent.getDisplayOrder().intValue();
+ if (currentDisplayOrder > maxDisplayOrder)
+ maxDisplayOrder = currentDisplayOrder;
+ }
+ logger.debug("current biggest displayOrder is: " + maxDisplayOrder);
+ return maxDisplayOrder+1;
+
+ }
+
public void simulatePropertyInspector_RunOffline(HttpServletRequest request)
{
- IMcService qaService =McUtils.getToolService(request);
+ IMcService mcService =McUtils.getToolService(request);
String toolContentId=(String)request.getSession().getAttribute(TOOL_CONTENT_ID);
if ((toolContentId != null) && (!toolContentId.equals("")))
{
logger.debug("passed TOOL_CONTENT_ID : " + new Long(toolContentId));
try
{
- qaService.setAsRunOffline(new Long(toolContentId));
+ mcService.setAsRunOffline(new Long(toolContentId));
}
catch(ToolException e)
{
@@ -957,15 +1139,15 @@
*/
public void simulatePropertyInspector_setAsDefineLater(HttpServletRequest request)
{
- IMcService qaService =McUtils.getToolService(request);
+ IMcService mcService =McUtils.getToolService(request);
String toolContentId=(String)request.getSession().getAttribute(TOOL_CONTENT_ID);
if ((toolContentId != null) && (!toolContentId.equals("")))
{
logger.debug("passed TOOL_CONTENT_ID : " + new Long(toolContentId));
try
{
- qaService.setAsDefineLater(new Long(toolContentId));
+ mcService.setAsDefineLater(new Long(toolContentId));
}
catch(ToolException e)
{
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java,v
diff -u -r1.9 -r1.10
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java 22 Nov 2005 20:38:06 -0000 1.9
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java 25 Nov 2005 12:02:19 -0000 1.10
@@ -199,7 +199,6 @@
mcLearningForm.setOptionValue(optionValue);
}
-
String checked=request.getParameter("checked");
logger.debug("parameter checked: " + checked);
if (checked != null)
@@ -524,8 +523,6 @@
}
-
-
public static boolean optionExists(String optionValue, Map generalMap)
{
Iterator itMap = generalMap.entrySet().iterator();
@@ -592,7 +589,6 @@
}
-
/**
* creates a user attempt in the db
* createAttempt(HttpServletRequest request)
@@ -613,7 +609,6 @@
while (itCheckedMap.hasNext())
{
Map.Entry checkedPairs = (Map.Entry)itCheckedMap.next();
-
Map mapCheckedOptions=(Map) checkedPairs.getValue();
Long questionDisplayOrder=new Long(checkedPairs.getKey().toString());
@@ -662,8 +657,6 @@
mapWeights.put(mapIndex.toString(),mcQueContent.getWeight().toString());
mapIndex=new Long(mapIndex.longValue()+1);
}
-
return mapWeights;
}
-
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java,v
diff -u -r1.67 -r1.68
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java 24 Nov 2005 13:56:02 -0000 1.67
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java 25 Nov 2005 12:02:19 -0000 1.68
@@ -41,6 +41,7 @@
import org.apache.struts.action.ActionMessages;
import org.apache.struts.actions.DispatchAction;
import org.lamsfoundation.lams.tool.mc.McAppConstants;
+import org.lamsfoundation.lams.tool.mc.McApplicationException;
import org.lamsfoundation.lams.tool.mc.McComparator;
import org.lamsfoundation.lams.tool.mc.McContent;
import org.lamsfoundation.lams.tool.mc.McOptsContent;
@@ -282,7 +283,10 @@
}
logger.debug("will validate weights");
- boolean weightsValid=validateQuestionWeights(request,mcAuthoringForm);
+ Map mapWeights= AuthoringUtil.repopulateCurrentWeightsMap(request, "questionWeight");
+ logger.debug("mapWeights: " + mapWeights);
+
+ boolean weightsValid=validateQuestionWeights(request,mapWeights, mcAuthoringForm);
logger.debug("weightsValid:" + weightsValid);
if (weightsValid == false)
{
@@ -310,7 +314,6 @@
mcAuthoringForm.resetUserAction();
persistError(request,"error.question.weight.total");
-
int maxQuestionIndex=mapQuestionsContent.size();
request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex));
logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX));
@@ -319,11 +322,8 @@
mcAuthoringForm.setSubmitQuestions(null);
return (mapping.findForward(LOAD_QUESTIONS));
}
-
-
- Map mapWeights= AuthoringUtil.repopulateMap(request, "questionWeight");
request.getSession().setAttribute(MAP_WEIGHTS, mapWeights);
- System.out.print("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS));
+ logger.debug("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS));
AuthoringUtil.addQuestionMemory(request, mcAuthoringForm, mapQuestionsContent, true);
logger.debug("after addQuestionMemory");
@@ -371,7 +371,7 @@
Map mapWeights= AuthoringUtil.repopulateMap(request, "questionWeight");
request.getSession().setAttribute(MAP_WEIGHTS, mapWeights);
- System.out.print("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS));
+ logger.debug("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS));
Map mapQuestionsContent=AuthoringUtil.repopulateMap(request, "questionContent");
logger.debug("mapQuestionsContent after shrinking: " + mapQuestionsContent);
@@ -448,7 +448,7 @@
Map mapWeights= AuthoringUtil.repopulateMap(request, "questionWeight");
request.getSession().setAttribute(MAP_WEIGHTS, mapWeights);
- System.out.print("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS));
+ logger.debug("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS));
String questionIndex =mcAuthoringForm.getQuestionIndex();
logger.debug("questionIndex:" + questionIndex);
@@ -1190,7 +1190,9 @@
return (mapping.findForward(LOAD_QUESTIONS));
}
- boolean weightsValid=validateQuestionWeights(request,mcAuthoringForm);
+ Map mapWeights= AuthoringUtil.repopulateCurrentWeightsMap(request, "questionWeight");
+ logger.debug("mapWeights: " + mapWeights);
+ boolean weightsValid=validateQuestionWeights(request,mapWeights, mcAuthoringForm);
logger.debug("weightsValid:" + weightsValid);
if (weightsValid == false)
{
@@ -1226,6 +1228,8 @@
mcAuthoringForm.setSubmitQuestions(null);
return (mapping.findForward(LOAD_QUESTIONS));
}
+ logger.debug("MAP_WEIGHTS is valid, persist it to session");
+ request.getSession().setAttribute(MAP_WEIGHTS, mapWeights);
boolean isQuestionsSequenced=false;
boolean isSynchInMonitor=false;
@@ -1395,7 +1399,7 @@
logger.debug("toolContentId:" + toolContentId);
McContent mcContent=mcService.retrieveMc(toolContentId);
- logger.debug("mcContent:" + mcContent);
+ logger.debug("existing mcContent:" + mcContent);
if (mcContent != null)
{
@@ -1432,12 +1436,24 @@
Map mapFeedbackCorrect =(Map)request.getSession().getAttribute(MAP_FEEDBACK_CORRECT);
logger.debug("Submit final MAP_FEEDBACK_CORRECT :" + mapFeedbackCorrect);
- AuthoringUtil.cleanupExistingQuestions(request, mcContent);
- logger.debug("post cleanupExistingQuestions");
+ //AuthoringUtil.cleanupExistingQuestions(request, mcContent);
+ //logger.debug("post cleanupExistingQuestions");
- AuthoringUtil.persistQuestions(request, mapQuestionsContent, mapFeedbackIncorrect, mapFeedbackCorrect, mcContent);
- logger.debug("post persistQuestions");
+ logger.debug("start processing questions content...");
+ Long mcContentId =mcContent.getUid();
+ List existingQuestions = mcService.refreshQuestionContent(mcContentId);
+ logger.debug("existingQuestions: " + existingQuestions);
+ logger.debug("will cleanupRedundantQuestions");
+ AuthoringUtil.cleanupRedundantQuestions(request, existingQuestions, mapQuestionsContent, mcContent);
+
+ logger.debug("existingQuestions: " + existingQuestions);
+ logger.debug("calling selectAndPersistQuestions: " + existingQuestions);
+ AuthoringUtil.selectAndPersistQuestions(request, existingQuestions, mapQuestionsContent, mapFeedbackIncorrect, mapFeedbackCorrect, mcContent);
+
+ existingQuestions = mcService.refreshQuestionContent(mcContentId);
+ logger.debug("last set of existingQuestions: " + existingQuestions);
+
logger.debug("will do addUploadedFilesMetaData");
McUtils.addUploadedFilesMetaData(request,mcContent);
logger.debug("done addUploadedFilesMetaData");
@@ -1682,7 +1698,7 @@
return (mapping.findForward(ALL_INSTRUCTIONS));
}
-
+
/**
* ensures that the weight valued entered are valid
* validateQuestionWeights(HttpServletRequest request, McAuthoringForm mcAuthoringForm)
@@ -1691,9 +1707,8 @@
* @param mcAuthoringForm
* @return
*/
- protected boolean validateQuestionWeights(HttpServletRequest request, McAuthoringForm mcAuthoringForm)
+ protected boolean validateQuestionWeights(HttpServletRequest request, Map mapWeights, McAuthoringForm mcAuthoringForm)
{
- Map mapWeights= AuthoringUtil.repopulateCurrentWeightsMap(request, "questionWeight");
logger.debug("mapWeights: " + mapWeights);
Iterator itMap = mapWeights.entrySet().iterator();
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java,v
diff -u -r1.25 -r1.26
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java 13 Nov 2005 13:20:24 -0000 1.25
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java 25 Nov 2005 12:02:19 -0000 1.26
@@ -134,12 +134,12 @@
*/
if (!existsContent(toolContentId, request))
{
- System.out.print("retrieving default content");
+ logger.debug("retrieving default content");
retrieveDefaultContent(request, mcAuthoringForm);
}
else
{
- System.out.print("retrieving existing content for: " + toolContentId);
+ logger.debug("retrieving existing content for: " + toolContentId);
retrieveExistingContent(request, mcAuthoringForm, toolContentId);
}
}
@@ -433,30 +433,16 @@
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);
+ Map mapQuestionsContent=AuthoringUtil.rebuildQuestionMapfromDB(request, new Long(toolContentId));
+ logger.debug("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()));
- }
- }
+ Map mapWeights=AuthoringUtil.rebuildWeightsMapfromDB(request, new Long(toolContentId));
+ logger.debug("mapWeights:" + mapWeights);
request.getSession().setAttribute(MAP_WEIGHTS, mapWeights);
- System.out.print("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS));
+ logger.debug("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS));
}
@@ -526,7 +512,7 @@
/* collect options for the default question content into a Map*/
McQueContent mcQueContent=mcService.getToolDefaultQuestionContent(mcContent.getUid().longValue());
- System.out.print("mcQueContent:" + mcQueContent);
+ logger.debug("mcQueContent:" + mcQueContent);
/* mcQueContent can not be null since here it was verified before*/
/* display a single sample question */
@@ -566,7 +552,7 @@
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));
+ logger.debug("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS));
}
@@ -578,7 +564,7 @@
*/
protected void initialiseAttributes(HttpServletRequest request)
{
- System.out.print("starting initialiseAttributes...");
+ logger.debug("starting initialiseAttributes...");
/* CURRENT_TAB == 1 defines Basic Tab
* CURRENT_TAB == 2 defines Avanced Tab
* CURRENT_TAB == 3 defines Instructions Tab