Search in sources :

Example 1 with ConditionExpression

use of org.olat.course.condition.interpreter.ConditionExpression in project OpenOLAT by OpenOLAT.

the class CourseEditorEnvImpl method toString.

@Override
public String toString() {
    String retVal = "";
    Set<String> keys = softRefs.keySet();
    for (Iterator<String> iter = keys.iterator(); iter.hasNext(); ) {
        String nodId = iter.next();
        retVal += "nodeId:" + nodId + "\n";
        List<ConditionExpression> conditionExprs = softRefs.get(nodId);
        for (Iterator<ConditionExpression> iterator = conditionExprs.iterator(); iterator.hasNext(); ) {
            ConditionExpression ce = iterator.next();
            retVal += "\t" + ce.toString() + "\n";
        }
        retVal += "\n";
    }
    return retVal;
}
Also used : ConditionExpression(org.olat.course.condition.interpreter.ConditionExpression)

Example 2 with ConditionExpression

use of org.olat.course.condition.interpreter.ConditionExpression in project OpenOLAT by OpenOLAT.

the class STCourseNode method getConditionExpressions.

/**
 * @see org.olat.course.nodes.AbstractAccessableCourseNode#getConditionExpressions()
 */
@Override
public List<ConditionExpression> getConditionExpressions() {
    List<ConditionExpression> retVal;
    List<ConditionExpression> parentsConditions = super.getConditionExpressions();
    if (parentsConditions.size() > 0) {
        retVal = new ArrayList<ConditionExpression>(parentsConditions);
    } else {
        retVal = new ArrayList<ConditionExpression>();
    }
    // init passedExpression and scoreExpression
    getScoreCalculator();
    passedExpression.setExpertMode(true);
    String coS = passedExpression.getConditionExpression();
    if (StringHelper.containsNonWhitespace(coS)) {
        // an active condition is defined
        ConditionExpression ce = new ConditionExpression(passedExpression.getConditionId());
        ce.setExpressionString(passedExpression.getConditionExpression());
        retVal.add(ce);
    }
    scoreExpression.setExpertMode(true);
    coS = scoreExpression.getConditionExpression();
    if (StringHelper.containsNonWhitespace(coS)) {
        // an active condition is defined
        ConditionExpression ce = new ConditionExpression(scoreExpression.getConditionId());
        ce.setExpressionString(scoreExpression.getConditionExpression());
        retVal.add(ce);
    }
    failedExpression.setExpertMode(true);
    coS = failedExpression.getConditionExpression();
    if (StringHelper.containsNonWhitespace(coS)) {
        // an active condition is defined
        ConditionExpression ce = new ConditionExpression(failedExpression.getConditionId());
        ce.setExpressionString(failedExpression.getConditionExpression());
        retVal.add(ce);
    }
    return retVal;
}
Also used : ConditionExpression(org.olat.course.condition.interpreter.ConditionExpression)

Example 3 with ConditionExpression

use of org.olat.course.condition.interpreter.ConditionExpression in project OpenOLAT by OpenOLAT.

the class ProjectBrokerCourseNode method getConditionExpressions.

/**
 * @see org.olat.course.nodes.GenericCourseNode#getConditionExpressions()
 */
@Override
public List<ConditionExpression> getConditionExpressions() {
    List<ConditionExpression> retVal;
    List<ConditionExpression> parentsConditions = super.getConditionExpressions();
    if (parentsConditions.size() > 0) {
        retVal = new ArrayList<>(parentsConditions);
    } else {
        retVal = new ArrayList<>();
    }
    String condition = getConditionProjectBroker().getConditionExpression();
    if (condition != null && !condition.equals("")) {
        // an active condition is defined
        ConditionExpression ce = new ConditionExpression(getConditionProjectBroker().getConditionId());
        ce.setExpressionString(getConditionProjectBroker().getConditionExpression());
        retVal.add(ce);
    }
    return retVal;
}
Also used : ConditionExpression(org.olat.course.condition.interpreter.ConditionExpression)

Example 4 with ConditionExpression

use of org.olat.course.condition.interpreter.ConditionExpression in project OpenOLAT by OpenOLAT.

the class WikiCourseNode method getConditionExpressions.

@Override
public List<ConditionExpression> getConditionExpressions() {
    List<ConditionExpression> parentConditions = super.getConditionExpressions();
    List<ConditionExpression> conditions = new ArrayList<>();
    if (parentConditions != null && parentConditions.size() > 0) {
        conditions.addAll(parentConditions);
    }
    Condition editCondition = getPreConditionEdit();
    if (editCondition != null && StringHelper.containsNonWhitespace(editCondition.getConditionExpression())) {
        ConditionExpression ce = new ConditionExpression(editCondition.getConditionId());
        ce.setExpressionString(editCondition.getConditionExpression());
        conditions.add(ce);
    }
    return conditions;
}
Also used : Condition(org.olat.course.condition.Condition) ConditionExpression(org.olat.course.condition.interpreter.ConditionExpression) ArrayList(java.util.ArrayList)

Example 5 with ConditionExpression

use of org.olat.course.condition.interpreter.ConditionExpression in project OpenOLAT by OpenOLAT.

the class InfoCourseNode method getConditionExpressions.

@Override
public List<ConditionExpression> getConditionExpressions() {
    List<ConditionExpression> parentConditions = super.getConditionExpressions();
    List<ConditionExpression> conditions = new ArrayList<>();
    if (parentConditions != null && parentConditions.size() > 0) {
        conditions.addAll(parentConditions);
    }
    Condition editCondition = getPreConditionEdit();
    if (editCondition != null && StringHelper.containsNonWhitespace(editCondition.getConditionExpression())) {
        ConditionExpression ce = new ConditionExpression(editCondition.getConditionId());
        ce.setExpressionString(editCondition.getConditionExpression());
        conditions.add(ce);
    }
    Condition adminCondition = getPreConditionAdmin();
    if (adminCondition != null && StringHelper.containsNonWhitespace(adminCondition.getConditionExpression())) {
        ConditionExpression ce = new ConditionExpression(adminCondition.getConditionId());
        ce.setExpressionString(adminCondition.getConditionExpression());
        conditions.add(ce);
    }
    return conditions;
}
Also used : Condition(org.olat.course.condition.Condition) ConditionExpression(org.olat.course.condition.interpreter.ConditionExpression) ArrayList(java.util.ArrayList)

Aggregations

ConditionExpression (org.olat.course.condition.interpreter.ConditionExpression)34 ArrayList (java.util.ArrayList)12 ConditionErrorMessage (org.olat.course.condition.interpreter.ConditionErrorMessage)8 Condition (org.olat.course.condition.Condition)6 CourseEditorEnv (org.olat.course.editor.CourseEditorEnv)4 HashMap (java.util.HashMap)2 Set (java.util.Set)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 DirectedGraph (org._3pq.jgrapht.DirectedGraph)2 Edge (org._3pq.jgrapht.Edge)2 CycleDetector (org._3pq.jgrapht.alg.CycleDetector)2 DirectedEdgeFactory (org._3pq.jgrapht.edge.EdgeFactories.DirectedEdgeFactory)2 DefaultDirectedGraph (org._3pq.jgrapht.graph.DefaultDirectedGraph)2 TreeVisitor (org.olat.core.util.tree.TreeVisitor)2 Visitor (org.olat.core.util.tree.Visitor)2 ICourse (org.olat.course.ICourse)2 StatusDescription (org.olat.course.editor.StatusDescription)2 AbstractFeedCourseNode (org.olat.course.nodes.AbstractFeedCourseNode)2