Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Activity.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Activity.hbm.xml,v diff -u -r1.38 -r1.39 --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Activity.hbm.xml 15 Aug 2007 01:51:54 -0000 1.38 +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Activity.hbm.xml 29 Aug 2007 03:45:13 -0000 1.39 @@ -274,13 +274,13 @@ @hibernate.class - - @hibernate.set lazy="true" inverse="true" cascade="none" + + @hibernate.set lazy="true" inverse="true" cascade="all-delete-orphan" @hibernate.collection-key column="sequence_activity_id" - @hibernate.collection-one-to-many class="org.lamsfoundation.lams.learningdesign.GroupBranchActivityEntry" + @hibernate.collection-one-to-many class="org.lamsfoundation.lams.learningdesign.BranchActivityEntry" - + Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/BranchActivityEntry.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/BranchActivityEntry.hbm.xml,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/BranchActivityEntry.hbm.xml 29 Aug 2007 03:45:13 -0000 1.1 @@ -0,0 +1,46 @@ + + + + + + + + + + + + + @hibernate.property column="group_branch_activity_ui_id" length="11" + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/BranchCondition.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/BranchCondition.hbm.xml,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/BranchCondition.hbm.xml 29 Aug 2007 03:45:13 -0000 1.1 @@ -0,0 +1,51 @@ + + + + + + + + + + + + + @hibernate.property column="condition_ui_id" length="11" + + + + @hibernate.property column="order_id" length="11" + + + + @hibernate.property column="name" length="255" + + + + + @hibernate.property column="type" length="255" + + + + @hibernate.property column="start_value" length="255" + + + + @hibernate.property column="end_value" length="255" + + + + @hibernate.property column="exact_match_value" length="255" + + + + Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Group.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Group.hbm.xml,v diff -u -r1.11 -r1.12 --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Group.hbm.xml 13 Jun 2007 10:36:44 -0000 1.11 +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Group.hbm.xml 29 Aug 2007 03:45:13 -0000 1.12 @@ -133,7 +133,7 @@ - + Fisheye: Tag 1.3 refers to a dead (removed) revision in file `lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/GroupBranchActivityEntry.hbm.xml'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_common/src/java/org/lamsfoundation/lams/commonContext.xml =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/commonContext.xml,v diff -u -r1.54 -r1.55 --- lams_common/src/java/org/lamsfoundation/lams/commonContext.xml 31 Jul 2007 06:09:08 -0000 1.54 +++ lams_common/src/java/org/lamsfoundation/lams/commonContext.xml 29 Aug 2007 03:44:55 -0000 1.55 @@ -45,9 +45,10 @@ org/lamsfoundation/lams/learningdesign/Activity.hbm.xml + org/lamsfoundation/lams/learningdesign/BranchActivityEntry.hbm.xml + org/lamsfoundation/lams/learningdesign/BranchCondition.hbm.xml org/lamsfoundation/lams/learningdesign/Group.hbm.xml org/lamsfoundation/lams/learningdesign/Grouping.hbm.xml - org/lamsfoundation/lams/learningdesign/GroupBranchActivityEntry.hbm.xml org/lamsfoundation/lams/learningdesign/LearningDesign.hbm.xml org/lamsfoundation/lams/learningdesign/LearningLibrary.hbm.xml org/lamsfoundation/lams/learningdesign/Transition.hbm.xml @@ -259,6 +260,9 @@ + + + Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/BranchActivityEntry.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/BranchActivityEntry.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/BranchActivityEntry.java 29 Aug 2007 03:44:53 -0000 1.1 @@ -0,0 +1,235 @@ +/**************************************************************** + * 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: BranchActivityEntry.java,v 1.1 2007/08/29 03:44:53 fmalikoff Exp $ */ +package org.lamsfoundation.lams.learningdesign; + +import org.apache.commons.lang.builder.CompareToBuilder; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; +import org.lamsfoundation.lams.learningdesign.dto.BranchActivityEntryDTO; +import org.lamsfoundation.lams.learningdesign.dto.ToolOutputBranchActivityEntryDTO; + +/** + * Models the relationship between a group and a branch for Chosen or Group based branching. + * Links the group to the sequence activity that makes up a branch within a branching activity. + * + * Models the relationship between a group and a branch for Tool Output Based branching. + * Links the condition that controls the set of users that access the sequence activity that makes up + * a branch within a branching activity. From the condition, a group can be created and populated. + * + * @author Fiona Malikoff + * @version 2.1 + * + * @hibernate.class table="lams_branch_activity_entry" +*/ +public class BranchActivityEntry { + + /** identifier field */ + protected Long entryId; + /** persistent field */ + protected Integer entryUIID; + /** persistent field */ + protected SequenceActivity branchSequenceActivity; + /** persistent field */ + protected BranchingActivity branchingActivity; + /** persistent field */ + private Group group; + /** persistent field */ + private BranchCondition condition; + + /** + * Default Constructor (for hibernate) + */ + public BranchActivityEntry() { + } + + /** + * Constructor for group based linking + */ + public BranchActivityEntry(Long entryId, Integer entryUIID, SequenceActivity branchSequenceActivity, + BranchingActivity branchingActivity, Group group) { + + this.entryId = entryId; + this.entryUIID = entryUIID; + this.branchSequenceActivity = branchSequenceActivity; + this.branchingActivity = branchingActivity; + this.group = group; + this.condition = null; + } + + /** + * Constructor for tool output based linking + */ + public BranchActivityEntry(Long entryId, Integer entryUIID, SequenceActivity branchSequenceActivity, + BranchingActivity branchingActivity, BranchCondition condition) { + + this.entryId = entryId; + this.entryUIID = entryUIID; + this.branchSequenceActivity = branchSequenceActivity; + this.branchingActivity = branchingActivity; + this.group = null; + this.condition = condition; + } + + + /** + * @hibernate.id + * generator-class="native" + * type="java.lang.Long" + * column="entry_id" + * + */ + public Long getEntryId() { + return this.entryId; + } + + public void setEntryId(Long id) { + entryId = id; + } + + /** + * @hibernate.property column="entry_ui_id" length="11" + */ + public Integer getEntryUIID() { + return this.entryUIID; + } + + public void setEntryUIID(Integer entryUIID) { + this.entryUIID = entryUIID; + } + + /** + * @hibernate.many-to-one + * not-null="true" + * @hibernate.column name="sequence_activity_id" + * + */ + public org.lamsfoundation.lams.learningdesign.SequenceActivity getBranchSequenceActivity() { + return this.branchSequenceActivity; + } + + public void setBranchSequenceActivity(org.lamsfoundation.lams.learningdesign.SequenceActivity branchSequenceActivity) { + this.branchSequenceActivity = branchSequenceActivity; + } + + /** + * @hibernate.many-to-one + * not-null="true" + * @hibernate.column name="branch_activity_id" + * + */ + public org.lamsfoundation.lams.learningdesign.BranchingActivity getBranchingActivity() { + return this.branchingActivity; + } + + public void setBranchingActivity(org.lamsfoundation.lams.learningdesign.BranchingActivity branchingActivity) { + this.branchingActivity = branchingActivity; + } + + /** + * @hibernate.many-to-one + * not-null="true" + * @hibernate.column name="group_id" + * + */ + public org.lamsfoundation.lams.learningdesign.Group getGroup() { + return this.group; + } + + public void setGroup(org.lamsfoundation.lams.learningdesign.Group group) { + this.group = group; + } + + /** + * Used for tool output based branching only + * + * @hibernate.many-to-one + * not-null="true" cascade="all-delete-orphan" + * @hibernate.column name="condition_id" + * + */ + public BranchCondition getCondition() { + return condition; + } + + public void setCondition(BranchCondition condition) { + this.condition = condition; + } + + + public BranchActivityEntryDTO getBranchActivityDTO() { + + BranchActivityEntryDTO entryDTO = null; + if ( getCondition() != null ) { + ToolOutputBranchActivityEntryDTO toolEntryDTO = new ToolOutputBranchActivityEntryDTO(); + toolEntryDTO.setCondition(getCondition().getBranchConditionDTO()); + entryDTO = toolEntryDTO; + } else { + entryDTO = new BranchActivityEntryDTO(); + } + + entryDTO.setEntryID(getEntryId()); + entryDTO.setEntryUIID(getEntryUIID()); + entryDTO.setGroupUIID(getGroup().getGroupUIID()); + entryDTO.setSequenceActivityUIID(getBranchSequenceActivity().getActivityUIID()); + entryDTO.setBranchingActivityUIID(getBranchingActivity().getActivityUIID()); + return entryDTO; + } + + public boolean equals(Object other) { + if ( (this == other ) ) return true; + if ( !(other instanceof BranchActivityEntry) ) return false; + BranchActivityEntry castOther = (BranchActivityEntry) other; + return new EqualsBuilder() + .append(this.getEntryId(), castOther.getEntryId()) + .append(this.getEntryUIID(), castOther.getEntryUIID()) + .isEquals(); + } + + public int hashCode() { + return new HashCodeBuilder() + .append(getEntryId()) + .append(getEntryUIID()) + .toHashCode(); + } + + public int compareTo(Object other) { + BranchActivityEntry castOther = (BranchActivityEntry) other; + return new CompareToBuilder() + .append(this.getEntryId(), castOther.getEntryId()) + .append(this.getEntryUIID(), castOther.getEntryUIID()) + .toComparison(); + } + + public String toString() { + return new ToStringBuilder(this) + .append("entryId", getEntryId()) + .append("entryUIID", getEntryUIID()) + .append("group", getGroup() != null ? getGroup().getGroupId().toString() : "") + .append("sequence activity", getBranchSequenceActivity() != null ? getBranchSequenceActivity().getActivityId().toString() : "") + .toString(); + } + + +} \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/BranchCondition.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/BranchCondition.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/BranchCondition.java 29 Aug 2007 03:44:54 -0000 1.1 @@ -0,0 +1,178 @@ +/**************************************************************** + * 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: BranchCondition.java,v 1.1 2007/08/29 03:44:54 fmalikoff Exp $ */ +package org.lamsfoundation.lams.learningdesign; + +import java.util.HashSet; + +import org.apache.commons.lang.builder.ToStringBuilder; +import org.lamsfoundation.lams.learningdesign.dto.BranchConditionDTO; + + +/** + * The ToolOutputBranchActivityEntries record the branch selection details for tool output based branching. During + * authoring, the tool will have supplied a ToolOutputDefinition object and this will have been used to configure + * which tool outputs match to a particular branch. This mapping is as a ToolOutputBranchActivityEntry. + * + * There should be one branch condition for each ToolOutputBranchActivityEntry. + */ +public class BranchCondition { + + private Long conditionId; + private Integer conditionUIID; + private Integer orderId; + private String name; + private String type; + private String startValue; + private String endValue; + private String exactMatchValue; + + /** default constructor */ + public BranchCondition() { + } + + /** full constructor */ + public BranchCondition(Long conditionId, Integer conditionUIID, Integer orderId, + String name, String type, String startValue, String endValue, String exactMatchValue) { + this.conditionId = conditionId; + this.conditionUIID = conditionUIID; + this.orderId = orderId; + this.name = name; + this.type = type; + this.startValue = startValue; + this.endValue = endValue; + this.exactMatchValue = exactMatchValue; + } + + + /** + * @hibernate.id + * generator-class="native" + * type="java.lang.Long" + * column="condition_id" + * + */ + public Long getConditionId() { + return conditionId; + } + public void setConditionId(Long conditionId) { + this.conditionId = conditionId; + } + + /** + * @hibernate.property column="condition_ui_id" length="11" + * + */ + public Integer getConditionUIID() { + return conditionUIID; + } + public void setConditionUIID(Integer conditionUIID) { + this.conditionUIID = conditionUIID; + } + + /** + * @hibernate.property column="order_id" length="11" + */ + public Integer getOrderId() { + return orderId; + } + public void setOrderId(Integer orderId) { + this.orderId = orderId; + } + /** + * @hibernate.property column="name" length="255" + */ + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + /** + * @hibernate.property column="type" length="255" + */ + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + /** + * @hibernate.property column="start_value" length="255" + */ + public String getStartValue() { + return startValue; + } + public void setStartValue(String startValue) { + this.startValue = startValue; + } + /** + * @hibernate.property column="end_value" length="255" + */ + public String getEndValue() { + return endValue; + } + public void setEndValue(String endValue) { + this.endValue = endValue; + } + /** + * @hibernate.property column="exact_match_value" length="255" + */ + public String getExactMatchValue() { + return exactMatchValue; + } + public void setExactMatchValue(String exactMatchValue) { + this.exactMatchValue = exactMatchValue; + } + + public BranchConditionDTO getBranchConditionDTO() { + return new BranchConditionDTO(this); + } + + public String toString() { + return new ToStringBuilder(this) + .append("conditionId", conditionId) + .append("conditionUIID", conditionUIID) + .append("orderId", orderId) + .append("name", name) + .append("type", type) + .append("startValue", startValue) + .append("endValue", endValue) + .append("exactMatchValue", exactMatchValue) + .toString(); + } + + /** Allocate this condition to the given branch, in a branching activity. This creates the BranchActivityEntry record and adds it + * to the branchActivities set. EntryUIID will only be populated if this is called from authoring + */ + public BranchActivityEntry allocateBranchToCondition(Integer entryUIID, SequenceActivity branch, BranchingActivity branchingActivity) { + BranchActivityEntry entry = new BranchActivityEntry(null, entryUIID, branch, (BranchingActivity) branchingActivity, this); + return entry; + } + + /** Create a new BranchCondition based on itself, leaving conditionId as null */ + public BranchCondition clone() { + return new BranchCondition(null, conditionUIID, orderId, name, type, startValue, endValue, exactMatchValue); + } + +} Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/Group.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/Group.java,v diff -u -r1.21 -r1.22 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/Group.java 2 Aug 2007 00:49:24 -0000 1.21 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/Group.java 29 Aug 2007 03:44:53 -0000 1.22 @@ -260,7 +260,7 @@ * @hibernate.collection-key * column="group_id" * @hibernate.collection-one-to-many - * class="org.lamsfoundation.lams.learningdesign.GroupBranchActivityEntry" + * class="org.lamsfoundation.lams.learningdesign.BranchActivityEntry" * */ public Set getBranchActivities() { @@ -353,25 +353,14 @@ Group newGroup = new Group(null, this.getGroupName(), this.getOrderId(), this.getGroupUIID(), newGrouping, null, null, null); - if ( this.getBranchActivities() != null && this.getBranchActivities().size() > 0) { - newGroup.setBranchActivities(new HashSet()); - Iterator iter = this.getBranchActivities().iterator(); - while ( iter.hasNext() ) { - GroupBranchActivityEntry oldEntry = (GroupBranchActivityEntry) iter.next(); - GroupBranchActivityEntry newEntry = new GroupBranchActivityEntry(null, - oldEntry.getEntryUIID(), newGroup, oldEntry.getBranchSequenceActivity(), oldEntry.getBranchingActivity()); - newGroup.getBranchActivities().add(newEntry); - } - } - - return newGroup; + return newGroup; } - /** Allocate this group to the given branch, in a branching activity. This creates the GroupBranchActivityEntry record and adds it - * to the branchActivities set. The entryId, entryUIID will only be populated if this is called from authoring + /** Allocate this group to the given branch, in a branching activity. This creates the BranchActivityEntry record and adds it + * to the branchActivities set. EntryUIID will only be populated if this is called from authoring */ - public GroupBranchActivityEntry allocateBranchToGroup(Long entryId, Integer entryUIID, SequenceActivity branch, BranchingActivity branchingActivity) { - GroupBranchActivityEntry entry = new GroupBranchActivityEntry(entryId, entryUIID, this, branch, (BranchingActivity) branchingActivity); + public BranchActivityEntry allocateBranchToGroup(Integer entryUIID, SequenceActivity branch, BranchingActivity branchingActivity) { + BranchActivityEntry entry = new BranchActivityEntry(null, entryUIID, branch, (BranchingActivity) branchingActivity, this); if ( getBranchActivities() == null ) { setBranchActivities(new HashSet()); } Fisheye: Tag 1.4 refers to a dead (removed) revision in file `lams_common/src/java/org/lamsfoundation/lams/learningdesign/GroupBranchActivityEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/Grouping.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/Grouping.java,v diff -u -r1.27 -r1.28 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/Grouping.java 2 Aug 2007 00:49:24 -0000 1.27 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/Grouping.java 29 Aug 2007 03:44:54 -0000 1.28 @@ -378,4 +378,17 @@ public void setGrouper(Grouper grouper) { this.grouper = grouper; } + + public Group getGroup(Integer groupUIID) { + if ( this.getGroups() != null ) { + Iterator iter = this.getGroups().iterator(); + while (iter.hasNext()) { + Group elem = (Group) iter.next(); + if ( elem.getGroupUIID().equals(groupUIID)) + return elem; + } + } + return null; + } + } Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/SequenceActivity.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/SequenceActivity.java,v diff -u -r1.30 -r1.31 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/SequenceActivity.java 15 Aug 2007 01:51:15 -0000 1.30 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/SequenceActivity.java 29 Aug 2007 03:44:53 -0000 1.31 @@ -24,6 +24,7 @@ package org.lamsfoundation.lams.learningdesign; import java.io.Serializable; +import java.util.HashSet; import java.util.Iterator; import java.util.Set; import java.util.SortedSet; @@ -137,6 +138,21 @@ SequenceActivity newSequenceActivity = new SequenceActivity(); copyToNewActivity(newSequenceActivity); newSequenceActivity.defaultActivity = this.defaultActivity; + + if ( this.getBranchEntries() != null && this.getBranchEntries().size() > 0) { + newSequenceActivity.setBranchEntries(new HashSet()); + Iterator iter = this.getBranchEntries().iterator(); + while ( iter.hasNext() ) { + BranchActivityEntry oldEntry = (BranchActivityEntry) iter.next(); + BranchActivityEntry newEntry = new BranchActivityEntry(null, + oldEntry.getEntryUIID(), oldEntry.getBranchSequenceActivity(), oldEntry.getBranchingActivity(), oldEntry.getGroup()); + if ( oldEntry.getCondition() != null ) { + newEntry.setCondition(oldEntry.getCondition().clone()); + } + newSequenceActivity.getBranchEntries().add(newEntry); + } + } + return newSequenceActivity; } @@ -156,11 +172,11 @@ } /** - * Get the set of the branch to group mappings used for this branching activity. The set contains GroupBranchActivityEntry entries + * Get the set of the branch to group mappings used for this branching activity. The set contains BranchActivityEntry entries * - * @hibernate.set lazy="true" inverse="true" cascade="none" + * @hibernate.set lazy="true" inverse="true" cascade="all-delete-orphan" * @hibernate.collection-key column="sequence_activity_id" - * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.learningdesign.GroupBranchActivityEntry" + * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.learningdesign.BranchActivityEntry" */ public Set getBranchEntries() { return branchEntries; @@ -173,13 +189,13 @@ /** Get the groups related to this sequence activity, related via the BranchEntries */ public SortedSet getGroupsForBranch() { - Set mappingEntries = getBranchEntries(); + Set mappingEntries = getBranchEntries(); TreeSet sortedGroups = new TreeSet(); if ( mappingEntries != null ) { Iterator mappingIter = mappingEntries.iterator(); if ( mappingIter.hasNext() ) { - sortedGroups.add(((GroupBranchActivityEntry) mappingIter.next()).getGroup()); + sortedGroups.add(((BranchActivityEntry) mappingIter.next()).getGroup()); } } Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dao/IBranchActivityEntryDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/dao/IBranchActivityEntryDAO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dao/IBranchActivityEntryDAO.java 29 Aug 2007 03:44:54 -0000 1.1 @@ -0,0 +1,43 @@ +/**************************************************************** + * 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: IBranchActivityEntryDAO.java,v 1.1 2007/08/29 03:44:54 fmalikoff Exp $ */ +package org.lamsfoundation.lams.learningdesign.dao; + +import java.util.List; + +import org.lamsfoundation.lams.learningdesign.BranchActivityEntry; + +/** + * @author fiona + * + */ +public interface IBranchActivityEntryDAO { + + /** + * Returns the list of BranchActivityEntries applicable for the given learning design, determined via the sequence + * activities (which form the related branches) + */ + public abstract List getEntriesByLearningDesign( + Long learningDesignId); + +} \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dao/hibernate/BranchActivityEntryDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/dao/hibernate/BranchActivityEntryDAO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dao/hibernate/BranchActivityEntryDAO.java 29 Aug 2007 03:44:54 -0000 1.1 @@ -0,0 +1,47 @@ +/**************************************************************** + * 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: BranchActivityEntryDAO.java,v 1.1 2007/08/29 03:44:54 fmalikoff Exp $$ */ +package org.lamsfoundation.lams.learningdesign.dao.hibernate; + +import java.util.List; + +import org.lamsfoundation.lams.dao.hibernate.BaseDAO; +import org.lamsfoundation.lams.learningdesign.BranchActivityEntry; +import org.lamsfoundation.lams.learningdesign.SequenceActivity; +import org.lamsfoundation.lams.learningdesign.dao.IBranchActivityEntryDAO; + +public class BranchActivityEntryDAO extends BaseDAO implements IBranchActivityEntryDAO { + + private final static String ENTRIES_FOR_LEARNING_DESIGN = "select entry from " + + BranchActivityEntry.class.getName() + " entry, " + SequenceActivity.class.getName() + " sequenceActivity " + + " where sequenceActivity.learningDesign.id = ? " + + " and entry.branchSequenceActivity = sequenceActivity"; + + /* (non-Javadoc) + * @see org.lamsfoundation.lams.learningdesign.dao.hibernate.IBranchActivityEntryDAO#getEntriesByLearningDesign(java.lang.Long) + */ + public List getEntriesByLearningDesign(Long learningDesignId){ + return (List) this.getHibernateTemplate().find(ENTRIES_FOR_LEARNING_DESIGN,learningDesignId); + } + +} Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/BranchActivityEntryDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/BranchActivityEntryDTO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/BranchActivityEntryDTO.java 29 Aug 2007 03:44:54 -0000 1.1 @@ -0,0 +1,101 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License 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: BranchActivityEntryDTO.java,v 1.1 2007/08/29 03:44:54 fmalikoff Exp $ */ +package org.lamsfoundation.lams.learningdesign.dto; + +import java.io.Serializable; + +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * Models the relationship between a group and a branch for Chosen or Group based branching. + * Links the group to the sequence activity that makes up a branch within a branching activity. + * Used by Flash - so we just record the related UI IDs, rather than the actual objects + * as they will appear elsewhere in the design. + * + * @author Fiona Malikoff + * @version 2.1 + * +*/ +public class BranchActivityEntryDTO implements Serializable { + + private Long entryID; + private Integer entryUIID; + private Integer groupUIID; + private Integer sequenceActivityUIID; + private Integer branchingActivityUIID; + + //--------------------------------------------------------------------- + // Object creation Methods + //--------------------------------------------------------------------- + + public Long getEntryID() { + return this.entryID; + } + + public void setEntryID(Long id) { + entryID = id; + } + + public Integer getGroupUIID() { + return this.groupUIID; + } + + public void setGroupUIID(Integer groupUIID) { + this.groupUIID = groupUIID; + } + + public Integer getSequenceActivityUIID() { + return this.sequenceActivityUIID; + } + + public void setSequenceActivityUIID(Integer sequenceActivityUIID) { + this.sequenceActivityUIID = sequenceActivityUIID; + } + + public Integer getEntryUIID() { + return entryUIID; + } + + public void setEntryUIID(Integer entryUIID) { + this.entryUIID = entryUIID; + } + + public Integer getBranchingActivityUIID() { + return branchingActivityUIID; + } + + public void setBranchingActivityUIID(Integer branchingActivityUIID) { + this.branchingActivityUIID = branchingActivityUIID; + } + + public String toString() { + return new ToStringBuilder(this) + .append("entryID",entryID) + .append("entryUIID", entryUIID) + .append("branchingActivityUIID",branchingActivityUIID) + .append("sequenceActivityUIID", sequenceActivityUIID) + .append("groupUIID",groupUIID) + .toString(); + } +} 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/BranchConditionDTO.java 29 Aug 2007 03:44:54 -0000 1.1 @@ -0,0 +1,125 @@ +/**************************************************************** + * 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: BranchConditionDTO.java,v 1.1 2007/08/29 03:44:54 fmalikoff Exp $ */ +package org.lamsfoundation.lams.learningdesign.dto; + +import org.apache.commons.lang.builder.ToStringBuilder; +import org.lamsfoundation.lams.learningdesign.BranchCondition; + + +/** + * The BranchConditionDTO records the details of one particular condition, used for tool output based branching. + * On one branching activity there will be one or more conditions, some with the same name. If the condition is a + * range condition then startValue and endValue will be populated. If it is an exactMatchCondition (such as for a + * boolean output definition) then the exactMatchValue will be true/false. Order id is used to ensure that the + * conditions are always listed in the same order on the screen. + */ +public class BranchConditionDTO { + + private Long conditionId; + private Integer conditionUIID; + private Integer orderId; + private String name; + private String type; + private String startValue; + private String endValue; + private String exactMatchValue; + + public BranchConditionDTO( BranchCondition condition ) { + this.conditionId = condition.getConditionId(); + this.conditionUIID = condition.getConditionUIID(); + this.orderId = condition.getOrderId(); + this.name = condition.getName(); + this.type = condition.getType(); + this.startValue = condition.getStartValue(); + this.endValue = condition.getEndValue(); + this.exactMatchValue = condition.getExactMatchValue(); + } + + public Long getConditionId() { + return conditionId; + } + + public void setConditionId(Long conditionId) { + this.conditionId = conditionId; + } + + public Integer getConditionUIID() { + return conditionUIID; + } + + public void setConditionUIID(Integer conditionUIID) { + this.conditionUIID = conditionUIID; + } + + public Integer getOrderId() { + return orderId; + } + public void setOrderId(Integer orderId) { + this.orderId = orderId; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public String getStartValue() { + return startValue; + } + public void setStartValue(String startValue) { + this.startValue = startValue; + } + public String getEndValue() { + return endValue; + } + public void setEndValue(String endValue) { + this.endValue = endValue; + } + public String getExactMatchValue() { + return exactMatchValue; + } + public void setExactMatchValue(String exactMatchValue) { + this.exactMatchValue = exactMatchValue; + } + + public String toString() { + return new ToStringBuilder(this) + .append("conditionId", conditionId) + .append("conditionUIID", conditionUIID) + .append("orderId", orderId) + .append("name", name) + .append("type", type) + .append("startValue", startValue) + .append("endValue", endValue) + .append("exactMatchValue", exactMatchValue) + .toString(); + } + +} Fisheye: Tag 1.4 refers to a dead (removed) revision in file `lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/GroupBranchActivityEntryDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LearningDesignDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LearningDesignDTO.java,v diff -u -r1.30 -r1.31 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LearningDesignDTO.java 2 Aug 2007 00:49:23 -0000 1.30 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LearningDesignDTO.java 29 Aug 2007 03:44:54 -0000 1.31 @@ -33,8 +33,8 @@ import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.learningdesign.ActivityDTOOrderComparator; +import org.lamsfoundation.lams.learningdesign.BranchActivityEntry; import org.lamsfoundation.lams.learningdesign.Group; -import org.lamsfoundation.lams.learningdesign.GroupBranchActivityEntry; import org.lamsfoundation.lams.learningdesign.Grouping; import org.lamsfoundation.lams.learningdesign.GroupingActivity; import org.lamsfoundation.lams.learningdesign.LearningDesign; @@ -419,8 +419,8 @@ if ( group.getBranchActivities().size() > 0 ) { Iterator iter2 = group.getBranchActivities().iterator(); while ( iter2.hasNext() ) { - GroupBranchActivityEntry gba = (GroupBranchActivityEntry) iter2.next(); - branchMappings.add(gba.getGroupBranchActivityDTO()); + BranchActivityEntry ba = (BranchActivityEntry) iter2.next(); + branchMappings.add(ba.getBranchActivityDTO()); } } } Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/ToolOutputBranchActivityEntryDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/ToolOutputBranchActivityEntryDTO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/ToolOutputBranchActivityEntryDTO.java 29 Aug 2007 03:44:54 -0000 1.1 @@ -0,0 +1,48 @@ +/**************************************************************** + * 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: ToolOutputBranchActivityEntryDTO.java,v 1.1 2007/08/29 03:44:54 fmalikoff Exp $ */ +package org.lamsfoundation.lams.learningdesign.dto; + + +/** + * Models the relationship between a group and a branch for Tool Output Based based branching. + * The branchCondition indicates the condition on which the related group should be created. + * During authoring, we expect branchCondition to be not null, and the group to be null. + * + * @author Fiona Malikoff + * @version 2.1 + * +*/ +public class ToolOutputBranchActivityEntryDTO extends BranchActivityEntryDTO { + + private BranchConditionDTO condition; + + public BranchConditionDTO getCondition() { + return condition; + } + + public void setCondition(BranchConditionDTO condition) { + this.condition = condition; + } + +} 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.70 -r1.71 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java 15 Aug 2007 01:51:16 -0000 1.70 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java 29 Aug 2007 03:44:54 -0000 1.71 @@ -80,26 +80,22 @@ import org.lamsfoundation.lams.dao.IBaseDAO; import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.learningdesign.ActivityOrderComparator; +import org.lamsfoundation.lams.learningdesign.BranchActivityEntry; import org.lamsfoundation.lams.learningdesign.BranchingActivity; -import org.lamsfoundation.lams.learningdesign.ChosenBranchingActivity; import org.lamsfoundation.lams.learningdesign.ChosenGrouping; import org.lamsfoundation.lams.learningdesign.ComplexActivity; import org.lamsfoundation.lams.learningdesign.Group; -import org.lamsfoundation.lams.learningdesign.GroupBranchActivityEntry; -import org.lamsfoundation.lams.learningdesign.GroupBranchingActivity; import org.lamsfoundation.lams.learningdesign.Grouping; import org.lamsfoundation.lams.learningdesign.GroupingActivity; import org.lamsfoundation.lams.learningdesign.LearningDesign; import org.lamsfoundation.lams.learningdesign.License; import org.lamsfoundation.lams.learningdesign.OptionsActivity; -import org.lamsfoundation.lams.learningdesign.ParallelActivity; import org.lamsfoundation.lams.learningdesign.PermissionGateActivity; import org.lamsfoundation.lams.learningdesign.RandomGrouping; import org.lamsfoundation.lams.learningdesign.ScheduleGateActivity; import org.lamsfoundation.lams.learningdesign.SequenceActivity; import org.lamsfoundation.lams.learningdesign.SynchGateActivity; import org.lamsfoundation.lams.learningdesign.ToolActivity; -import org.lamsfoundation.lams.learningdesign.ToolBranchingActivity; import org.lamsfoundation.lams.learningdesign.Transition; import org.lamsfoundation.lams.learningdesign.dao.IActivityDAO; import org.lamsfoundation.lams.learningdesign.dao.IGroupingDAO; @@ -108,7 +104,7 @@ import org.lamsfoundation.lams.learningdesign.dao.ILicenseDAO; import org.lamsfoundation.lams.learningdesign.dao.ITransitionDAO; import org.lamsfoundation.lams.learningdesign.dto.AuthoringActivityDTO; -import org.lamsfoundation.lams.learningdesign.dto.GroupBranchActivityEntryDTO; +import org.lamsfoundation.lams.learningdesign.dto.BranchActivityEntryDTO; import org.lamsfoundation.lams.learningdesign.dto.GroupDTO; import org.lamsfoundation.lams.learningdesign.dto.GroupingDTO; import org.lamsfoundation.lams.learningdesign.dto.LearningDesignDTO; @@ -1446,11 +1442,11 @@ } // branch mappings - maps groups to branchs - List entryDtoList = dto.getBranchMappings(); + List entryDtoList = dto.getBranchMappings(); if ( entryDtoList != null ) { - Set entryList = new HashSet(); - for (GroupBranchActivityEntryDTO entryDto : entryDtoList) { - GroupBranchActivityEntry entry = getGroupBranchActivityEntry(entryDto, groupByUIIDMapper, activityByUIIDMapper); + Set entryList = new HashSet(); + for (BranchActivityEntryDTO entryDto : entryDtoList) { + BranchActivityEntry entry = getBranchActivityEntry(entryDto, groupByUIIDMapper, activityByUIIDMapper); entryList.add(entry); } } @@ -1654,7 +1650,7 @@ * Note: there isn't an set in the learning design for the branch mappings. The group objects actually contain the link * to the mappings, so this method updates the group objects. */ - private GroupBranchActivityEntry getGroupBranchActivityEntry(GroupBranchActivityEntryDTO entryDto, MapgroupByUIIDMapper, + private BranchActivityEntry getBranchActivityEntry(BranchActivityEntryDTO entryDto, MapgroupByUIIDMapper, Map activityByUIIDMapper) { Activity branch = activityByUIIDMapper.get(entryDto.getSequenceActivityUIID()); @@ -1675,7 +1671,7 @@ return null; } - return group.allocateBranchToGroup(null, entryDto.getEntryUIID(), (SequenceActivity) branch, (BranchingActivity) branchingActivity); + return group.allocateBranchToGroup(entryDto.getEntryUIID(), (SequenceActivity) branch, (BranchingActivity) branchingActivity); } private Transition getTransition(TransitionDTO transDto, Map activityMapper) { Index: lams_common/src/java/org/lamsfoundation/lams/util/wddx/WDDXTAGS.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/util/wddx/WDDXTAGS.java,v diff -u -r1.23 -r1.24 --- lams_common/src/java/org/lamsfoundation/lams/util/wddx/WDDXTAGS.java 15 Aug 2007 01:51:16 -0000 1.23 +++ lams_common/src/java/org/lamsfoundation/lams/util/wddx/WDDXTAGS.java 29 Aug 2007 03:44:54 -0000 1.24 @@ -134,11 +134,6 @@ public static final String GROUP_USER_LIST = "userList"; public static final String GROUP_UIID = "groupUIID"; - public static final String GROUP_BRANCH_ACTIVITY_ENTRY_ID = "entryID"; - public static final String GROUP_BRANCH_ACTIVITY_ENTRY_UIID = "entryUIID"; - public static final String GROUP_BRANCH_SEQUENCE_ACTIVITY_UIID = "sequenceActivityUIID"; - public static final String GROUP_BRANCH_ACTIVITY_UIID = "branchingActivityUIID"; - /** Transition specific tags */ public static final String TRANSITION_ID ="transitionID"; public static final String TRANSITION_UIID ="transitionUIID"; @@ -200,5 +195,24 @@ public static final String END_XCOORD="endXCoord"; public static final String END_YCOORD="endYCoord"; + /** Branch Mapping and Tool Condition Tags */ + public static final String BRANCH_ACTIVITY_ENTRY_ID = "entryID"; + public static final String BRANCH_ACTIVITY_ENTRY_UIID = "entryUIID"; + public static final String BRANCH_SEQUENCE_ACTIVITY_UIID = "sequenceActivityUIID"; + public static final String BRANCH_ACTIVITY_UIID = "branchingActivityUIID"; + public static final String BRANCH_CONDITION = "condition"; + // reuse GROUP_UIID for the Group field + public static final String CONDITION_ID = "conditionID"; + public static final String CONDITION_UIID = "conditionUIID"; + // reuse ORDER_ID for the OrderId field + public static final String CONDITION_NAME = "name"; + public static final String CONDITION_TYPE = "type"; + public static final String CONDITION_START_VALUE = "startValue"; + public static final String CONDITION_END_VALUE = "endValue"; + public static final String CONDITION_EXACT_MATCH_VALUE = "exactMatchValue"; + + + + }