Skip to content
Snippets Groups Projects
Commit 5998d52a authored by srosse's avatar srosse
Browse files

OO-2144: enhance compatibility with old course configuration for enrollment

parent 77785aea
No related branches found
No related tags found
No related merge requests found
...@@ -176,7 +176,7 @@ public class ENCourseNode extends AbstractAccessableCourseNode { ...@@ -176,7 +176,7 @@ public class ENCourseNode extends AbstractAccessableCourseNode {
// FIXME: refine statusdescriptions // FIXME: refine statusdescriptions
String shortKey = "error.nogroupdefined.short"; String shortKey = "error.nogroupdefined.short";
String longKey = "error.nogroupdefined.long"; String longKey = "error.nogroupdefined.long";
String[] params = new String[] { this.getShortTitle() }; String[] params = new String[] { getShortTitle() };
String translPackage = Util.getPackageName(ENEditController.class); String translPackage = Util.getPackageName(ENEditController.class);
sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage); sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage);
sd.setDescriptionForUnit(getIdent()); sd.setDescriptionForUnit(getIdent());
...@@ -391,9 +391,8 @@ public class ENCourseNode extends AbstractAccessableCourseNode { ...@@ -391,9 +391,8 @@ public class ENCourseNode extends AbstractAccessableCourseNode {
public void postImportCopy(CourseEnvironmentMapper envMapper) { public void postImportCopy(CourseEnvironmentMapper envMapper) {
ModuleConfiguration mc = getModuleConfiguration(); ModuleConfiguration mc = getModuleConfiguration();
String groupNames = (String)mc.get(ENCourseNode.CONFIG_GROUPNAME); String groupNames = (String)mc.get(ENCourseNode.CONFIG_GROUPNAME);
@SuppressWarnings("unchecked") List<Long> groupKeys = mc.getList(ENCourseNode.CONFIG_GROUP_IDS, Long.class);
List<Long> groupKeys = (List<Long>) mc.get(ENCourseNode.CONFIG_GROUP_IDS); if(groupKeys == null || groupKeys.isEmpty()) {
if(groupKeys == null) {
groupKeys = envMapper.toGroupKeyFromOriginalNames(groupNames); groupKeys = envMapper.toGroupKeyFromOriginalNames(groupNames);
} else { } else {
groupKeys = envMapper.toGroupKeyFromOriginalKeys(groupKeys); groupKeys = envMapper.toGroupKeyFromOriginalKeys(groupKeys);
...@@ -401,12 +400,11 @@ public class ENCourseNode extends AbstractAccessableCourseNode { ...@@ -401,12 +400,11 @@ public class ENCourseNode extends AbstractAccessableCourseNode {
mc.set(ENCourseNode.CONFIG_GROUP_IDS, groupKeys); mc.set(ENCourseNode.CONFIG_GROUP_IDS, groupKeys);
String areaNames = (String)mc.get(ENCourseNode.CONFIG_AREANAME); String areaNames = (String)mc.get(ENCourseNode.CONFIG_AREANAME);
@SuppressWarnings("unchecked") List<Long> areaKeys = mc.getList(ENCourseNode.CONFIG_AREA_IDS, Long.class);
List<Long> areaKeys = (List<Long>) mc.get(ENCourseNode.CONFIG_AREA_IDS); if(areaKeys == null || areaKeys.isEmpty()) {
if(areaKeys == null) {
areaKeys = envMapper.toAreaKeyFromOriginalNames(areaNames); areaKeys = envMapper.toAreaKeyFromOriginalNames(areaNames);
} else { } else {
areaKeys = envMapper.toAreaKeyFromOriginalKeys(groupKeys); areaKeys = envMapper.toAreaKeyFromOriginalKeys(areaKeys);
} }
mc.set(ENCourseNode.CONFIG_AREA_IDS, areaKeys); mc.set(ENCourseNode.CONFIG_AREA_IDS, areaKeys);
} }
...@@ -416,16 +414,14 @@ public class ENCourseNode extends AbstractAccessableCourseNode { ...@@ -416,16 +414,14 @@ public class ENCourseNode extends AbstractAccessableCourseNode {
super.postExport(envMapper, backwardsCompatible); super.postExport(envMapper, backwardsCompatible);
ModuleConfiguration mc = getModuleConfiguration(); ModuleConfiguration mc = getModuleConfiguration();
@SuppressWarnings("unchecked") List<Long> groupKeys = mc.getList(ENCourseNode.CONFIG_GROUP_IDS, Long.class);
List<Long> groupKeys = (List<Long>) mc.get(ENCourseNode.CONFIG_GROUP_IDS);
if(groupKeys != null) { if(groupKeys != null) {
String groupNames = envMapper.toGroupNames(groupKeys); String groupNames = envMapper.toGroupNames(groupKeys);
mc.set(ENCourseNode.CONFIG_GROUPNAME, groupNames); mc.set(ENCourseNode.CONFIG_GROUPNAME, groupNames);
} }
@SuppressWarnings("unchecked") List<Long> areaKeys = mc.getList(ENCourseNode.CONFIG_AREA_IDS, Long.class);
List<Long> areaKeys = (List<Long>) mc.get(ENCourseNode.CONFIG_AREA_IDS); if(areaKeys != null) {
if(areaKeys != null ) {
String areaNames = envMapper.toAreaNames(areaKeys); String areaNames = envMapper.toAreaNames(areaKeys);
mc.set(ENCourseNode.CONFIG_AREANAME, areaNames); mc.set(ENCourseNode.CONFIG_AREANAME, areaNames);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment