Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -r39838c382f405d63b2bd93eeb2b4cae36d4a2877 -r1fe0f4f546903187be6f35e4d5c027853da9408c Binary files differ Index: lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java =================================================================== diff -u -rd3b9b5d94b98da06dcce673877406d8e580a114e -r1fe0f4f546903187be6f35e4d5c027853da9408c --- lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java (.../ObjectExtractor.java) (revision d3b9b5d94b98da06dcce673877406d8e580a114e) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java (.../ObjectExtractor.java) (revision 1fe0f4f546903187be6f35e4d5c027853da9408c) @@ -470,6 +470,7 @@ progressDefaultChildActivities(); learningDesign.setFirstActivity(learningDesign.calculateFirstActivity()); + learningDesign.setFloatingActivity(learningDesign.calculateFloatingActivity()); learningDesignDAO.insertOrUpdate(learningDesign); deleteUnwantedGroupings(); Index: lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java =================================================================== diff -u -r05db875c7974d705f89231416ff6dfe91a5e70f1 -r1fe0f4f546903187be6f35e4d5c027853da9408c --- lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java (.../AuthoringService.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/service/AuthoringService.java (.../AuthoringService.java) (revision 1fe0f4f546903187be6f35e4d5c027853da9408c) @@ -936,6 +936,7 @@ // set first activity assumes that the transitions are all set up // correctly. newLearningDesign.setFirstActivity(newLearningDesign.calculateFirstActivity()); + newLearningDesign.setFloatingActivity(newLearningDesign.calculateFloatingActivity()); newLearningDesign.setLearningDesignUIID(originalLearningDesign.getLearningDesignUIID()); updateCompetenceMappings(newLearningDesign.getCompetences(), newActivities); Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesign.hbm.xml =================================================================== diff -u -rda463361264d2a6fa4948cf8c089c649c2f7064a -r1fe0f4f546903187be6f35e4d5c027853da9408c --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesign.hbm.xml (.../LearningDesign.hbm.xml) (revision da463361264d2a6fa4948cf8c089c649c2f7064a) +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/LearningDesign.hbm.xml (.../LearningDesign.hbm.xml) (revision 1fe0f4f546903187be6f35e4d5c027853da9408c) @@ -189,6 +189,14 @@ + + + + @hibernate.column name="floating_activity_id" + + + + Index: lams_common/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r699b25061c42a5974cdaf8934d9f57219fa1dc2f -r1fe0f4f546903187be6f35e4d5c027853da9408c --- lams_common/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 699b25061c42a5974cdaf8934d9f57219fa1dc2f) +++ lams_common/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 1fe0f4f546903187be6f35e4d5c027853da9408c) @@ -56,6 +56,6 @@ validation.error.conditionGateMustHaveAnInputToolActivity =A Condition Gate must have an Input Tool. validation.error.FloatingActivity.maximum =A maximum of {0} reference activities is allow. Please remove one or more reference activities. validation.error.FloatingActivity =If you are planning to have reference activities you need at least one reference activity in the container. +validation.error.first.activity =A starting Activity is missing from the sequence. - #======= End labels: Exported 50 labels for en AU ===== Index: lams_common/db/sql/create_lams_11_tables.sql =================================================================== diff -u -r05db875c7974d705f89231416ff6dfe91a5e70f1 -r1fe0f4f546903187be6f35e4d5c027853da9408c --- lams_common/db/sql/create_lams_11_tables.sql (.../create_lams_11_tables.sql) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1) +++ lams_common/db/sql/create_lams_11_tables.sql (.../create_lams_11_tables.sql) (revision 1fe0f4f546903187be6f35e4d5c027853da9408c) @@ -346,6 +346,7 @@ , description TEXT , title VARCHAR(255) , first_activity_id BIGINT(20) + , floating_activity_id BIGINT(20) , max_id INT(11) , valid_design_flag TINYINT(4) NOT NULL , read_only_flag TINYINT(4) NOT NULL @@ -386,6 +387,7 @@ )TYPE=InnoDB; CREATE INDEX idx_design_parent_id ON lams_learning_design (original_learning_design_id ASC); CREATE INDEX idx_design_first_act ON lams_learning_design (first_activity_id ASC); +CREATE INDEX idx_design_floating_act ON lams_learning_design (floating_activity_id ASC); CREATE TABLE lams_grouping ( grouping_id BIGINT(20) NOT NULL AUTO_INCREMENT Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch0015_updateFrom22.sql =================================================================== diff -u -r05db875c7974d705f89231416ff6dfe91a5e70f1 -r1fe0f4f546903187be6f35e4d5c027853da9408c --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch0015_updateFrom22.sql (.../patch0015_updateFrom22.sql) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch0015_updateFrom22.sql (.../patch0015_updateFrom22.sql) (revision 1fe0f4f546903187be6f35e4d5c027853da9408c) @@ -9,6 +9,11 @@ ALTER TABLE lams_tool ADD COLUMN pedagogical_planner_url TEXT; ALTER TABLE lams_system_tool ADD COLUMN pedagogical_planner_url TEXT; UPDATE lams_system_tool SET pedagogical_planner_url='pedagogicalPlanner/initGrouping.do' WHERE system_tool_id=1; + +-- LDEV-2074 -------------- +ALTER TABLE lams_learning_design ADD COLUMN first_activity_id BIGINT(20); +CREATE INDEX idx_design_floating_act ON lams_learning_design (floating_activity_id ASC); + ----------------------Put all sql statements above here------------------------- -- If there were no errors, commit and restore autocommit to on Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/Activity.java =================================================================== diff -u -r39838c382f405d63b2bd93eeb2b4cae36d4a2877 -r1fe0f4f546903187be6f35e4d5c027853da9408c --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/Activity.java (.../Activity.java) (revision 39838c382f405d63b2bd93eeb2b4cae36d4a2877) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/Activity.java (.../Activity.java) (revision 1fe0f4f546903187be6f35e4d5c027853da9408c) @@ -1161,5 +1161,13 @@ return getParentBranch(parent, processedActivityIds); } + + public boolean isFloating() { + if(parentActivity != null) { + return parentActivity.isFloatingActivity(); + } + + return false; + } } \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesign.java =================================================================== diff -u -rfdbf7a3cfb10831b1ac581efa42807d3207a71ff -r1fe0f4f546903187be6f35e4d5c027853da9408c --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesign.java (.../LearningDesign.java) (revision fdbf7a3cfb10831b1ac581efa42807d3207a71ff) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesign.java (.../LearningDesign.java) (revision 1fe0f4f546903187be6f35e4d5c027853da9408c) @@ -79,6 +79,9 @@ /** nullable persistent field */ private Activity firstActivity; + + /** nullable persistent field */ + private Activity floatingActivity; /** nullable persistent field */ private Integer maxID; @@ -167,6 +170,7 @@ String description, String title, Activity firstActivity, + Activity floatingActivity, Integer maxID, Boolean validDesign, Boolean readOnly, @@ -194,6 +198,7 @@ this.description = description; this.title = title; this.firstActivity = firstActivity; + this.floatingActivity = floatingActivity; this.maxID = maxID; this.validDesign = validDesign; this.readOnly = readOnly; @@ -483,13 +488,26 @@ Iterator parentIterator = parentActivities.iterator(); while(parentIterator.hasNext()){ Activity activity = (Activity)parentIterator.next(); - if(activity.getTransitionTo()==null){ + if(activity.getTransitionTo()==null && !activity.isFloatingActivity()){ newFirstActivity = activity; break; } } return newFirstActivity; } + public Activity calculateFloatingActivity(){ + Activity newFloatingActivity = null; + HashSet parentActivities = this.getParentActivities(); + Iterator parentIterator = parentActivities.iterator(); + while(parentIterator.hasNext()){ + Activity activity = (Activity)parentIterator.next(); + if(activity.isFloatingActivity()){ + newFloatingActivity = activity; + break; + } + } + return newFloatingActivity; + } public WorkspaceFolder getWorkspaceFolder() { return workspaceFolder; } @@ -565,7 +583,13 @@ this.competences = competences; } - + public void setFloatingActivity(Activity activity) { + floatingActivity = activity; + } + + public Activity getFloatingActivity() { + return floatingActivity; + } } \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignProcessor.java =================================================================== diff -u -r4f68a533e24967e0185132c5e361a8a054f43941 -r1fe0f4f546903187be6f35e4d5c027853da9408c --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignProcessor.java (.../LearningDesignProcessor.java) (revision 4f68a533e24967e0185132c5e361a8a054f43941) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignProcessor.java (.../LearningDesignProcessor.java) (revision 1fe0f4f546903187be6f35e4d5c027853da9408c) @@ -67,9 +67,16 @@ /** Do any processing needed at the end of a complex activity */ public abstract void endSimpleActivity(SimpleActivity activity) throws LearningDesignProcessorException; + /** A simple activity has been found. Do any processing needed at the start of the activity */ + //public abstract void startFloatingActivity(FloatingActivity activity) throws LearningDesignProcessorException ; + + /** Do any processing needed at the end of a complex activity */ + //public abstract void endFloatingActivity(FloatingActivity activity) throws LearningDesignProcessorException; + public void parseLearningDesign() throws LearningDesignProcessorException { if ( getDesign() != null ) { handleActivity(getDesign().getFirstActivity()); + if(getDesign().getFloatingActivity() != null) handleComplexActivity(getDesign().getFloatingActivity()); } } @@ -132,7 +139,7 @@ startSimpleActivity(simple); endSimpleActivity(simple); } - + public LearningDesign getDesign() { return design; } Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LearningDesignDTO.java =================================================================== diff -u -rfdbf7a3cfb10831b1ac581efa42807d3207a71ff -r1fe0f4f546903187be6f35e4d5c027853da9408c --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LearningDesignDTO.java (.../LearningDesignDTO.java) (revision fdbf7a3cfb10831b1ac581efa42807d3207a71ff) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LearningDesignDTO.java (.../LearningDesignDTO.java) (revision 1fe0f4f546903187be6f35e4d5c027853da9408c) @@ -56,6 +56,8 @@ private String title; private Long firstActivityID; private Integer firstActivityUIID; + private Long floatingActivityID; + private Integer floatingActivityUIID; private Integer maxID; private Boolean validDesign; private Boolean readOnly; @@ -96,6 +98,8 @@ String title, Long firstActivityID, Integer firstActivityUIID, + Long floatingActivityID, + Integer floatingActivityUIID, Integer maxId, Boolean validDesign, Boolean readOnly, @@ -124,6 +128,8 @@ this.title = title; this.firstActivityID = firstActivityID; this.firstActivityUIID = firstActivityUIID; + this.floatingActivityID = floatingActivityID; + this.floatingActivityUIID = floatingActivityUIID; this.maxID = maxId; this.validDesign = validDesign; this.readOnly = readOnly; @@ -162,6 +168,13 @@ this.firstActivityUIID = learningDesign.getFirstActivity()!=null? learningDesign.getFirstActivity().getActivityUIID(): null; + this.floatingActivityID = learningDesign.getFirstActivity()!=null? + learningDesign.getFirstActivity().getActivityId(): + null; + this.floatingActivityUIID = learningDesign.getFloatingActivity()!=null? + learningDesign.getFloatingActivity().getActivityUIID(): + null; + this.maxID = learningDesign.getMaxID(); this.validDesign = learningDesign.getValidDesign(); this.designVersion = learningDesign.getDesignVersion(); @@ -264,6 +277,12 @@ return firstActivityID; } /** + * @return Returns the floatingActivityID. + */ + public Long getFloatingActivityID() { + return floatingActivityID; + } + /** * @return Returns the helpText. */ public String getHelpText() { @@ -522,6 +541,13 @@ this.firstActivityID = firstActivityID; } /** + * @param floatingActivityID The floatingActivityID to set. + */ + public void setFloatingActivityID(Long floatingActivityID) { + if(!floatingActivityID.equals(WDDXTAGS.NUMERIC_NULL_VALUE_LONG)) + this.floatingActivityID = floatingActivityID; + } + /** * @param helpText The helpText to set. */ public void setHelpText(String helpText) { @@ -652,11 +678,24 @@ return firstActivityUIID; } /** + * @return Returns the floatingActivityUIID. + */ + public Integer getFloatingActivityUIID() { + return floatingActivityUIID; + } + /** * @param firstActivityUIID The firstActivityUIID to set. */ public void setFirstActivityUIID(Integer firstActivityUIID) { if(!firstActivityUIID.equals(WDDXTAGS.NUMERIC_NULL_VALUE_INTEGER)) this.firstActivityUIID = firstActivityUIID; + } + /** + * @param floatingActivityUIID The floatingActivityUIID to set. + */ + public void setFloatingActivityUIID(Integer floatingActivityUIID) { + if(!floatingActivityUIID.equals(WDDXTAGS.NUMERIC_NULL_VALUE_INTEGER)) + this.floatingActivityUIID = floatingActivityUIID; } /** * @return Returns the onlineInstructions. Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/ValidationErrorDTO.java =================================================================== diff -u -r39838c382f405d63b2bd93eeb2b4cae36d4a2877 -r1fe0f4f546903187be6f35e4d5c027853da9408c --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/ValidationErrorDTO.java (.../ValidationErrorDTO.java) (revision 39838c382f405d63b2bd93eeb2b4cae36d4a2877) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/ValidationErrorDTO.java (.../ValidationErrorDTO.java) (revision 1fe0f4f546903187be6f35e4d5c027853da9408c) @@ -42,15 +42,16 @@ public static final String GROUPING_SELECTED_ERROR_KEY = "validation.error.GroupingSelected"; // GS public static final String OPTIONAL_ACTIVITY_ERROR_KEY = "validation.error.OptionalActivity"; // OA public static final String OPTIONAL_ACTIVITY_ORDER_ID_INVALID_ERROR_KEY = "validation.error.OptionalActivityOrderId"; // OAOI - public static final String FLOATING_ACTIVITY_ERROR_KEY = "validation.error.FloatingActivity"; // OA - public static final String FLOATING_ACTIVITY_MAX_ERROR_KEY = "validation.error.FloatingActivity.maximum"; // OA + public static final String FLOATING_ACTIVITY_ERROR_KEY = "validation.error.FloatingActivity"; // FLA + public static final String FLOATING_ACTIVITY_MAX_ERROR_KEY = "validation.error.FloatingActivity.maximum"; // FLA public static final String SCHEDULE_GATE_ERROR_TYPE1_KEY = "validation.error.illegalScheduleGateOffsetsType1"; // SG public static final String SCHEDULE_GATE_ERROR_TYPE2_KEY = "validation.error.illegalScheduleGateOffsetsType2"; public static final String CONDITION_GATE_ACTVITY_CONDITION = "validation.error.conditionGateMustHaveACondition"; // CGC public static final String CONDITION_GATE_ACTVITY_TOOLINPUT = "validation.error.conditionGateMustHaveAnInputToolActivity"; // CGI public static final String GROUPING_ACTIVITY_MISSING_GROUPING_KEY = "validation.error.grouping.missing"; // GM public static final String GROUPING_ACTIVITY_GROUP_COUNT_MISMATCH_KEY = "validation.error.group.count.mismatch"; // GC - + public static final String FIRST_ACTIVITY_ERROR_KEY = "validation.error.first.activity"; // FIA + public static final String BRANCHING_ACTIVITY_MUST_HAVE_A_BRANCH = "validation.error.branching.must.have.a.branch"; // BB public static final String BRANCHING_ACTIVITY_MUST_HAVE_DEFAULT_BRANCH = "validation.error.toolBranchingMustHaveDefaultBranch"; // BDB public static final String SEQUENCE_ACTIVITY_MUST_HAVE_FIRST_ACTIVITY = "validation.error.sequenceActivityMustHaveFirstActivity"; // SFA @@ -70,7 +71,7 @@ public static final String GROUPING_SELECTED_ERROR_CODE = "GS"; public static final String OPTIONAL_ACTIVITY_ERROR_CODE = "OA"; public static final String OPTIONAL_ACTIVITY_ORDER_ID_INVALID_ERROR_CODE = "OAOI"; - public static final String FLOATING_ACTIVITY_ERROR_CODE = "FA"; + public static final String FLOATING_ACTIVITY_ERROR_CODE = "FLA"; public static final String FLOATING_ACTIVITY_MAX_ERROR_CODE = "FAMX"; public static final String SCHEDULE_GATE_ERROR_CODE = "SG1"; public static final String CONDITION_GATE_ACTVITY_CONDITION_ERROR_CODE = "CGC"; @@ -85,7 +86,8 @@ public static final String BRANCH_CONDITION_INVALID_ERROR_CODE = "BCOND"; public static final String BRANCHING_ACTVITY_TOOLINPUT_ERROR_CODE = "BTI"; public static final String BRANCHING_ACTVITY_TOOLCONDITION_ERROR_CODE = "BTC"; - + public static final String FIRST_ACTIVITY_ERROR_CODE = "FIA"; + private static MessageResources resources = MessageResources.getMessageResources(ValidationErrorDTO.CONFIG_PARAM); /** * Rule: Other (Covers any cases that are not covered by another code) Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/LearningDesignValidator.java =================================================================== diff -u -r39838c382f405d63b2bd93eeb2b4cae36d4a2877 -r1fe0f4f546903187be6f35e4d5c027853da9408c --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/LearningDesignValidator.java (.../LearningDesignValidator.java) (revision 39838c382f405d63b2bd93eeb2b4cae36d4a2877) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/LearningDesignValidator.java (.../LearningDesignValidator.java) (revision 1fe0f4f546903187be6f35e4d5c027853da9408c) @@ -65,6 +65,11 @@ public Vector validate() { errors = new Vector(); // initialises the list of validation messages. + // check the design has a starting or first activity + if(learningDesign.getFirstActivity() == null) + errors.add(new ValidationErrorDTO(ValidationErrorDTO.FIRST_ACTIVITY_ERROR_CODE, messageService + .getMessage(ValidationErrorDTO.FIRST_ACTIVITY_ERROR_KEY))); + // check all activities have their necessary transitions. First check the // top level, then we need to check each branch inside a branching activity. Set topLevelActivities = extractFloatingActivities(learningDesign.getParentActivities()); @@ -93,9 +98,12 @@ * @param topLevelActivities Set of Top-level activities. */ private Set extractFloatingActivities(Set topLevelActivities) { - for (Activity activity : (Set) topLevelActivities) - if(activity.isFloatingActivity()) + for (Activity activity : (Set) topLevelActivities) { + if(activity.isFloatingActivity()) { topLevelActivities.remove(activity); + return topLevelActivities; + } + } return topLevelActivities; } Index: lams_common/src/java/org/lamsfoundation/lams/util/wddx/WDDXTAGS.java =================================================================== diff -u -rd3b9b5d94b98da06dcce673877406d8e580a114e -r1fe0f4f546903187be6f35e4d5c027853da9408c --- lams_common/src/java/org/lamsfoundation/lams/util/wddx/WDDXTAGS.java (.../WDDXTAGS.java) (revision d3b9b5d94b98da06dcce673877406d8e580a114e) +++ lams_common/src/java/org/lamsfoundation/lams/util/wddx/WDDXTAGS.java (.../WDDXTAGS.java) (revision 1fe0f4f546903187be6f35e4d5c027853da9408c) @@ -170,6 +170,8 @@ 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 FLOATING_ACTIVITY_ID = "floatingActivityID"; + public static final String FLOATING_ACTIVITY_UIID = "floatingActivityUIID"; public static final String MAX_ID = "maxID"; public static final String VALID_DESIGN = "validDesign"; Index: lams_common/test/java/org/lamsfoundation/lams/learningdesign/dao/TestLearningDesignDAO.java =================================================================== diff -u -r870373d635bc769aee2dc271e6ff12818fcfcea6 -r1fe0f4f546903187be6f35e4d5c027853da9408c --- lams_common/test/java/org/lamsfoundation/lams/learningdesign/dao/TestLearningDesignDAO.java (.../TestLearningDesignDAO.java) (revision 870373d635bc769aee2dc271e6ff12818fcfcea6) +++ lams_common/test/java/org/lamsfoundation/lams/learningdesign/dao/TestLearningDesignDAO.java (.../TestLearningDesignDAO.java) (revision 1fe0f4f546903187be6f35e4d5c027853da9408c) @@ -64,6 +64,13 @@ long x = 20; assertEquals(activity.getActivityId().longValue(),x); } + public void testCalculateFloatingActivity(){ + learningDesign = learningDesignDAO.getLearningDesignById(new Long(1)); + Activity activity = learningDesign.calculateFloatingActivity(); + assertNotNull(activity.getActivityId()); + long x = 20; + assertEquals(activity.getActivityId().longValue(),x); + } public void testGetAllValidLearningDesignsInFolder(){ List list = learningDesignDAO.getAllValidLearningDesignsInFolder(new Integer(1)); System.out.println("SIZE:"+list.size());