Index: lams_build/lib/lams/lams-central.jar =================================================================== diff -u -rc70c4cfe5be79e0627c85cef134184260b0a72c2 -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 Binary files differ Index: lams_build/lib/lams/lams-learning.jar =================================================================== diff -u -r6cbd4eddf683da44fcbf3faed4ae3fe10e8336b8 -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 Binary files differ Index: lams_build/lib/lams/lams-monitoring.jar =================================================================== diff -u -rbe67c75d689af8e546c029f1f7b3973c6a36fdd2 -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 Binary files differ Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -r7d2a82b7692725eb6d795432931510a199e9b2d0 -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 Binary files differ Index: lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java =================================================================== diff -u -rc70c4cfe5be79e0627c85cef134184260b0a72c2 -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java (.../ObjectExtractor.java) (revision c70c4cfe5be79e0627c85cef134184260b0a72c2) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java (.../ObjectExtractor.java) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -1626,10 +1626,15 @@ Iterator iter = oldbranchActivityEntryList.iterator(); while (iter.hasNext()) { BranchActivityEntry oldEntry = (BranchActivityEntry) iter.next(); + SequenceActivity sequenceActivity = oldEntry.getBranchSequenceActivity(); - if (sequenceActivity != null) { + if (sequenceActivity == null) { + oldEntry.getBranchingActivity().getBranchActivityEntries().remove(oldEntry); + + } else { sequenceActivity.getBranchEntries().remove(oldEntry); } + Group group = oldEntry.getGroup(); if (group != null) { group.getBranchActivities().remove(oldEntry); @@ -1653,7 +1658,14 @@ } Integer sequenceActivityUIID = WDDXProcessor.convertToInteger(details, WDDXTAGS.BRANCH_SEQUENCE_ACTIVITY_UIID); - Integer branchingActivityUIID = WDDXProcessor.convertToInteger(details, WDDXTAGS.BRANCH_ACTIVITY_UIID); + Boolean gateOpenWhenConditionMet = WDDXProcessor.convertToBoolean(details, + WDDXTAGS.BRANCH_GATE_OPENS_WHEN_CONDITION_MET); + Integer branchingActivityUIID = null; + if (gateOpenWhenConditionMet != null) { + branchingActivityUIID = WDDXProcessor.convertToInteger(details, WDDXTAGS.BRANCH_GATE_ACTIVITY_UIID); + } else { + branchingActivityUIID = WDDXProcessor.convertToInteger(details, WDDXTAGS.BRANCH_ACTIVITY_UIID); + } Activity branchingActivity = newActivityMap.get(branchingActivityUIID); if (branchingActivity == null) { @@ -1694,12 +1706,15 @@ BranchActivityEntry uiid_match = null; BranchActivityEntry id_match = null; Iterator iter = null; - if (sequenceActivity != null) { + if (sequenceActivity == null) { + ConditionGateActivity conditionGateActitivity = (ConditionGateActivity) branchingActivity; + if (conditionGateActitivity.getBranchActivityEntries() != null) { + iter = conditionGateActitivity.getBranchActivityEntries().iterator(); + } + } else { if (sequenceActivity.getBranchEntries() != null) { iter = sequenceActivity.getBranchEntries().iterator(); } - } else { - iter = ((ConditionGateActivity) branchingActivity).getOpeningGateBranchEntries().iterator(); } if (iter != null) { @@ -1740,19 +1755,28 @@ if (entry == null) { if (condition != null) { - entry = condition.allocateBranchToCondition(entryUIID, sequenceActivity, branchingActivity); + entry = condition.allocateBranchToCondition(entryUIID, sequenceActivity, branchingActivity, + gateOpenWhenConditionMet); } else { entry = group.allocateBranchToGroup(entryUIID, sequenceActivity, (BranchingActivity) branchingActivity); } } else { entry.setEntryUIID(entryUIID); entry.setBranchSequenceActivity(sequenceActivity); entry.setBranchingActivity(branchingActivity); + entry.setGateOpenWhenConditionMet(gateOpenWhenConditionMet); } entry.setGroup(group); entry.setCondition(condition); - if (sequenceActivity != null) { + + if (branchingActivity.isConditionGate()) { + ConditionGateActivity conditionGateActitivity = (ConditionGateActivity) branchingActivity; + if (conditionGateActitivity.getBranchActivityEntries() == null) { + conditionGateActitivity.setBranchActivityEntries(new HashSet()); + } + conditionGateActitivity.getBranchActivityEntries().add(entry); + } else { if (sequenceActivity.getBranchEntries() == null) { sequenceActivity.setBranchEntries(new HashSet()); } Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Activity.hbm.xml =================================================================== diff -u -rda463361264d2a6fa4948cf8c089c649c2f7064a -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Activity.hbm.xml (.../Activity.hbm.xml) (revision da463361264d2a6fa4948cf8c089c649c2f7064a) +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Activity.hbm.xml (.../Activity.hbm.xml) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -253,16 +253,8 @@ @hibernate.class - + @hibernate.class - - @hibernate.set lazy="true" inverse="true" cascade="all-delete-orphan" - @hibernate.collection-key column="branch_activity_id" - @hibernate.collection-one-to-many class="org.lamsfoundation.lams.learningdesign.BranchActivityEntry" - - - - Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/BranchActivityEntry.hbm.xml =================================================================== diff -u -r542b83631b403e37429fce3bb928f2800c5cd9b8 -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/BranchActivityEntry.hbm.xml (.../BranchActivityEntry.hbm.xml) (revision 542b83631b403e37429fce3bb928f2800c5cd9b8) +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/BranchActivityEntry.hbm.xml (.../BranchActivityEntry.hbm.xml) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -20,7 +20,11 @@ @hibernate.property column="group_branch_activity_ui_id" length="11" - + + + + @hibernate.property column="open_gate" + Index: lams_common/db/sql/create_lams_11_tables.sql =================================================================== diff -u -r4b24094f139dd10a9779ce6e678cb8ca38317148 -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_common/db/sql/create_lams_11_tables.sql (.../create_lams_11_tables.sql) (revision 4b24094f139dd10a9779ce6e678cb8ca38317148) +++ lams_common/db/sql/create_lams_11_tables.sql (.../create_lams_11_tables.sql) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -616,6 +616,7 @@ , sequence_activity_id BIGINT(20) , branch_activity_id BIGINT(20) NOT NULL , condition_id BIGINT(20) + , open_gate TINYINT , PRIMARY KEY (entry_id) , INDEX (group_id) , CONSTRAINT FK_lams_group_activity_1 FOREIGN KEY (group_id) Index: lams_common/db/sql/insert_types_data.sql =================================================================== diff -u -rafbddf96d0e99536ff626f456db9b36f7d5df6ae -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_common/db/sql/insert_types_data.sql (.../insert_types_data.sql) (revision afbddf96d0e99536ff626f456db9b36f7d5df6ae) +++ lams_common/db/sql/insert_types_data.sql (.../insert_types_data.sql) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -81,6 +81,7 @@ INSERT INTO lams_learning_activity_type VALUES (11, 'BRANCHING_GROUP'); INSERT INTO lams_learning_activity_type VALUES (12, 'BRANCHING_TOOL'); INSERT INTO lams_learning_activity_type VALUES (13, 'OPTIONS_WITH_SEQUENCES'); +INSERT INTO lams_learning_activity_type VALUES (14, 'GATE_CONDITION'); INSERT INTO lams_gate_activity_level VALUES (1, 'LEARNER'); INSERT INTO lams_gate_activity_level VALUES (2, 'GROUP'); @@ -215,6 +216,14 @@ 'monitoring/sequenceExportPortfolio?mode=teacher', 'monitoring/sequence.do?method=viewSequence', 'monitoring/sequence.do?method=viewSequence', now()); +INSERT INTO lams_system_tool (system_tool_id, learning_activity_type_id, tool_display_name, description, + learner_url, learner_preview_url, learner_progress_url, export_pfolio_learner_url, + export_pfolio_class_url, monitor_url, contribute_url, create_date_time) +VALUES (10, 14, 'Condition Gate', 'Gate: Opens if conditions are met', + 'learning/gate.do?method=knockGate', 'learning/gate.do?method=knockGate', null, null, + 'monitoring/gateExportPortfolio?mode=teacher', 'monitoring/gate.do?method=viewGate', + 'monitoring/gate.do?method=viewGate', now() ); + -- Supported Locales INSERT INTO lams_supported_locale (locale_id, language_iso_code, country_iso_code, description, direction, fckeditor_code) VALUES (1, 'en', 'AU', 'English (Australia)', 'LTR', 'en-au'); Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch0013_updateFrom21.sql =================================================================== diff -u -r4b24094f139dd10a9779ce6e678cb8ca38317148 -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch0013_updateFrom21.sql (.../patch0013_updateFrom21.sql) (revision 4b24094f139dd10a9779ce6e678cb8ca38317148) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch0013_updateFrom21.sql (.../patch0013_updateFrom21.sql) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -40,4 +40,15 @@ CREATE TABLE lams_lesson ( learner_presence_avail TINYINT(1) DEFAULT 0 , learner_im_avail TINYINT(1) DEFAULT 0 -)TYPE=InnoDB; \ No newline at end of file +)TYPE=InnoDB; + +-- LDEV-1299 - Instead of mapping the conditions that open a gate to fictional sequences, there is only a boolean value ------------- +ALTER TABLE lams_branch_activity_entry ADD COLUMN open_gate TINYINT; +INSERT INTO lams_learning_activity_type VALUES (14, 'GATE_CONDITION'); +INSERT INTO lams_system_tool (system_tool_id, learning_activity_type_id, tool_display_name, description, + learner_url, learner_preview_url, learner_progress_url, export_pfolio_learner_url, + export_pfolio_class_url, monitor_url, contribute_url, create_date_time) +VALUES (10, 14, 'Condition Gate', 'Gate: Opens if conditions are met', + 'learning/gate.do?method=knockGate', 'learning/gate.do?method=knockGate', null, null, + 'monitoring/gateExportPortfolio?mode=teacher', 'monitoring/gate.do?method=viewGate', + 'monitoring/gate.do?method=viewGate', now() ); \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/Activity.java =================================================================== diff -u -r6d0ec5db1add705fb9da59656aaa4916e1163893 -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/Activity.java (.../Activity.java) (revision 6d0ec5db1add705fb9da59656aaa4916e1163893) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/Activity.java (.../Activity.java) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -46,1077 +46,1105 @@ import org.lamsfoundation.lams.util.Nullable; /** - * Base class for all activities. If you add another subclass, - * you must update ActivityDAO.getActivityByActivityId() and add a - * ACTIVITY_TYPE constant. + * Base class for all activities. If you add another subclass, you must update ActivityDAO.getActivityByActivityId() and + * add a ACTIVITY_TYPE constant. * * @hibernate.class table="lams_learning_activity" */ public abstract class Activity implements Serializable, Nullable { - //--------------------------------------------------------------------- - // Class Level Constants - //--------------------------------------------------------------------- - /* - * static final variables indicating the type of activities - * available for a LearningDesign. As new types of activities - * are added, these constants must be updated, as well as - * ActivityDAO.getActivityByActivityId() - * - * OPTIONS_WITH_SEQUENCES_TYPE is set up just to support Flash. - * The server treads OptionsActivity and OptionalSequenceActivity - * the same. - */ - /* *****************************************************************/ - public static final int TOOL_ACTIVITY_TYPE = 1; - public static final int GROUPING_ACTIVITY_TYPE = 2; - public static final int SYNCH_GATE_ACTIVITY_TYPE = 3; - public static final int SCHEDULE_GATE_ACTIVITY_TYPE = 4; - public static final int PERMISSION_GATE_ACTIVITY_TYPE = 5; - public static final int PARALLEL_ACTIVITY_TYPE = 6; - public static final int OPTIONS_ACTIVITY_TYPE = 7; - public static final int SEQUENCE_ACTIVITY_TYPE = 8; - public static final int SYSTEM_GATE_ACTIVITY_TYPE = 9; - public static final int CHOSEN_BRANCHING_ACTIVITY_TYPE = 10; - public static final int GROUP_BRANCHING_ACTIVITY_TYPE = 11; - public static final int TOOL_BRANCHING_ACTIVITY_TYPE = 12; - public static final int OPTIONS_WITH_SEQUENCES_TYPE = 13; - public static final int CONDITION_GATE_ACTIVITY_TYPE = 14; - /******************************************************************/ + // --------------------------------------------------------------------- + // Class Level Constants + // --------------------------------------------------------------------- + /* + * static final variables indicating the type of activities available for a LearningDesign. As new types of + * activities are added, these constants must be updated, as well as ActivityDAO.getActivityByActivityId() + * + * OPTIONS_WITH_SEQUENCES_TYPE is set up just to support Flash. The server treads OptionsActivity and + * OptionalSequenceActivity the same. + */ + /* **************************************************************** */ + public static final int TOOL_ACTIVITY_TYPE = 1; + public static final int GROUPING_ACTIVITY_TYPE = 2; + public static final int SYNCH_GATE_ACTIVITY_TYPE = 3; + public static final int SCHEDULE_GATE_ACTIVITY_TYPE = 4; + public static final int PERMISSION_GATE_ACTIVITY_TYPE = 5; + public static final int PARALLEL_ACTIVITY_TYPE = 6; + public static final int OPTIONS_ACTIVITY_TYPE = 7; + public static final int SEQUENCE_ACTIVITY_TYPE = 8; + public static final int SYSTEM_GATE_ACTIVITY_TYPE = 9; + public static final int CHOSEN_BRANCHING_ACTIVITY_TYPE = 10; + public static final int GROUP_BRANCHING_ACTIVITY_TYPE = 11; + public static final int TOOL_BRANCHING_ACTIVITY_TYPE = 12; + public static final int OPTIONS_WITH_SEQUENCES_TYPE = 13; + public static final int CONDITION_GATE_ACTIVITY_TYPE = 14; + /** *************************************************************** */ - /** - * static final variables indicating the the category of activities - *******************************************************************/ - public static final int CATEGORY_SYSTEM = 1; - public static final int CATEGORY_COLLABORATION = 2; - public static final int CATEGORY_ASSESSMENT = 3; - public static final int CATEGORY_CONTENT = 4; - public static final int CATEGORY_SPLIT = 5; - public static final int CATEGORY_RESPONSE = 6; - /******************************************************************/ + /******************************************************************************************************************* + * static final variables indicating the the category of activities + ******************************************************************************************************************/ + public static final int CATEGORY_SYSTEM = 1; + public static final int CATEGORY_COLLABORATION = 2; + public static final int CATEGORY_ASSESSMENT = 3; + public static final int CATEGORY_CONTENT = 4; + public static final int CATEGORY_SPLIT = 5; + public static final int CATEGORY_RESPONSE = 6; + /** *************************************************************** */ - /** - * static final variables indicating the grouping_support of activities - *******************************************************************/ - public static final int GROUPING_SUPPORT_NONE = 1; - public static final int GROUPING_SUPPORT_OPTIONAL = 2; - public static final int GROUPING_SUPPORT_REQUIRED = 3; - /******************************************************************/ + /******************************************************************************************************************* + * static final variables indicating the grouping_support of activities + ******************************************************************************************************************/ + public static final int GROUPING_SUPPORT_NONE = 1; + public static final int GROUPING_SUPPORT_OPTIONAL = 2; + public static final int GROUPING_SUPPORT_REQUIRED = 3; + /** *************************************************************** */ - /** - * Entries for an activity in a language property file - */ - public static final String I18N_TITLE = "activity.title"; - public static final String I18N_DESCRIPTION = "activity.description"; - public static final String I18N_HELP_TEXT = "activity.helptext"; + /** + * Entries for an activity in a language property file + */ + public static final String I18N_TITLE = "activity.title"; + public static final String I18N_DESCRIPTION = "activity.description"; + public static final String I18N_HELP_TEXT = "activity.helptext"; - //--------------------------------------------------------------------- - // Instance variables - //--------------------------------------------------------------------- - /** WDDX packet specific attribute created to identify the - * type of object being passed.*/ - public static final String OBJECT_TYPE = "Activity"; + // --------------------------------------------------------------------- + // Instance variables + // --------------------------------------------------------------------- + /** + * WDDX packet specific attribute created to identify the type of object being passed. + */ + public static final String OBJECT_TYPE = "Activity"; - /** identifier field */ - private Long activityId; + /** identifier field */ + private Long activityId; - /** FLASH generated value. Unique per LearningDesign. - * Required by flash only.*/ - private Integer activityUIID; + /** + * FLASH generated value. Unique per LearningDesign. Required by flash only. + */ + private Integer activityUIID; - /** Description of the activity*/ - private String description; + /** Description of the activity */ + private String description; - /** Title of the activity*/ - private String title; + /** Title of the activity */ + private String title; - /** Help text for the activity*/ - private String helpText; + /** Help text for the activity */ + private String helpText; - /** UI specific attribute indicating the - * position of the activity*/ - private Integer xcoord; + /** + * UI specific attribute indicating the position of the activity + */ + private Integer xcoord; - /** UI specific attribute indicating the - * position of the activity*/ - private Integer ycoord; + /** + * UI specific attribute indicating the position of the activity + */ + private Integer ycoord; - /** Indicates the order in which the activities - * appear inside complex activities. Starts from - * 0, 1 and so on.*/ - private Integer orderId; + /** + * Indicates the order in which the activities appear inside complex activities. Starts from 0, 1 and so on. + */ + private Integer orderId; - /** Indicates whether the content of this activity - * would be defined later in the monitoring environment or not.*/ - private Boolean defineLater; + /** + * Indicates whether the content of this activity would be defined later in the monitoring environment or not. + */ + private Boolean defineLater; - /** Indicates whether this activity is available offline*/ - private Boolean runOffline; + /** Indicates whether this activity is available offline */ + private Boolean runOffline; - /** Date this activity was created */ - private Date createDateTime; + /** Date this activity was created */ + private Date createDateTime; - /** The image that represents the icon of this - * activity in the UI*/ - private String libraryActivityUiImage; + /** + * The image that represents the icon of this activity in the UI + */ + private String libraryActivityUiImage; - /** The LearningLibrary of which this activity is a part*/ - private LearningLibrary learningLibrary; + /** The LearningLibrary of which this activity is a part */ + private LearningLibrary learningLibrary; - /** The activity that acts as a container/parent for - * this activity. Normally would be one of the - * complex activities which have child activities - * defined inside them. */ - private Activity parentActivity; + /** + * The activity that acts as a container/parent for this activity. Normally would be one of the complex activities + * which have child activities defined inside them. + */ + private Activity parentActivity; - /** Single Library can have one or more activities - * defined inside it. This field indicates which - * activity is this.*/ - private Activity libraryActivity; + /** + * Single Library can have one or more activities defined inside it. This field indicates which activity is this. + */ + private Activity libraryActivity; - /** The LearningDesign to which this activity belongs*/ - private LearningDesign learningDesign; + /** The LearningDesign to which this activity belongs */ + private LearningDesign learningDesign; - /** The Grouping that applies to this activity*/ - private Grouping grouping; + /** The Grouping that applies to this activity */ + private Grouping grouping; - /** The grouping_ui_id of the Grouping that - * applies that to this activity - * */ - private Integer groupingUIID; + /** + * The grouping_ui_id of the Grouping that applies that to this activity + */ + private Integer groupingUIID; - /** The type of activity */ - private Integer activityTypeId; + /** The type of activity */ + private Integer activityTypeId; - /** The category of activity */ - private Integer activityCategoryID; + /** The category of activity */ + private Integer activityCategoryID; - /** persistent field */ - private Transition transitionTo; + /** persistent field */ + private Transition transitionTo; - /** persistent field */ - private Transition transitionFrom; + /** persistent field */ + private Transition transitionFrom; - /** the activity_ui_id of the parent activity */ - private Integer parentUIID; + /** the activity_ui_id of the parent activity */ + private Integer parentUIID; - private Boolean applyGrouping; + private Boolean applyGrouping; - private Integer groupingSupportType; + private Integer groupingSupportType; - /** Name of the file (including the package) that contains the text strings for - * this activity. e.g. org.lamsfoundation.lams.tool.sbmt.SbmtResources.properties. */ - private String languageFile; + /** + * Name of the file (including the package) that contains the text strings for this activity. e.g. + * org.lamsfoundation.lams.tool.sbmt.SbmtResources.properties. + */ + private String languageFile; - /** An activity is readOnly when a learner starts doing the activity. - * Used in editOnFly. */ - private Boolean readOnly; + /** + * An activity is readOnly when a learner starts doing the activity. Used in editOnFly. + */ + private Boolean readOnly; - /** An activity is initialised if it is ready to be used in lesson ie the tool content - * is set up, schedule gates are scheduled, etc. Used to detect which activities - * need to be initialised for live edit. */ - private Boolean initialised; + /** + * An activity is initialised if it is ready to be used in lesson ie the tool content is set up, schedule gates are + * scheduled, etc. Used to detect which activities need to be initialised for live edit. + */ + private Boolean initialised; - /** If stopAfterActivity is true, then the progress engine should "end" the lesson at this point. - * Used to arbitrarily stop somewhere in a design, such as at the end of the branch. The normal - * final activity of a design does not necessarily have this set - the progress engine will just - * stop when it runs out of transitions to follow. */ - private Boolean stopAfterActivity; + /** + * If stopAfterActivity is true, then the progress engine should "end" the lesson at this point. Used to arbitrarily + * stop somewhere in a design, such as at the end of the branch. The normal final activity of a design does not + * necessarily have this set - the progress engine will just stop when it runs out of transitions to follow. + */ + private Boolean stopAfterActivity; - /** - * The activities that supplied inputs to this activity. - */ - private Set inputActivities; - - /** - * The BranchActivityEntries that map conditions to this Activity; bi-directional association - * required (e.g. LDEV-1910) - */ - private Set branchActivityEntries; + /** + * The activities that supplied inputs to this activity. + */ + private Set inputActivities; - //--------------------------------------------------------------------- - // Object constructors - //--------------------------------------------------------------------- + /** + * The BranchActivityEntries that map conditions to this Activity; bi-directional association required (e.g. + * LDEV-1910) + */ + private Set branchActivityEntries; - /* For the createDateTime fields, if the value is null, then it will default - * to the current time. - */ + // --------------------------------------------------------------------- + // Object constructors + // --------------------------------------------------------------------- - /** full constructor */ - public Activity(Long activityId, Integer id, String description, String title, Integer xcoord, Integer ycoord, - Integer orderId, Boolean defineLater, Date createDateTime, LearningLibrary learningLibrary, Activity parentActivity, - Activity libraryActivity, Integer parentUIID, LearningDesign learningDesign, Grouping grouping, - Integer activityTypeId, Transition transitionTo, Transition transitionFrom, String languageFile, - Boolean stopAfterActivity, Set inputActivities, Set branchActivityEntries) { - this.activityId = activityId; - activityUIID = id; - this.description = description; - this.title = title; - this.xcoord = xcoord; - this.ycoord = ycoord; - this.orderId = orderId; - this.defineLater = defineLater; - this.createDateTime = createDateTime != null ? createDateTime : new Date(); - this.learningLibrary = learningLibrary; - this.parentActivity = parentActivity; - this.parentUIID = parentUIID; - this.libraryActivity = libraryActivity; - this.learningDesign = learningDesign; - this.grouping = grouping; - this.activityTypeId = activityTypeId; - this.transitionTo = transitionTo; - this.transitionFrom = transitionFrom; - this.languageFile = languageFile; - readOnly = false; - initialised = false; - this.stopAfterActivity = stopAfterActivity; - this.inputActivities = inputActivities; - this.branchActivityEntries = branchActivityEntries; - } + /* + * For the createDateTime fields, if the value is null, then it will default to the current time. + */ - /** default constructor */ - public Activity() { - grouping = null; - createDateTime = new Date(); //default value is set to when the object is created - readOnly = false; - initialised = false; - stopAfterActivity = false; - } + /** full constructor */ + public Activity(Long activityId, Integer id, String description, String title, Integer xcoord, Integer ycoord, + Integer orderId, Boolean defineLater, Date createDateTime, LearningLibrary learningLibrary, + Activity parentActivity, Activity libraryActivity, Integer parentUIID, LearningDesign learningDesign, + Grouping grouping, Integer activityTypeId, Transition transitionTo, Transition transitionFrom, + String languageFile, Boolean stopAfterActivity, Set inputActivities, Set branchActivityEntries) { + this.activityId = activityId; + activityUIID = id; + this.description = description; + this.title = title; + this.xcoord = xcoord; + this.ycoord = ycoord; + this.orderId = orderId; + this.defineLater = defineLater; + this.createDateTime = createDateTime != null ? createDateTime : new Date(); + this.learningLibrary = learningLibrary; + this.parentActivity = parentActivity; + this.parentUIID = parentUIID; + this.libraryActivity = libraryActivity; + this.learningDesign = learningDesign; + this.grouping = grouping; + this.activityTypeId = activityTypeId; + this.transitionTo = transitionTo; + this.transitionFrom = transitionFrom; + this.languageFile = languageFile; + readOnly = false; + initialised = false; + this.stopAfterActivity = stopAfterActivity; + this.inputActivities = inputActivities; + this.branchActivityEntries = branchActivityEntries; + } - /** minimal constructor */ - public Activity(Long activityId, Boolean defineLater, Date createDateTime, LearningLibrary learningLibrary, - Activity parentActivity, LearningDesign learningDesign, Grouping grouping, Integer activityTypeId, - Transition transitionTo, Transition transitionFrom) { - this.activityId = activityId; - this.defineLater = defineLater; - this.createDateTime = createDateTime != null ? createDateTime : new Date(); - this.learningLibrary = learningLibrary; - this.parentActivity = parentActivity; - this.learningDesign = learningDesign; - this.grouping = grouping; - this.activityTypeId = activityTypeId; - this.transitionTo = transitionTo; - this.transitionFrom = transitionFrom; - readOnly = false; - initialised = false; - stopAfterActivity = false; - } + /** default constructor */ + public Activity() { + grouping = null; + createDateTime = new Date(); // default value is set to when the object is created + readOnly = false; + initialised = false; + stopAfterActivity = false; + } - public static Activity getActivityInstance(int activityType) { - // the default constructors don't set up the activity type - // so we need to do that manually - // also default to a sensible category type - Activity activity = null; - switch (activityType) { - case TOOL_ACTIVITY_TYPE: - activity = new ToolActivity(); - activity.setActivityCategoryID(Activity.CATEGORY_CONTENT); - break; - case OPTIONS_ACTIVITY_TYPE: - activity = new OptionsActivity(); - activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); - break; - case PARALLEL_ACTIVITY_TYPE: - activity = new ParallelActivity(); - activity.setActivityCategoryID(Activity.CATEGORY_SPLIT); - break; - case SEQUENCE_ACTIVITY_TYPE: - activity = new SequenceActivity(); - activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); - break; - case SYNCH_GATE_ACTIVITY_TYPE: - activity = new SynchGateActivity(); - activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); - break; - case SCHEDULE_GATE_ACTIVITY_TYPE: - activity = new ScheduleGateActivity(); - activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); - break; - case PERMISSION_GATE_ACTIVITY_TYPE: - activity = new PermissionGateActivity(); - activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); - break; - case SYSTEM_GATE_ACTIVITY_TYPE: - activity = new SystemGateActivity(); - activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); - break; - case CHOSEN_BRANCHING_ACTIVITY_TYPE: - activity = new ChosenBranchingActivity(); - activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); - break; - case GROUP_BRANCHING_ACTIVITY_TYPE: - activity = new GroupBranchingActivity(); - activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); - break; - case TOOL_BRANCHING_ACTIVITY_TYPE: - activity = new ToolBranchingActivity(); - activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); - break; - case OPTIONS_WITH_SEQUENCES_TYPE: - activity = new OptionsWithSequencesActivity(); - activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); - break; - default: - activity = new GroupingActivity(); - activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); - break; - } - activity.setActivityTypeId(new Integer(activityType)); - return activity; - } + /** minimal constructor */ + public Activity(Long activityId, Boolean defineLater, Date createDateTime, LearningLibrary learningLibrary, + Activity parentActivity, LearningDesign learningDesign, Grouping grouping, Integer activityTypeId, + Transition transitionTo, Transition transitionFrom) { + this.activityId = activityId; + this.defineLater = defineLater; + this.createDateTime = createDateTime != null ? createDateTime : new Date(); + this.learningLibrary = learningLibrary; + this.parentActivity = parentActivity; + this.learningDesign = learningDesign; + this.grouping = grouping; + this.activityTypeId = activityTypeId; + this.transitionTo = transitionTo; + this.transitionFrom = transitionFrom; + readOnly = false; + initialised = false; + stopAfterActivity = false; + } - //--------------------------------------------------------------------- - // Getters and Setters - //--------------------------------------------------------------------- - /** - * @hibernate.activityUIID generator-class="native" type="java.lang.Long" - * column="activity_id" - */ - public Long getActivityId() { - return activityId; + public static Activity getActivityInstance(int activityType) { + // the default constructors don't set up the activity type + // so we need to do that manually + // also default to a sensible category type + Activity activity = null; + switch (activityType) { + case TOOL_ACTIVITY_TYPE: + activity = new ToolActivity(); + activity.setActivityCategoryID(Activity.CATEGORY_CONTENT); + break; + case OPTIONS_ACTIVITY_TYPE: + activity = new OptionsActivity(); + activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); + break; + case PARALLEL_ACTIVITY_TYPE: + activity = new ParallelActivity(); + activity.setActivityCategoryID(Activity.CATEGORY_SPLIT); + break; + case SEQUENCE_ACTIVITY_TYPE: + activity = new SequenceActivity(); + activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); + break; + case SYNCH_GATE_ACTIVITY_TYPE: + activity = new SynchGateActivity(); + activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); + break; + case SCHEDULE_GATE_ACTIVITY_TYPE: + activity = new ScheduleGateActivity(); + activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); + break; + case PERMISSION_GATE_ACTIVITY_TYPE: + activity = new PermissionGateActivity(); + activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); + break; + case SYSTEM_GATE_ACTIVITY_TYPE: + activity = new SystemGateActivity(); + activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); + break; + case CONDITION_GATE_ACTIVITY_TYPE: + activity = new ConditionGateActivity(); + activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); + break; + case CHOSEN_BRANCHING_ACTIVITY_TYPE: + activity = new ChosenBranchingActivity(); + activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); + break; + case GROUP_BRANCHING_ACTIVITY_TYPE: + activity = new GroupBranchingActivity(); + activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); + break; + case TOOL_BRANCHING_ACTIVITY_TYPE: + activity = new ToolBranchingActivity(); + activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); + break; + case OPTIONS_WITH_SEQUENCES_TYPE: + activity = new OptionsWithSequencesActivity(); + activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); + break; + default: + activity = new GroupingActivity(); + activity.setActivityCategoryID(Activity.CATEGORY_SYSTEM); + break; } + activity.setActivityTypeId(new Integer(activityType)); + return activity; + } - public void setActivityId(Long activityId) { - this.activityId = activityId; - } + // --------------------------------------------------------------------- + // Getters and Setters + // --------------------------------------------------------------------- + /** + * @hibernate.activityUIID generator-class="native" type="java.lang.Long" column="activity_id" + */ + public Long getActivityId() { + return activityId; + } - /** - * @hibernate.property column="activityUIID" length="11" - */ - public Integer getActivityUIID() { - return activityUIID; - } + public void setActivityId(Long activityId) { + this.activityId = activityId; + } - public void setActivityUIID(Integer id) { - activityUIID = id; - } + /** + * @hibernate.property column="activityUIID" length="11" + */ + public Integer getActivityUIID() { + return activityUIID; + } - /** - * @hibernate.property column="description" length="65535" - */ - public String getDescription() { - return description; - } + public void setActivityUIID(Integer id) { + activityUIID = id; + } - public void setDescription(String description) { - this.description = description; - } + /** + * @hibernate.property column="description" length="65535" + */ + public String getDescription() { + return description; + } - /** - * @hibernate.property column="title" length="255" - */ - public String getTitle() { - return title; - } + public void setDescription(String description) { + this.description = description; + } - public void setTitle(String title) { - this.title = title; - } + /** + * @hibernate.property column="title" length="255" + */ + public String getTitle() { + return title; + } - /** - * @hibernate.property column="xcoord" length="11" - */ - public Integer getXcoord() { - return xcoord; - } + public void setTitle(String title) { + this.title = title; + } - public void setXcoord(Integer xcoord) { - this.xcoord = xcoord; - } + /** + * @hibernate.property column="xcoord" length="11" + */ + public Integer getXcoord() { + return xcoord; + } - /** - * @hibernate.property column="ycoord" length="11" - */ - public Integer getYcoord() { - return ycoord; - } + public void setXcoord(Integer xcoord) { + this.xcoord = xcoord; + } - public void setYcoord(Integer ycoord) { - this.ycoord = ycoord; - } + /** + * @hibernate.property column="ycoord" length="11" + */ + public Integer getYcoord() { + return ycoord; + } - /** - * @hibernate.property column="order_id" length="11" - */ - public Integer getOrderId() { - return orderId; - } + public void setYcoord(Integer ycoord) { + this.ycoord = ycoord; + } - public void setOrderId(Integer orderId) { - this.orderId = orderId; - } + /** + * @hibernate.property column="order_id" length="11" + */ + public Integer getOrderId() { + return orderId; + } - /** - * @hibernate.property column="define_later_flag" length="4" not-null="true" - */ - public Boolean getDefineLater() { - return defineLater; - } + public void setOrderId(Integer orderId) { + this.orderId = orderId; + } - public void setDefineLater(Boolean defineLater) { - this.defineLater = defineLater; - } + /** + * @hibernate.property column="define_later_flag" length="4" not-null="true" + */ + public Boolean getDefineLater() { + return defineLater; + } - /** - * @hibernate.property column="create_date_time" length="19" not-null="true" - */ - public Date getCreateDateTime() { - return createDateTime; - } + public void setDefineLater(Boolean defineLater) { + this.defineLater = defineLater; + } - /* If createDateTime is null, then it will default to the current date/time */ - public void setCreateDateTime(Date createDateTime) { - this.createDateTime = createDateTime != null ? createDateTime : new Date(); - } + /** + * @hibernate.property column="create_date_time" length="19" not-null="true" + */ + public Date getCreateDateTime() { + return createDateTime; + } - /** - * @hibernate.many-to-one not-null="true" - * @hibernate.column name="learning_library_id" - * - */ - public org.lamsfoundation.lams.learningdesign.LearningLibrary getLearningLibrary() { - return learningLibrary; - } + /* If createDateTime is null, then it will default to the current date/time */ + public void setCreateDateTime(Date createDateTime) { + this.createDateTime = createDateTime != null ? createDateTime : new Date(); + } - public void setLearningLibrary(org.lamsfoundation.lams.learningdesign.LearningLibrary learningLibrary) { - this.learningLibrary = learningLibrary; - } + /** + * @hibernate.many-to-one not-null="true" + * @hibernate.column name="learning_library_id" + * + */ + public org.lamsfoundation.lams.learningdesign.LearningLibrary getLearningLibrary() { + return learningLibrary; + } - /** - * @hibernate.many-to-one not-null="true" - * @hibernate.column name="parent_activity_id" - * - */ - public org.lamsfoundation.lams.learningdesign.Activity getParentActivity() { - return parentActivity; - } + public void setLearningLibrary(org.lamsfoundation.lams.learningdesign.LearningLibrary learningLibrary) { + this.learningLibrary = learningLibrary; + } - public void setParentActivity(Activity parentActivity) { - this.parentActivity = parentActivity; - } + /** + * @hibernate.many-to-one not-null="true" + * @hibernate.column name="parent_activity_id" + * + */ + public org.lamsfoundation.lams.learningdesign.Activity getParentActivity() { + return parentActivity; + } - /** - * @hibernate.many-to-one not-null="true" - * @hibernate.column name="learning_design_id" - * - */ - public org.lamsfoundation.lams.learningdesign.LearningDesign getLearningDesign() { - return learningDesign; - } + public void setParentActivity(Activity parentActivity) { + this.parentActivity = parentActivity; + } - public void setLearningDesign(org.lamsfoundation.lams.learningdesign.LearningDesign learningDesign) { - this.learningDesign = learningDesign; - } + /** + * @hibernate.many-to-one not-null="true" + * @hibernate.column name="learning_design_id" + * + */ + public org.lamsfoundation.lams.learningdesign.LearningDesign getLearningDesign() { + return learningDesign; + } - /** - * @hibernate.many-to-one not-null="true" - * @hibernate.column name="grouping_id" - * - */ - public org.lamsfoundation.lams.learningdesign.Grouping getGrouping() { - return grouping; - } + public void setLearningDesign(org.lamsfoundation.lams.learningdesign.LearningDesign learningDesign) { + this.learningDesign = learningDesign; + } - public void setGrouping(org.lamsfoundation.lams.learningdesign.Grouping grouping) { - this.grouping = grouping; - } + /** + * @hibernate.many-to-one not-null="true" + * @hibernate.column name="grouping_id" + * + */ + public org.lamsfoundation.lams.learningdesign.Grouping getGrouping() { + return grouping; + } - /** - * @hibernate.many-to-one not-null="true" - * @hibernate.column name="learning_activity_type_id" - * - */ - public Integer getActivityTypeId() { - return activityTypeId; - } + public void setGrouping(org.lamsfoundation.lams.learningdesign.Grouping grouping) { + this.grouping = grouping; + } - public void setActivityTypeId(Integer activityTypeId) { - this.activityTypeId = activityTypeId; - } + /** + * @hibernate.many-to-one not-null="true" + * @hibernate.column name="learning_activity_type_id" + * + */ + public Integer getActivityTypeId() { + return activityTypeId; + } - /** - * @return Returns the applyGrouping. - */ - public Boolean getApplyGrouping() { - return applyGrouping; - } + public void setActivityTypeId(Integer activityTypeId) { + this.activityTypeId = activityTypeId; + } - /** - * @param applyGrouping The applyGrouping to set. - */ - public void setApplyGrouping(Boolean applyGrouping) { - this.applyGrouping = applyGrouping; - } + /** + * @return Returns the applyGrouping. + */ + public Boolean getApplyGrouping() { + return applyGrouping; + } - /** - * @return Returns the groupingSupportType. - */ - public Integer getGroupingSupportType() { - return groupingSupportType; - } + /** + * @param applyGrouping + * The applyGrouping to set. + */ + public void setApplyGrouping(Boolean applyGrouping) { + this.applyGrouping = applyGrouping; + } - /** - * @param groupingSupportType The groupingSupportType to set. - */ - public void setGroupingSupportType(Integer groupingSupportType) { - this.groupingSupportType = groupingSupportType; - } + /** + * @return Returns the groupingSupportType. + */ + public Integer getGroupingSupportType() { + return groupingSupportType; + } - /** - * @return Returns the readOnly. - */ - public Boolean getReadOnly() { - return readOnly; - } + /** + * @param groupingSupportType + * The groupingSupportType to set. + */ + public void setGroupingSupportType(Integer groupingSupportType) { + this.groupingSupportType = groupingSupportType; + } - /** - * @param readOnly The readOnly to set. - */ - public void setReadOnly(Boolean readOnly) { - this.readOnly = readOnly; - } + /** + * @return Returns the readOnly. + */ + public Boolean getReadOnly() { + return readOnly; + } - /** - * @return Returns the initialised flag. - */ - public Boolean isInitialised() { - return initialised; - } + /** + * @param readOnly + * The readOnly to set. + */ + public void setReadOnly(Boolean readOnly) { + this.readOnly = readOnly; + } - /** - * @param readOnly The readOnly to set. - */ - public void setInitialised(Boolean initialised) { - this.initialised = initialised; - } + /** + * @return Returns the initialised flag. + */ + public Boolean isInitialised() { + return initialised; + } - /** - * @return Returns the stopAfterActivity flag. - */ - public Boolean isStopAfterActivity() { - return stopAfterActivity; - } + /** + * @param readOnly + * The readOnly to set. + */ + public void setInitialised(Boolean initialised) { + this.initialised = initialised; + } - /** - * @param readOnly The stopAfterActivity to set. - */ - public void setStopAfterActivity(Boolean stopAfterActivity) { - this.stopAfterActivity = stopAfterActivity; - } + /** + * @return Returns the stopAfterActivity flag. + */ + public Boolean isStopAfterActivity() { + return stopAfterActivity; + } - /** - * @return Returns the inputActivities. - */ - public Set getInputActivities() { - if (inputActivities == null) { - this.setInputActivities(new HashSet()); - } - return inputActivities; - } + /** + * @param readOnly + * The stopAfterActivity to set. + */ + public void setStopAfterActivity(Boolean stopAfterActivity) { + this.stopAfterActivity = stopAfterActivity; + } - /** - * @param InputActivities The InputActivities to set. - */ - public void setInputActivities(Set inputActivities) { - this.inputActivities = inputActivities; + /** + * @return Returns the inputActivities. + */ + public Set getInputActivities() { + if (inputActivities == null) { + this.setInputActivities(new HashSet()); } - - /** - * @return Returns the branchActivityEntries. - */ - public Set getBranchActivityEntries() { - return branchActivityEntries; - } + return inputActivities; + } - /** - * @param branchActivityEntries The branchActivityEntries to set. - */ - public void setBranchActivityEntries(Set branchActivityEntries) { - this.branchActivityEntries = branchActivityEntries; - } + /** + * @param InputActivities + * The InputActivities to set. + */ + public void setInputActivities(Set inputActivities) { + this.inputActivities = inputActivities; + } - @Override - public String toString() { - return new ToStringBuilder(this).append("activityId", activityId).append("activityUIID", activityUIID).append( - "description", description).toString(); - } + /** + * @return Returns the branchActivityEntries. + */ + public Set getBranchActivityEntries() { + return branchActivityEntries; + } - @Override - public boolean equals(Object other) { - if (this == other) { - return true; - } - if (!(other instanceof Activity)) { - return false; - } - Activity castOther = (Activity) other; - return new EqualsBuilder().append(this.getActivityId(), castOther.getActivityId()).append(this.getActivityUIID(), - castOther.getActivityUIID()).isEquals(); - } + /** + * @param branchActivityEntries + * The branchActivityEntries to set. + */ + public void setBranchActivityEntries(Set branchActivityEntries) { + this.branchActivityEntries = branchActivityEntries; + } - @Override - public int hashCode() { - return new HashCodeBuilder().append(getActivityId()).append(getActivityUIID()).toHashCode(); - } + @Override + public String toString() { + return new ToStringBuilder(this).append("activityId", activityId).append("activityUIID", activityUIID).append( + "description", description).toString(); + } - /** - * @hibernate.property column="library_activity_ui_image" length="255" - * @return Returns the libraryActivityUiImage. - */ - public String getLibraryActivityUiImage() { - return libraryActivityUiImage; + @Override + public boolean equals(Object other) { + if (this == other) { + return true; } - - /** - * @param libraryActivityUiImage - * The libraryActivityUiImage to set. - */ - public void setLibraryActivityUiImage(String libraryActivityUiImage) { - this.libraryActivityUiImage = libraryActivityUiImage; + if (!(other instanceof Activity)) { + return false; } + Activity castOther = (Activity) other; + return new EqualsBuilder().append(this.getActivityId(), castOther.getActivityId()).append( + this.getActivityUIID(), castOther.getActivityUIID()).isEquals(); + } - /** - * This function returns the Transition that - * STARTS FROM THIS ACTIVITY. In simpler words the - * next activity in the transition. - * - * For example, if we have a transition as following - * A --> B --> C. For activity B this function would - * return C. That is the Transition FROM activity B. - * - * @return Returns the transitionFrom. - */ - public Transition getTransitionFrom() { - return transitionFrom; - } + @Override + public int hashCode() { + return new HashCodeBuilder().append(getActivityId()).append(getActivityUIID()).toHashCode(); + } - /** - * @param transitionFrom The transitionFrom to set. - */ - public void setTransitionFrom(Transition transitionFrom) { - this.transitionFrom = transitionFrom; - } + /** + * @hibernate.property column="library_activity_ui_image" length="255" + * @return Returns the libraryActivityUiImage. + */ + public String getLibraryActivityUiImage() { + return libraryActivityUiImage; + } - /** - * This function returns the Transition that - * POINTS TO THIS ACTIVITY and NOT the transition - * that this activity points to. - * - * For example, if we have a transition as following - * A --> B --> C. For activity B this function would - * return A. That is the Transition that points TO - * activity B. - * - * @return Returns the transitionTo. - */ - public Transition getTransitionTo() { - return transitionTo; - } + /** + * @param libraryActivityUiImage + * The libraryActivityUiImage to set. + */ + public void setLibraryActivityUiImage(String libraryActivityUiImage) { + this.libraryActivityUiImage = libraryActivityUiImage; + } - /** - * @param transitionTo The transitionTo to set. - */ - public void setTransitionTo(Transition transitionTo) { - this.transitionTo = transitionTo; - } + /** + * This function returns the Transition that STARTS FROM THIS ACTIVITY. In simpler words the next activity in the + * transition. + * + * For example, if we have a transition as following A --> B --> C. For activity B this function would return C. + * That is the Transition FROM activity B. + * + * @return Returns the transitionFrom. + */ + public Transition getTransitionFrom() { + return transitionFrom; + } - public Integer getParentUIID() { - return parentUIID; - } + /** + * @param transitionFrom + * The transitionFrom to set. + */ + public void setTransitionFrom(Transition transitionFrom) { + this.transitionFrom = transitionFrom; + } - public void setParentUIID(Integer parent_ui_id) { - parentUIID = parent_ui_id; - } + /** + * This function returns the Transition that POINTS TO THIS ACTIVITY and NOT the transition that this activity + * points to. + * + * For example, if we have a transition as following A --> B --> C. For activity B this function would return A. + * That is the Transition that points TO activity B. + * + * @return Returns the transitionTo. + */ + public Transition getTransitionTo() { + return transitionTo; + } - public Activity getLibraryActivity() { - return libraryActivity; - } + /** + * @param transitionTo + * The transitionTo to set. + */ + public void setTransitionTo(Transition transitionTo) { + this.transitionTo = transitionTo; + } - public void setLibraryActivity(Activity libraryActivity) { - this.libraryActivity = libraryActivity; - } + public Integer getParentUIID() { + return parentUIID; + } - public String getHelpText() { - return helpText; - } + public void setParentUIID(Integer parent_ui_id) { + parentUIID = parent_ui_id; + } - public void setHelpText(String helpText) { - this.helpText = helpText; - } + public Activity getLibraryActivity() { + return libraryActivity; + } - public Integer getGroupingUIID() { - return groupingUIID; - } + public void setLibraryActivity(Activity libraryActivity) { + this.libraryActivity = libraryActivity; + } - public void setGroupingUIID(Integer groupingUIID) { - this.groupingUIID = groupingUIID; - } + public String getHelpText() { + return helpText; + } - public Boolean getRunOffline() { - return runOffline; - } + public void setHelpText(String helpText) { + this.helpText = helpText; + } - public void setRunOffline(Boolean runOffline) { - this.runOffline = runOffline; - } + public Integer getGroupingUIID() { + return groupingUIID; + } - public Integer getActivityCategoryID() { - return activityCategoryID; - } + public void setGroupingUIID(Integer groupingUIID) { + this.groupingUIID = groupingUIID; + } - public void setActivityCategoryID(Integer activityCategoryID) { - this.activityCategoryID = activityCategoryID; - } + public Boolean getRunOffline() { + return runOffline; + } - public String getLanguageFile() { - return languageFile; - } + public void setRunOffline(Boolean runOffline) { + this.runOffline = runOffline; + } - public void setLanguageFile(String languageFile) { - this.languageFile = languageFile; - } + public Integer getActivityCategoryID() { + return activityCategoryID; + } - //--------------------------------------------------------------------- - // Service Methods - //--------------------------------------------------------------------- + public void setActivityCategoryID(Integer activityCategoryID) { + this.activityCategoryID = activityCategoryID; + } - /** - * This method that get all tool activities belong to the current activity. - * - * As the activity object structure might be infinite, we recursively loop - * through the entire structure and added all tool activities into the set - * that we want to return. This method calls a method getToolActivitiesInActivity() - * which must be defined in subclasses for tool or a complex activities. - * This handles the polymorphic aspect of this function. (Note: we can't - * use instanceOf as we are dealing with Hibernate proxies.) - * - * @return the set of all tool activities. - */ - public Set getAllToolActivities() { - SortedSet toolActivities = new TreeSet(new ActivityOrderComparator()); - getToolActivitiesInActivity(toolActivities); - return toolActivities; - } + public String getLanguageFile() { + return languageFile; + } - protected void getToolActivitiesInActivity(SortedSet toolActivities) { + public void setLanguageFile(String languageFile) { + this.languageFile = languageFile; + } - // a simple activity doesn't have any tool activities + // --------------------------------------------------------------------- + // Service Methods + // --------------------------------------------------------------------- - } + /** + * This method that get all tool activities belong to the current activity. + * + * As the activity object structure might be infinite, we recursively loop through the entire structure and added + * all tool activities into the set that we want to return. This method calls a method getToolActivitiesInActivity() + * which must be defined in subclasses for tool or a complex activities. This handles the polymorphic aspect of this + * function. (Note: we can't use instanceOf as we are dealing with Hibernate proxies.) + * + * @return the set of all tool activities. + */ + public Set getAllToolActivities() { + SortedSet toolActivities = new TreeSet(new ActivityOrderComparator()); + getToolActivitiesInActivity(toolActivities); + return toolActivities; + } - /** - * Return the group information for the requested user when he is running - * current activity instance, based on the grouping data in the activity. - * @param learner the requested user - * @return the group that this user belongs to. - */ - public Group getGroupFor(User learner) { - return getGroupFor(learner, this.getGrouping()); - } + protected void getToolActivitiesInActivity(SortedSet toolActivities) { - /** - * Return the group information for the requested user when he is running - * current activity instance, based on the given grouping. - *

- * If we are using the grouping set up in the activity, the grouping will be - * this.getGrouping(). If the activity isn't grouped, then it should use - * the class grouping. - * - * @param learner the requested user - * @return the group that this user belongs to. - */ - protected Group getGroupFor(User learner, Grouping inGrouping) { - if (inGrouping == null) { - throw new IllegalArgumentException("Exception occured in " + "getGroupFor, no grouping has been defined"); - } + // a simple activity doesn't have any tool activities - for (Iterator i = inGrouping.getGroups().iterator(); i.hasNext();) { - Group group = (Group) i.next(); - if (inGrouping.isLearnerGroup(group) && group.hasLearner(learner)) { - return group; - } - } + } - return new NullGroup(); - } + /** + * Return the group information for the requested user when he is running current activity instance, based on the + * grouping data in the activity. + * + * @param learner + * the requested user + * @return the group that this user belongs to. + */ + public Group getGroupFor(User learner) { + return getGroupFor(learner, this.getGrouping()); + } - //--------------------------------------------------------------------- - // Activity Type checking methods - //--------------------------------------------------------------------- - /** - * Check up whether an activity is tool activity or not. - * @return is this activity a tool activity? - */ - public boolean isToolActivity() { - return getActivityTypeId().intValue() == Activity.TOOL_ACTIVITY_TYPE; + /** + * Return the group information for the requested user when he is running current activity instance, based on the + * given grouping. + *

+ * If we are using the grouping set up in the activity, the grouping will be this.getGrouping(). If the activity + * isn't grouped, then it should use the class grouping. + * + * @param learner + * the requested user + * @return the group that this user belongs to. + */ + protected Group getGroupFor(User learner, Grouping inGrouping) { + if (inGrouping == null) { + throw new IllegalArgumentException("Exception occured in " + "getGroupFor, no grouping has been defined"); } - /** - * Check up whether an activity is sequence activity or not. - * @return is this activity a sequence activity? - */ - public boolean isSequenceActivity() { - return getActivityTypeId().intValue() == Activity.SEQUENCE_ACTIVITY_TYPE; + for (Iterator i = inGrouping.getGroups().iterator(); i.hasNext();) { + Group group = (Group) i.next(); + if (inGrouping.isLearnerGroup(group) && group.hasLearner(learner)) { + return group; + } } - public boolean isParallelActivity() { - return getActivityTypeId().intValue() == Activity.PARALLEL_ACTIVITY_TYPE; - } + return new NullGroup(); + } - public boolean isOptionsActivity() { - return getActivityTypeId().intValue() == Activity.OPTIONS_ACTIVITY_TYPE - || getActivityTypeId().intValue() == Activity.OPTIONS_WITH_SEQUENCES_TYPE; - } + // --------------------------------------------------------------------- + // Activity Type checking methods + // --------------------------------------------------------------------- + /** + * Check up whether an activity is tool activity or not. + * + * @return is this activity a tool activity? + */ + public boolean isToolActivity() { + return getActivityTypeId().intValue() == Activity.TOOL_ACTIVITY_TYPE; + } - public boolean isComplexActivity() { - return getActivityTypeId().intValue() == Activity.SEQUENCE_ACTIVITY_TYPE - || getActivityTypeId().intValue() == Activity.PARALLEL_ACTIVITY_TYPE - || getActivityTypeId().intValue() == Activity.OPTIONS_ACTIVITY_TYPE - || getActivityTypeId().intValue() == Activity.OPTIONS_WITH_SEQUENCES_TYPE - || getActivityTypeId().intValue() == Activity.CHOSEN_BRANCHING_ACTIVITY_TYPE - || getActivityTypeId().intValue() == Activity.GROUP_BRANCHING_ACTIVITY_TYPE - || getActivityTypeId().intValue() == Activity.TOOL_BRANCHING_ACTIVITY_TYPE; - } + /** + * Check up whether an activity is sequence activity or not. + * + * @return is this activity a sequence activity? + */ + public boolean isSequenceActivity() { + return getActivityTypeId().intValue() == Activity.SEQUENCE_ACTIVITY_TYPE; + } - public boolean isSystemToolActivity() { - return ISystemToolActivity.class.isInstance(this); - } + public boolean isParallelActivity() { + return getActivityTypeId().intValue() == Activity.PARALLEL_ACTIVITY_TYPE; + } - public boolean isGateActivity() { - return getActivityTypeId().intValue() == Activity.SCHEDULE_GATE_ACTIVITY_TYPE - || getActivityTypeId().intValue() == Activity.PERMISSION_GATE_ACTIVITY_TYPE - || getActivityTypeId().intValue() == Activity.SYNCH_GATE_ACTIVITY_TYPE - || getActivityTypeId().intValue() == Activity.SYSTEM_GATE_ACTIVITY_TYPE; - } + public boolean isOptionsActivity() { + return getActivityTypeId().intValue() == Activity.OPTIONS_ACTIVITY_TYPE + || getActivityTypeId().intValue() == Activity.OPTIONS_WITH_SEQUENCES_TYPE; + } - /** - * Check up whether an activity is synch gate activity or not. - * @return is this activity a synch gate activity? - */ - public boolean isSynchGate() { - return getActivityTypeId().intValue() == Activity.SYNCH_GATE_ACTIVITY_TYPE; - } + public boolean isComplexActivity() { + return getActivityTypeId().intValue() == Activity.SEQUENCE_ACTIVITY_TYPE + || getActivityTypeId().intValue() == Activity.PARALLEL_ACTIVITY_TYPE + || getActivityTypeId().intValue() == Activity.OPTIONS_ACTIVITY_TYPE + || getActivityTypeId().intValue() == Activity.OPTIONS_WITH_SEQUENCES_TYPE + || getActivityTypeId().intValue() == Activity.CHOSEN_BRANCHING_ACTIVITY_TYPE + || getActivityTypeId().intValue() == Activity.GROUP_BRANCHING_ACTIVITY_TYPE + || getActivityTypeId().intValue() == Activity.TOOL_BRANCHING_ACTIVITY_TYPE; + } - /** - * Check up whether an activity is permission gate activity or not. - * @return is this activity a permission gate activity. - */ - public boolean isPermissionGate() { - return getActivityTypeId().intValue() == Activity.PERMISSION_GATE_ACTIVITY_TYPE; - } + public boolean isSystemToolActivity() { + return ISystemToolActivity.class.isInstance(this); + } - /** - * Check up whether an activity is schedule gate activity or not. - * @return is this activity a schedule gate activity. - */ - public boolean isScheduleGate() { - return getActivityTypeId().intValue() == Activity.SCHEDULE_GATE_ACTIVITY_TYPE; - } + public boolean isGateActivity() { + return getActivityTypeId().intValue() == Activity.SCHEDULE_GATE_ACTIVITY_TYPE + || getActivityTypeId().intValue() == Activity.PERMISSION_GATE_ACTIVITY_TYPE + || getActivityTypeId().intValue() == Activity.SYNCH_GATE_ACTIVITY_TYPE + || getActivityTypeId().intValue() == Activity.SYSTEM_GATE_ACTIVITY_TYPE + || getActivityTypeId().intValue() == Activity.CONDITION_GATE_ACTIVITY_TYPE; + } - public boolean isConditionGate() { - return getActivityTypeId().intValue() == Activity.CONDITION_GATE_ACTIVITY_TYPE; - } + /** + * Check up whether an activity is synch gate activity or not. + * + * @return is this activity a synch gate activity? + */ + public boolean isSynchGate() { + return getActivityTypeId().intValue() == Activity.SYNCH_GATE_ACTIVITY_TYPE; + } - /** - * Check up whether an activity is schedule gate activity or not. - * @return is this activity a schedule gate activity. - */ - public boolean isSystemGate() { - return getActivityTypeId().intValue() == Activity.SYSTEM_GATE_ACTIVITY_TYPE; - } + /** + * Check up whether an activity is permission gate activity or not. + * + * @return is this activity a permission gate activity. + */ + public boolean isPermissionGate() { + return getActivityTypeId().intValue() == Activity.PERMISSION_GATE_ACTIVITY_TYPE; + } - /** - * /** - * Check up whether an activity is grouping activity or not. - * @return is this activity a grouping activity - */ - public boolean isGroupingActivity() { - return getActivityTypeId().intValue() == Activity.GROUPING_ACTIVITY_TYPE; - } + /** + * Check up whether an activity is schedule gate activity or not. + * + * @return is this activity a schedule gate activity. + */ + public boolean isScheduleGate() { + return getActivityTypeId().intValue() == Activity.SCHEDULE_GATE_ACTIVITY_TYPE; + } - /** - * Check up whether an activity is some sort of branching activity or not - * @return is this activity a branching activity - */ - public boolean isBranchingActivity() { - return getActivityTypeId().intValue() == Activity.CHOSEN_BRANCHING_ACTIVITY_TYPE - || getActivityTypeId().intValue() == Activity.GROUP_BRANCHING_ACTIVITY_TYPE - || getActivityTypeId().intValue() == Activity.TOOL_BRANCHING_ACTIVITY_TYPE; - } + public boolean isConditionGate() { + return getActivityTypeId().intValue() == Activity.CONDITION_GATE_ACTIVITY_TYPE; + } - /** - * Check up whether an activity is branching activity based on the monitor choice or not. - * @return is this activity a branching activity - */ - public boolean isChosenBranchingActivity() { - return getActivityTypeId().intValue() == Activity.CHOSEN_BRANCHING_ACTIVITY_TYPE; - } + /** + * Check up whether an activity is schedule gate activity or not. + * + * @return is this activity a schedule gate activity. + */ + public boolean isSystemGate() { + return getActivityTypeId().intValue() == Activity.SYSTEM_GATE_ACTIVITY_TYPE; + } - /** - * Check up whether an activity is branching activity based on an existing group or not. - * @return is this activity a branching activity - */ - public boolean isGroupBranchingActivity() { - return getActivityTypeId().intValue() == Activity.GROUP_BRANCHING_ACTIVITY_TYPE; - } + /** + * /** Check up whether an activity is grouping activity or not. + * + * @return is this activity a grouping activity + */ + public boolean isGroupingActivity() { + return getActivityTypeId().intValue() == Activity.GROUPING_ACTIVITY_TYPE; + } - /** - * Check up whether an activity is branching activity based on another activity's output or not. - * @return is this activity a branching activity - */ - public boolean isToolBranchingActivity() { - return getActivityTypeId().intValue() == Activity.TOOL_BRANCHING_ACTIVITY_TYPE; - } + /** + * Check up whether an activity is some sort of branching activity or not + * + * @return is this activity a branching activity + */ + public boolean isBranchingActivity() { + return getActivityTypeId().intValue() == Activity.CHOSEN_BRANCHING_ACTIVITY_TYPE + || getActivityTypeId().intValue() == Activity.GROUP_BRANCHING_ACTIVITY_TYPE + || getActivityTypeId().intValue() == Activity.TOOL_BRANCHING_ACTIVITY_TYPE; + } - public boolean isActivityReadOnly() { - return readOnly.equals(Boolean.TRUE); - } + /** + * Check up whether an activity is branching activity based on the monitor choice or not. + * + * @return is this activity a branching activity + */ + public boolean isChosenBranchingActivity() { + return getActivityTypeId().intValue() == Activity.CHOSEN_BRANCHING_ACTIVITY_TYPE; + } - //--------------------------------------------------------------------- - // Data Transfer object creation methods - //--------------------------------------------------------------------- - /** - * Return the activity dto for progress view. - * @return the activity dto. - */ - public ProgressActivityDTO getProgressActivityData() { - return new ProgressActivityDTO(activityId); - } + /** + * Check up whether an activity is branching activity based on an existing group or not. + * + * @return is this activity a branching activity + */ + public boolean isGroupBranchingActivity() { + return getActivityTypeId().intValue() == Activity.GROUP_BRANCHING_ACTIVITY_TYPE; + } - /** Get the authoring DTO for this activity. Overidden by ComplexActivity. - */ - public Set getAuthoringActivityDTOSet(ArrayList branchMappings, - String languageCode) { - Set dtoSet = new TreeSet(new ActivityDTOOrderComparator()); - dtoSet.add(new AuthoringActivityDTO(this, branchMappings, languageCode)); - return dtoSet; - } + /** + * Check up whether an activity is branching activity based on another activity's output or not. + * + * @return is this activity a branching activity + */ + public boolean isToolBranchingActivity() { + return getActivityTypeId().intValue() == Activity.TOOL_BRANCHING_ACTIVITY_TYPE; + } - public LibraryActivityDTO getLibraryActivityDTO(String languageCode) { - return new LibraryActivityDTO(this, languageCode); - } + public boolean isActivityReadOnly() { + return readOnly.equals(Boolean.TRUE); + } - /** Create a deep copy of the this activity. It should return the same - * subclass as the activity being copied. Generally doesn't copy the "link" type - * fields like transitions, learning design, etc. - * @param uiidOffset - this should be added to UIID fields in any new objects. Used - * when importing a design into another design. - * @return deep copy of this object - */ - public abstract Activity createCopy(int uiidOffset); + // --------------------------------------------------------------------- + // Data Transfer object creation methods + // --------------------------------------------------------------------- + /** + * Return the activity dto for progress view. + * + * @return the activity dto. + */ + public ProgressActivityDTO getProgressActivityData() { + return new ProgressActivityDTO(activityId); + } - protected void copyToNewActivity(Activity newActivity, int uiidOffset) { + /** + * Get the authoring DTO for this activity. Overidden by ComplexActivity. + */ + public Set getAuthoringActivityDTOSet(ArrayList branchMappings, + String languageCode) { + Set dtoSet = new TreeSet(new ActivityDTOOrderComparator()); + dtoSet.add(new AuthoringActivityDTO(this, branchMappings, languageCode)); + return dtoSet; + } - newActivity.setActivityUIID(LearningDesign.addOffset(this.getActivityUIID(), uiidOffset)); - newActivity.setDescription(this.getDescription()); - newActivity.setTitle(this.getTitle()); - newActivity.setHelpText(this.getHelpText()); - newActivity.setXcoord(this.getXcoord()); - newActivity.setYcoord(this.getYcoord()); - newActivity.setActivityTypeId(this.getActivityTypeId()); + public LibraryActivityDTO getLibraryActivityDTO(String languageCode) { + return new LibraryActivityDTO(this, languageCode); + } - newActivity.setGroupingSupportType(this.getGroupingSupportType()); - newActivity.setApplyGrouping(this.getApplyGrouping()); - newActivity.setActivityCategoryID(this.getActivityCategoryID()); + /** + * Create a deep copy of the this activity. It should return the same subclass as the activity being copied. + * Generally doesn't copy the "link" type fields like transitions, learning design, etc. + * + * @param uiidOffset - + * this should be added to UIID fields in any new objects. Used when importing a design into another + * design. + * @return deep copy of this object + */ + public abstract Activity createCopy(int uiidOffset); - newActivity.setGrouping(this.getGrouping()); - newActivity.setGroupingUIID(LearningDesign.addOffset(this.getGroupingUIID(), uiidOffset)); + protected void copyToNewActivity(Activity newActivity, int uiidOffset) { - newActivity.setDefineLater(this.getDefineLater()); - newActivity.setCreateDateTime(new Date()); - newActivity.setRunOffline(this.getRunOffline()); - newActivity.setLearningLibrary(this.getLearningLibrary()); - newActivity.setLibraryActivity(this.getLibraryActivity()); - newActivity.setLibraryActivityUiImage(this.getLibraryActivityUiImage()); - newActivity.setLanguageFile(this.getLanguageFile()); + newActivity.setActivityUIID(LearningDesign.addOffset(this.getActivityUIID(), uiidOffset)); + newActivity.setDescription(this.getDescription()); + newActivity.setTitle(this.getTitle()); + newActivity.setHelpText(this.getHelpText()); + newActivity.setXcoord(this.getXcoord()); + newActivity.setYcoord(this.getYcoord()); + newActivity.setActivityTypeId(this.getActivityTypeId()); - newActivity.setOrderId(this.getOrderId()); - newActivity.setReadOnly(this.getReadOnly()); - newActivity.setStopAfterActivity(this.isStopAfterActivity()); + newActivity.setGroupingSupportType(this.getGroupingSupportType()); + newActivity.setApplyGrouping(this.getApplyGrouping()); + newActivity.setActivityCategoryID(this.getActivityCategoryID()); - newActivity.setParentActivity(this.getParentActivity()); - newActivity.setParentUIID(LearningDesign.addOffset(this.getParentUIID(), uiidOffset)); + newActivity.setGrouping(this.getGrouping()); + newActivity.setGroupingUIID(LearningDesign.addOffset(this.getGroupingUIID(), uiidOffset)); - if (this.getInputActivities() != null && this.getInputActivities().size() > 0) { - newActivity.setInputActivities(new HashSet()); - newActivity.getInputActivities().addAll(this.getInputActivities()); - } - } + newActivity.setDefineLater(this.getDefineLater()); + newActivity.setCreateDateTime(new Date()); + newActivity.setRunOffline(this.getRunOffline()); + newActivity.setLearningLibrary(this.getLearningLibrary()); + newActivity.setLibraryActivity(this.getLibraryActivity()); + newActivity.setLibraryActivityUiImage(this.getLibraryActivityUiImage()); + newActivity.setLanguageFile(this.getLanguageFile()); - // --------------------------------------------------------------------- - // Data Validation methods - //--------------------------------------------------------------------- + newActivity.setOrderId(this.getOrderId()); + newActivity.setReadOnly(this.getReadOnly()); + newActivity.setStopAfterActivity(this.isStopAfterActivity()); - /** - * Validate activity - * - */ - public Vector validateActivity(MessageService messageService) { - return null; + newActivity.setParentActivity(this.getParentActivity()); + newActivity.setParentUIID(LearningDesign.addOffset(this.getParentUIID(), uiidOffset)); + + if (this.getInputActivities() != null && this.getInputActivities().size() > 0) { + newActivity.setInputActivities(new HashSet()); + newActivity.getInputActivities().addAll(this.getInputActivities()); } + } - /** Get the input activity UIIDs in a format suitable for Flash. See also getToolInputActivityID */ - public ArrayList getInputActivityUIIDs() { - ArrayList list = new ArrayList(); - if (getInputActivities() != null && getInputActivities().size() > 0) { - Iterator iter = getInputActivities().iterator(); - while (iter.hasNext()) { - Activity inputAct = (Activity) iter.next(); - list.add(inputAct.getActivityUIID()); - } - } - return list; + // --------------------------------------------------------------------- + // Data Validation methods + // --------------------------------------------------------------------- + + /** + * Validate activity + * + */ + public Vector validateActivity(MessageService messageService) { + return null; + } + + /** Get the input activity UIIDs in a format suitable for Flash. See also getToolInputActivityID */ + public ArrayList getInputActivityUIIDs() { + ArrayList list = new ArrayList(); + if (getInputActivities() != null && getInputActivities().size() > 0) { + Iterator iter = getInputActivities().iterator(); + while (iter.hasNext()) { + Activity inputAct = (Activity) iter.next(); + list.add(inputAct.getActivityUIID()); + } } + return list; + } - /** - * Get the first input activity's UIID as the tool input activity. The db is set up to allow multiple input - * activities, but at present we only support one. See also getInputActivityUIIDs. - */ - public Integer getToolInputActivityUIID() { - if (getInputActivities() != null) { - Iterator iter = getInputActivities().iterator(); - if (iter.hasNext()) { - return ((Activity) iter.next()).getActivityUIID(); - } - } - return null; + /** + * Get the first input activity's UIID as the tool input activity. The db is set up to allow multiple input + * activities, but at present we only support one. See also getInputActivityUIIDs. + */ + public Integer getToolInputActivityUIID() { + if (getInputActivities() != null) { + Iterator iter = getInputActivities().iterator(); + if (iter.hasNext()) { + return ((Activity) iter.next()).getActivityUIID(); + } } + return null; + } - /** - * Is this activity inside a branch? If so, return turn branch activity (ie the sequence, not the - * branching activity. Returns null if not in a branch. - */ - public Activity getParentBranch() { - if (isSequenceActivity() && getParentActivity() != null && getParentActivity().isBranchingActivity()) { - // I'm a branch, so start the process off with my parent! - return getParentBranch(getParentActivity(), new HashSet()); - } - else { - return getParentBranch(this, new HashSet()); - } + /** + * Is this activity inside a branch? If so, return turn branch activity (ie the sequence, not the branching + * activity. Returns null if not in a branch. + */ + public Activity getParentBranch() { + if (isSequenceActivity() && getParentActivity() != null && getParentActivity().isBranchingActivity()) { + // I'm a branch, so start the process off with my parent! + return getParentBranch(getParentActivity(), new HashSet()); + } else { + return getParentBranch(this, new HashSet()); } + } - private Activity getParentBranch(Activity activity, Set processedActivityIds) { + private Activity getParentBranch(Activity activity, Set processedActivityIds) { - Activity parent = activity.getParentActivity(); + Activity parent = activity.getParentActivity(); - if (parent == null) { - return null; - } + if (parent == null) { + return null; + } - if (parent.isBranchingActivity()) { - return activity; - } + if (parent.isBranchingActivity()) { + return activity; + } - // double check that we haven't already processed this activity. Should never happen but if it does it - // would cause an infinite loop. - if (processedActivityIds.contains(activity.getActivityId())) { - return null; - } + // double check that we haven't already processed this activity. Should never happen but if it does it + // would cause an infinite loop. + if (processedActivityIds.contains(activity.getActivityId())) { + return null; + } - processedActivityIds.add(activity.getActivityId()); + processedActivityIds.add(activity.getActivityId()); - return getParentBranch(parent, processedActivityIds); - } + return getParentBranch(parent, processedActivityIds); + } } \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/BranchActivityEntry.java =================================================================== diff -u -r209087915bc219f430c282ad00e5d1e6462f9b5f -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/BranchActivityEntry.java (.../BranchActivityEntry.java) (revision 209087915bc219f430c282ad00e5d1e6462f9b5f) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/BranchActivityEntry.java (.../BranchActivityEntry.java) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -29,204 +29,224 @@ import org.apache.commons.lang.builder.ToStringBuilder; import org.lamsfoundation.lams.learningdesign.dto.BranchActivityEntryDTO; import org.lamsfoundation.lams.learningdesign.dto.ToolOutputBranchActivityEntryDTO; +import org.lamsfoundation.lams.learningdesign.dto.ToolOutputGateActivityEntryDTO; -/** - * 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. - * +/** + * 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 Activity branchingActivity; - /** persistent field */ - private Group group; - /** persistent field */ - private BranchCondition condition; + /** identifier field */ + protected Long entryId; + /** persistent field */ + protected Integer entryUIID; + /** persistent field */ + protected SequenceActivity branchSequenceActivity; + /** persistent field */ + protected Activity branchingActivity; + /** persistent field */ + private Group group; + /** persistent field */ + private BranchCondition condition; + /** persistent field */ + private Boolean gateOpenWhenConditionMet; - /** - * Default Constructor (for hibernate) - */ - public BranchActivityEntry() { - } + /** + * Default Constructor (for hibernate) + */ + public BranchActivityEntry() { + } - /** - * Constructor for group based linking - */ - public BranchActivityEntry(Long entryId, Integer entryUIID, SequenceActivity branchSequenceActivity, - Activity branchingActivity, Group group) { + /** + * Constructor for group based linking + */ + public BranchActivityEntry(Long entryId, Integer entryUIID, SequenceActivity branchSequenceActivity, + Activity branchingActivity, Group group) { - this.entryId = entryId; - this.entryUIID = entryUIID; - this.branchSequenceActivity = branchSequenceActivity; - this.branchingActivity = branchingActivity; - this.group = group; - condition = null; - } + this.entryId = entryId; + this.entryUIID = entryUIID; + this.branchSequenceActivity = branchSequenceActivity; + this.branchingActivity = branchingActivity; + this.group = group; - /** - * Constructor for tool output based linking - */ - public BranchActivityEntry(Long entryId, Integer entryUIID, SequenceActivity branchSequenceActivity, - Activity branchingActivity, BranchCondition condition) { + condition = null; + } - this.entryId = entryId; - this.entryUIID = entryUIID; - this.branchSequenceActivity = branchSequenceActivity; - this.branchingActivity = branchingActivity; - group = null; - this.condition = condition; - } + /** + * Constructor for tool output based linking + */ + public BranchActivityEntry(Long entryId, Integer entryUIID, SequenceActivity branchSequenceActivity, + Activity branchingActivity, BranchCondition condition, Boolean gateOpenWhenConditionMet) { - /** - * @hibernate.id - * generator-class="native" - * type="java.lang.Long" - * column="entry_id" - * - */ - public Long getEntryId() { - return entryId; - } + this.entryId = entryId; + this.entryUIID = entryUIID; + this.branchSequenceActivity = branchSequenceActivity; + this.branchingActivity = branchingActivity; + group = null; + this.gateOpenWhenConditionMet = gateOpenWhenConditionMet; + this.condition = condition; + } - public void setEntryId(Long id) { - entryId = id; - } + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="entry_id" + * + */ + public Long getEntryId() { + return entryId; + } - /** - * @hibernate.property column="entry_ui_id" length="11" - */ - public Integer getEntryUIID() { - return entryUIID; - } + public void setEntryId(Long id) { + entryId = id; + } - public void setEntryUIID(Integer entryUIID) { - this.entryUIID = entryUIID; - } + /** + * @hibernate.property column="entry_ui_id" length="11" + */ + public Integer getEntryUIID() { + return entryUIID; + } - /** - * @hibernate.many-to-one - * not-null="true" - * @hibernate.column name="sequence_activity_id" - * - */ - public org.lamsfoundation.lams.learningdesign.SequenceActivity getBranchSequenceActivity() { - return branchSequenceActivity; - } + public void setEntryUIID(Integer entryUIID) { + this.entryUIID = entryUIID; + } - public void setBranchSequenceActivity(org.lamsfoundation.lams.learningdesign.SequenceActivity branchSequenceActivity) { - this.branchSequenceActivity = branchSequenceActivity; - } + /** + * @hibernate.many-to-one not-null="true" + * @hibernate.column name="sequence_activity_id" + * + */ + public org.lamsfoundation.lams.learningdesign.SequenceActivity getBranchSequenceActivity() { + return branchSequenceActivity; + } - /** - * @hibernate.many-to-one - * not-null="true" - * @hibernate.column name="branch_activity_id" - * - */ - public org.lamsfoundation.lams.learningdesign.Activity getBranchingActivity() { - return branchingActivity; - } + public void setBranchSequenceActivity(org.lamsfoundation.lams.learningdesign.SequenceActivity branchSequenceActivity) { + this.branchSequenceActivity = branchSequenceActivity; + } - public void setBranchingActivity(Activity branchingActivity) { - this.branchingActivity = branchingActivity; - } + /** + * @hibernate.many-to-one not-null="true" + * @hibernate.column name="branch_activity_id" + * + */ + public org.lamsfoundation.lams.learningdesign.Activity getBranchingActivity() { + return branchingActivity; + } - /** - * @hibernate.many-to-one - * not-null="true" - * @hibernate.column name="group_id" - * - */ - public org.lamsfoundation.lams.learningdesign.Group getGroup() { - return group; - } + public void setBranchingActivity(Activity branchingActivity) { + this.branchingActivity = branchingActivity; + } - public void setGroup(org.lamsfoundation.lams.learningdesign.Group group) { - this.group = group; - } + /** + * @hibernate.many-to-one not-null="true" + * @hibernate.column name="group_id" + * + */ + public org.lamsfoundation.lams.learningdesign.Group getGroup() { + return 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 setGroup(org.lamsfoundation.lams.learningdesign.Group group) { + this.group = group; + } - public void setCondition(BranchCondition condition) { - this.condition = condition; - } + /** + * 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 BranchActivityEntryDTO getBranchActivityEntryDTO(Integer toolActivityUIID) { + public void setCondition(BranchCondition condition) { + this.condition = condition; + } - BranchActivityEntryDTO entryDTO = null; - if (getCondition() != null) { - ToolOutputBranchActivityEntryDTO toolEntryDTO = new ToolOutputBranchActivityEntryDTO(); - toolEntryDTO.setCondition(getCondition().getBranchConditionDTO(toolActivityUIID)); - entryDTO = toolEntryDTO; - } - else { - entryDTO = new BranchActivityEntryDTO(); - } + public BranchActivityEntryDTO getBranchActivityEntryDTO(Integer toolActivityUIID) { - entryDTO.setEntryID(getEntryId()); - entryDTO.setEntryUIID(getEntryUIID()); - if (getGroup() != null) { - entryDTO.setGroupUIID(getGroup().getGroupUIID()); - } - entryDTO.setSequenceActivityUIID(getBranchSequenceActivity().getActivityUIID()); - entryDTO.setBranchingActivityUIID(getBranchingActivity().getActivityUIID()); - return entryDTO; - } + BranchActivityEntryDTO entryDTO = null; + if (getCondition() != null) { + ToolOutputBranchActivityEntryDTO toolEntryDTO = null; + if (getGateOpenWhenConditionMet() != null) { + ToolOutputGateActivityEntryDTO gateEntryDTO = new ToolOutputGateActivityEntryDTO(); + gateEntryDTO.setGateOpenWhenConditionMet(getGateOpenWhenConditionMet()); + toolEntryDTO = gateEntryDTO; + } else { + toolEntryDTO = new ToolOutputBranchActivityEntryDTO(); + } + toolEntryDTO.setCondition(getCondition().getBranchConditionDTO(toolActivityUIID)); + entryDTO = toolEntryDTO; - @Override - 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(); + } else { + entryDTO = new BranchActivityEntryDTO(); } - @Override - public int hashCode() { - return new HashCodeBuilder().append(getEntryId()).append(getEntryUIID()).toHashCode(); + entryDTO.setEntryID(getEntryId()); + entryDTO.setEntryUIID(getEntryUIID()); + if (getGroup() != null) { + entryDTO.setGroupUIID(getGroup().getGroupUIID()); } - - public int compareTo(Object other) { - BranchActivityEntry castOther = (BranchActivityEntry) other; - return new CompareToBuilder().append(this.getEntryId(), castOther.getEntryId()).append(this.getEntryUIID(), - castOther.getEntryUIID()).toComparison(); + if (getBranchSequenceActivity() != null) { + entryDTO.setSequenceActivityUIID(getBranchSequenceActivity().getActivityUIID()); } + entryDTO.setBranchingActivityUIID(getBranchingActivity().getActivityUIID()); + return entryDTO; + } - @Override - 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(); + @Override + 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(); + } + @Override + 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(); + } + + @Override + 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(); + } + + /** + * @hibernate.property column="open_gate" + * @return + */ + public Boolean getGateOpenWhenConditionMet() { + return gateOpenWhenConditionMet; + } + + public void setGateOpenWhenConditionMet(Boolean gateOpenWhenConditionMet) { + this.gateOpenWhenConditionMet = gateOpenWhenConditionMet; + } + } \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/BranchCondition.java =================================================================== diff -u -r542b83631b403e37429fce3bb928f2800c5cd9b8 -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/BranchCondition.java (.../BranchCondition.java) (revision 542b83631b403e37429fce3bb928f2800c5cd9b8) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/BranchCondition.java (.../BranchCondition.java) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -209,8 +209,9 @@ * populated if this is called from authoring */ public BranchActivityEntry allocateBranchToCondition(Integer entryUIID, SequenceActivity branch, - Activity outputBasedActivity) { - BranchActivityEntry entry = new BranchActivityEntry(null, entryUIID, branch, outputBasedActivity, this); + Activity outputBasedActivity, Boolean gateOpenWhenConditionMet) { + BranchActivityEntry entry = new BranchActivityEntry(null, entryUIID, branch, outputBasedActivity, this, + gateOpenWhenConditionMet); return entry; } Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/ConditionGateActivity.java =================================================================== diff -u -r6d0ec5db1add705fb9da59656aaa4916e1163893 -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/ConditionGateActivity.java (.../ConditionGateActivity.java) (revision 6d0ec5db1add705fb9da59656aaa4916e1163893) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/ConditionGateActivity.java (.../ConditionGateActivity.java) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -25,6 +25,7 @@ import java.io.Serializable; import java.util.HashSet; +import java.util.Iterator; import java.util.Set; import java.util.Vector; @@ -35,112 +36,124 @@ import org.lamsfoundation.lams.util.MessageService; /** - * Gate activity that is based on tools' output and conditions. + * Gate activity that is based on tools' output and conditions. + * * @author Marcin Cieslak * @hibernate.class */ public class ConditionGateActivity extends GateActivity implements Serializable { - /** - * List of the branch entries which open the gate. - */ - private Set openingGateBranchEntries = new HashSet(); - /** full constructor */ - public ConditionGateActivity(Long activityId, Integer id, String description, String title, Integer xcoord, Integer ycoord, - Integer orderId, Boolean defineLater, java.util.Date createDateTime, LearningLibrary learningLibrary, - Activity parentActivity, Activity libraryActivity, Integer parentUIID, LearningDesign learningDesign, - Grouping grouping, Integer activityTypeId, Transition transitionTo, Transition transitionFrom, String languageFile, - Boolean stopAfterActivity, Set inputActivities, Integer gateActivityLevelId, Set waitingLearners, SystemTool sysTool, - Set branchActivityEntries) { - super(activityId, id, description, title, xcoord, ycoord, orderId, defineLater, createDateTime, learningLibrary, - parentActivity, libraryActivity, parentUIID, learningDesign, grouping, activityTypeId, transitionTo, - transitionFrom, languageFile, stopAfterActivity, inputActivities, gateActivityLevelId, waitingLearners, sysTool, - branchActivityEntries); - super.simpleActivityStrategy = new ConditionGateActivityStrategy(this); - } + /** full constructor */ + public ConditionGateActivity(Long activityId, Integer id, String description, String title, Integer xcoord, + Integer ycoord, Integer orderId, Boolean defineLater, java.util.Date createDateTime, + LearningLibrary learningLibrary, Activity parentActivity, Activity libraryActivity, Integer parentUIID, + LearningDesign learningDesign, Grouping grouping, Integer activityTypeId, Transition transitionTo, + Transition transitionFrom, String languageFile, Boolean stopAfterActivity, Set inputActivities, + Integer gateActivityLevelId, Set waitingLearners, SystemTool sysTool, Set branchActivityEntries) { + super(activityId, id, description, title, xcoord, ycoord, orderId, defineLater, createDateTime, + learningLibrary, parentActivity, libraryActivity, parentUIID, learningDesign, grouping, activityTypeId, + transitionTo, transitionFrom, languageFile, stopAfterActivity, inputActivities, gateActivityLevelId, + waitingLearners, sysTool, branchActivityEntries); + super.simpleActivityStrategy = new ConditionGateActivityStrategy(this); + } - /** default constructor */ - public ConditionGateActivity() { - super.simpleActivityStrategy = new ConditionGateActivityStrategy(this); - } + /** default constructor */ + public ConditionGateActivity() { + super.simpleActivityStrategy = new ConditionGateActivityStrategy(this); + } - /** minimal constructor */ - public ConditionGateActivity(Long activityId, Boolean defineLater, java.util.Date createDateTime, - org.lamsfoundation.lams.learningdesign.LearningLibrary learningLibrary, - org.lamsfoundation.lams.learningdesign.Activity parentActivity, - org.lamsfoundation.lams.learningdesign.LearningDesign learningDesign, - org.lamsfoundation.lams.learningdesign.Grouping grouping, Integer activityTypeId, Transition transitionTo, - Transition transitionFrom, Integer gateActivityLevelId, Set waitingLearners) { - super(activityId, defineLater, createDateTime, learningLibrary, parentActivity, learningDesign, grouping, activityTypeId, - transitionTo, transitionFrom, gateActivityLevelId, waitingLearners); - super.simpleActivityStrategy = new ConditionGateActivityStrategy(this); - } + /** minimal constructor */ + public ConditionGateActivity(Long activityId, Boolean defineLater, java.util.Date createDateTime, + org.lamsfoundation.lams.learningdesign.LearningLibrary learningLibrary, + org.lamsfoundation.lams.learningdesign.Activity parentActivity, + org.lamsfoundation.lams.learningdesign.LearningDesign learningDesign, + org.lamsfoundation.lams.learningdesign.Grouping grouping, Integer activityTypeId, Transition transitionTo, + Transition transitionFrom, Integer gateActivityLevelId, Set waitingLearners) { + super(activityId, defineLater, createDateTime, learningLibrary, parentActivity, learningDesign, grouping, + activityTypeId, transitionTo, transitionFrom, gateActivityLevelId, waitingLearners); + super.simpleActivityStrategy = new ConditionGateActivityStrategy(this); + } - /** - * Makes a copy of the PermissionGateActivity for authoring, preview and monitoring enviornment - * @return PermissionGateActivity Returns a deep-copy of the originalActivity - */ - @Override - public Activity createCopy(int uiidOffset) { - ConditionGateActivity newConditionGateActivity = new ConditionGateActivity(); - copyToNewActivity(newConditionGateActivity, uiidOffset); - newConditionGateActivity.setGateOpen(new Boolean(false)); - newConditionGateActivity.setGateActivityLevelId(this.getGateActivityLevelId()); - return newConditionGateActivity; + /** + * Makes a copy of the PermissionGateActivity for authoring, preview and monitoring enviornment + * + * @return PermissionGateActivity Returns a deep-copy of the originalActivity + */ + @Override + public Activity createCopy(int uiidOffset) { + ConditionGateActivity newConditionGateActivity = new ConditionGateActivity(); + copyToNewActivity(newConditionGateActivity, uiidOffset); + newConditionGateActivity.setGateOpen(new Boolean(false)); + newConditionGateActivity.setGateActivityLevelId(this.getGateActivityLevelId()); - } + if (this.getBranchActivityEntries() != null && this.getBranchActivityEntries().size() > 0) { + newConditionGateActivity.setBranchActivityEntries(new HashSet()); + Iterator iter = this.getBranchActivityEntries().iterator(); + while (iter.hasNext()) { + BranchActivityEntry oldEntry = (BranchActivityEntry) iter.next(); + BranchActivityEntry newEntry = new BranchActivityEntry(null, LearningDesign.addOffset(oldEntry + .getEntryUIID(), uiidOffset), null, newConditionGateActivity, null, oldEntry + .getGateOpenWhenConditionMet()); + if (oldEntry.getCondition() != null) { + BranchCondition newCondition = oldEntry.getCondition().clone(uiidOffset); + newEntry.setCondition(newCondition); - @Override - public String toString() { - return new ToStringBuilder(this).append("activityId", getActivityId()).toString(); + } + newConditionGateActivity.getBranchActivityEntries().add(newEntry); + } } - /** - * @see org.lamsfoundation.lams.util.Nullable#isNull() - */ - public boolean isNull() { - return false; - } + return newConditionGateActivity; - public Set getOpeningGateBranchEntries() { - return openingGateBranchEntries; - } + } - public void setOpeningGateBranchEntries(Set openingGateConditions) { - openingGateBranchEntries = openingGateConditions; - } + @Override + public String toString() { + return new ToStringBuilder(this).append("activityId", getActivityId()).toString(); + } - @Override - public Vector validateActivity(MessageService messageService) { - Vector listOfValidationErrors = new Vector(); + /** + * @see org.lamsfoundation.lams.util.Nullable#isNull() + */ + public boolean isNull() { + return false; + } - if (getInputActivities() == null || getInputActivities().size() == 0) { - listOfValidationErrors.add(new ValidationErrorDTO(ValidationErrorDTO.CONDITION_GATE_ACTVITY_TOOLINPUT_ERROR_CODE, - messageService.getMessage(ValidationErrorDTO.CONDITION_GATE_ACTVITY_TOOLINPUT), this.getActivityUIID())); - } + @Override + public Vector validateActivity(MessageService messageService) { + Vector listOfValidationErrors = new Vector(); - boolean conditionsExist = false; - if (getOpeningGateBranchEntries() != null) { - for (BranchActivityEntry entry : getOpeningGateBranchEntries()) { - BranchCondition condition = entry.getCondition(); - if (condition == null) { - listOfValidationErrors.add(new ValidationErrorDTO(ValidationErrorDTO.BRANCH_CONDITION_INVALID_ERROR_CODE, - messageService.getMessage(ValidationErrorDTO.BRANCH_CONDITION_INVALID), this.getActivityUIID())); - } - else { - conditionsExist = true; - if (!condition.isValid()) { - listOfValidationErrors.add(new ValidationErrorDTO(ValidationErrorDTO.BRANCH_CONDITION_INVALID_ERROR_CODE, - messageService.getMessage(ValidationErrorDTO.BRANCH_CONDITION_INVALID), this.getActivityUIID())); - } - } - } - } + if (getInputActivities() == null || getInputActivities().size() == 0) { + listOfValidationErrors.add(new ValidationErrorDTO( + ValidationErrorDTO.CONDITION_GATE_ACTVITY_TOOLINPUT_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.CONDITION_GATE_ACTVITY_TOOLINPUT), this.getActivityUIID())); + } - if (!conditionsExist) { - listOfValidationErrors.add(new ValidationErrorDTO(ValidationErrorDTO.CONDITION_GATE_ACTVITY_CONDITION_ERROR_CODE, - messageService.getMessage(ValidationErrorDTO.CONDITION_GATE_ACTVITY_CONDITION), this.getActivityUIID())); + boolean conditionsExist = false; + if (getBranchActivityEntries() != null) { + for (BranchActivityEntry entry : (Set) getBranchActivityEntries()) { + BranchCondition condition = entry.getCondition(); + if (condition == null) { + listOfValidationErrors.add(new ValidationErrorDTO( + ValidationErrorDTO.BRANCH_CONDITION_INVALID_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.BRANCH_CONDITION_INVALID), this.getActivityUIID())); + } else { + conditionsExist = true; + if (!condition.isValid()) { + listOfValidationErrors.add(new ValidationErrorDTO( + ValidationErrorDTO.BRANCH_CONDITION_INVALID_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.BRANCH_CONDITION_INVALID), this + .getActivityUIID())); + } } - return listOfValidationErrors; + } } + + if (!conditionsExist) { + listOfValidationErrors.add(new ValidationErrorDTO( + ValidationErrorDTO.CONDITION_GATE_ACTVITY_CONDITION_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.CONDITION_GATE_ACTVITY_CONDITION), this.getActivityUIID())); + } + return listOfValidationErrors; + } } \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dao/hibernate/BranchActivityEntryDAO.java =================================================================== diff -u -r542b83631b403e37429fce3bb928f2800c5cd9b8 -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dao/hibernate/BranchActivityEntryDAO.java (.../BranchActivityEntryDAO.java) (revision 542b83631b403e37429fce3bb928f2800c5cd9b8) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dao/hibernate/BranchActivityEntryDAO.java (.../BranchActivityEntryDAO.java) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -26,17 +26,16 @@ import java.util.List; import org.lamsfoundation.lams.dao.hibernate.BaseDAO; +import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.learningdesign.BranchActivityEntry; import org.lamsfoundation.lams.learningdesign.BranchCondition; -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"; + + BranchActivityEntry.class.getName() + " entry, " + Activity.class.getName() + " branchingActivity " + + " where branchingActivity.learningDesign.id = ? " + " and entry.branchingActivity = branchingActivity"; private final static String CONDITION_BY_ID = "FROM " + BranchCondition.class.getName() + " con WHERE con.conditionId = ?"; Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/AuthoringActivityDTO.java =================================================================== diff -u -r01cc9502760d6b2a784d254efc95adc700a15e25 -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/AuthoringActivityDTO.java (.../AuthoringActivityDTO.java) (revision 01cc9502760d6b2a784d254efc95adc700a15e25) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/AuthoringActivityDTO.java (.../AuthoringActivityDTO.java) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -315,7 +315,7 @@ } else if (activity.isToolActivity()) { addToolActivityAttributes((ToolActivity) activity); } else if (activity.isGateActivity()) { - addGateActivityAttributes(activity); + addGateActivityAttributes(activity, branchMappings); } else { addComplexActivityAttributes(activity, branchMappings); } @@ -369,7 +369,7 @@ ArrayList branchMappings) { Activity parentActivity = activity.getParentActivity(); - Integer toolActivityUIID = parentActivity != null ? parentActivity.getToolInputActivityUIID() : null; + Integer toolActivityUIID = parentActivity == null ? null : parentActivity.getToolInputActivityUIID(); Iterator iter = activity.getBranchEntries().iterator(); while (iter.hasNext()) { @@ -406,13 +406,13 @@ } } - private void addGateActivityAttributes(Object activity) { + private void addGateActivityAttributes(Object activity, ArrayList branchMappings) { if (activity instanceof SynchGateActivity) { addSynchGateActivityAttributes((SynchGateActivity) activity); } else if (activity instanceof PermissionGateActivity) { addPermissionGateActivityAttributes((PermissionGateActivity) activity); } else if (activity instanceof ConditionGateActivity) { - addConditionGateActivityAttributes((ConditionGateActivity) activity); + addConditionGateActivityAttributes((ConditionGateActivity) activity, branchMappings); } else if (activity instanceof SystemGateActivity) { addSystemGateActivityAttributes((SystemGateActivity) activity); } else { @@ -425,7 +425,13 @@ } - private void addConditionGateActivityAttributes(ConditionGateActivity activity) { + private void addConditionGateActivityAttributes(ConditionGateActivity activity, + ArrayList branchMappings) { + Iterator iter = activity.getBranchActivityEntries().iterator(); + while (iter.hasNext()) { + BranchActivityEntry ba = (BranchActivityEntry) iter.next(); + branchMappings.add(ba.getBranchActivityEntryDTO(toolActivityUIID)); + } } private void addSynchGateActivityAttributes(SynchGateActivity activity) { Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/ToolOutputGateActivityEntryDTO.java =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/ToolOutputGateActivityEntryDTO.java (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/ToolOutputGateActivityEntryDTO.java (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -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$ */ +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 ToolOutputGateActivityEntryDTO extends ToolOutputBranchActivityEntryDTO { + private Integer gateActivityUIID; + private Boolean gateOpenWhenConditionMet; + + public Integer getGateActivityUIID() { + return getBranchingActivityUIID(); + } + + public void setGateActivityUIID(Integer gateActivityUIID) { + setBranchingActivityUIID(gateActivityUIID); + } + + public Boolean getGateOpenWhenConditionMet() { + return gateOpenWhenConditionMet; + } + + public void setGateOpenWhenConditionMet(Boolean gateOpenWhenConditionMet) { + this.gateOpenWhenConditionMet = gateOpenWhenConditionMet; + } + + @Override + public void setBranchingActivityUIID(Integer branchingActivityUIID) { + super.setBranchingActivityUIID(branchingActivityUIID); + gateActivityUIID = branchingActivityUIID; + } +} \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java =================================================================== diff -u -r01cc9502760d6b2a784d254efc95adc700a15e25 -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java (.../ExportToolContentService.java) (revision 01cc9502760d6b2a784d254efc95adc700a15e25) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java (.../ExportToolContentService.java) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -112,6 +112,7 @@ import org.lamsfoundation.lams.learningdesign.dto.GroupingDTO; import org.lamsfoundation.lams.learningdesign.dto.LearningDesignDTO; import org.lamsfoundation.lams.learningdesign.dto.ToolOutputBranchActivityEntryDTO; +import org.lamsfoundation.lams.learningdesign.dto.ToolOutputGateActivityEntryDTO; import org.lamsfoundation.lams.learningdesign.dto.TransitionDTO; import org.lamsfoundation.lams.lesson.LessonClass; import org.lamsfoundation.lams.tool.SystemTool; @@ -2216,11 +2217,6 @@ Map groupByUIIDMapper, Map activityByUIIDMapper) { SequenceActivity branch = (SequenceActivity) activityByUIIDMapper.get(entryDto.getSequenceActivityUIID()); - if (branch == null) { - log.error("Unable to find matching sequence activity for group to branch mapping " + entryDto - + " Skipping entry"); - return null; - } Activity branchingActivity = activityByUIIDMapper.get(entryDto.getBranchingActivityUIID()); if (branchingActivity == null) { @@ -2232,26 +2228,38 @@ Group group = groupByUIIDMapper.get(entryDto.getGroupUIID()); BranchCondition condition = null; + Boolean gateOpenWhenConditionMet = null; if (entryDto instanceof ToolOutputBranchActivityEntryDTO) { BranchConditionDTO dto = ((ToolOutputBranchActivityEntryDTO) entryDto).getCondition(); if (dto != null) { condition = new BranchCondition(dto); condition.setConditionId(null); } + if (entryDto instanceof ToolOutputGateActivityEntryDTO) { + gateOpenWhenConditionMet = ((ToolOutputGateActivityEntryDTO) entryDto).getGateOpenWhenConditionMet(); + } } BranchActivityEntry entry = null; if (condition != null) { - entry = condition.allocateBranchToCondition(entryDto.getEntryUIID(), branch, branchingActivity); + entry = condition.allocateBranchToCondition(entryDto.getEntryUIID(), branch, branchingActivity, + gateOpenWhenConditionMet); } else if (group != null) { entry = group.allocateBranchToGroup(entryDto.getEntryUIID(), branch, (BranchingActivity) branchingActivity); } if (entry != null) { - if (branch.getBranchEntries() == null) { - branch.setBranchEntries(new HashSet()); + if (branch == null) { + if (branchingActivity.getBranchActivityEntries() == null) { + branchingActivity.setBranchActivityEntries(new HashSet()); + } + branchingActivity.getBranchActivityEntries().add(entry); + } else { + if (branch.getBranchEntries() == null) { + branch.setBranchEntries(new HashSet()); + } + branch.getBranchEntries().add(entry); } - branch.getBranchEntries().add(entry); return entry; } else { log.error("Unable to find group or condition for branch mapping " + entryDto + " Skipping entry"); Index: lams_common/src/java/org/lamsfoundation/lams/tool/SystemTool.java =================================================================== diff -u -r209087915bc219f430c282ad00e5d1e6462f9b5f -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_common/src/java/org/lamsfoundation/lams/tool/SystemTool.java (.../SystemTool.java) (revision 209087915bc219f430c282ad00e5d1e6462f9b5f) +++ lams_common/src/java/org/lamsfoundation/lams/tool/SystemTool.java (.../SystemTool.java) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -30,312 +30,307 @@ import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; -/** - * Represents the URLs for the internal functionality such as grouping and gates. - * Eventually these will become "pluggable" tools, so that we can have other - * types of grouping/gates, without making changes to the core. +/** + * Represents the URLs for the internal functionality such as grouping and gates. Eventually these will become + * "pluggable" tools, so that we can have other types of grouping/gates, without making changes to the core. * * @hibernate.class table="lams_system_tool" */ public class SystemTool implements Serializable { - /* System Tool IDs */ - public static final Long GROUPING = new Long(1); - public static final Long SYNC_GATE = new Long(2); - public static final Long SCHEDULE_GATE = new Long(3); - public static final Long PERMISSION_GATE = new Long(4); - public static final Long SYSTEM_GATE = new Long(5); - public static final Long TEACHER_CHOSEN_BRANCHING = new Long(6); - public static final Long GROUP_BASED_BRANCHING = new Long(7); - public static final Long TOOL_BASED_BRANCHING = new Long(8); - public static final Long SEQUENCE = new Long(9); - public static final Long CONDITION_GATE = new Long(9); + /* System Tool IDs */ + public static final Long GROUPING = new Long(1); + public static final Long SYNC_GATE = new Long(2); + public static final Long SCHEDULE_GATE = new Long(3); + public static final Long PERMISSION_GATE = new Long(4); + public static final Long SYSTEM_GATE = new Long(5); + public static final Long TEACHER_CHOSEN_BRANCHING = new Long(6); + public static final Long GROUP_BASED_BRANCHING = new Long(7); + public static final Long TOOL_BASED_BRANCHING = new Long(8); + public static final Long SEQUENCE = new Long(9); + public static final Long CONDITION_GATE = new Long(10); - /** identifier field */ - private Long systemToolId; + /** identifier field */ + private Long systemToolId; - /** persistent field - the type of activity */ - private Integer activityTypeId; + /** persistent field - the type of activity */ + private Integer activityTypeId; - /** persistent field */ - private String toolDisplayName; + /** persistent field */ + private String toolDisplayName; - /** nullable persistent field */ - private String description; + /** nullable persistent field */ + private String description; - /** persistent field */ - private String learnerUrl; + /** persistent field */ + private String learnerUrl; - /** persistent field */ - private String learnerPreviewUrl; + /** persistent field */ + private String learnerPreviewUrl; - /** persistent field */ - private String learnerProgressUrl; + /** persistent field */ + private String learnerProgressUrl; - /** persistent field */ - private String exportPortfolioLearnerUrl; + /** persistent field */ + private String exportPortfolioLearnerUrl; - /** persistent field */ - private String exportPortfolioClassUrl; + /** persistent field */ + private String exportPortfolioClassUrl; - /** persistent field */ - private String monitorUrl; + /** persistent field */ + private String monitorUrl; - /** persistent field */ - private String contributeUrl; + /** persistent field */ + private String contributeUrl; - /** persistent field */ - private String helpUrl; + /** persistent field */ + private String helpUrl; - /** persistent field */ - private String adminUrl; + /** persistent field */ + private String adminUrl; - /** persistent field */ - private Date createDateTime; + /** persistent field */ + private Date createDateTime; - /** - * Entries for an tool in a language property file - */ - public static final String I18N_DISPLAY_NAME = "tool.display.name"; - public static final String I18N_DESCRIPTION = "tool.description"; + /** + * Entries for an tool in a language property file + */ + public static final String I18N_DISPLAY_NAME = "tool.display.name"; + public static final String I18N_DESCRIPTION = "tool.description"; - /** full constructor */ - public SystemTool(Long systemToolId, Integer activityTypeId, String displayName, String description, String learnerUrl, - String learnerPreviewUrl, String learnerProgressUrl, String exportPortfolioLearnerUrl, - String exportPortfolioClassUrl, String monitorUrl, String contributeUrl, String helpUrl, Date createDateTime) { - this.systemToolId = systemToolId; - this.activityTypeId = activityTypeId; - toolDisplayName = displayName; - this.description = description; + /** full constructor */ + public SystemTool(Long systemToolId, Integer activityTypeId, String displayName, String description, + String learnerUrl, String learnerPreviewUrl, String learnerProgressUrl, String exportPortfolioLearnerUrl, + String exportPortfolioClassUrl, String monitorUrl, String contributeUrl, String helpUrl, Date createDateTime) { + this.systemToolId = systemToolId; + this.activityTypeId = activityTypeId; + toolDisplayName = displayName; + this.description = description; - this.learnerUrl = learnerUrl; - this.learnerPreviewUrl = learnerPreviewUrl; - this.learnerProgressUrl = learnerProgressUrl; - this.exportPortfolioLearnerUrl = exportPortfolioLearnerUrl; - this.exportPortfolioClassUrl = exportPortfolioClassUrl; - this.monitorUrl = monitorUrl; - this.contributeUrl = contributeUrl; - this.helpUrl = helpUrl; + this.learnerUrl = learnerUrl; + this.learnerPreviewUrl = learnerPreviewUrl; + this.learnerProgressUrl = learnerProgressUrl; + this.exportPortfolioLearnerUrl = exportPortfolioLearnerUrl; + this.exportPortfolioClassUrl = exportPortfolioClassUrl; + this.monitorUrl = monitorUrl; + this.contributeUrl = contributeUrl; + this.helpUrl = helpUrl; - this.createDateTime = createDateTime; - } + this.createDateTime = createDateTime; + } - /** default constructor */ - public SystemTool() { - } + /** default constructor */ + public SystemTool() { + } - /** - * @hibernate.id generator-class="native" type="java.lang.Long" - * column="system_tool_id" - */ - public Long getSystemToolId() { - return systemToolId; - } + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="system_tool_id" + */ + public Long getSystemToolId() { + return systemToolId; + } - public void setSystemToolId(Long systemToolId) { - this.systemToolId = systemToolId; - } + public void setSystemToolId(Long systemToolId) { + this.systemToolId = systemToolId; + } - /** - * @hibernate.property column="learning_activity_type_id" type="java.lang.Integer" - * not-null="true" - */ - public Integer getActivityTypeId() { - return activityTypeId; - } + /** + * @hibernate.property column="learning_activity_type_id" type="java.lang.Integer" not-null="true" + */ + public Integer getActivityTypeId() { + return activityTypeId; + } - public void setActivityTypeId(Integer activityTypeId) { - this.activityTypeId = activityTypeId; - } + public void setActivityTypeId(Integer activityTypeId) { + this.activityTypeId = activityTypeId; + } - /** - * @hibernate.property column="tool_display_name" length="255" - * not-null="true" - */ - public String getToolDisplayName() { - return toolDisplayName; - } + /** + * @hibernate.property column="tool_display_name" length="255" not-null="true" + */ + public String getToolDisplayName() { + return toolDisplayName; + } - public void setToolDisplayName(String toolDisplayName) { - this.toolDisplayName = toolDisplayName; - } + public void setToolDisplayName(String toolDisplayName) { + this.toolDisplayName = toolDisplayName; + } - /** - * @hibernate.property column="description" length="65535" - */ - public String getDescription() { - return description; - } + /** + * @hibernate.property column="description" length="65535" + */ + public String getDescription() { + return description; + } - public void setDescription(String description) { - this.description = description; - } + public void setDescription(String description) { + this.description = description; + } - /** - * @hibernate.property column="learner_url" length="65535" - * not-null="true" - */ - public String getLearnerUrl() { - return learnerUrl; - } + /** + * @hibernate.property column="learner_url" length="65535" not-null="true" + */ + public String getLearnerUrl() { + return learnerUrl; + } - public void setLearnerUrl(String learnerUrl) { - this.learnerUrl = learnerUrl; - } + public void setLearnerUrl(String learnerUrl) { + this.learnerUrl = learnerUrl; + } - /** - * @hibernate.property column="learner_preview_url" length="65535" - * not-null="false" - */ - public String getLearnerPreviewUrl() { - return learnerPreviewUrl; - } + /** + * @hibernate.property column="learner_preview_url" length="65535" not-null="false" + */ + public String getLearnerPreviewUrl() { + return learnerPreviewUrl; + } - public void setLearnerPreviewUrl(String learnerPreviewUrl) { - this.learnerPreviewUrl = learnerPreviewUrl; - } + public void setLearnerPreviewUrl(String learnerPreviewUrl) { + this.learnerPreviewUrl = learnerPreviewUrl; + } - /** - * @hibernate.property column="learner_progress_url" length="65535" - * not-null="false" - */ - public String getLearnerProgressUrl() { - return learnerProgressUrl; - } + /** + * @hibernate.property column="learner_progress_url" length="65535" not-null="false" + */ + public String getLearnerProgressUrl() { + return learnerProgressUrl; + } - public void setLearnerProgressUrl(String learnerProgressUrl) { - this.learnerProgressUrl = learnerProgressUrl; - } + public void setLearnerProgressUrl(String learnerProgressUrl) { + this.learnerProgressUrl = learnerProgressUrl; + } - /** - * @hibernate.property column="export_pfolio_learner_url" length="65535" - * not-null="false" - */ - public String getExportPortfolioLearnerUrl() { - return exportPortfolioLearnerUrl; - } + /** + * @hibernate.property column="export_pfolio_learner_url" length="65535" not-null="false" + */ + public String getExportPortfolioLearnerUrl() { + return exportPortfolioLearnerUrl; + } - public void setExportPortfolioLearnerUrl(String exportPortfolioLearnerUrl) { - this.exportPortfolioLearnerUrl = exportPortfolioLearnerUrl; - } + public void setExportPortfolioLearnerUrl(String exportPortfolioLearnerUrl) { + this.exportPortfolioLearnerUrl = exportPortfolioLearnerUrl; + } - /** - * @hibernate.property column="export_pfolio_class_url" length="65535" - * not-null="false" - */ - public String getExportPortfolioClassUrl() { - return exportPortfolioClassUrl; - } + /** + * @hibernate.property column="export_pfolio_class_url" length="65535" not-null="false" + */ + public String getExportPortfolioClassUrl() { + return exportPortfolioClassUrl; + } - public void setExportPortfolioClassUrl(String exportPortfolioClassUrl) { - this.exportPortfolioClassUrl = exportPortfolioClassUrl; - } + public void setExportPortfolioClassUrl(String exportPortfolioClassUrl) { + this.exportPortfolioClassUrl = exportPortfolioClassUrl; + } - /** - * @hibernate.property column="admin_url" length="65535" not-null="false" - * @return Returns the helpUrl. - */ - public String getAdminUrl() { - return adminUrl; - } + /** + * @hibernate.property column="admin_url" length="65535" not-null="false" + * @return Returns the helpUrl. + */ + public String getAdminUrl() { + return adminUrl; + } - /** - * @param helpUrl The helpUrl to set. - */ - public void setAdminUrl(String adminUrl) { - this.adminUrl = adminUrl; - } + /** + * @param helpUrl + * The helpUrl to set. + */ + public void setAdminUrl(String adminUrl) { + this.adminUrl = adminUrl; + } - /** - * @hibernate.property column="create_date_time" - length="19" not-null="true" - * @return Returns the createDateTime. - */ - public Date getCreateDateTime() { - return createDateTime; - } + /** + * @hibernate.property column="create_date_time" length="19" not-null="true" + * @return Returns the createDateTime. + */ + public Date getCreateDateTime() { + return createDateTime; + } - /** - * @param createDateTime The createDateTime to set. - */ - public void setCreateDateTime(Date createDateTime) { - this.createDateTime = createDateTime; - } + /** + * @param createDateTime + * The createDateTime to set. + */ + public void setCreateDateTime(Date createDateTime) { + this.createDateTime = createDateTime; + } - /** - * Does this tool support contribute? Will be true if the contributeURL is not null/empty string. - */ - public boolean getSupportsContribute() { - String contributeURL = getContributeUrl(); - return contributeURL != null && contributeURL.trim().length() > 0; - } + /** + * Does this tool support contribute? Will be true if the contributeURL is not null/empty string. + */ + public boolean getSupportsContribute() { + String contributeURL = getContributeUrl(); + return contributeURL != null && contributeURL.trim().length() > 0; + } - /** - * @hibernate.property column="contribute_url" length="65535" not-null="false" - * @return Returns the contributeUrl. - */ - public String getContributeUrl() { - return contributeUrl; - } + /** + * @hibernate.property column="contribute_url" length="65535" not-null="false" + * @return Returns the contributeUrl. + */ + public String getContributeUrl() { + return contributeUrl; + } - /** - * @param contributeUrl The contributUrl to set. - */ - public void setContributeUrl(String contributeUrl) { - this.contributeUrl = contributeUrl; - } + /** + * @param contributeUrl + * The contributUrl to set. + */ + public void setContributeUrl(String contributeUrl) { + this.contributeUrl = contributeUrl; + } - /** - * @hibernate.property column="monitor_url" length="65535" not-null="false" - * @return Returns the monitorUrl. - */ - public String getMonitorUrl() { - return monitorUrl; - } + /** + * @hibernate.property column="monitor_url" length="65535" not-null="false" + * @return Returns the monitorUrl. + */ + public String getMonitorUrl() { + return monitorUrl; + } - /** - * @param monitorUrl The monitorUrl to set. - */ - public void setMonitorUrl(String monitorUrl) { - this.monitorUrl = monitorUrl; - } + /** + * @param monitorUrl + * The monitorUrl to set. + */ + public void setMonitorUrl(String monitorUrl) { + this.monitorUrl = monitorUrl; + } - /** - * @hibernate.property column="help_url" length="65535" not-null="false" - * @return Returns the helpUrl. - */ - public String getHelpUrl() { - return helpUrl; - } + /** + * @hibernate.property column="help_url" length="65535" not-null="false" + * @return Returns the helpUrl. + */ + public String getHelpUrl() { + return helpUrl; + } - /** - * @param helpUrl The helpUrl to set. - */ - public void setHelpUrl(String helpUrl) { - this.helpUrl = helpUrl; - } + /** + * @param helpUrl + * The helpUrl to set. + */ + public void setHelpUrl(String helpUrl) { + this.helpUrl = helpUrl; + } - @Override - public String toString() { - return new ToStringBuilder(this).append("systemToolId", getSystemToolId()).append("activityTypeId", getActivityTypeId()) - .toString(); - } + @Override + public String toString() { + return new ToStringBuilder(this).append("systemToolId", getSystemToolId()).append("activityTypeId", + getActivityTypeId()).toString(); + } - @Override - public boolean equals(Object other) { - if (this == other) { - return true; - } - if (!(other instanceof SystemTool)) { - return false; - } - SystemTool castOther = (SystemTool) other; - return new EqualsBuilder().append(this.getSystemToolId(), castOther.getSystemToolId()).isEquals(); + @Override + public boolean equals(Object other) { + if (this == other) { + return true; } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(getSystemToolId()).toHashCode(); + if (!(other instanceof SystemTool)) { + return false; } + SystemTool castOther = (SystemTool) other; + return new EqualsBuilder().append(this.getSystemToolId(), castOther.getSystemToolId()).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(getSystemToolId()).toHashCode(); + } + } Index: lams_common/src/java/org/lamsfoundation/lams/util/wddx/WDDXTAGS.java =================================================================== diff -u -rd02ece68fd7e5bd6ca301c92d9f41a6580a6e5ed -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_common/src/java/org/lamsfoundation/lams/util/wddx/WDDXTAGS.java (.../WDDXTAGS.java) (revision d02ece68fd7e5bd6ca301c92d9f41a6580a6e5ed) +++ lams_common/src/java/org/lamsfoundation/lams/util/wddx/WDDXTAGS.java (.../WDDXTAGS.java) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -29,212 +29,208 @@ */ public interface WDDXTAGS { - /** - * The string value in a WDDX packet that indicates that this value is - * really null - */ - public static final String STRING_NULL_VALUE = "string_null_value"; - /** - * The Boolean value in a WDDX packet that indicates that this value is - * really null. Implemented as a String as Boolean is too restrictive. - */ - public static final String BOOLEAN_NULL_VALUE_AS_STRING = "boolean_null_value"; - /** - * Don't know what to do Java -> Flash yet. TODO remove. - */ - public static final Boolean BOOLEAN_NULL_VALUE = new Boolean(false); - /** - * The Long value in a WDDX packet that indicates that this value is really - * null. - */ - public static final Long NUMERIC_NULL_VALUE_LONG = new Long(-111111); - /** - * The Integer value in a WDDX packet that indicates that this value is - * really null. - */ - public static final Integer NUMERIC_NULL_VALUE_INTEGER = new Integer( - -111111); - /** - * The Double value in a WDDX packet that indicates that this value is - * really null. This is used to check a value coming in from WDDX - as it - * tends to return Doubles, not Long or Integers. - */ - public static final Double NUMERIC_NULL_VALUE_DOUBLE = new Double(-111111); - /** - * The Date value in a WDDX packet that indicates that this value is really - * null. - */ - public static final Date DATE_NULL_VALUE = new Date(0); + /** + * The string value in a WDDX packet that indicates that this value is really null + */ + public static final String STRING_NULL_VALUE = "string_null_value"; + /** + * The Boolean value in a WDDX packet that indicates that this value is really null. Implemented as a String as + * Boolean is too restrictive. + */ + public static final String BOOLEAN_NULL_VALUE_AS_STRING = "boolean_null_value"; + /** + * Don't know what to do Java -> Flash yet. TODO remove. + */ + public static final Boolean BOOLEAN_NULL_VALUE = new Boolean(false); + /** + * The Long value in a WDDX packet that indicates that this value is really null. + */ + public static final Long NUMERIC_NULL_VALUE_LONG = new Long(-111111); + /** + * The Integer value in a WDDX packet that indicates that this value is really null. + */ + public static final Integer NUMERIC_NULL_VALUE_INTEGER = new Integer(-111111); + /** + * The Double value in a WDDX packet that indicates that this value is really null. This is used to check a value + * coming in from WDDX - as it tends to return Doubles, not Long or Integers. + */ + public static final Double NUMERIC_NULL_VALUE_DOUBLE = new Double(-111111); + /** + * The Date value in a WDDX packet that indicates that this value is really null. + */ + public static final Date DATE_NULL_VALUE = new Date(0); - /* General Tags */ - public static final String OBJECT_TYPE = "objectType"; // not used in 1.1 + /* General Tags */ + public static final String OBJECT_TYPE = "objectType"; // not used in 1.1 - public static final String DESCRIPTION = "description"; - public static final String TITLE = "title"; - public static final String HELP_TEXT = "helpText"; - public static final String XCOORD = "xCoord"; - public static final String YCOORD = "yCoord"; - public static final String GROUPINGS = "groupings"; - public static final String TRANSITIONS = "transitions"; - public static final String ACTIVITIES = "activities"; - public static final String COMPETENCES = "competences"; - public static final String COMPETENCE_MAPPINGS = "competenceMappings"; - public static final String COMPETENCE_MAPPING = "competenceMapping"; - public static final String BRANCH_MAPPINGS = "branchMappings"; + public static final String DESCRIPTION = "description"; + public static final String TITLE = "title"; + public static final String HELP_TEXT = "helpText"; + public static final String XCOORD = "xCoord"; + public static final String YCOORD = "yCoord"; + public static final String GROUPINGS = "groupings"; + public static final String TRANSITIONS = "transitions"; + public static final String ACTIVITIES = "activities"; + public static final String COMPETENCES = "competences"; + public static final String COMPETENCE_MAPPINGS = "competenceMappings"; + public static final String COMPETENCE_MAPPING = "competenceMapping"; + public static final String BRANCH_MAPPINGS = "branchMappings"; - /* Learning Library specific tags */ - public static final String LEARNING_LIBRARY_ID = "learningLibraryID"; - public static final String LIB_ACTIVITIES = "templateActivities"; - public static final String LIB_PACKAGE = "libraries"; - public static final String DESIGN_PACKAGE = "designs"; + /* Learning Library specific tags */ + public static final String LEARNING_LIBRARY_ID = "learningLibraryID"; + public static final String LIB_ACTIVITIES = "templateActivities"; + public static final String LIB_PACKAGE = "libraries"; + public static final String DESIGN_PACKAGE = "designs"; - /* Activity specific tags */ - public static final String ACTIVITY_ID = "activityID"; - public static final String ACTIVITY_UIID = "activityUIID"; - public static final String ACTIVITY_TITLE = "activityTitle"; + /* Activity specific tags */ + public static final String ACTIVITY_ID = "activityID"; + public static final String ACTIVITY_UIID = "activityUIID"; + public static final String ACTIVITY_TITLE = "activityTitle"; - public static final String PARENT_ACTIVITY_ID = "parentActivityID"; - public static final String PARENT_UIID = "parentUIID"; + public static final String PARENT_ACTIVITY_ID = "parentActivityID"; + public static final String PARENT_UIID = "parentUIID"; - public static final String ACTIVITY_TYPE_ID = "activityTypeID"; - public static final String ORDER_ID = "orderID"; + public static final String ACTIVITY_TYPE_ID = "activityTypeID"; + public static final String ORDER_ID = "orderID"; - public static final String ACTIVITY_CATEGORY_ID = "activityCategoryID"; + public static final String ACTIVITY_CATEGORY_ID = "activityCategoryID"; - public static final String DEFINE_LATER = "defineLater"; - public static final String RUN_OFFLINE = "runOffline"; - public static final String OFFLINE_INSTRUCTIONS = "offlineInstructions"; - public static final String ONLINE_INSTRUCTIONS = "onlineInstructions"; - public static final String LIBRARY_IMAGE = "libraryActivityUIImage"; - public static final String LIBRARY_ACTIVITY = "libraryActivityID"; + public static final String DEFINE_LATER = "defineLater"; + public static final String RUN_OFFLINE = "runOffline"; + public static final String OFFLINE_INSTRUCTIONS = "offlineInstructions"; + public static final String ONLINE_INSTRUCTIONS = "onlineInstructions"; + public static final String LIBRARY_IMAGE = "libraryActivityUIImage"; + public static final String LIBRARY_ACTIVITY = "libraryActivityID"; - public static final String APPLY_GROUPING = "applyGrouping"; - public static final String GROUPING_SUPPORT_TYPE = "groupingSupportType"; - public static final String STOP_AFTER_ACTIVITY = "stopAfterActivity"; - public static final String INPUT_ACTIVITIES = "inputActivities"; // not - // used - // yet - public static final String INPUT_TOOL_ACTIVITY_UIID = "toolActivityUIID"; + public static final String APPLY_GROUPING = "applyGrouping"; + public static final String GROUPING_SUPPORT_TYPE = "groupingSupportType"; + public static final String STOP_AFTER_ACTIVITY = "stopAfterActivity"; + public static final String INPUT_ACTIVITIES = "inputActivities"; // not + // used + // yet + public static final String INPUT_TOOL_ACTIVITY_UIID = "toolActivityUIID"; - /** OptionsActivity specific tags */ - public static final String MAX_OPTIONS = "maxOptions"; - public static final String MIN_OPTIONS = "minOptions"; - public static final String OPTIONS_INSTRUCTIONS = "optionsInstructions"; + /** OptionsActivity specific tags */ + public static final String MAX_OPTIONS = "maxOptions"; + public static final String MIN_OPTIONS = "minOptions"; + public static final String OPTIONS_INSTRUCTIONS = "optionsInstructions"; - /** ToolActivity specific tags */ - public static final String TOOL_ID = "toolID"; - public static final String TOOL_CONTENT_ID = "toolContentID"; - public static final String TOOL_CONTENT_IDS = "toolContentIDs"; + /** ToolActivity specific tags */ + public static final String TOOL_ID = "toolID"; + public static final String TOOL_CONTENT_ID = "toolContentID"; + public static final String TOOL_CONTENT_IDS = "toolContentIDs"; - /** GateActivity specific tags */ - public static final String GATE_ACTIVITY_LEVEL_ID = "gateActivityLevelID"; - public static final String GATE_START_DATE = "gateStartDateTime"; - public static final String GATE_END_DATE = "gateEndDateTime"; - public static final String GATE_START_OFFSET = "gateStartTimeOffset"; - public static final String GATE_END_OFFSET = "gateEndTimeOffset"; - public static final String GATE_OPEN = "gateOpen"; + /** GateActivity specific tags */ + public static final String GATE_ACTIVITY_LEVEL_ID = "gateActivityLevelID"; + public static final String GATE_START_DATE = "gateStartDateTime"; + public static final String GATE_END_DATE = "gateEndDateTime"; + public static final String GATE_START_OFFSET = "gateStartTimeOffset"; + public static final String GATE_END_OFFSET = "gateEndTimeOffset"; + public static final String GATE_OPEN = "gateOpen"; - /** Grouping Activity specific tags */ - public static final String CREATE_GROUPING_ID = "createGroupingID"; - public static final String CREATE_GROUPING_UIID = "createGroupingUIID"; + /** Grouping Activity specific tags */ + public static final String CREATE_GROUPING_ID = "createGroupingID"; + public static final String CREATE_GROUPING_UIID = "createGroupingUIID"; - /** Grouping specific tags */ - public static final String GROUPING_ID = "groupingID"; - public static final String GROUPING_UIID = "groupingUIID"; - public static final String GROUPING_TYPE_ID = "groupingTypeID"; - public static final String LEARNERS_PER_GROUP = "learnersPerGroup"; - public static final String MAX_NUMBER_OF_GROUPS = "maxNumberOfGroups"; - public static final String NUMBER_OF_GROUPS = "numberOfGroups"; - public static final String STAFF_GROUP_ID = "staffGroupID"; - public static final String GROUPING_DTO = "groupingDTO"; - public static final String GROUPS = "groups"; - public static final String EQUAL_NUMBER_OF_LEARNERS_PER_GROUP = "equalNumberOfLearnersPerGroup"; + /** Grouping specific tags */ + public static final String GROUPING_ID = "groupingID"; + public static final String GROUPING_UIID = "groupingUIID"; + public static final String GROUPING_TYPE_ID = "groupingTypeID"; + public static final String LEARNERS_PER_GROUP = "learnersPerGroup"; + public static final String MAX_NUMBER_OF_GROUPS = "maxNumberOfGroups"; + public static final String NUMBER_OF_GROUPS = "numberOfGroups"; + public static final String STAFF_GROUP_ID = "staffGroupID"; + public static final String GROUPING_DTO = "groupingDTO"; + public static final String GROUPS = "groups"; + public static final String EQUAL_NUMBER_OF_LEARNERS_PER_GROUP = "equalNumberOfLearnersPerGroup"; - public static final String GROUP_ID = "groupID"; - public static final String GROUP_NAME = "groupName"; - public static final String GROUP_USER_LIST = "userList"; - public static final String GROUP_UIID = "groupUIID"; + public static final String GROUP_ID = "groupID"; + public static final String GROUP_NAME = "groupName"; + public static final String GROUP_USER_LIST = "userList"; + public static final String GROUP_UIID = "groupUIID"; - /** Transition specific tags */ - public static final String TRANSITION_ID = "transitionID"; - public static final String TRANSITION_UIID = "transitionUIID"; - public static final String TRANSITION_TO = "to_activity_id"; - public static final String TRANSITION_FROM = "from_activity_id"; - public static final String TO_ACTIVITY_UIID = "toUIID"; - public static final String FROM_ACTIVITY_UIID = "fromUIID"; + /** Transition specific tags */ + public static final String TRANSITION_ID = "transitionID"; + public static final String TRANSITION_UIID = "transitionUIID"; + public static final String TRANSITION_TO = "to_activity_id"; + public static final String TRANSITION_FROM = "from_activity_id"; + public static final String TO_ACTIVITY_UIID = "toUIID"; + public static final String FROM_ACTIVITY_UIID = "fromUIID"; - /** Tool Specific tags */ - public static final String TOOL_DISPLAY_NAME = "displayName"; - public static final String TOOl_AUTH_URL = "toolAuthoringURL"; - public static final String AUTH_URL = "authoringURLS"; + /** Tool Specific tags */ + public static final String TOOL_DISPLAY_NAME = "displayName"; + public static final String TOOl_AUTH_URL = "toolAuthoringURL"; + public static final String AUTH_URL = "authoringURLS"; - /** LearningDesign specific tags */ - public static final String LEARNING_DESIGN_ID = "learningDesignID"; - public static final String LEARNING_DESIGN_UIID = "learningDesignUIID"; - public static final String FIRST_ACTIVITY_ID = "firstActivityID"; - public static final String FIRST_ACTIVITY_UIID = "firstActivityUIID"; + /** LearningDesign specific tags */ + public static final String LEARNING_DESIGN_ID = "learningDesignID"; + public static final String LEARNING_DESIGN_UIID = "learningDesignUIID"; + public static final String FIRST_ACTIVITY_ID = "firstActivityID"; + public static final String FIRST_ACTIVITY_UIID = "firstActivityUIID"; - public static final String MAX_ID = "maxID"; - public static final String VALID_DESIGN = "validDesign"; - public static final String READ_ONLY = "readOnly"; - public static final String EDIT_OVERRIDE_LOCK = "editOverrideLock"; - public static final String DATE_READ_ONLY = "dateReadOnly"; - public static final String USER_ID = "userID"; - public static final String EDIT_OVERRIDE_USER_ID = "editOverrideUserID"; + public static final String MAX_ID = "maxID"; + public static final String VALID_DESIGN = "validDesign"; + public static final String READ_ONLY = "readOnly"; + public static final String EDIT_OVERRIDE_LOCK = "editOverrideLock"; + public static final String DATE_READ_ONLY = "dateReadOnly"; + public static final String USER_ID = "userID"; + public static final String EDIT_OVERRIDE_USER_ID = "editOverrideUserID"; - public static final String COPY_TYPE = "copyTypeID"; - public static final String CREATION_DATE = "createDateTime"; - public static final String LAST_MODIFIED_DATE = "lastModifiedDateTime"; - public static final String VERSION = "version"; - public static final String ORIGINAL_DESIGN_ID = "originalLearningDesignID"; - public static final String WORKSPACE_FOLDER_ID = "workspaceFolderID"; - public static final String DURATION = "duration"; - public static final String LICENCE_ID = "licenseID"; - public static final String LICENSE_TEXT = "licenseText"; - public static final String CONTENT_FOLDER_ID = "contentFolderID"; - public static final String SAVE_MODE = "saveMode"; + public static final String COPY_TYPE = "copyTypeID"; + public static final String CREATION_DATE = "createDateTime"; + public static final String LAST_MODIFIED_DATE = "lastModifiedDateTime"; + public static final String VERSION = "version"; + public static final String ORIGINAL_DESIGN_ID = "originalLearningDesignID"; + public static final String WORKSPACE_FOLDER_ID = "workspaceFolderID"; + public static final String DURATION = "duration"; + public static final String LICENCE_ID = "licenseID"; + public static final String LICENSE_TEXT = "licenseText"; + public static final String CONTENT_FOLDER_ID = "contentFolderID"; + public static final String SAVE_MODE = "saveMode"; - /** ComplexActivity specific tags */ - public static final String CHILD_ACTIVITIES = "childActivities"; - public static final String DEFAULT_ACTIVITY_UIID = "defaultActivityUIID"; + /** ComplexActivity specific tags */ + public static final String CHILD_ACTIVITIES = "childActivities"; + public static final String DEFAULT_ACTIVITY_UIID = "defaultActivityUIID"; - /** Crash Dump Specific Tags */ - public static final String CRASH_DUMP_BATCH = "crashDataBatch"; + /** Crash Dump Specific Tags */ + public static final String CRASH_DUMP_BATCH = "crashDataBatch"; - /** Notebook Specific Tags */ - public static final String EXTERNAL_ID = "externalID"; - public static final String EXTERNAL_ID_TYPE = "externalIDType"; - public static final String EXTERNAL_SIG = "externalSignature"; - public static final String ENTRY = "entry"; + /** Notebook Specific Tags */ + public static final String EXTERNAL_ID = "externalID"; + public static final String EXTERNAL_ID_TYPE = "externalIDType"; + public static final String EXTERNAL_SIG = "externalSignature"; + public static final String ENTRY = "entry"; - /** Branching Activity Specific Tags */ - public static final String START_XCOORD = "startXCoord"; - public static final String START_YCOORD = "startYCoord"; - public static final String END_XCOORD = "endXCoord"; - public static final String END_YCOORD = "endYCoord"; + /** Branching Activity Specific Tags */ + public static final String START_XCOORD = "startXCoord"; + public static final String START_YCOORD = "startYCoord"; + 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_DISPLAY_NAME = "displayName"; - 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"; + /** 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"; + public static final String BRANCH_GATE_OPENS_WHEN_CONDITION_MET = "gateOpenWhenConditionMet"; + public static final String BRANCH_GATE_ACTIVITY_UIID = "gateActivityUIID"; + // 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_DISPLAY_NAME = "displayName"; + 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"; - /** LD Import specific tags */ - public static final String LEARNING_DESIGN_TO_IMPORT_ID = "learningDesignIDToImport"; - public static final String CREATE_NEW_LEARNING_DESIGN = "createNewLearningDesign"; + /** LD Import specific tags */ + public static final String LEARNING_DESIGN_TO_IMPORT_ID = "learningDesignIDToImport"; + public static final String CREATE_NEW_LEARNING_DESIGN = "createNewLearningDesign"; - /** Tool adapters specific tags */ - public static final String CUSTOM_CSV = "customCSV"; + /** Tool adapters specific tags */ + public static final String CUSTOM_CSV = "customCSV"; } Index: lams_learning/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -rd5ff2e0121d67650eea6d972b04954a023cc3d4d -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_learning/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d5ff2e0121d67650eea6d972b04954a023cc3d4d) +++ lams_learning/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -93,7 +93,7 @@ label.learner.choice.group.message =Please select a group. Some groups may not be available if they reached the maximum number of members. label.choose.group.button =Choose label.condition.gate.title =Condition Gate -label.condition.gate.close.message =You have reached a condition gate. You have not satisfied the required conditions and you may not pass. Please return to previous activities. +label.condition.gate.close.message =You have reached a condition gate. You have not satisfied the required conditions and you may not pass. Please return to previous activities. After you correct your answers, please press the button to proceed to next activities. #======= End labels: Exported 88 labels for en AU ===== Index: lams_learning/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -rd5ff2e0121d67650eea6d972b04954a023cc3d4d -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_learning/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision d5ff2e0121d67650eea6d972b04954a023cc3d4d) +++ lams_learning/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -93,7 +93,7 @@ label.learner.choice.group.message =Please select a group. Some groups may not be available if they reached the maximum number of members. label.choose.group.button =Choose label.condition.gate.title =Condition Gate -label.condition.gate.close.message =You have reached a condition gate. You have not satisfied the required conditions and you may not pass. Please return to previous activities. +label.condition.gate.close.message =You have reached a condition gate. You have not satisfied the required conditions and you may not pass. Please return to previous activities. After you correct your answers, please press the button to proceed to next activities. #======= End labels: Exported 88 labels for en AU ===== Index: lams_learning/conf/xdoclet/struts-forms.xml =================================================================== diff -u -rfdca3605f0b782b19e214abbe94df6f4a457b88e -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_learning/conf/xdoclet/struts-forms.xml (.../struts-forms.xml) (revision fdca3605f0b782b19e214abbe94df6f4a457b88e) +++ lams_learning/conf/xdoclet/struts-forms.xml (.../struts-forms.xml) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -19,6 +19,7 @@ + Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java =================================================================== diff -u -r1f29a11ef492885ecf8cfe7f9fec5912d58ae04d -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java (.../LearnerService.java) (revision 1f29a11ef492885ecf8cfe7f9fec5912d58ae04d) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java (.../LearnerService.java) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -1076,15 +1076,16 @@ if (toolSession != null) { - Set openingGateConditions = conditionGate.getOpeningGateBranchEntries(); + Set branchEntries = conditionGate.getBranchActivityEntries(); // Go through each condition until we find one that passes and that opens the gate. // Cache the tool output so that we aren't calling it over an over again. Map toolOutputMap = new HashMap(); - Iterator conditionIterator = openingGateConditions.iterator(); + Iterator entryIterator = branchEntries.iterator(); - while (!shouldOpenGate && conditionIterator.hasNext()) { - BranchCondition condition = conditionIterator.next().getCondition(); + while (entryIterator.hasNext()) { + BranchActivityEntry entry = entryIterator.next(); + BranchCondition condition = entry.getCondition(); String conditionName = condition.getName(); ToolOutput toolOutput = toolOutputMap.get(conditionName); if (toolOutput == null) { @@ -1103,10 +1104,14 @@ } if (toolOutput != null && condition.isMet(toolOutput)) { - shouldOpenGate = true; - // save the learner to the "allowed to pass" list so we don't check the conditions over and over - // again (maybe we should??) - conditionGate.addLeaner(learner, true); + shouldOpenGate = entry.getGateOpenWhenConditionMet(); + if (shouldOpenGate) { + // save the learner to the "allowed to pass" list so we don't check the conditions over and + // over + // again (maybe we should??) + conditionGate.addLeaner(learner, true); + } + break; } } } Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GateAction.java =================================================================== diff -u -r209087915bc219f430c282ad00e5d1e6462f9b5f -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GateAction.java (.../GateAction.java) (revision 209087915bc219f430c282ad00e5d1e6462f9b5f) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GateAction.java (.../GateAction.java) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -50,153 +50,153 @@ import org.lamsfoundation.lams.web.util.AttributeNames; /** - *

The action servlet that deals with gate activity. This class allows the - * learner to knock gate when they reach the gate. The knocking process will - * be triggered by the lams progress engine in the first place. The learner - * can also trigger the knocking process by clicking on the button on the - * waiting page.

+ *

+ * The action servlet that deals with gate activity. This class allows the learner to knock gate when they reach the + * gate. The knocking process will be triggered by the lams progress engine in the first place. The learner can also + * trigger the knocking process by clicking on the button on the waiting page. + *

* - *

Learner will progress to the next activity if the gate is open. Otherwise, - * the learner should see the waiting page.

+ *

+ * Learner will progress to the next activity if the gate is open. Otherwise, the learner should see the waiting page. + *

* - *

Has a special override key - if the parameter force is set and the - * lesson is a preview lesson, then the gate will be opened straight away. This - * allows the author to see gate shut initially but override it and open it - * rather than being held up by the gate.

+ *

+ * Has a special override key - if the parameter force is set and the lesson is a preview lesson, then the gate will be + * opened straight away. This allows the author to see gate shut initially but override it and open it rather than being + * held up by the gate. + *

* * @author Jacky Fang - * @since 2005-4-7 + * @since 2005-4-7 * @version 1.1 * * ----------------XDoclet Tags-------------------- * - * @struts:action name="GateForm" - * path="/gate" - * parameter="method" - * validate="false" + * @struts:action name="GateForm" path="/gate" parameter="method" validate="false" * * @struts:action-forward name="permissionGate" path=".permissionGate" * @struts:action-forward name="scheduleGate" path=".scheduleGate" * @struts:action-forward name="synchGate" path=".synchGate" - * @struts:action-forward name="conditionGate" path=".conditionGate" - * ----------------XDoclet Tags-------------------- + * @struts:action-forward name="conditionGate" path=".conditionGate" ----------------XDoclet Tags-------------------- */ public class GateAction extends LamsDispatchAction { - //--------------------------------------------------------------------- - // Instance variables - //--------------------------------------------------------------------- - // private static Logger log = Logger.getLogger(GateAction.class); + // --------------------------------------------------------------------- + // Instance variables + // --------------------------------------------------------------------- + // private static Logger log = Logger.getLogger(GateAction.class); - //--------------------------------------------------------------------- - // Class level constants - Struts forward - //--------------------------------------------------------------------- - private static final String VIEW_PERMISSION_GATE = "permissionGate"; - private static final String VIEW_SCHEDULE_GATE = "scheduleGate"; - private static final String VIEW_SYNCH_GATE = "synchGate"; - private static final String VIEW_CONDITION_GATE = "conditionGate"; + // --------------------------------------------------------------------- + // Class level constants - Struts forward + // --------------------------------------------------------------------- + private static final String VIEW_PERMISSION_GATE = "permissionGate"; + private static final String VIEW_SCHEDULE_GATE = "scheduleGate"; + private static final String VIEW_SYNCH_GATE = "synchGate"; + private static final String VIEW_CONDITION_GATE = "conditionGate"; - /** Input parameter. Boolean value */ - public static final String PARAM_FORCE_GATE_OPEN = "force"; + /** Input parameter. Boolean value */ + public static final String PARAM_FORCE_GATE_OPEN = "force"; - //--------------------------------------------------------------------- - // Struts Dispatch Method - //--------------------------------------------------------------------- - /** - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException - */ - public ActionForward knockGate(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { - boolean forceGate = WebUtil.readBooleanParam(request, GateAction.PARAM_FORCE_GATE_OPEN, false); - Long activityId = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID); - Long lessonId = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID); + // --------------------------------------------------------------------- + // Struts Dispatch Method + // --------------------------------------------------------------------- + /** + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward knockGate(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException { + boolean forceGate = WebUtil.readBooleanParam(request, GateAction.PARAM_FORCE_GATE_OPEN, false); + Long activityId = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID); + Long lessonId = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID); - //initialize service object - ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); - Activity activity = learnerService.getActivity(activityId); - ActivityMapping actionMappings = LearningWebUtil.getActivityMapping(this.getServlet().getServletContext()); + // initialize service object + ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); + Activity activity = learnerService.getActivity(activityId); + ActivityMapping actionMappings = LearningWebUtil.getActivityMapping(this.getServlet().getServletContext()); - User learner = LearningWebUtil.getUser(learnerService); - Lesson lesson = learnerService.getLesson(lessonId); + User learner = LearningWebUtil.getUser(learnerService); + Lesson lesson = learnerService.getLesson(lessonId); - // don't use LearningWebUtil.getLearnerProgress(request, learnerService) as it may try to get the lesson - // from the activity and the activity may be null (if this was a system stop gate). - LearnerProgress learnerProgress = (LearnerProgress) request - .getAttribute(ActivityAction.LEARNER_PROGRESS_REQUEST_ATTRIBUTE); - if (learnerProgress == null) { - learnerProgress = learnerService.getProgress(learner.getUserId(), lessonId); - } + // don't use LearningWebUtil.getLearnerProgress(request, learnerService) as it may try to get the lesson + // from the activity and the activity may be null (if this was a system stop gate). + LearnerProgress learnerProgress = (LearnerProgress) request + .getAttribute(ActivityAction.LEARNER_PROGRESS_REQUEST_ATTRIBUTE); + if (learnerProgress == null) { + learnerProgress = learnerService.getProgress(learner.getUserId(), lessonId); + } - if (activity != null) { - //knock the gate - GateActivityDTO gate = learnerService.knockGate(activityId, learner, forceGate); + if (activity != null) { + // knock the gate + GateActivityDTO gate = learnerService.knockGate(activityId, learner, forceGate); - if (gate == null) { - throw new LearnerServiceException("Gate missing. gate id [" + activityId + "]"); - } + if (gate == null) { + throw new LearnerServiceException("Gate missing. gate id [" + activityId + "]"); + } - //if the gate is closed, ask the learner to wait ( updating the cached learner progress on the way ) - if (!gate.getAllowToPass()) { - ActionForward forward = findViewByGateType(mapping, (DynaActionForm) form, gate, lesson); - LearningWebUtil.setupProgressInRequest((DynaActionForm) form, request, learnerProgress); - return forward; - } - } + // if the gate is closed, ask the learner to wait ( updating the cached learner progress on the way ) + if (!gate.getAllowToPass()) { + ActionForward forward = findViewByGateType(mapping, (DynaActionForm) form, gate, lesson); + LearningWebUtil.setupProgressInRequest((DynaActionForm) form, request, learnerProgress); + return forward; + } + } - // gate is open, so let the learner go to the next activity ( updating the cached learner progress on the way ) - return LearningWebUtil.completeActivity(request, response, actionMappings, learnerProgress, activity, - learner.getUserId(), learnerService, true); + // gate is open, so let the learner go to the next activity ( updating the cached learner progress on the way ) + return LearningWebUtil.completeActivity(request, response, actionMappings, learnerProgress, activity, learner + .getUserId(), learnerService, true); - } + } - //--------------------------------------------------------------------- - // Helper methods - //--------------------------------------------------------------------- - /** - * Dispatch view the according to the gate type. - * - * @param mapping An ActionMapping class that will be used by the Action - * class to tell the ActionServlet where to send the end-user. - * @param gateForm The ActionForm class that will contain any data submitted - * by the end-user via a form. - * @param permissionGate the gate activity object - * @param totalNumActiveLearners total number of active learners in the lesson (may not all be logged in) - * @return An ActionForward class that will be returned to the ActionServlet - * indicating where the user is to go next. - */ - private ActionForward findViewByGateType(ActionMapping mapping, DynaActionForm gateForm, GateActivityDTO gate, Lesson lesson) { - gateForm.set("totalLearners", new Integer(gate.getExpectedLearners().size())); - gateForm.set("waitingLearners", new Integer(gate.getWaitingLearners().size())); - gateForm.set("previewLesson", lesson.isPreviewLesson()); - gateForm.set(AttributeNames.PARAM_ACTIVITY_ID, gate.getActivityId()); - gateForm.set(AttributeNames.PARAM_LESSON_ID, lesson.getLessonId()); - gateForm.set("gate", gate); - if (gate.isSynchGate()) { - return mapping.findForward(GateAction.VIEW_SYNCH_GATE); - } - else if (gate.isScheduleGate()) { - ScheduleGateActivity scheduleGate = (ScheduleGateActivity) gate.getGateActivity(); - gateForm.set("startingTime", scheduleGate.getGateStartDateTime()); - gateForm.set("endingTime", scheduleGate.getGateEndDateTime()); - return mapping.findForward(GateAction.VIEW_SCHEDULE_GATE); - } - else if (gate.isConditionGate()) { - return mapping.findForward(GateAction.VIEW_CONDITION_GATE); - } - else if (gate.isPermissionGate() || gate.isSystemGate()) { - return mapping.findForward(GateAction.VIEW_PERMISSION_GATE); - } - else { - throw new LearnerServiceException("Invalid gate activity. " + "gate id [" + gate.getActivityId() + "] - the type [" - + gate.getActivityTypeId() + "] is not a gate type"); - } + // --------------------------------------------------------------------- + // Helper methods + // --------------------------------------------------------------------- + /** + * Dispatch view the according to the gate type. + * + * @param mapping + * An ActionMapping class that will be used by the Action class to tell the ActionServlet where to + * send the end-user. + * @param gateForm + * The ActionForm class that will contain any data submitted by the end-user via a form. + * @param permissionGate + * the gate activity object + * @param totalNumActiveLearners + * total number of active learners in the lesson (may not all be logged in) + * @return An ActionForward class that will be returned to the ActionServlet indicating where the user is to go + * next. + */ + private ActionForward findViewByGateType(ActionMapping mapping, DynaActionForm gateForm, GateActivityDTO gate, + Lesson lesson) { + gateForm.set("totalLearners", new Integer(gate.getExpectedLearners().size())); + gateForm.set("waitingLearners", new Integer(gate.getWaitingLearners().size())); + gateForm.set("previewLesson", lesson.isPreviewLesson()); + gateForm.set("monitorCanOpenGate", true); + gateForm.set(AttributeNames.PARAM_ACTIVITY_ID, gate.getActivityId()); + gateForm.set(AttributeNames.PARAM_LESSON_ID, lesson.getLessonId()); + gateForm.set("gate", gate); + if (gate.isSynchGate()) { + return mapping.findForward(GateAction.VIEW_SYNCH_GATE); + } else if (gate.isScheduleGate()) { + ScheduleGateActivity scheduleGate = (ScheduleGateActivity) gate.getGateActivity(); + gateForm.set("startingTime", scheduleGate.getGateStartDateTime()); + gateForm.set("endingTime", scheduleGate.getGateEndDateTime()); + return mapping.findForward(GateAction.VIEW_SCHEDULE_GATE); + } else if (gate.isConditionGate()) { + gateForm.set("monitorCanOpenGate", false); + return mapping.findForward(GateAction.VIEW_CONDITION_GATE); + } else if (gate.isPermissionGate() || gate.isSystemGate()) { + return mapping.findForward(GateAction.VIEW_PERMISSION_GATE); + } else { + throw new LearnerServiceException("Invalid gate activity. " + "gate id [" + gate.getActivityId() + + "] - the type [" + gate.getActivityTypeId() + "] is not a gate type"); } + } } Index: lams_learning/web/gate/gateNext.jsp =================================================================== diff -u -r9481bb9c6f8c0e4d6fbed6b230a41c77feda64c6 -r8386a3fecd9c7baf6ed69d499016dedd8a83eac6 --- lams_learning/web/gate/gateNext.jsp (.../gateNext.jsp) (revision 9481bb9c6f8c0e4d6fbed6b230a41c77feda64c6) +++ lams_learning/web/gate/gateNext.jsp (.../gateNext.jsp) (revision 8386a3fecd9c7baf6ed69d499016dedd8a83eac6) @@ -1,7 +1,8 @@ + +

+
-

-

 

&force=true