[rules-users] Getting Error while using Drools 5.3.0

mkhan_rt54fde maliullah at gmail.com
Tue May 1 20:02:14 EDT 2012


Hi,

Sorry for the delay in reply.

Thanks for pointing out the typo.I corrected that and redepolyed my
application.However,this time, I am seeing the following error:

org.drools.rule.InvalidRulePackage: Evaluator '>' does not support type
'ValueType = 'String' : [Rule name='VIN required for newer vehicles']

Here is my .dslr file:

rule "Set Time To Live"
	when
		there is a restoration request
	then 
		set quote process time to live to: 3
		add additional action "check state regulation for vintage car restoration"
end


#validation
rule "Year is required" 
no-loop true
	when
		request does not contain model year
	then 
		set reason of rejection to "year is required"
		reject request
end


#additional action
rule "VIN required for newer vehicles" 
no-loop true
	when
		request contains no VIN and the car was built after year 1982
	then 
		ask the customer to provide VIN
end

 
Here is my .dsl file:

[condition][]there is a restoration request=info: CarRulesInfo()
[consequence][]set quote process time to live to:
{value}=info.setTimeToLive({value});
[condition][]request does not contain model year=info:
CarRulesInfo(quoteRequest.year == null  )
[consequence][]reject request=info.setValid( false );
[condition][]request contains no VIN and the car was built after year
{value}=info: CarRulesInfo(quoteRequest.VIN == null, quoteRequest.modelYear
> 1982  )
[consequence][]ask the customer to provide
VIN=info.setAdditionalActions("Ask customer to provide VIN number");
[consequence][]set reason of rejection to
"{value}"=info.setReasonOfRejection("{value}");
[consequence][]add additional action
"{value}"=info.setAdditionalActions("{value}");

and here is my java class:

public class QuoteRequest {

	private Contact contact;
	private Address address;

	private String make;
	private String model;
	private String style;
	private String year;

	private String VIN;
	private String condition;
	private String description;
	private String zip;

	private List<Link> links = new ArrayList<Link>();

	public static void printForMe() {
		System.out.println("printing for you");
	}

	public Contact getContact() {
		return contact;
	}

	public void setContact(Contact contact) {
		this.contact = contact;
	}

	public Address getAddress() {
		return address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	public String getMake() {
		return make;
	}

	public void setMake(String make) {
		this.make = make;
	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public String getStyle() {
		return style;
	}

	public void setStyle(String style) {
		this.style = style;
	}

	public String getYear() {
		return returnString(year);
	}

	public Integer getModelYear() {
		Integer modelYear = (getYear() == null) ? null : Integer.parseInt(year);
		
		return modelYear;
	}

	public void setYear(String year) {
		this.year = year;
	}

	public String getVIN() {
		return returnString(VIN);
	}

	public void setVIN(String vin) {
		VIN = vin;
	}

	public String getCondition() {
		return condition;
	}

	public void setCondition(String condition) {
		this.condition = condition;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getZip() {
		return zip;
	}

	public void setZip(String zip) {
		this.zip = zip;
	}

	public List<Link> getLinks() {
		return links;
	}

	public void setLinks(List<Link> links) {
		this.links = links;
	}
	
	private String returnString(String s) {
		return (s == null || s.isEmpty()) ? null : s;
	}
}

Not sure why I am getting this error.Any suggestions?

Thanks.




--
View this message in context: http://drools.46999.n3.nabble.com/Getting-Error-while-using-Drools-5-3-0-tp3936714p3954007.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list