Search in sources :

Example 16 with ExpressionFormLine

use of org.drools.workbench.models.datamodel.rule.ExpressionFormLine in project drools by kiegroup.

the class CopyExpressionVisitor method copyMethodParams.

private void copyMethodParams(ExpressionMethod part, ExpressionMethod method) {
    Map<ExpressionMethodParameterDefinition, ExpressionFormLine> params = new HashMap<ExpressionMethodParameterDefinition, ExpressionFormLine>();
    for (Map.Entry<ExpressionMethodParameterDefinition, ExpressionFormLine> entry : part.getParams().entrySet()) {
        params.put(new ExpressionMethodParameterDefinition(entry.getKey().getIndex(), entry.getKey().getDataType()), new ExpressionFormLine(entry.getValue()));
    }
    method.setParams(params);
}
Also used : ExpressionFormLine(org.drools.workbench.models.datamodel.rule.ExpressionFormLine) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) ExpressionMethodParameterDefinition(org.drools.workbench.models.datamodel.rule.ExpressionMethodParameterDefinition)

Example 17 with ExpressionFormLine

use of org.drools.workbench.models.datamodel.rule.ExpressionFormLine in project drools by kiegroup.

the class ToStringExpressionVisitor method paramsToString.

private String paramsToString(List<ExpressionFormLine> params) {
    if (params.isEmpty()) {
        return "";
    }
    StringBuilder strParams = new StringBuilder();
    for (ExpressionFormLine param : params) {
        ToStringExpressionVisitor visitor = new ToStringExpressionVisitor(constraintValueBuilder);
        visitor.visit(param.getRootExpression());
        strParams.append(", ").append(visitor.getText());
    }
    return strParams.substring(2);
}
Also used : ExpressionFormLine(org.drools.workbench.models.datamodel.rule.ExpressionFormLine)

Example 18 with ExpressionFormLine

use of org.drools.workbench.models.datamodel.rule.ExpressionFormLine in project drools by kiegroup.

the class CopyExpressionVisitorTest method testExpressionFormLineCopy.

@Test
public void testExpressionFormLineCopy() {
    ExpressionFormLine efl = new ExpressionFormLine();
    efl.appendPart(new ExpressionCollection("collection", "CT", "GT", "PT"));
    efl.appendPart(new ExpressionCollectionIndex("collectionIndex", "CT", "GT"));
    efl.appendPart(new ExpressionField("field", "CT", "FT", "PT"));
    efl.appendPart(new ExpressionFieldVariable("fieldVariable", "Type"));
    efl.appendPart(new ExpressionGlobalVariable("globalVariable", "CT", "GT", "PT"));
    efl.appendPart(new ExpressionMethod("method", "CT", "GT"));
    efl.appendPart(new ExpressionMethodParameter("methodParam", "CT", "GT"));
    efl.appendPart(new ExpressionText("text"));
    efl.appendPart(new ExpressionUnboundFact("FactType"));
    efl.appendPart(new ExpressionVariable("binding", "FactType"));
    // verify that the new instance created with copy constructor is equal to original
    assertEquals(efl, new ExpressionFormLine(efl));
}
Also used : ExpressionFormLine(org.drools.workbench.models.datamodel.rule.ExpressionFormLine) ExpressionFieldVariable(org.drools.workbench.models.datamodel.rule.ExpressionFieldVariable) ExpressionMethod(org.drools.workbench.models.datamodel.rule.ExpressionMethod) ExpressionCollectionIndex(org.drools.workbench.models.datamodel.rule.ExpressionCollectionIndex) ExpressionMethodParameter(org.drools.workbench.models.datamodel.rule.ExpressionMethodParameter) ExpressionCollection(org.drools.workbench.models.datamodel.rule.ExpressionCollection) ExpressionText(org.drools.workbench.models.datamodel.rule.ExpressionText) ExpressionVariable(org.drools.workbench.models.datamodel.rule.ExpressionVariable) ExpressionField(org.drools.workbench.models.datamodel.rule.ExpressionField) ExpressionUnboundFact(org.drools.workbench.models.datamodel.rule.ExpressionUnboundFact) ExpressionGlobalVariable(org.drools.workbench.models.datamodel.rule.ExpressionGlobalVariable) Test(org.junit.Test)

Example 19 with ExpressionFormLine

use of org.drools.workbench.models.datamodel.rule.ExpressionFormLine in project drools-wb by kiegroup.

the class RuleModelCloneVisitor method visitExpressionFormLine.

private ExpressionFormLine visitExpressionFormLine(ExpressionFormLine efl) {
    ExpressionFormLine clone = new ExpressionFormLine(efl);
    clone.setBinding(efl.getBinding());
    return clone;
}
Also used : ExpressionFormLine(org.drools.workbench.models.datamodel.rule.ExpressionFormLine)

Example 20 with ExpressionFormLine

use of org.drools.workbench.models.datamodel.rule.ExpressionFormLine in project drools-wb by kiegroup.

the class RuleModelCloneVisitorTest method buildExpressionFormLine.

private static ExpressionFormLine buildExpressionFormLine() {
    ExpressionFormLine efl = new ExpressionFormLine();
    efl.setBinding("eflBinding");
    efl.appendPart(new ExpressionText("text"));
    efl.appendPart(new ExpressionCollectionIndex("collectionIndex", "CT", "GT"));
    return efl;
}
Also used : ExpressionFormLine(org.drools.workbench.models.datamodel.rule.ExpressionFormLine) ExpressionCollectionIndex(org.drools.workbench.models.datamodel.rule.ExpressionCollectionIndex) ExpressionText(org.drools.workbench.models.datamodel.rule.ExpressionText)

Aggregations

ExpressionFormLine (org.drools.workbench.models.datamodel.rule.ExpressionFormLine)24 Test (org.junit.Test)16 CompositeFactPattern (org.drools.workbench.models.datamodel.rule.CompositeFactPattern)14 FactPattern (org.drools.workbench.models.datamodel.rule.FactPattern)14 FromAccumulateCompositeFactPattern (org.drools.workbench.models.datamodel.rule.FromAccumulateCompositeFactPattern)14 FromCollectCompositeFactPattern (org.drools.workbench.models.datamodel.rule.FromCollectCompositeFactPattern)14 FromCompositeFactPattern (org.drools.workbench.models.datamodel.rule.FromCompositeFactPattern)14 ExpressionVariable (org.drools.workbench.models.datamodel.rule.ExpressionVariable)10 FromEntryPointFactPattern (org.drools.workbench.models.datamodel.rule.FromEntryPointFactPattern)9 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)8 ExpressionText (org.drools.workbench.models.datamodel.rule.ExpressionText)7 SingleFieldConstraint (org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)7 BaseSingleFieldConstraint (org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)6 ExpressionMethod (org.drools.workbench.models.datamodel.rule.ExpressionMethod)5 IPattern (org.drools.workbench.models.datamodel.rule.IPattern)5 ExpressionField (org.drools.workbench.models.datamodel.rule.ExpressionField)4 ExpressionUnboundFact (org.drools.workbench.models.datamodel.rule.ExpressionUnboundFact)3 SingleFieldConstraintEBLeftSide (org.drools.workbench.models.datamodel.rule.SingleFieldConstraintEBLeftSide)3 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 ExpressionCollectionIndex (org.drools.workbench.models.datamodel.rule.ExpressionCollectionIndex)2