use of org.olat.group.model.BusinessGroupReference in project openolat by klemens.
the class KeyAndNameConverterTest method convertGroupAndAreaKeyToName_sameKey.
@Test
public void convertGroupAndAreaKeyToName_sameKey() {
CourseEnvironmentMapper envMapper = new CourseEnvironmentMapper();
BGArea newArea = new MockArea(567l, "Area 1");
BGAreaReference areaRef = new BGAreaReference(newArea, null, null);
envMapper.getAreas().add(areaRef);
MockBusinessGroup newGroup = new MockBusinessGroup(567l, "Group 1");
BusinessGroupReference bgRef = new BusinessGroupReference(newGroup, null, null);
envMapper.getGroups().add(bgRef);
String convertedExp = convertExpressionKeyToName("inLearningArea(\"567\") & isLearningGroupFull(\"567\")", envMapper);
Assert.assertEquals("inLearningArea(\"Area 1\") & isLearningGroupFull(\"Group 1\")", convertedExp);
}
use of org.olat.group.model.BusinessGroupReference in project openolat by klemens.
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 klemens.
the class KeyAndNameConverterTest method convertBusinessGroupKeyToKey.
@Test
public void convertBusinessGroupKeyToKey() {
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 = convertExpressionKeyToKey("inRightGroup(\"345\")", envMapper);
Assert.assertEquals("inRightGroup(\"567\")", convertedExp);
}
use of org.olat.group.model.BusinessGroupReference in project openolat by klemens.
the class KeyAndNameConverterTest method convertGroupAndAreaKeyToKey_sameKey.
@Test
public void convertGroupAndAreaKeyToKey_sameKey() {
CourseEnvironmentMapper envMapper = new CourseEnvironmentMapper();
BGArea newArea = new MockArea(567l, "Area 1");
BGAreaReference areaRef = new BGAreaReference(newArea, 345l, "Area 1");
envMapper.getAreas().add(areaRef);
MockBusinessGroup newGroup = new MockBusinessGroup(568l, "Group 1");
BusinessGroupReference bgRef = new BusinessGroupReference(newGroup, 345l, "Group 1");
envMapper.getGroups().add(bgRef);
String convertedExp = convertExpressionKeyToKey("inLearningArea(\"345\") & inRightGroup(\"345\")", envMapper);
Assert.assertEquals("inLearningArea(\"567\") & inRightGroup(\"568\")", convertedExp);
}
use of org.olat.group.model.BusinessGroupReference in project openolat by klemens.
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());
}
}
}
Aggregations