use of org.olat.group.model.BusinessGroupReference in project openolat by klemens.
the class KeyAndNameConverter method convertExpressionKeyToKey.
public static String convertExpressionKeyToKey(String expression, CourseEnvironmentMapper envMapper) {
for (String groupMethod : groupMethods) {
for (BusinessGroupReference group : envMapper.getGroups()) {
String strToMatch = groupMethod + "(\"" + group.getOriginalKey() + "\")";
String replacement = groupMethod + "(\"" + group.getKey() + "\")";
expression = StringHelper.replaceAllCaseInsensitive(expression, strToMatch, replacement);
}
}
for (BGAreaReference area : envMapper.getAreas()) {
String strToMatch = areaMethod + "(\"" + area.getOriginalKey() + "\")";
String replacement = areaMethod + "(\"" + area.getKey() + "\")";
expression = StringHelper.replaceAllCaseInsensitive(expression, strToMatch, replacement);
}
for (BusinessGroupReference group : envMapper.getGroups()) {
String strToMatch = "\"" + group.getOriginalKey() + "\"";
String replacement = "\"" + group.getKey() + "\"";
expression = StringHelper.replaceAllCaseInsensitive(expression, strToMatch, replacement);
}
for (BGAreaReference area : envMapper.getAreas()) {
String strToMatch = "\"" + area.getOriginalKey() + "\"";
String replacement = "\"" + area.getKey() + "\"";
expression = StringHelper.replaceAllCaseInsensitive(expression, strToMatch, replacement);
}
return expression;
}
use of org.olat.group.model.BusinessGroupReference in project openolat by klemens.
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.BusinessGroupReference in project OpenOLAT by OpenOLAT.
the class KeyAndNameConverterTest method convertBusinessGroupKeyToName.
@Test
public void convertBusinessGroupKeyToName() {
CourseEnvironmentMapper envMapper = new CourseEnvironmentMapper();
MockBusinessGroup newGroup = new MockBusinessGroup(567l, "Group 1");
BusinessGroupReference bgRef = new BusinessGroupReference(newGroup, null, null);
envMapper.getGroups().add(bgRef);
String convertedExp = convertExpressionKeyToName("isLearningGroupFull(\"567\")", envMapper);
Assert.assertEquals("isLearningGroupFull(\"Group 1\")", convertedExp);
}
use of org.olat.group.model.BusinessGroupReference in project OpenOLAT by OpenOLAT.
the class KeyAndNameConverterTest method convertBusinessGroupNameToKey.
@Test
public void convertBusinessGroupNameToKey() {
CourseEnvironmentMapper envMapper = new CourseEnvironmentMapper();
MockBusinessGroup newGroup = new MockBusinessGroup(567l, "Group 1");
BusinessGroupReference bgRef = new BusinessGroupReference(newGroup, 345l, "Group 1");
envMapper.getGroups().add(bgRef);
String convertedExp = convertExpressionNameToKey("inLearningGroup(\"Group 1\")", envMapper);
Assert.assertEquals("inLearningGroup(\"567\")", convertedExp);
}
use of org.olat.group.model.BusinessGroupReference in project OpenOLAT by OpenOLAT.
the class KeyAndNameConverter method convertExpressionKeyToKey.
public static String convertExpressionKeyToKey(String expression, CourseEnvironmentMapper envMapper) {
for (String groupMethod : groupMethods) {
for (BusinessGroupReference group : envMapper.getGroups()) {
String strToMatch = groupMethod + "(\"" + group.getOriginalKey() + "\")";
String replacement = groupMethod + "(\"" + group.getKey() + "\")";
expression = StringHelper.replaceAllCaseInsensitive(expression, strToMatch, replacement);
}
}
for (BGAreaReference area : envMapper.getAreas()) {
String strToMatch = areaMethod + "(\"" + area.getOriginalKey() + "\")";
String replacement = areaMethod + "(\"" + area.getKey() + "\")";
expression = StringHelper.replaceAllCaseInsensitive(expression, strToMatch, replacement);
}
for (BusinessGroupReference group : envMapper.getGroups()) {
String strToMatch = "\"" + group.getOriginalKey() + "\"";
String replacement = "\"" + group.getKey() + "\"";
expression = StringHelper.replaceAllCaseInsensitive(expression, strToMatch, replacement);
}
for (BGAreaReference area : envMapper.getAreas()) {
String strToMatch = "\"" + area.getOriginalKey() + "\"";
String replacement = "\"" + area.getKey() + "\"";
expression = StringHelper.replaceAllCaseInsensitive(expression, strToMatch, replacement);
}
return expression;
}
Aggregations