Search in sources :

Example 1 with BooleanExpression

use of org.talend.hadoop.distribution.condition.BooleanExpression in project tbd-studio-se by Talend.

the class DistributionVersion method getDisplayShowIf.

public String getDisplayShowIf() {
    final Expression trueExp = new BooleanExpression(true);
    final Expression falseExp = new BooleanExpression(false);
    ComponentCondition additionalCondition = displayCondition;
    if (additionalCondition != null && (trueExp.getExpressionString().equals(additionalCondition.getConditionString()) || falseExp.getExpressionString().equals(additionalCondition.getConditionString()))) {
        // Don't show a version if it's display condition is a BooleanCondition.
        return trueExp.getExpressionString().equals(additionalCondition.getConditionString()) ? Boolean.TRUE.toString() : Boolean.FALSE.toString();
    } else {
        // Compose the ComponentCondition to display a version.
        ComponentCondition condition;
        org.talend.hadoop.distribution.condition.Expression e = new BasicExpression(distribution.componentType.getDistributionParameter(), EqualityOperator.EQ, distribution.name);
        if (additionalCondition != null) {
            condition = new MultiComponentCondition(new SimpleComponentCondition(e), BooleanOperator.AND, new NestedComponentCondition(additionalCondition));
        } else {
            condition = new SimpleComponentCondition(e);
        }
        return condition.getConditionString();
    }
}
Also used : BooleanExpression(org.talend.hadoop.distribution.condition.BooleanExpression) BasicExpression(org.talend.hadoop.distribution.condition.BasicExpression) Expression(org.talend.hadoop.distribution.condition.Expression) BasicExpression(org.talend.hadoop.distribution.condition.BasicExpression) BooleanExpression(org.talend.hadoop.distribution.condition.BooleanExpression) SimpleComponentCondition(org.talend.hadoop.distribution.condition.SimpleComponentCondition) MultiComponentCondition(org.talend.hadoop.distribution.condition.MultiComponentCondition) SimpleComponentCondition(org.talend.hadoop.distribution.condition.SimpleComponentCondition) NestedComponentCondition(org.talend.hadoop.distribution.condition.NestedComponentCondition) ComponentCondition(org.talend.hadoop.distribution.condition.ComponentCondition) MultiComponentCondition(org.talend.hadoop.distribution.condition.MultiComponentCondition) NestedComponentCondition(org.talend.hadoop.distribution.condition.NestedComponentCondition) Expression(org.talend.hadoop.distribution.condition.Expression)

Aggregations

BasicExpression (org.talend.hadoop.distribution.condition.BasicExpression)1 BooleanExpression (org.talend.hadoop.distribution.condition.BooleanExpression)1 ComponentCondition (org.talend.hadoop.distribution.condition.ComponentCondition)1 Expression (org.talend.hadoop.distribution.condition.Expression)1 MultiComponentCondition (org.talend.hadoop.distribution.condition.MultiComponentCondition)1 NestedComponentCondition (org.talend.hadoop.distribution.condition.NestedComponentCondition)1 SimpleComponentCondition (org.talend.hadoop.distribution.condition.SimpleComponentCondition)1