[rules-users] Not possible to directly access the property
Wolfgang Laun
wolfgang.laun at gmail.com
Mon Feb 20 01:31:51 EST 2012
The cited error message isn't related to the reported change by refactoring.
What you show of the changed rule doesn't differ from the original rule.
Drools version(s)?
At a loss
-W
On 19/02/2012, bradypt <paul.brady at airnz.co.nz> wrote:
> I'm a Drools novice but am doing a regular refactor which is causing a
> problem for our existing rulebase.
>
> Before my refactor, I had an interface Itinerary that had a getRules()
> method. getRules() returned a simple POJO that had a getDestination method.
>
> My Drools rule looked like:
> rule "NZSF Accommodation - With infants" salience 101
> activation-group "NZSF Accommodation"
> when
> itinerary : Itinerary( rules.destination memberOf
> travelServicesFeatures.accommodationDestinations )
> eval(isOnlineBookingAllowed(itinerary) == false)
> then
> TravelService travelService = addTravelService(travelServices,
> TravelService.Type.ACCOMMODATION);
> travelService.appendVariant(ResourceType.TEXT, "phone");
> travelService.setNull(ResourceType.URL, true);
> Airport destination = itinerary.getRules().getDestination();
> travelService.setArguments(ResourceType.TEXT, new
> ResourceRefImpl("City." + destination.getCode()));
> end
>
> All was working fine.
>
> My refactor is simply to move Rules.getDestination() to the Itinerary
> interface so I changed my rule to:
>
> rule "NZSF Accommodation - With infants" salience 101
> activation-group "NZSF Accommodation"
> when
> itinerary : Itinerary( destination memberOf
> travelServicesFeatures.accommodationDestinations )
> eval(isOnlineBookingAllowed(itinerary) == false)
> then ...
>
> Now I get:
> java.lang.RuntimeException: Errors in rules: Not possible to directly access
> the property 'accommodationDestinations' of declaration
> 'travelServicesFeatures' since it is not a pattern : [Rule name='NZSF
> Accommodation - With infants']
> Unable to create restriction '[QualifiedIndentifierRestr: memberOf
> travelServicesFeatures.accommodationDestinations ]' for field 'destination'
> in the rule 'NZSF Accommodation - With infants' : [Rule name='NZSF
> Accommodation - With infants']
>
> Any help greatly appreciated!
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Not-possible-to-directly-access-the-property-tp3758865p3758865.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
More information about the rules-users
mailing list