Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java =================================================================== diff -u -r01dc4c845c05a0f718f8d6bff395337f2a6e6fa0 -r05a283f0b2253465a2b8ad7b36d1a1691ddba707 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java (.../ExportToolContentService.java) (revision 01dc4c845c05a0f718f8d6bff395337f2a6e6fa0) +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java (.../ExportToolContentService.java) (revision 05a283f0b2253465a2b8ad7b36d1a1691ddba707) @@ -345,7 +345,8 @@ private static final String KEY_MSG_IMPORT_FILE_FORMAT = "msg.import.file.format"; /** - * Class of tool attachment file handler class and relative fields information container. + * Class of tool attachment file handler class and relative fields + * information container. */ private class NameInfo { @@ -492,8 +493,8 @@ } /** - * This class is just for later system extent tool compaiblity strategy use. Currently, it just simple to get tool - * by same signature. + * This class is just for later system extent tool compaiblity strategy use. + * Currently, it just simple to get tool by same signature. * * @author Steve.Ni * @@ -701,8 +702,8 @@ /** * Generate temporary files: resources.xml and transitions.xml.
- * Transform LAMS format learning_design.xml with resources.xml and transitions.xml into ims_learning_design.xml - * file. + * Transform LAMS format learning_design.xml with resources.xml and + * transitions.xml into ims_learning_design.xml file. * * @param resChildren * @param rootDir @@ -888,9 +889,10 @@ } /** - * Generate the nodes for a property and the related conditions. The first element is the property, which goes in - * the tag, the second through fourth elements are the if-then-else that makes up the condition and - * goes in the tag. + * Generate the nodes for a property and the related conditions. The first + * element is the property, which goes in the tag, the second + * through fourth elements are the if-then-else that makes up the condition + * and goes in the tag. * * @param activityId * @return @@ -946,11 +948,15 @@ } /** - * This quite complex method will return a sorted acitivityDTO list according to current LD DTO.
- * It considers the broken LD situation. A first activity will always be first one, but others in the broken - * sequence in this LD sorted by randomly. In one broken sequence, all activities will sorted by transition.
- * The reason to use lots "for" is Activity DTO does not contain next transition information. It has to be iterator - * all transitions or activities. + * This quite complex method will return a sorted acitivityDTO list + * according to current LD DTO.
+ * It considers the broken LD situation. A first activity will always be + * first one, but others in the broken sequence in this LD sorted by + * randomly. In one broken sequence, all activities will sorted by + * transition.
+ * The reason to use lots "for" is Activity DTO does not contain next + * transition information. It has to be iterator all transitions or + * activities. * * @param ldDto * @return @@ -1049,8 +1055,9 @@ } /** - * Move LAMS tool.xml from tool folder to export content root folder and modify it to {toolContentID}.xml file. - * Cache all attachement files from this tool into ArrayList, which will be save into a temporary file + * Move LAMS tool.xml from tool folder to export content root folder and + * modify it to {toolContentID}.xml file. Cache all attachement files from + * this tool into ArrayList, which will be save into a temporary file * (resources.xml) and used by XSLT. * * @param rootDir @@ -1237,8 +1244,9 @@ } /** - * Import the learning design from the given path. Set the importer as the creator. If the workspaceFolderUid is - * null then saves the design in the user's own workspace folder. + * Import the learning design from the given path. Set the importer as the + * creator. If the workspaceFolderUid is null then saves the design in the + * user's own workspace folder. * * @param designFile * @param importer @@ -1319,8 +1327,8 @@ * * @return learningDesingID * @throws ExportToolContentException - * @see org.lamsfoundation.lams.authoring.service.IExportToolContentService.importLearningDesign102(String, User, - * WorkspaceFolder) + * @see org.lamsfoundation.lams.authoring.service.IExportToolContentService.importLearningDesign102(String, + * User, WorkspaceFolder) */ public Long importLearningDesignV102(String ldWddxPacket, User importer, Integer workspaceFolderUid, List toolsErrorMsgs) throws ImportToolContentException { @@ -1747,7 +1755,8 @@ } /** - * If there are any errors happen during tool exporting content. Writing failed message to file. + * If there are any errors happen during tool exporting content. Writing + * failed message to file. */ private void writeErrorToToolFile(String rootPath, Long toolContentId, String msg) { // create tool's save path @@ -2017,11 +2026,13 @@ // Once the learning design is saved, we can import the competences Set competenceList = new HashSet(); - for (CompetenceDTO competenceDTO : dto.getCompetences()) { - Competence competence = new Competence(); - competence.setDescription(competenceDTO.getDescription()); - competence.setTitle(competenceDTO.getTitle()); - competenceList.add(competence); + if (dto.getCompetences() != null) { + for (CompetenceDTO competenceDTO : dto.getCompetences()) { + Competence competence = new Competence(); + competence.setDescription(competenceDTO.getDescription()); + competence.setTitle(competenceDTO.getTitle()); + competenceList.add(competence); + } } // TODO: Save competence mappings on import. @@ -2101,7 +2112,8 @@ } /** - * Method to sort activity DTO according to the rule: Paretns is before their children. + * Method to sort activity DTO according to the rule: Paretns is before + * their children. * * @param activities * @return @@ -2143,10 +2155,12 @@ } /** - * Get learning design object from this Learning design DTO object. It also following our import rules: + * Get learning design object from this Learning design DTO object. It also + * following our import rules: *
  • lams_license - Assume same in all lams system. Import same ID
  • *
  • lams_copy_type - Set to 1.This indicates it is "normal" design.
  • - *
  • lams_workspace_folder - An input parameters to let user choose import workspace
  • + *
  • lams_workspace_folder - An input parameters to let user choose + * import workspace
  • *
  • User - The person who execute import action
  • *
  • OriginalLearningDesign - set to null
  • * @@ -2301,12 +2315,14 @@ } /** - * Creates the map entry between a branch sequence activity and a group. We need the group maps and the activity - * maps so that we can update the ids to the groups and the activities. Therefore this method must be done after all - * the groups are imported and the activities are imported. + * Creates the map entry between a branch sequence activity and a group. We + * need the group maps and the activity maps so that we can update the ids + * to the groups and the activities. Therefore this method must be done + * after all the groups are imported and the activities are imported. * - * Note: there isn't an set in the learning design for the branch mappings. The group objects actually contain the - * link to the mappings, so this method updates the group objects. + * Note: there isn't an set in the learning design for the branch mappings. + * The group objects actually contain the link to the mappings, so this + * method updates the group objects. */ private BranchActivityEntry getBranchActivityEntry(BranchActivityEntryDTO entryDto, Map groupByUIIDMapper, Map activityByUIIDMapper) {