Skip to content
Snippets Groups Projects
Commit 671eb0e0 authored by srosse's avatar srosse
Browse files

OO-1780: remap the groups after copy of e-mail course element to the right configuration

parent a5ca87f7
No related branches found
No related tags found
No related merge requests found
......@@ -133,28 +133,26 @@ public class COCourseNode extends AbstractAccessableCourseNode {
ModuleConfiguration mc = getModuleConfiguration();
String coachesGroupNames = (String)mc.get(COEditController.CONFIG_KEY_EMAILTOCOACHES_GROUP);
String particpantsGroupNames = (String)mc.get(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_GROUP);
@SuppressWarnings("unchecked")
List<Long> coachesGroupKeys = (List<Long>) mc.get(COEditController.CONFIG_KEY_EMAILTOCOACHES_GROUP_ID);
@SuppressWarnings("unchecked")
List<Long> participantsGroupKeys = (List<Long>) mc.get(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_GROUP_ID);
//remap group keys
List<Long> coachesGroupKeys = mc.getList(COEditController.CONFIG_KEY_EMAILTOCOACHES_GROUP_ID, Long.class);
if(coachesGroupKeys == null) {
coachesGroupKeys = envMapper.toGroupKeyFromOriginalNames(coachesGroupNames);
} else {
coachesGroupKeys = envMapper.toGroupKeyFromOriginalKeys(coachesGroupKeys);
}
mc.set(COEditController.CONFIG_KEY_EMAILTOGROUP_IDS, coachesGroupKeys);
mc.set(COEditController.CONFIG_KEY_EMAILTOCOACHES_GROUP_ID, coachesGroupKeys);
List<Long> participantsGroupKeys = mc.getList(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_GROUP_ID, Long.class);
if(participantsGroupKeys == null) {
participantsGroupKeys = envMapper.toGroupKeyFromOriginalNames(particpantsGroupNames);
} else {
participantsGroupKeys = envMapper.toGroupKeyFromOriginalKeys(participantsGroupKeys);
}
mc.set(COEditController.CONFIG_KEY_EMAILTOGROUP_IDS, participantsGroupKeys);
mc.set(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_GROUP_ID, participantsGroupKeys);
//remap area keys
String coachesAreaNames = (String)mc.get(COEditController.CONFIG_KEY_EMAILTOCOACHES_AREA);
@SuppressWarnings("unchecked")
List<Long> coachesAreaKeys = (List<Long>) mc.get(COEditController.CONFIG_KEY_EMAILTOCOACHES_AREA_IDS);
List<Long> coachesAreaKeys = mc.getList(COEditController.CONFIG_KEY_EMAILTOCOACHES_AREA_IDS, Long.class);
if(coachesAreaKeys == null) {
coachesAreaKeys = envMapper.toAreaKeyFromOriginalNames(coachesAreaNames);
} else {
......@@ -163,8 +161,7 @@ public class COCourseNode extends AbstractAccessableCourseNode {
mc.set(COEditController.CONFIG_KEY_EMAILTOCOACHES_AREA_IDS, coachesAreaKeys);
String participantsAreaNames = (String)mc.get(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_AREA);
@SuppressWarnings("unchecked")
List<Long> participantsAreaKeys = (List<Long>) mc.get(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_AREA_ID);
List<Long> participantsAreaKeys = mc.getList(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_AREA_ID, Long.class);
if(participantsAreaKeys == null) {
participantsAreaKeys = envMapper.toAreaKeyFromOriginalNames(participantsAreaNames);
} else {
......
......@@ -95,8 +95,7 @@ public class CORunController extends BasicController {
Translator fallback = Util.createPackageTranslator(ContactFormController.class, ureq.getLocale());
setTranslator(Util.createPackageTranslator(CORunController.class, ureq.getLocale(), fallback));
@SuppressWarnings("unchecked")
List<String> emailListConfig = (List<String>) moduleConfiguration.get(COEditController.CONFIG_KEY_EMAILTOADRESSES);
List<String> emailListConfig = moduleConfiguration.getList(COEditController.CONFIG_KEY_EMAILTOADRESSES, String.class);
String mSubject = (String) moduleConfiguration.get(COEditController.CONFIG_KEY_MSUBJECT_DEFAULT);
String mBody = (String) moduleConfiguration.get(COEditController.CONFIG_KEY_MBODY_DEFAULT);
......@@ -110,29 +109,25 @@ public class CORunController extends BasicController {
String participantGroupNames = (String)moduleConfiguration.get(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_GROUP);
@SuppressWarnings("unchecked")
List<Long> participantGroupKeys = (List<Long>) moduleConfiguration.get(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_GROUP_ID);
List<Long> participantGroupKeys = moduleConfiguration.getList(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_GROUP_ID, Long.class);
if(participantGroupKeys == null && StringHelper.containsNonWhitespace(participantGroupNames)) {
participantGroupKeys = businessGroupService.toGroupKeys(participantGroupNames, cgm.getCourseEntry());
}
String participantAreaNames = (String)moduleConfiguration.get(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_AREA);
@SuppressWarnings("unchecked")
List<Long> participantAreaKeys = (List<Long>) moduleConfiguration.get(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_AREA_ID);
List<Long> participantAreaKeys = moduleConfiguration.getList(COEditController.CONFIG_KEY_EMAILTOPARTICIPANTS_AREA_ID, Long.class);
if(participantAreaKeys == null && StringHelper.containsNonWhitespace(participantAreaNames)) {
participantAreaKeys = businessGroupService.toGroupKeys(participantAreaNames, cgm.getCourseEntry());
}
String coachGroupNames = (String)moduleConfiguration.get(COEditController.CONFIG_KEY_EMAILTOCOACHES_GROUP);
@SuppressWarnings("unchecked")
List<Long> coachGroupKeys = (List<Long>) moduleConfiguration.get(COEditController.CONFIG_KEY_EMAILTOCOACHES_GROUP_ID);
List<Long> coachGroupKeys = moduleConfiguration.getList(COEditController.CONFIG_KEY_EMAILTOCOACHES_GROUP_ID, Long.class);
if(coachGroupKeys == null && StringHelper.containsNonWhitespace(coachGroupNames)) {
coachGroupKeys = businessGroupService.toGroupKeys(coachGroupNames, cgm.getCourseEntry());
}
String coachAreaNames = (String)moduleConfiguration.get(COEditController.CONFIG_KEY_EMAILTOCOACHES_AREA);
@SuppressWarnings("unchecked")
List<Long> coachAreaKeys = (List<Long>) moduleConfiguration.get(COEditController.CONFIG_KEY_EMAILTOCOACHES_AREA_IDS);
List<Long> coachAreaKeys = moduleConfiguration.getList(COEditController.CONFIG_KEY_EMAILTOCOACHES_AREA_IDS, Long.class);
if(coachAreaKeys == null && StringHelper.containsNonWhitespace(coachAreaNames)) {
coachAreaKeys = businessGroupService.toGroupKeys(coachAreaNames, cgm.getCourseEntry());
}
......
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