latest event within a timeframe
by Alexander Wolf
[Drools Version 5.5.0 Final]
Hey -
I got an event E1 that is only valid, if the latest event E2 following E1 within 2 minutes has the value 1
--> I want have the rule fire 2 minutes after E1 but only if E1 is valid
This is my rule:
rule "inform about E1"
when
//event (T1) is the initial trigger
$event1 : Event(type == EventType.T1)
//there is an event (T2) with value 0 between 0,2m after doorClosed
$event2: Event(type == EventType.T2, value == 1, this after [0, 2m] $event1, $timestamp : timestamp)
//there is no newer event (T2) within the timeframe
not Measurement(type == EventType.T2, this after [0, 2m] $event1, timestamp > $timestamp)
then
//print info
log(drools, "E1 valid");
end
An example of Events:
12:00:00 - E1
12:01:00 - E2 ( value = 0 )
12:01:10 - E2 ( value = 0 )
12:01:40 - E2 ( value = 0 )
12:01:50 - E2 ( value = 1 )
12:02:10 - E2 ( value = 0 )
I would expect the output: [log() does log the clock-time when my rule fires)
12:02:00 E1 valid
But what I get is:
12:03:50 E1 valid
So I see that the late coming E2 (@12:02:10) is correctly ignored, the rule result is basically correct, but the rule is fired much to late. (actually 2 minutes after $event2 and not as expected 2 minutes after $event1).
Could someone give me a hint what I did wrong?
Regards,
Alex
12 years, 3 months
Dependency enumeration
by agarwalk
Hi
I have created following enumeration and java class file.
*Enumeration:*
'OrderData.propertyState':(new com.asps.rules.OrderData()).loadStates()
'OrderData.fulfillmentReviewerName[propertyState]':'(new
com.asps.rules.OrderData()).loadReviewers("@{propertyState}")'
*Java class:*
public class OrderData implements Serializable {
private String propertyState;
private String fulfillmentReviewerName;
// getters and setters
public List<String> loadStates() {
List<String> states = new ArrayList<String>();
states.add("CA");
states.add("NY");
states.add("FL");
return states;
}
public List<String> loadReviewers(final String propertyState) {
List<String> reviewers = new ArrayList<String>();
System.out.println("### in load reviewers ### : " + propertyState);
if ("CA".equalsIgnoreCase(propertyState)) {
reviewers.add("A");
reviewers.add("B");
System.out.println("Reviewers : A & B");
} else if ("NY".equalsIgnoreCase(propertyState)) {
reviewers.add("C");
reviewers.add("D");
System.out.println("Reviewers : C& D");
} else if ("FL".equalsIgnoreCase(propertyState)) {
reviewers.add("E");
reviewers.add("F");
System.out.println("Reviewers : E& F");
} else {
reviewers.add("G");
reviewers.add("H");
System.out.println("Reviewers : G& H");
}
return reviewers;
}
}
I created a rule as follows
WHEN
There is an OrderData with:
propertyState[propertyState]* FL* --- This is a drop down which
is being displayed correctly
fulfillmentReviewerName [fulfillmentReviewerName] -- This should
have been the drop down. Values are dependent on the state selected.
When i try to create above rule the enumeration is loaded correctly for
propertyState but the enumeration is not loaded for fulfillmentReviewerName
field. When I saw the logs the correct method and condition is being
invoked (as per Sys out)but drop down does not contain anything.
ANy suggestions?
--
View this message in context: http://drools.46999.n3.nabble.com/Dependency-enumeration-tp3245703p324570...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Use System Variable when referring to Resources
by srikanthmalli
Hi,
Is it possible to use System variable when referring to Resources in
Drools-Spring integration?
<drools:kagent id="kAgent" kbase="kBase" new-instance="false">
<drools:resources>
<drools:resource type="PKG"
source="file:/C:/Guvnor-Repository/Sample_v1.PKG">
</drools:resource>
</drools:resources>
</drools:kagent>
<drools:kagent id="kAgent" kbase="kBase" new-instance="false">
<drools:resources>
<drools:resource type="PKG"
source="file:${SYS_VAR_RULE_PKG_DIR}/Sample_v1.PKG">
</drools:resource>
</drools:resources>
</drools:kagent>
Thanks,
-Sri
--
View this message in context: http://drools.46999.n3.nabble.com/Use-System-Variable-when-referring-to-R...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Guvnor 5.5.0.Final Web decision table's advanced enum is not working.
by Soumya.plavaga
Hi,
We are trying to use the advanced enumeration with guvnor 5.5.0.Final. But
seems not working for us. We are doing this -
Having model cascadedModel. CascadedModel has following fields -
1. categoryField (Type Text)
2. departmentField. (Type Text)
Cascaded model has a fact called -
cascadedFact.
Created an enum called cascadedEnum having following -
Fact => 'cascadedFact'
Field => 'categoryField'
Context => '(new
com.ugamsolutions.projectname.guvnorhelper.CategoryListing()).getAttributeListByName("categoryName")'
Fact => 'cascadedFact'
Field => departmentField[categoryField]
Context => '(new
com.ugamsolutions.projectname.guvnorhelper.DepartmentListing()).getAttributeListByNameAndCategoryIdString("departmentName","@{categoryField}")'
And using these two enums in a web decision table's drop down. First drop
down suppose to display all the categories returned for 'categoryField' and
second dropdown will return the departments based upon category dropdown
selection.
Here my case Category drop down is listing properly, no issues. But upon
category selection department dropdown is not loading at all. Actually I can
see '{@categoryField} in enum is not replacing the primary drop down's
selected value. Can you please take a look and let me know if there is any
issue with the advanced dropdown with web decision table in guvnor
5.5.0.Final war?
Any help will be really appriciated.
Many Thanks,
Soumya
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-5-5-0-Final-Web-decision-table-s...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months