Search in sources :

Example 1 with ReturnValueRestriction

use of org.drools.verifier.components.ReturnValueRestriction in project drools by kiegroup.

the class FieldConstraintDescrVisitor method visit.

/**
 * End
 *
 * @param descr
 */
private void visit(ReturnValueRestrictionDescr descr) {
    ReturnValueRestriction restriction = new ReturnValueRestriction(pattern);
    restriction.setPatternIsNot(pattern.isPatternNot());
    restriction.setFieldPath(field.getPath());
    restriction.setOperator(Operator.determineOperator(descr.getEvaluator(), descr.isNegated()));
    restriction.setClassMethodName(descr.getClassMethodName());
    restriction.setContent(descr.getContent());
    restriction.setDeclarations(descr.getDeclarations());
    restriction.setOrderNumber(orderNumber);
    restriction.setParentPath(pattern.getPath());
    restriction.setParentType(pattern.getVerifierComponentType());
    data.add(restriction);
    solvers.addPatternComponent(restriction);
}
Also used : ReturnValueRestriction(org.drools.verifier.components.ReturnValueRestriction)

Example 2 with ReturnValueRestriction

use of org.drools.verifier.components.ReturnValueRestriction in project drools by kiegroup.

the class VerifierDataMapsTest method testSaveVerifierComponentAndGetForAllRestrictions.

@Test
public void testSaveVerifierComponentAndGetForAllRestrictions() {
    Pattern pattern = VerifierComponentMockFactory.createPattern1();
    saveVerifierComponentAndGet(LiteralRestriction.createRestriction(pattern, ""));
    saveVerifierComponentAndGet(new EnumRestriction(pattern));
    saveVerifierComponentAndGet(new QualifiedIdentifierRestriction(pattern));
    saveVerifierComponentAndGet(new ReturnValueRestriction(pattern));
    saveVerifierComponentAndGet(new ReturnValueRestriction(pattern));
    saveVerifierComponentAndGet(new VariableRestriction(pattern));
}
Also used : Pattern(org.drools.verifier.components.Pattern) SubPattern(org.drools.verifier.components.SubPattern) VariableRestriction(org.drools.verifier.components.VariableRestriction) EnumRestriction(org.drools.verifier.components.EnumRestriction) ReturnValueRestriction(org.drools.verifier.components.ReturnValueRestriction) QualifiedIdentifierRestriction(org.drools.verifier.components.QualifiedIdentifierRestriction) Test(org.junit.Test)

Aggregations

ReturnValueRestriction (org.drools.verifier.components.ReturnValueRestriction)2 EnumRestriction (org.drools.verifier.components.EnumRestriction)1 Pattern (org.drools.verifier.components.Pattern)1 QualifiedIdentifierRestriction (org.drools.verifier.components.QualifiedIdentifierRestriction)1 SubPattern (org.drools.verifier.components.SubPattern)1 VariableRestriction (org.drools.verifier.components.VariableRestriction)1 Test (org.junit.Test)1