use of org.olat.group.model.BusinessGroupReference in project openolat by klemens.
the class CourseEnvironmentMapper method toGroupKeyFromOriginalNames.
public List<Long> toGroupKeyFromOriginalNames(String groupNames) {
if (!StringHelper.containsNonWhitespace(groupNames))
return null;
String[] groupNameArr = groupNames.split(",");
List<Long> groupKeyList = new ArrayList<Long>();
for (String groupName : groupNameArr) {
groupName = groupName.trim();
for (BusinessGroupReference group : groups) {
if (groupName.equalsIgnoreCase(group.getOriginalName())) {
groupKeyList.add(group.getKey());
break;
}
}
}
return groupKeyList;
}
use of org.olat.group.model.BusinessGroupReference in project openolat by klemens.
the class KeyAndNameConverter method convertExpressionNameToKey.
public static String convertExpressionNameToKey(String expression, CourseEnvironmentMapper envMapper) {
for (String groupMethod : groupMethods) {
for (BusinessGroupReference group : envMapper.getGroups()) {
String strToMatch = groupMethod + "(\"" + group.getOriginalName() + "\")";
String replacement = groupMethod + "(\"" + group.getKey() + "\")";
expression = StringHelper.replaceAllCaseInsensitive(expression, strToMatch, replacement);
}
}
for (BGAreaReference area : envMapper.getAreas()) {
String strToMatch = areaMethod + "(\"" + area.getOriginalName() + "\")";
String replacement = areaMethod + "(\"" + area.getKey() + "\")";
expression = StringHelper.replaceAllCaseInsensitive(expression, strToMatch, replacement);
}
// fallback for special case where there is blank between the ( and "
for (BusinessGroupReference group : envMapper.getGroups()) {
String strToMatch = "\"" + group.getOriginalName() + "\"";
String replacement = "\"" + group.getKey() + "\"";
expression = StringHelper.replaceAllCaseInsensitive(expression, strToMatch, replacement);
}
for (BGAreaReference area : envMapper.getAreas()) {
String strToMatch = "\"" + area.getOriginalName() + "\"";
String replacement = "\"" + area.getKey() + "\"";
expression = StringHelper.replaceAllCaseInsensitive(expression, strToMatch, replacement);
}
return expression;
}
Aggregations