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);
}
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);
}
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));
}
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;
}
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;
}
Aggregations