Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -r49867f4335115e9ead65e6911111410a6da5af1c -r01cc9502760d6b2a784d254efc95adc700a15e25 Binary files differ Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/AuthoringActivityDTO.java =================================================================== diff -u -rdd9119169c0c90312762924f8ee12e15c7674efa -r01cc9502760d6b2a784d254efc95adc700a15e25 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/AuthoringActivityDTO.java (.../AuthoringActivityDTO.java) (revision dd9119169c0c90312762924f8ee12e15c7674efa) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/AuthoringActivityDTO.java (.../AuthoringActivityDTO.java) (revision 01cc9502760d6b2a784d254efc95adc700a15e25) @@ -218,7 +218,6 @@ * GroupingActivity. For the groupings array see LearningDesignDTO. */ // private GroupingDTO groupingDTO; - /** * Single Library can have one or more activities defined inside it. This field indicates which activity is this. */ @@ -954,7 +953,7 @@ * The groupingID to set. */ public void setGroupingID(Long groupingID) { - if (!groupingID.equals(WDDXTAGS.NUMERIC_NULL_VALUE_LONG)) { + if (!WDDXTAGS.NUMERIC_NULL_VALUE_LONG.equals(groupingID)) { this.groupingID = groupingID; } } @@ -964,7 +963,7 @@ * The groupingUIID to set. */ public void setGroupingUIID(Integer groupingUIID) { - if (!groupingUIID.equals(WDDXTAGS.NUMERIC_NULL_VALUE_INTEGER)) { + if (!WDDXTAGS.NUMERIC_NULL_VALUE_LONG.equals(groupingUIID)) { this.groupingUIID = groupingUIID; } } Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java =================================================================== diff -u -r3ab4d0836d2a5df92096b5e8c69b676e84c03cd9 -r01cc9502760d6b2a784d254efc95adc700a15e25 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java (.../ExportToolContentService.java) (revision 3ab4d0836d2a5df92096b5e8c69b676e84c03cd9) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java (.../ExportToolContentService.java) (revision 01cc9502760d6b2a784d254efc95adc700a15e25) @@ -468,12 +468,15 @@ ldDto.setTitle(ldDto.getTitle().concat(ExportToolContentService.IMS_FILE_NAME_EXT)); } - XStream designXml = new XStream(); - designXml.toXML(ldDto, ldFile); - ldFile.close(); + /* + * learning design DTO is ready to be written into XML, but we need to find out which groupings and + * branching mappings are not supposed to be included into the structure (LDEV-1825) + */ + Set groupingsToSkip = new TreeSet(); + // for these branching activities there will be no branching mappings saved into XML, since they will be + // recreated in monitoring + Set branchingActivitiesToSkip = new TreeSet(); - log.debug("Learning design xml export success"); - // iterator all activities in this learning design and export their content to given folder. // The content will contain tool.xml and attachment files of tools from LAMS repository. List activities = ldDto.getActivities(); @@ -484,9 +487,25 @@ // iterator all activities and export tool.xml and its attachments for (AuthoringActivityDTO activity : activities) { + int activityTypeID = activity.getActivityTypeID().intValue(); + // for teacher chosen and tool based branching activities there should be no groupings saved to XML + if (activityTypeID == Activity.CHOSEN_BRANCHING_ACTIVITY_TYPE + || activityTypeID == Activity.TOOL_BRANCHING_ACTIVITY_TYPE) { + Long groupingID = activity.getGroupingID(); + if (groupingID != null) { + groupingsToSkip.add(groupingID); + } + activity.setApplyGrouping(false); + activity.setGroupingID(null); + activity.setGroupingUIID(null); + continue; + } + // for group based define later branching activities there should be no branching mappings saved to XML + if (activityTypeID == Activity.GROUP_BRANCHING_ACTIVITY_TYPE && activity.getDefineLater()) { + branchingActivitiesToSkip.add(activity.getActivityUIID()); + } // skip non-tool activities - if (activity.getActivityTypeID().intValue() != Activity.TOOL_ACTIVITY_TYPE) { - + if (activityTypeID != Activity.TOOL_ACTIVITY_TYPE) { continue; } @@ -517,6 +536,28 @@ } } // end all activities export + // skipping unwanted elements; learning design DTO is altered but not persisted; + Iterator groupingIter = ldDto.getGroupings().iterator(); + while (groupingIter.hasNext()) { + if (groupingsToSkip.contains(groupingIter.next().getGroupingID())) { + groupingIter.remove(); + } + } + + Iterator branchMappingsIter = ldDto.getBranchMappings().iterator(); + while (branchMappingsIter.hasNext()) { + if (branchingActivitiesToSkip.contains(branchMappingsIter.next().getBranchingActivityUIID())) { + branchMappingsIter.remove(); + } + } + + // exporting XML + XStream designXml = new XStream(); + designXml.toXML(ldDto, ldFile); + ldFile.close(); + + log.debug("Learning design xml export success"); + try { // handle IMS format if (format == ExportToolContentService.PACKAGE_FORMAT_IMS) {