Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatOutputFactory.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatOutputFactory.java,v diff -u -r1.2 -r1.3 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatOutputFactory.java 28 Oct 2008 05:35:23 -0000 1.2 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatOutputFactory.java 31 Oct 2008 05:57:27 -0000 1.3 @@ -59,14 +59,9 @@ Chat chat = (Chat) toolContentObject; // adding all existing conditions chatMessagesDefinition.setDefaultConditions(new ArrayList(chat.getConditions())); - // if no conditions were created in the tool instance, a default condition is added; the condition is - // persisted in ChatService. + // if no conditions were created in the tool instance, a default condition is added; if (chatMessagesDefinition.getDefaultConditions().isEmpty()) { - String name = buildConditionName(ChatConstants.TEXT_SEARCH_DEFINITION_NAME, chat.getToolContentId() - .toString()); - // Default condition checks if messages contain word "LAMS" - ChatCondition defaultCondition = new ChatCondition(null, null, 1, name, getI18NText( - ChatConstants.TEXT_SEARCH_DEFAULT_CONDITION_DISPLAY_NAME_KEY, false), "LAMS", null, null, null); + ChatCondition defaultCondition = createDefaultComplexCondition(chat); chat.getConditions().add(defaultCondition); chatMessagesDefinition.getDefaultConditions().add(defaultCondition); } @@ -159,4 +154,18 @@ private boolean isTextSearchConditionName(String name) { return name != null && name.startsWith(ChatConstants.TEXT_SEARCH_DEFINITION_NAME); } + + /** + * Creates a default condition so teachers know how to use complex conditions for this tool. + * + * @param chat + * content of the tool + * @return default chat condition + */ + protected ChatCondition createDefaultComplexCondition(Chat chat) { + String name = buildConditionName(ChatConstants.TEXT_SEARCH_DEFINITION_NAME, chat.getToolContentId().toString()); + // Default condition checks if messages contain word "LAMS" + return new ChatCondition(null, null, 1, name, getI18NText( + ChatConstants.TEXT_SEARCH_DEFAULT_CONDITION_DISPLAY_NAME_KEY, false), "LAMS", null, null, null); + } } \ No newline at end of file Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java,v diff -u -r1.47 -r1.48 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java 27 Oct 2008 03:31:23 -0000 1.47 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java 31 Oct 2008 05:57:27 -0000 1.48 @@ -388,14 +388,8 @@ if (chat == null) { chat = getDefaultContent(); } - // If there are no user added conditions, the default condition will be added in the output factory. It also - // needs to be persisted. - boolean defaultConditionToBeAdded = chat.getConditions().isEmpty(); - SortedMap map = getChatOutputFactory().getToolOutputDefinitions(chat); - if (defaultConditionToBeAdded && !chat.getConditions().isEmpty()) { - saveOrUpdateChat(chat); - } - return map; + + return getChatOutputFactory().getToolOutputDefinitions(chat); } /* IChatService Methods */ @@ -418,6 +412,9 @@ ChatService.logger.error(error); throw new ChatException(error); } + if (defaultContent.getConditions().isEmpty()) { + defaultContent.getConditions().add(getChatOutputFactory().createDefaultComplexCondition(defaultContent)); + } return defaultContent; } Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumOutputFactory.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumOutputFactory.java,v diff -u -r1.5 -r1.6 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumOutputFactory.java 28 Oct 2008 05:35:24 -0000 1.5 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumOutputFactory.java 31 Oct 2008 05:57:38 -0000 1.6 @@ -67,23 +67,9 @@ Forum forum = (Forum) toolContentObject; // adding all existing conditions chosenTopicAnswersDefinition.setDefaultConditions(new ArrayList(forum.getConditions())); - // if no conditions were created in the tool instance, a default condition is added; the condition is - // persisted in ForumService. + // if no conditions were created in the tool instance, a default condition is added; if (chosenTopicAnswersDefinition.getDefaultConditions().isEmpty() && !forum.getMessages().isEmpty()) { - Set messages = new HashSet(); - for (Message message : (Set) forum.getMessages()) { - if (message.getIsAuthored()) { - messages.add(message); - break; - } - } - - String name = buildConditionName(ForumConstants.TEXT_SEARCH_DEFINITION_NAME, forum.getContentId() - .toString()); - // Default condition checks if the answers for the first topic contain word "LAMS" - ForumCondition defaultCondition = new ForumCondition(null, null, 1, name, getI18NText( - ForumConstants.TEXT_SEARCH_DEFAULT_CONDITION_DISPLAY_NAME_KEY, false), "LAMS", null, null, - null, messages); + ForumCondition defaultCondition = createDefaultComplexCondition(forum); forum.getConditions().add(defaultCondition); chosenTopicAnswersDefinition.getDefaultConditions().add(defaultCondition); } @@ -202,4 +188,31 @@ private boolean isTextSearchConditionName(String name) { return name != null && name.startsWith(ForumConstants.TEXT_SEARCH_DEFINITION_NAME); } + + /** + * Creates a default condition so teachers know how to use complex conditions for this tool. + * + * @param forum + * content of the tool + * @return default Forum condition + */ + protected ForumCondition createDefaultComplexCondition(Forum forum) { + + if (forum.getMessages().isEmpty()) { + return null; + } + Set messages = new HashSet(); + for (Message message : (Set) forum.getMessages()) { + if (message.getIsAuthored()) { + messages.add(message); + break; + } + } + + String name = buildConditionName(ForumConstants.TEXT_SEARCH_DEFINITION_NAME, forum.getContentId().toString()); + // Default condition checks if the answers for the first topic contain word "LAMS" + return new ForumCondition(null, null, 1, name, getI18NText( + ForumConstants.TEXT_SEARCH_DEFAULT_CONDITION_DISPLAY_NAME_KEY, false), "LAMS", null, null, null, + messages); + } } Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java,v diff -u -r1.96 -r1.97 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java 27 Oct 2008 00:53:02 -0000 1.96 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java 31 Oct 2008 05:57:37 -0000 1.97 @@ -851,15 +851,8 @@ Forum forum = getForumByContentId(toolContentId); if (forum == null) { forum = getDefaultForum(); - } // If there are no user added conditions, the default condition will be added in the output factory. It - // also - // needs to be persisted. - boolean defaultConditionToBeAdded = forum.getConditions().isEmpty(); - SortedMap map = getForumOutputFactory().getToolOutputDefinitions(forum); - if (defaultConditionToBeAdded && !forum.getConditions().isEmpty()) { - updateForum(forum); } - return map; + return getForumOutputFactory().getToolOutputDefinitions(forum); } /** @@ -964,6 +957,9 @@ } Forum defaultContent = getDefaultForum(); + if (defaultContent.getConditions().isEmpty()) { + defaultContent.getConditions().add(getForumOutputFactory().createDefaultComplexCondition(defaultContent)); + } // get default content by given ID. Forum content = new Forum(); content = Forum.newInstance(defaultContent, contentID, forumToolContentHandler); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java,v diff -u -r1.48 -r1.49 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java 27 Oct 2008 00:48:05 -0000 1.48 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java 31 Oct 2008 05:57:26 -0000 1.49 @@ -294,4 +294,6 @@ public String createConditionName(Collection existingConditions); public void deleteCondition(QaCondition condition); + + public QaCondition createDefaultComplexCondition(QaContent qaContent); } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaOutputFactory.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaOutputFactory.java,v diff -u -r1.7 -r1.8 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaOutputFactory.java 28 Oct 2008 05:35:24 -0000 1.7 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaOutputFactory.java 31 Oct 2008 05:57:26 -0000 1.8 @@ -63,17 +63,10 @@ QaContent qaContent = (QaContent) toolContentObject; // adding all existing conditions allAnswersDefinition.setDefaultConditions(new ArrayList(qaContent.getConditions())); - // if no conditions were created in the tool instance, a default condition is added; the condition is - // persisted in QaService. + // if no conditions were created in the tool instance, a default condition is added; if (allAnswersDefinition.getDefaultConditions().isEmpty() && !qaContent.getQaQueContents().isEmpty()) { - Set questions = new HashSet(); - questions.add((QaQueContent) qaContent.getQaQueContents().iterator().next()); - String name = buildConditionName(QaAppConstants.TEXT_SEARCH_DEFINITION_NAME, qaContent.getQaContentId() - .toString()); - // Default condition checks if the first answer contains word "LAMS" - QaCondition defaultCondition = new QaCondition(null, null, 1, name, getI18NText( - QaAppConstants.TEXT_SEARCH_DEFAULT_CONDITION_DISPLAY_NAME_KEY, false), "LAMS", null, null, - null, questions); + + QaCondition defaultCondition = createDefaultComplexCondition(qaContent); qaContent.getConditions().add(defaultCondition); allAnswersDefinition.getDefaultConditions().add(defaultCondition); @@ -169,4 +162,25 @@ private boolean isTextSearchConditionName(String name) { return name != null && name.startsWith(QaAppConstants.TEXT_SEARCH_DEFINITION_NAME); } + + /** + * Creates a default condition so teachers know how to use complex conditions for this tool. + * + * @param qaContent + * content of the tool + * @return default Q&A condition + */ + protected QaCondition createDefaultComplexCondition(QaContent qaContent) { + if (qaContent.getQaQueContents().isEmpty()) { + return null; + } + Set questions = new HashSet(); + questions.add((QaQueContent) qaContent.getQaQueContents().iterator().next()); + String name = buildConditionName(QaAppConstants.TEXT_SEARCH_DEFINITION_NAME, qaContent.getQaContentId() + .toString()); + // Default condition checks if the first answer contains word "LAMS" + return new QaCondition(null, null, 1, name, getI18NText( + QaAppConstants.TEXT_SEARCH_DEFAULT_CONDITION_DISPLAY_NAME_KEY, false), "LAMS", null, null, null, + questions); + } } \ No newline at end of file Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java,v diff -u -r1.80 -r1.81 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java 27 Oct 2008 00:48:05 -0000 1.80 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java 31 Oct 2008 05:57:26 -0000 1.81 @@ -740,12 +740,12 @@ { QaServicePOJO.logger.debug("start of copyToolContent with ids: " + fromContentId + " and " + toContentId); - + long defaultContentId = 0; if (fromContentId == null) { QaServicePOJO.logger.debug("fromContentId is null."); QaServicePOJO.logger.debug("attempt retrieving tool's default content id with signatute : " + QaAppConstants.MY_SIGNATURE); - long defaultContentId = 0; + try { defaultContentId = getToolDefaultContentIdBySignature(QaAppConstants.MY_SIGNATURE); fromContentId = new Long(defaultContentId); @@ -770,7 +770,6 @@ QaServicePOJO.logger.debug("fromContent is null."); QaServicePOJO.logger.debug("attempt retrieving tool's default content id with signatute : " + QaAppConstants.MY_SIGNATURE); - long defaultContentId = 0; try { defaultContentId = getToolDefaultContentIdBySignature(QaAppConstants.MY_SIGNATURE); fromContentId = new Long(defaultContentId); @@ -782,9 +781,12 @@ } fromContent = qaDAO.loadQaById(fromContentId.longValue()); + QaServicePOJO.logger.debug("using fromContent: " + fromContent); } - + if (fromContentId.equals(defaultContentId) && fromContent != null && fromContent.getConditions().isEmpty()) { + fromContent.getConditions().add(getQaOutputFactory().createDefaultComplexCondition(fromContent)); + } QaServicePOJO.logger.debug("final - retrieved fromContent: " + fromContent); QaServicePOJO.logger.debug("final - before new instance using " + fromContent + " and " + toContentId); @@ -1059,6 +1061,9 @@ if (toolContentObj == null) { long defaultToolContentId = toolService.getToolDefaultContentIdBySignature(QaAppConstants.MY_SIGNATURE); toolContentObj = retrieveQa(defaultToolContentId); + if (toolContentObj != null && toolContentObj.getConditions().isEmpty()) { + toolContentObj.getConditions().add(getQaOutputFactory().createDefaultComplexCondition(toolContentObj)); + } } if (toolContentObj == null) { throw new DataMissingException("Unable to find default content for the question and answer tool"); @@ -1149,15 +1154,11 @@ if (qaContent == null) { long defaultToolContentId = toolService.getToolDefaultContentIdBySignature(QaAppConstants.MY_SIGNATURE); qaContent = retrieveQa(defaultToolContentId); + if (qaContent != null && qaContent.getConditions().isEmpty()) { + qaContent.getConditions().add(getQaOutputFactory().createDefaultComplexCondition(qaContent)); + } } - // If there are no user added conditions, the default condition will be added in the output factory. It also - // needs to be persisted. - boolean defaultConditionToBeAdded = qaContent.getConditions().isEmpty(); - SortedMap map = getQaOutputFactory().getToolOutputDefinitions(qaContent); - if (defaultConditionToBeAdded && !qaContent.getConditions().isEmpty()) { - updateQa(qaContent); - } - return map; + return getQaOutputFactory().getToolOutputDefinitions(qaContent); } /** @@ -1236,6 +1237,9 @@ } qaContent = qaDAO.loadQaById(toolContentID.longValue()); + if (qaContent.getConditions().isEmpty()) { + qaContent.getConditions().add(getQaOutputFactory().createDefaultComplexCondition(qaContent)); + } } QaServicePOJO.logger.debug("final - retrieved qaContent: " + qaContent); @@ -1851,4 +1855,8 @@ qaDAO.deleteCondition(condition); } } + + public QaCondition createDefaultComplexCondition(QaContent qaContent) { + return getQaOutputFactory().createDefaultComplexCondition(qaContent); + } } \ No newline at end of file Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java,v diff -u -r1.67 -r1.68 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java 21 Oct 2008 02:25:35 -0000 1.67 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java 31 Oct 2008 05:57:26 -0000 1.68 @@ -409,6 +409,9 @@ QaStarterAction.logger.debug("getting content with id:" + toolContentID); QaContent qaContent = qaService.retrieveQa(toolContentID); + if (isDefaultContent && qaContent.getConditions().isEmpty()) { + qaContent.getConditions().add(qaService.createDefaultComplexCondition(qaContent)); + } QaStarterAction.logger.debug("QaContent: " + qaContent); QaUtils.populateAuthoringDTO(request, qaContent, qaGeneralAuthoringDTO); Index: lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/NotebookOutputFactory.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/NotebookOutputFactory.java,v diff -u -r1.2 -r1.3 --- lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/NotebookOutputFactory.java 31 Oct 2008 01:41:51 -0000 1.2 +++ lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/NotebookOutputFactory.java 31 Oct 2008 05:57:26 -0000 1.3 @@ -59,15 +59,9 @@ Notebook notebook = (Notebook) toolContentObject; // adding all existing conditions notebookEntryDefinition.setDefaultConditions(new ArrayList(notebook.getConditions())); - // if no conditions were created in the tool instance, a default condition is added; the condition is - // persisted in NotebookService. + // if no conditions were created in the tool instance, a default condition is added; if (notebookEntryDefinition.getDefaultConditions().isEmpty()) { - String name = buildConditionName(NotebookConstants.TEXT_SEARCH_DEFINITION_NAME, notebook - .getToolContentId().toString()); - // Default condition checks if the text contains word "LAMS" - NotebookCondition defaultCondition = new NotebookCondition(null, null, 1, name, getI18NText( - NotebookConstants.TEXT_SEARCH_DEFAULT_CONDITION_DISPLAY_NAME_KEY, false), "LAMS", null, null, - null); + NotebookCondition defaultCondition = createDefaultComplexCondition(notebook); notebook.getConditions().add(defaultCondition); notebookEntryDefinition.getDefaultConditions().add(defaultCondition); } @@ -153,4 +147,19 @@ private boolean isTextSearchConditionName(String name) { return name != null && name.startsWith(NotebookConstants.TEXT_SEARCH_DEFINITION_NAME); } + + /** + * Creates a default condition so teachers know how to use complex conditions for this tool. + * + * @param notebook + * content of the tool + * @return default notebook condition + */ + protected NotebookCondition createDefaultComplexCondition(Notebook notebook) { + String name = buildConditionName(NotebookConstants.TEXT_SEARCH_DEFINITION_NAME, notebook.getToolContentId() + .toString()); + // Default condition checks if the text contains word "LAMS" + return new NotebookCondition(null, null, 1, name, getI18NText( + NotebookConstants.TEXT_SEARCH_DEFAULT_CONDITION_DISPLAY_NAME_KEY, false), "LAMS", null, null, null); + } } \ No newline at end of file Index: lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/NotebookService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/NotebookService.java,v diff -u -r1.17 -r1.18 --- lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/NotebookService.java 31 Oct 2008 01:41:51 -0000 1.17 +++ lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/NotebookService.java 31 Oct 2008 05:57:26 -0000 1.18 @@ -305,18 +305,10 @@ */ public SortedMap getToolOutputDefinitions(Long toolContentId) throws ToolException { Notebook notebook = getNotebookDAO().getByContentId(toolContentId); - if (notebook == null) { notebook = getDefaultContent(); } - // If there are no user added conditions, the default condition will be added in the output factory. It also - // needs to be persisted. - boolean defaultConditionToBeAdded = notebook.getConditions().isEmpty(); - SortedMap map = getNotebookOutputFactory().getToolOutputDefinitions(notebook); - if (defaultConditionToBeAdded && !notebook.getConditions().isEmpty()) { - saveOrUpdateNotebook(notebook); - } - return map; + return getNotebookOutputFactory().getToolOutputDefinitions(notebook); } /* ********** INotebookService Methods ********************************* */ @@ -352,6 +344,10 @@ NotebookService.logger.error(error); throw new NotebookException(error); } + if (defaultContent.getConditions().isEmpty()) { + defaultContent.getConditions() + .add(getNotebookOutputFactory().createDefaultComplexCondition(defaultContent)); + } return defaultContent; } Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/service/SurveyOutputFactory.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/service/SurveyOutputFactory.java,v diff -u -r1.3 -r1.4 --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/service/SurveyOutputFactory.java 28 Oct 2008 05:35:24 -0000 1.3 +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/service/SurveyOutputFactory.java 31 Oct 2008 05:57:32 -0000 1.4 @@ -63,19 +63,10 @@ Survey survey = (Survey) toolContentObject; // adding all existing conditions allAnswersDefinition.setDefaultConditions(new ArrayList(survey.getConditions())); - // if no conditions were created in the tool instance, a default condition is added; the condition is - // persisted in SurveyService. + // if no conditions were created in the tool instance, a default condition is added; if (allAnswersDefinition.getDefaultConditions().isEmpty() && !survey.getQuestions().isEmpty()) { - Set questions = new HashSet(); - questions.add(survey.getQuestions().iterator().next()); - String name = buildConditionName(SurveyConstants.TEXT_SEARCH_DEFINITION_NAME, survey.getContentId() - .toString()); - // Default condition checks if the first answer contains word "LAMS" - SurveyCondition defaultCondition = new SurveyCondition(null, null, 1, name, getI18NText( - SurveyConstants.TEXT_SEARCH_DEFAULT_CONDITION_DISPLAY_NAME_KEY, false), "LAMS", null, null, - null, questions); + SurveyCondition defaultCondition = createDefaultComplexCondition(survey); survey.getConditions().add(defaultCondition); - allAnswersDefinition.getDefaultConditions().add(defaultCondition); } allAnswersDefinition.setShowConditionNameOnly(true); @@ -168,4 +159,29 @@ private boolean isTextSearchConditionName(String name) { return name != null && name.startsWith(SurveyConstants.TEXT_SEARCH_DEFINITION_NAME); } + + /** + * Creates a default condition so teachers know how to use complex conditions for this tool. + * + * @param survey + * content of the tool + * @return default survey condition + */ + protected SurveyCondition createDefaultComplexCondition(Survey survey) { + Set questions = new HashSet(); + for (SurveyQuestion question : survey.getQuestions()) { + if (question.getType() == SurveyConstants.SURVEY_TYPE_TEXT_ENTRY) { + questions.add(question); + break; + } + } + if (questions.isEmpty()) { + return null; + } + String name = buildConditionName(SurveyConstants.TEXT_SEARCH_DEFINITION_NAME, survey.getContentId().toString()); + // Default condition checks if the first answer contains word "LAMS" + return new SurveyCondition(null, null, 1, name, getI18NText( + SurveyConstants.TEXT_SEARCH_DEFAULT_CONDITION_DISPLAY_NAME_KEY, false), "LAMS", null, null, null, + questions); + } } \ No newline at end of file Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/service/SurveyServiceImpl.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/service/SurveyServiceImpl.java,v diff -u -r1.25 -r1.26 --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/service/SurveyServiceImpl.java 27 Oct 2008 00:49:15 -0000 1.25 +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/service/SurveyServiceImpl.java 31 Oct 2008 05:57:32 -0000 1.26 @@ -177,6 +177,9 @@ } Survey defaultContent = getDefaultSurvey(); + if (defaultContent.getConditions().isEmpty()) { + defaultContent.getConditions().add(getSurveyOutputFactory().createDefaultComplexCondition(defaultContent)); + } // save default content by given ID. Survey content = new Survey(); content = Survey.newInstance(defaultContent, contentId, surveyToolContentHandler); @@ -745,14 +748,7 @@ throw new ToolException(e); } } - // If there are no user added conditions, the default condition will be added in the output factory. It also - // needs to be persisted. - boolean defaultConditionToBeAdded = survey.getConditions().isEmpty(); - SortedMap map = getSurveyOutputFactory().getToolOutputDefinitions(survey); - if (defaultConditionToBeAdded && !survey.getConditions().isEmpty()) { - saveOrUpdateSurvey(survey); - } - return map; + return getSurveyOutputFactory().getToolOutputDefinitions(survey); } public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException {