Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/TextSearchCondition.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/TextSearchCondition.java,v diff -u -r1.4 -r1.5 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/TextSearchCondition.java 27 Oct 2008 00:46:39 -0000 1.4 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/TextSearchCondition.java 31 Oct 2008 01:06:58 -0000 1.5 @@ -30,7 +30,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; -import org.lamsfoundation.lams.learningdesign.dto.BranchConditionDTO; +import org.lamsfoundation.lams.learningdesign.dto.TextSearchConditionDTO; import org.lamsfoundation.lams.tool.ToolOutput; import org.lamsfoundation.lams.web.TextSearchActionForm; @@ -114,8 +114,12 @@ * * @param conditionDTO */ - public TextSearchCondition(BranchConditionDTO conditionDTO) { + public TextSearchCondition(TextSearchConditionDTO conditionDTO) { super(conditionDTO); + allWords = conditionDTO.getAllWords(); + phrase = conditionDTO.getPhrase(); + anyWords = conditionDTO.getAnyWords(); + excludedWords = conditionDTO.getExcludedWords(); } /** @@ -369,4 +373,9 @@ return text == null ? null : text.replaceAll(TextSearchCondition.BR_TAG_REGEX, " ").replaceAll( TextSearchCondition.HTML_TAG_REGEX, ""); } + + @Override + public TextSearchConditionDTO getBranchConditionDTO(Integer toolActivityUIID) { + return new TextSearchConditionDTO(this, toolActivityUIID); + } } \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/BranchConditionDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/BranchConditionDTO.java,v diff -u -r1.8 -r1.9 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/BranchConditionDTO.java 4 Oct 2008 02:44:27 -0000 1.8 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/BranchConditionDTO.java 31 Oct 2008 01:06:58 -0000 1.9 @@ -47,18 +47,16 @@ private Integer toolActivityUIID; public BranchConditionDTO(BranchCondition condition, Integer toolActivityUIID) { - conditionId = condition.getConditionId(); - conditionUIID = condition.getConditionUIID(); - orderID = condition.getOrderId(); - name = condition.getName(); - displayName = condition.getDisplayName(); - type = condition.getType(); - - startValue = condition.getStartValue(); - endValue = condition.getEndValue(); - - exactMatchValue = condition.getExactMatchValue(); - this.toolActivityUIID = toolActivityUIID; + setConditionId(condition.getConditionId()); + setConditionUIID(condition.getConditionUIID()); + setOrderID(condition.getOrderId()); + setName(condition.getName()); + setDisplayName(condition.getDisplayName()); + setType(condition.getType()); + setStartValue(condition.getStartValue()); + setEndValue(condition.getEndValue()); + setExactMatchValue(condition.getExactMatchValue()); + setToolActivityUIID(toolActivityUIID); } public Long getConditionId() { @@ -156,4 +154,7 @@ this.toolActivityUIID = toolActivityUIID; } + public BranchCondition getCondition() { + return new BranchCondition(this); + } } \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/TextSearchConditionDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/TextSearchConditionDTO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/TextSearchConditionDTO.java 31 Oct 2008 01:06:58 -0000 1.1 @@ -0,0 +1,97 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id: TextSearchConditionDTO.java,v 1.1 2008/10/31 01:06:58 marcin Exp $ */ +package org.lamsfoundation.lams.learningdesign.dto; + +import org.lamsfoundation.lams.learningdesign.TextSearchCondition; + +/** + * Stores additional information from TextSearchCondition that should be serialized. All tools that have their own + * TextSearchConditions must also have TextSearchConditionDTOs, otherwise learning design will not be properly exported. + * + * @author Marcin Cieslak + * + */ +public class TextSearchConditionDTO extends BranchConditionDTO { + /** + * All the words from this string should be found in the tool output. + */ + protected String allWords; + /** + * The whole phrase from this string should be found in the tool output. + */ + protected String phrase; + /** + * At least one of the words from this string should be found in the tool output. + */ + protected String anyWords; + /** + * None of the words from this string should be found in the tool output. + */ + protected String excludedWords; + + public TextSearchConditionDTO(TextSearchCondition condition, Integer toolActivityUIID) { + super(condition, toolActivityUIID); + allWords = condition.getAllWords(); + phrase = condition.getPhrase(); + anyWords = condition.getAnyWords(); + excludedWords = condition.getExcludedWords(); + } + + public String getAllWords() { + return allWords; + } + + public void setAllWords(String allWords) { + this.allWords = allWords; + } + + public String getPhrase() { + return phrase; + } + + public void setPhrase(String phrase) { + this.phrase = phrase; + } + + public String getAnyWords() { + return anyWords; + } + + public void setAnyWords(String anyWords) { + this.anyWords = anyWords; + } + + public String getExcludedWords() { + return excludedWords; + } + + public void setExcludedWords(String excludedWords) { + this.excludedWords = excludedWords; + } + + @Override + public TextSearchCondition getCondition() { + return new TextSearchCondition(this); + } +} \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java,v diff -u -r1.91 -r1.92 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java 29 Oct 2008 05:35:13 -0000 1.91 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java 31 Oct 2008 01:06:58 -0000 1.92 @@ -2232,7 +2232,7 @@ if (entryDto instanceof ToolOutputBranchActivityEntryDTO) { BranchConditionDTO dto = ((ToolOutputBranchActivityEntryDTO) entryDto).getCondition(); if (dto != null) { - condition = new BranchCondition(dto); + condition = dto.getCondition(); condition.setConditionId(null); } if (entryDto instanceof ToolOutputGateActivityEntryDTO) { Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/ChatConditionDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/ChatConditionDTO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/ChatConditionDTO.java 31 Oct 2008 01:06:59 -0000 1.1 @@ -0,0 +1,40 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id: ChatConditionDTO.java,v 1.1 2008/10/31 01:06:59 marcin Exp $ */ +package org.lamsfoundation.lams.tool.chat.dto; + +import org.lamsfoundation.lams.learningdesign.TextSearchCondition; +import org.lamsfoundation.lams.learningdesign.dto.TextSearchConditionDTO; +import org.lamsfoundation.lams.tool.chat.model.ChatCondition; + +public class ChatConditionDTO extends TextSearchConditionDTO { + + public ChatConditionDTO(TextSearchCondition condition, Integer toolActivityUIID) { + super(condition, toolActivityUIID); + } + + @Override + public ChatCondition getCondition() { + return new ChatCondition(this); + } +} \ No newline at end of file Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/ChatCondition.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/ChatCondition.java,v diff -u -r1.1 -r1.2 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/ChatCondition.java 27 Oct 2008 03:31:23 -0000 1.1 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/model/ChatCondition.java 31 Oct 2008 01:06:59 -0000 1.2 @@ -7,11 +7,12 @@ import org.lamsfoundation.lams.learningdesign.BranchCondition; import org.lamsfoundation.lams.learningdesign.LearningDesign; import org.lamsfoundation.lams.learningdesign.TextSearchCondition; -import org.lamsfoundation.lams.learningdesign.dto.BranchConditionDTO; +import org.lamsfoundation.lams.learningdesign.dto.TextSearchConditionDTO; import org.lamsfoundation.lams.tool.OutputType; import org.lamsfoundation.lams.tool.ToolOutput; import org.lamsfoundation.lams.tool.ToolOutputFormatException; import org.lamsfoundation.lams.tool.ToolOutputValue; +import org.lamsfoundation.lams.tool.chat.dto.ChatConditionDTO; /** * A text search condition with a set of messages on which the search should be performed. @@ -26,7 +27,7 @@ super(); } - public ChatCondition(BranchConditionDTO conditionDTO) { + public ChatCondition(TextSearchConditionDTO conditionDTO) { super(conditionDTO); } @@ -112,4 +113,9 @@ Matcher matcher = regexPattern.matcher(textToMatch); return matcher.find(); } + + @Override + public ChatConditionDTO getBranchConditionDTO(Integer toolActivityUIID) { + return new ChatConditionDTO(this, toolActivityUIID); + } } \ No newline at end of file Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/dto/ForumConditionDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/dto/ForumConditionDTO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/dto/ForumConditionDTO.java 31 Oct 2008 01:07:01 -0000 1.1 @@ -0,0 +1,59 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id: ForumConditionDTO.java,v 1.1 2008/10/31 01:07:01 marcin Exp $ */ +package org.lamsfoundation.lams.tool.forum.dto; + +import java.util.Set; +import java.util.TreeSet; + +import org.lamsfoundation.lams.learningdesign.dto.TextSearchConditionDTO; +import org.lamsfoundation.lams.tool.forum.persistence.ForumCondition; +import org.lamsfoundation.lams.tool.forum.persistence.Message; +import org.lamsfoundation.lams.tool.forum.util.ConditionTopicComparator; + +public class ForumConditionDTO extends TextSearchConditionDTO { + private Set topics = new TreeSet(new ConditionTopicComparator()); + + public ForumConditionDTO(ForumCondition condition, Integer toolActivityUIID) { + super(condition, toolActivityUIID); + for (Message topic : condition.getTopics()) { + Message topicCopy = new Message(); + topicCopy.setCreated(topic.getCreated()); + topicCopy.setSubject(topic.getSubject()); + topics.add(topicCopy); + } + } + + @Override + public ForumCondition getCondition() { + return new ForumCondition(this); + } + + public Set getTopics() { + return topics; + } + + public void setTopics(Set topics) { + this.topics = topics; + } +} \ No newline at end of file Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/ForumCondition.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/ForumCondition.java,v diff -u -r1.1 -r1.2 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/ForumCondition.java 27 Oct 2008 00:53:02 -0000 1.1 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/ForumCondition.java 31 Oct 2008 01:07:01 -0000 1.2 @@ -34,11 +34,11 @@ import org.lamsfoundation.lams.learningdesign.BranchCondition; import org.lamsfoundation.lams.learningdesign.LearningDesign; import org.lamsfoundation.lams.learningdesign.TextSearchCondition; -import org.lamsfoundation.lams.learningdesign.dto.BranchConditionDTO; import org.lamsfoundation.lams.tool.OutputType; import org.lamsfoundation.lams.tool.ToolOutput; import org.lamsfoundation.lams.tool.ToolOutputFormatException; import org.lamsfoundation.lams.tool.ToolOutputValue; +import org.lamsfoundation.lams.tool.forum.dto.ForumConditionDTO; import org.lamsfoundation.lams.tool.forum.util.ConditionTopicComparator; /** @@ -59,8 +59,14 @@ } - public ForumCondition(BranchConditionDTO conditionDTO) { + public ForumCondition(ForumConditionDTO conditionDTO) { super(conditionDTO); + for (Message topic : conditionDTO.getTopics()) { + Message topicCopy = new Message(); + topicCopy.setCreated(topic.getCreated()); + topicCopy.setSubject(topic.getSubject()); + topics.add(topicCopy); + } } public ForumCondition(Long conditionId, Integer conditionUIID, Integer orderId, String name, String displayName, @@ -152,16 +158,16 @@ @Override public ForumCondition clone(int uiidOffset) { Integer newConditionUIID = LearningDesign.addOffset(conditionUIID, uiidOffset); - Set questionsCopy = new TreeSet(new ConditionTopicComparator()); + Set topicsCopy = new TreeSet(new ConditionTopicComparator()); for (Message topic : getTopics()) { Message topicCopy = new Message(); topicCopy.setCreated(topic.getCreated()); topicCopy.setSubject(topic.getSubject()); - questionsCopy.add(topicCopy); + topicsCopy.add(topicCopy); } return new ForumCondition(null, newConditionUIID, orderId, name, displayName, allWords, phrase, anyWords, - excludedWords, questionsCopy); + excludedWords, topicsCopy); } /** @@ -214,4 +220,9 @@ Matcher matcher = regexPattern.matcher(textToMatch); return matcher.find(); } + + @Override + public ForumConditionDTO getBranchConditionDTO(Integer toolActivityUIID) { + return new ForumConditionDTO(this, toolActivityUIID); + } } \ No newline at end of file Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaCondition.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaCondition.java,v diff -u -r1.4 -r1.5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaCondition.java 23 Oct 2008 04:07:13 -0000 1.4 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaCondition.java 31 Oct 2008 01:06:58 -0000 1.5 @@ -31,7 +31,6 @@ import org.lamsfoundation.lams.learningdesign.BranchCondition; import org.lamsfoundation.lams.learningdesign.LearningDesign; import org.lamsfoundation.lams.learningdesign.TextSearchCondition; -import org.lamsfoundation.lams.learningdesign.dto.BranchConditionDTO; import org.lamsfoundation.lams.tool.OutputType; import org.lamsfoundation.lams.tool.ToolOutput; import org.lamsfoundation.lams.tool.ToolOutputFormatException; @@ -60,8 +59,13 @@ } - public QaCondition(BranchConditionDTO conditionDTO) { + public QaCondition(QaConditionDTO conditionDTO) { super(conditionDTO); + for (QaQueContent question : conditionDTO.getQuestions()) { + QaQueContent questionCopy = new QaQueContent(question.getQuestion(), question.getDisplayOrder(), null, + null, null, null); + getQuestions().add(questionCopy); + } } public QaCondition(Long conditionId, Integer conditionUIID, Integer orderId, String name, String displayName, @@ -162,4 +166,9 @@ protected boolean isValid() { return getQuestions() != null && !getQuestions().isEmpty(); } + + @Override + public QaConditionDTO getBranchConditionDTO(Integer toolActivityUIID) { + return new QaConditionDTO(this, toolActivityUIID); + } } \ No newline at end of file Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaConditionDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/QaConditionDTO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaConditionDTO.java 31 Oct 2008 01:06:58 -0000 1.1 @@ -0,0 +1,56 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id: QaConditionDTO.java,v 1.1 2008/10/31 01:06:58 marcin Exp $ */ +package org.lamsfoundation.lams.tool.qa; + +import java.util.Set; +import java.util.TreeSet; + +import org.lamsfoundation.lams.learningdesign.dto.TextSearchConditionDTO; +import org.lamsfoundation.lams.tool.qa.util.QaQueContentComparator; + +public class QaConditionDTO extends TextSearchConditionDTO { + private Set questions = new TreeSet(new QaQueContentComparator()); + + public QaConditionDTO(QaCondition condition, Integer toolActivityUIID) { + super(condition, toolActivityUIID); + for (QaQueContent question : condition.getQuestions()) { + QaQueContent questionCopy = new QaQueContent(question.getQuestion(), question.getDisplayOrder(), null, + null, null, null); + getQuestions().add(questionCopy); + } + } + + public Set getQuestions() { + return questions; + } + + public void setQuestions(Set questions) { + this.questions = questions; + } + + @Override + public QaCondition getCondition() { + return new QaCondition(this); + } +} \ No newline at end of file Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/dto/SurveyConditionDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/dto/SurveyConditionDTO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/dto/SurveyConditionDTO.java 31 Oct 2008 01:06:59 -0000 1.1 @@ -0,0 +1,60 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id: SurveyConditionDTO.java,v 1.1 2008/10/31 01:06:59 marcin Exp $ */ +package org.lamsfoundation.lams.tool.survey.dto; + +import java.util.Set; +import java.util.TreeSet; + +import org.lamsfoundation.lams.learningdesign.dto.TextSearchConditionDTO; +import org.lamsfoundation.lams.tool.survey.model.SurveyCondition; +import org.lamsfoundation.lams.tool.survey.model.SurveyQuestion; +import org.lamsfoundation.lams.tool.survey.util.QuestionsComparator; + +public class SurveyConditionDTO extends TextSearchConditionDTO { + private Set questions = new TreeSet(new QuestionsComparator()); + + public SurveyConditionDTO(SurveyCondition condition, Integer toolActivityUIID) { + super(condition, toolActivityUIID); + for (SurveyQuestion question : condition.getQuestions()) { + SurveyQuestion questionCopy = new SurveyQuestion(); + questionCopy.setSequenceId(question.getSequenceId()); + questionCopy.setShortTitle(question.getShortTitle()); + questionCopy.setType(question.getType()); + getQuestions().add(questionCopy); + } + } + + public Set getQuestions() { + return questions; + } + + public void setQuestions(Set questions) { + this.questions = questions; + } + + @Override + public SurveyCondition getCondition() { + return new SurveyCondition(this); + } +} \ No newline at end of file Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/model/SurveyCondition.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/model/SurveyCondition.java,v diff -u -r1.2 -r1.3 --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/model/SurveyCondition.java 23 Oct 2008 04:05:59 -0000 1.2 +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/model/SurveyCondition.java 31 Oct 2008 01:06:59 -0000 1.3 @@ -30,11 +30,11 @@ import org.lamsfoundation.lams.learningdesign.BranchCondition; import org.lamsfoundation.lams.learningdesign.LearningDesign; import org.lamsfoundation.lams.learningdesign.TextSearchCondition; -import org.lamsfoundation.lams.learningdesign.dto.BranchConditionDTO; import org.lamsfoundation.lams.tool.OutputType; import org.lamsfoundation.lams.tool.ToolOutput; import org.lamsfoundation.lams.tool.ToolOutputFormatException; import org.lamsfoundation.lams.tool.ToolOutputValue; +import org.lamsfoundation.lams.tool.survey.dto.SurveyConditionDTO; import org.lamsfoundation.lams.tool.survey.util.QuestionsComparator; /** @@ -56,8 +56,16 @@ } - public SurveyCondition(BranchConditionDTO conditionDTO) { + public SurveyCondition(SurveyConditionDTO conditionDTO) { super(conditionDTO); + + for (SurveyQuestion question : conditionDTO.getQuestions()) { + SurveyQuestion questionCopy = new SurveyQuestion(); + questionCopy.setSequenceId(question.getSequenceId()); + questionCopy.setShortTitle(question.getShortTitle()); + questionCopy.setType(question.getType()); + getQuestions().add(questionCopy); + } } public SurveyCondition(Long conditionId, Integer conditionUIID, Integer orderId, String name, String displayName, @@ -160,4 +168,9 @@ protected boolean isValid() { return getQuestions() != null && !getQuestions().isEmpty(); } + + @Override + public SurveyConditionDTO getBranchConditionDTO(Integer toolActivityUIID) { + return new SurveyConditionDTO(this, toolActivityUIID); + } } \ No newline at end of file