container );
// after building the predicate, we are done, so return
return;
} else {
context.getErrors().add( new RuleError( context.getRule(),
fieldConstraintDescr,
null,
"Unable to create Field Extractor for '" + fieldName + "' of '"+pattern.getObjectType().toString()+"' in rule '"+context.getRule().getName()+"'" ) );
return;
}
}
Restriction restriction = createRestriction( context,
pattern,
fieldConstraintDescr,
fieldConstraintDescr.getRestriction(),
extractor );
if ( restriction == null ) {
// error was already logged during restriction creation failure
return;
}
Constraint constraint = null;
if ( restriction instanceof AbstractCompositeRestriction ) {
constraint = new MultiRestrictionFieldConstraint( extractor,
restriction );
} else if ( restriction instanceof LiteralRestriction ) {
constraint = new LiteralConstraint( extractor,
(LiteralRestriction) restriction );
} else if ( restriction instanceof VariableRestriction ) {
constraint = new VariableConstraint( extractor,
(VariableRestriction) restriction );
} else if ( restriction instanceof ReturnValueRestriction ) {
constraint = new ReturnValueConstraint( extractor,
(ReturnValueRestriction) restriction );
} else {
context.getErrors().add( new RuleError( context.getRule(),
fieldConstraintDescr,
null,
"This is a bug: Unkown restriction type '" + restriction.getClass() + "' for pattern '"+pattern.getObjectType().toString()+"' in rule '"+context.getRule().getName()+"'" ) );
}