use of org.olat.group.model.BGAreaReference in project OpenOLAT by OpenOLAT.
the class CourseEnvironmentMapper method toAreaKeyFromOriginalNames.
public List<Long> toAreaKeyFromOriginalNames(String areaNames) {
if (!StringHelper.containsNonWhitespace(areaNames))
return null;
String[] areaNameArr = areaNames.split(",");
List<Long> areaKeyList = new ArrayList<Long>();
for (String areaName : areaNameArr) {
areaName = areaName.trim();
for (BGAreaReference area : areas) {
if (areaName.equalsIgnoreCase(area.getOriginalName())) {
areaKeyList.add(area.getKey());
break;
}
}
}
return areaKeyList;
}
use of org.olat.group.model.BGAreaReference in project OpenOLAT by OpenOLAT.
the class CourseEnvironmentMapper method avoidDuplicateNames.
public void avoidDuplicateNames() {
Set<String> names = new HashSet<String>();
for (BusinessGroupReference ref : getGroups()) {
if (names.contains(ref.getName())) {
String newName = generateName(ref.getName(), names);
names.add(newName);
ref.setName(newName);
} else {
names.add(ref.getName());
}
}
names.clear();
for (BGAreaReference ref : getAreas()) {
if (names.contains(ref.getName())) {
String newName = generateName(ref.getName(), names);
names.add(newName);
ref.setName(newName);
} else {
names.add(ref.getName());
}
}
}
use of org.olat.group.model.BGAreaReference in project OpenOLAT by OpenOLAT.
the class PersistingCourseGroupManager method getBusinessGroupEnvironment.
/**
* This operation load all business groups and areas. Use with caution, costly!
* @param resource
* @param fGroupExportXML
* @return
*/
public CourseEnvironmentMapper getBusinessGroupEnvironment() {
CourseEnvironmentMapper env = new CourseEnvironmentMapper();
List<BusinessGroup> groups = businessGroupService.findBusinessGroups(null, getCourseEntry(), 0, -1);
for (BusinessGroup group : groups) {
env.getGroups().add(new BusinessGroupReference(group));
}
List<BGArea> areas = areaManager.findBGAreasInContext(getCourseResource());
for (BGArea area : areas) {
env.getAreas().add(new BGAreaReference(area));
}
return env;
}
use of org.olat.group.model.BGAreaReference in project OpenOLAT by OpenOLAT.
the class OLATUpgrade_8_2_0 method getCourseEnvironmentMapper.
private CourseEnvironmentMapper getCourseEnvironmentMapper(RepositoryEntry courseResource) {
CourseEnvironmentMapper envMapper = new CourseEnvironmentMapper();
List<BusinessGroup> groups = businessGroupService.findBusinessGroups(null, courseResource, 0, -1);
for (BusinessGroup group : groups) {
envMapper.getGroups().add(new BusinessGroupReference(group));
}
List<BGArea> areas = areaManager.findBGAreasInContext(courseResource.getOlatResource());
for (BGArea area : areas) {
envMapper.getAreas().add(new BGAreaReference(area));
}
return envMapper;
}
use of org.olat.group.model.BGAreaReference in project OpenOLAT by OpenOLAT.
the class KeyAndNameConverter method convertExpressionKeyToName.
/**
* isLearningGroupFull, inLearningGroup, inRightGroup, inLearningArea, isLearningGroupFull
*/
public static String convertExpressionKeyToName(String expression, CourseEnvironmentMapper envMapper) {
for (String groupMethod : groupMethods) {
for (BusinessGroupReference group : envMapper.getGroups()) {
String strToMatch = groupMethod + "(\"" + group.getKey() + "\")";
String replacement = groupMethod + "(\"" + group.getName() + "\")";
expression = StringHelper.replaceAllCaseInsensitive(expression, strToMatch, replacement);
}
}
for (BGAreaReference area : envMapper.getAreas()) {
String strToMatch = areaMethod + "(\"" + area.getKey() + "\")";
String replacement = areaMethod + "(\"" + area.getName() + "\")";
expression = StringHelper.replaceAllCaseInsensitive(expression, strToMatch, replacement);
}
for (BusinessGroupReference group : envMapper.getGroups()) {
String strToMatch = "\"" + group.getKey() + "\"";
String replacement = "\"" + group.getName() + "\"";
expression = StringHelper.replaceAllCaseInsensitive(expression, strToMatch, replacement);
}
for (BGAreaReference area : envMapper.getAreas()) {
String strToMatch = "\"" + area.getKey() + "\"";
String replacement = "\"" + area.getName() + "\"";
expression = StringHelper.replaceAllCaseInsensitive(expression, strToMatch, replacement);
}
return expression;
}
Aggregations