use of org.drools.workbench.models.datamodel.rule.ExpressionFieldVariable in project drools by kiegroup.
the class CopyExpressionVisitor method visit.
public void visit(ExpressionFieldVariable part) {
add(new ExpressionFieldVariable(part.getName(), part.getClassType()));
moveNext(part);
}
use of org.drools.workbench.models.datamodel.rule.ExpressionFieldVariable in project drools-wb by kiegroup.
the class ExpressionBuilder method onStartPointChange.
private void onStartPointChange(final String value) {
setModified(true);
panel.clear();
final int dotPos = value.indexOf('.');
final String prefix = value.substring(0, dotPos);
final String attrib = value.substring(dotPos + 1);
if (prefix.equals(VARIABLE_VALUE_PREFIX)) {
FactPattern fact = getRuleModel().getLHSBoundFact(attrib);
ExpressionPart variable;
if (fact != null) {
variable = new ExpressionVariable(fact.getBoundName(), fact.getFactType());
} else {
// if the variable is not bound to a Fact Pattern then it must be bound to a Field
String lhsBindingType = getRuleModel().getLHSBindingType(attrib);
variable = new ExpressionFieldVariable(attrib, lhsBindingType);
}
expression.appendPart(variable);
onStartPointChangeUpdateWidget();
} else if (prefix.equals(GLOBAL_VARIABLE_VALUE_PREFIX)) {
ExpressionPartHelper.getExpressionPartForGlobalVariable(getDataModelOracle(), attrib, new Callback<ExpressionPart>() {
@Override
public void callback(final ExpressionPart part) {
expression.appendPart(part);
onStartPointChangeUpdateWidget();
}
});
}
}
use of org.drools.workbench.models.datamodel.rule.ExpressionFieldVariable 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));
}
Aggregations