Search in sources :

Example 31 with BusinessGroupReference

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;
}
Also used : BusinessGroupReference(org.olat.group.model.BusinessGroupReference) ArrayList(java.util.ArrayList)

Example 32 with BusinessGroupReference

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;
}
Also used : BusinessGroupReference(org.olat.group.model.BusinessGroupReference) BGAreaReference(org.olat.group.model.BGAreaReference)

Aggregations

BusinessGroupReference (org.olat.group.model.BusinessGroupReference)32 BGAreaReference (org.olat.group.model.BGAreaReference)20 CourseEnvironmentMapper (org.olat.course.export.CourseEnvironmentMapper)16 Test (org.junit.Test)12 BGArea (org.olat.group.area.BGArea)12 BusinessGroup (org.olat.group.BusinessGroup)8 IOException (java.io.IOException)4 HashSet (java.util.HashSet)4 AssertException (org.olat.core.logging.AssertException)4 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)4 XStream (com.thoughtworks.xstream.XStream)2 File (java.io.File)2 Field (java.lang.reflect.Field)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 CollaborationTools (org.olat.collaboration.CollaborationTools)2 Identity (org.olat.core.id.Identity)2 LocalFileImpl (org.olat.core.util.vfs.LocalFileImpl)2 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)2 Project (org.olat.course.nodes.projectbroker.datamodel.Project)2