diff --git a/src/main/java/org/olat/course/nodes/ENCourseNode.java b/src/main/java/org/olat/course/nodes/ENCourseNode.java index 6f773e7228285e67d7ae7f11b920edf8c7c05782..c51cafd4554e1387a43b0d30421887a07436bfb8 100644 --- a/src/main/java/org/olat/course/nodes/ENCourseNode.java +++ b/src/main/java/org/olat/course/nodes/ENCourseNode.java @@ -176,7 +176,7 @@ public class ENCourseNode extends AbstractAccessableCourseNode { // FIXME: refine statusdescriptions String shortKey = "error.nogroupdefined.short"; String longKey = "error.nogroupdefined.long"; - String[] params = new String[] { this.getShortTitle() }; + String[] params = new String[] { getShortTitle() }; String translPackage = Util.getPackageName(ENEditController.class); sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage); sd.setDescriptionForUnit(getIdent()); @@ -391,9 +391,8 @@ public class ENCourseNode extends AbstractAccessableCourseNode { public void postImportCopy(CourseEnvironmentMapper envMapper) { ModuleConfiguration mc = getModuleConfiguration(); String groupNames = (String)mc.get(ENCourseNode.CONFIG_GROUPNAME); - @SuppressWarnings("unchecked") - List<Long> groupKeys = (List<Long>) mc.get(ENCourseNode.CONFIG_GROUP_IDS); - if(groupKeys == null) { + List<Long> groupKeys = mc.getList(ENCourseNode.CONFIG_GROUP_IDS, Long.class); + if(groupKeys == null || groupKeys.isEmpty()) { groupKeys = envMapper.toGroupKeyFromOriginalNames(groupNames); } else { groupKeys = envMapper.toGroupKeyFromOriginalKeys(groupKeys); @@ -401,12 +400,11 @@ public class ENCourseNode extends AbstractAccessableCourseNode { mc.set(ENCourseNode.CONFIG_GROUP_IDS, groupKeys); String areaNames = (String)mc.get(ENCourseNode.CONFIG_AREANAME); - @SuppressWarnings("unchecked") - List<Long> areaKeys = (List<Long>) mc.get(ENCourseNode.CONFIG_AREA_IDS); - if(areaKeys == null) { + List<Long> areaKeys = mc.getList(ENCourseNode.CONFIG_AREA_IDS, Long.class); + if(areaKeys == null || areaKeys.isEmpty()) { areaKeys = envMapper.toAreaKeyFromOriginalNames(areaNames); } else { - areaKeys = envMapper.toAreaKeyFromOriginalKeys(groupKeys); + areaKeys = envMapper.toAreaKeyFromOriginalKeys(areaKeys); } mc.set(ENCourseNode.CONFIG_AREA_IDS, areaKeys); } @@ -416,16 +414,14 @@ public class ENCourseNode extends AbstractAccessableCourseNode { super.postExport(envMapper, backwardsCompatible); ModuleConfiguration mc = getModuleConfiguration(); - @SuppressWarnings("unchecked") - List<Long> groupKeys = (List<Long>) mc.get(ENCourseNode.CONFIG_GROUP_IDS); + List<Long> groupKeys = mc.getList(ENCourseNode.CONFIG_GROUP_IDS, Long.class); if(groupKeys != null) { String groupNames = envMapper.toGroupNames(groupKeys); mc.set(ENCourseNode.CONFIG_GROUPNAME, groupNames); } - @SuppressWarnings("unchecked") - List<Long> areaKeys = (List<Long>) mc.get(ENCourseNode.CONFIG_AREA_IDS); - if(areaKeys != null ) { + List<Long> areaKeys = mc.getList(ENCourseNode.CONFIG_AREA_IDS, Long.class); + if(areaKeys != null) { String areaNames = envMapper.toAreaNames(areaKeys); mc.set(ENCourseNode.CONFIG_AREANAME, areaNames); }