[JBoss JIRA] (DROOLS-2427) Drools @Watch not working with accumulate in code
by NA NA (JIRA)
[ https://issues.jboss.org/browse/DROOLS-2427?page=com.atlassian.jira.plugi... ]
NA NA edited comment on DROOLS-2427 at 3/27/18 1:07 PM:
--------------------------------------------------------
It behaves the same way (ignores the watch annotation) with the use of setter only. Not sure if its related to accumulate or not, but without accumulate it works just fine.
was (Author: sash101):
It behaves the same way (ignores the watch annotation) with the use of setter only. Not sure if its related to accumulate or not, but without accumulate it works just fine.
> Drools @Watch not working with accumulate in code
> -------------------------------------------------
>
> Key: DROOLS-2427
> URL: https://issues.jboss.org/browse/DROOLS-2427
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Reporter: Mario Fusco
> Assignee: Mario Fusco
> Attachments: PropertyReactiveBug.zip
>
>
> I'm using Drools 7.6 and for some reason @watch doesn't stop the rule from reactivating itself or other rules when only the unwatched property is changed. Which results in an infinite loop.
> Can someone figure out what am I doing wrong?
> The rule:
> {code}
> package com.model
> import com.model.*;
> import java.util.List;
> rule "10% for 15 High-range Items"
> when
> $o: Order($lines: orderLines) @watch(!discount)
> Number(intValue >= 15) from accumulate(
> OrderLine($item: item, $q: quantity) from $lines and
> Item(category == Item.Category.HIGH_RANGE) from $item,
> sum($q)
> )
> then
> modify($o) {increaseDiscount(0.10)}
> end
> {code}
> The model used is from the book Mastering JBoss Drools. The method increase discount has been annotated with @Modifes. The order class:
> {code}
> public class Order implements Serializable {
> private static final long serialVersionUID = 1L;
> private Long orderId;
> private Date date;
> private Customer customer;
> private List<OrderLine> orderLines = new ArrayList<>();
> private Discount discount;
> public Order() {
> }
> public Long getOrderId() {
> return orderId;
> }
> public void setOrderId(Long orderId) {
> this.orderId = orderId;
> }
> public Customer getCustomer() {
> return customer;
> }
> public void setCustomer(Customer customer) {
> this.customer = customer;
> }
> public Date getDate() {
> return date;
> }
> public void setDate(Date date) {
> this.date = date;
> }
> public List<OrderLine> getOrderLines() {
> return orderLines;
> }
> public void setItems(List<OrderLine> orderLines) {
> this.orderLines = orderLines;
> }
> public double getTotal() {
> return this.getOrderLines().stream()
> .mapToDouble(item -> item.getItem().getSalePrice() * item.getQuantity())
> .sum();
> }
> public int getTotalItems() {
> return this.getOrderLines().stream()
> .mapToInt(item -> item.getQuantity())
> .sum();
> }
> @Modifies({"discount"})
> public void increaseDiscount(double increase) {
> if (discount == null) {
> discount = new Discount(0.0);
> }
> discount.setPercentage(discount.getPercentage() + increase);
> }
> public Discount getDiscount() {
> return discount;
> }
> public double getDiscountPercentage() {
> return discount.getPercentage();
> }
> public void setDiscount(Discount discount) {
> this.discount = discount;
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
8 years, 1 month
[JBoss JIRA] (DROOLS-2427) Drools @Watch not working with accumulate in code
by NA NA (JIRA)
[ https://issues.jboss.org/browse/DROOLS-2427?page=com.atlassian.jira.plugi... ]
NA NA commented on DROOLS-2427:
-------------------------------
It behaves the same way (ignores the watch annotation) with the use of setter only. Not sure if its related to accumulate or not, but without accumulate it works just fine.
> Drools @Watch not working with accumulate in code
> -------------------------------------------------
>
> Key: DROOLS-2427
> URL: https://issues.jboss.org/browse/DROOLS-2427
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Reporter: Mario Fusco
> Assignee: Mario Fusco
> Attachments: PropertyReactiveBug.zip
>
>
> I'm using Drools 7.6 and for some reason @watch doesn't stop the rule from reactivating itself or other rules when only the unwatched property is changed. Which results in an infinite loop.
> Can someone figure out what am I doing wrong?
> The rule:
> {code}
> package com.model
> import com.model.*;
> import java.util.List;
> rule "10% for 15 High-range Items"
> when
> $o: Order($lines: orderLines) @watch(!discount)
> Number(intValue >= 15) from accumulate(
> OrderLine($item: item, $q: quantity) from $lines and
> Item(category == Item.Category.HIGH_RANGE) from $item,
> sum($q)
> )
> then
> modify($o) {increaseDiscount(0.10)}
> end
> {code}
> The model used is from the book Mastering JBoss Drools. The method increase discount has been annotated with @Modifes. The order class:
> {code}
> public class Order implements Serializable {
> private static final long serialVersionUID = 1L;
> private Long orderId;
> private Date date;
> private Customer customer;
> private List<OrderLine> orderLines = new ArrayList<>();
> private Discount discount;
> public Order() {
> }
> public Long getOrderId() {
> return orderId;
> }
> public void setOrderId(Long orderId) {
> this.orderId = orderId;
> }
> public Customer getCustomer() {
> return customer;
> }
> public void setCustomer(Customer customer) {
> this.customer = customer;
> }
> public Date getDate() {
> return date;
> }
> public void setDate(Date date) {
> this.date = date;
> }
> public List<OrderLine> getOrderLines() {
> return orderLines;
> }
> public void setItems(List<OrderLine> orderLines) {
> this.orderLines = orderLines;
> }
> public double getTotal() {
> return this.getOrderLines().stream()
> .mapToDouble(item -> item.getItem().getSalePrice() * item.getQuantity())
> .sum();
> }
> public int getTotalItems() {
> return this.getOrderLines().stream()
> .mapToInt(item -> item.getQuantity())
> .sum();
> }
> @Modifies({"discount"})
> public void increaseDiscount(double increase) {
> if (discount == null) {
> discount = new Discount(0.0);
> }
> discount.setPercentage(discount.getPercentage() + increase);
> }
> public Discount getDiscount() {
> return discount;
> }
> public double getDiscountPercentage() {
> return discount.getPercentage();
> }
> public void setDiscount(Discount discount) {
> this.discount = discount;
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
8 years, 1 month
[JBoss JIRA] (DROOLS-2427) Drools @Watch not working with accumulate in code
by NA NA (JIRA)
[ https://issues.jboss.org/browse/DROOLS-2427?page=com.atlassian.jira.plugi... ]
NA NA updated DROOLS-2427:
--------------------------
Attachment: PropertyReactiveBug.zip
> Drools @Watch not working with accumulate in code
> -------------------------------------------------
>
> Key: DROOLS-2427
> URL: https://issues.jboss.org/browse/DROOLS-2427
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Reporter: Mario Fusco
> Assignee: Mario Fusco
> Attachments: PropertyReactiveBug.zip
>
>
> I'm using Drools 7.6 and for some reason @watch doesn't stop the rule from reactivating itself or other rules when only the unwatched property is changed. Which results in an infinite loop.
> Can someone figure out what am I doing wrong?
> The rule:
> {code}
> package com.model
> import com.model.*;
> import java.util.List;
> rule "10% for 15 High-range Items"
> when
> $o: Order($lines: orderLines) @watch(!discount)
> Number(intValue >= 15) from accumulate(
> OrderLine($item: item, $q: quantity) from $lines and
> Item(category == Item.Category.HIGH_RANGE) from $item,
> sum($q)
> )
> then
> modify($o) {increaseDiscount(0.10)}
> end
> {code}
> The model used is from the book Mastering JBoss Drools. The method increase discount has been annotated with @Modifes. The order class:
> {code}
> public class Order implements Serializable {
> private static final long serialVersionUID = 1L;
> private Long orderId;
> private Date date;
> private Customer customer;
> private List<OrderLine> orderLines = new ArrayList<>();
> private Discount discount;
> public Order() {
> }
> public Long getOrderId() {
> return orderId;
> }
> public void setOrderId(Long orderId) {
> this.orderId = orderId;
> }
> public Customer getCustomer() {
> return customer;
> }
> public void setCustomer(Customer customer) {
> this.customer = customer;
> }
> public Date getDate() {
> return date;
> }
> public void setDate(Date date) {
> this.date = date;
> }
> public List<OrderLine> getOrderLines() {
> return orderLines;
> }
> public void setItems(List<OrderLine> orderLines) {
> this.orderLines = orderLines;
> }
> public double getTotal() {
> return this.getOrderLines().stream()
> .mapToDouble(item -> item.getItem().getSalePrice() * item.getQuantity())
> .sum();
> }
> public int getTotalItems() {
> return this.getOrderLines().stream()
> .mapToInt(item -> item.getQuantity())
> .sum();
> }
> @Modifies({"discount"})
> public void increaseDiscount(double increase) {
> if (discount == null) {
> discount = new Discount(0.0);
> }
> discount.setPercentage(discount.getPercentage() + increase);
> }
> public Discount getDiscount() {
> return discount;
> }
> public double getDiscountPercentage() {
> return discount.getPercentage();
> }
> public void setDiscount(Discount discount) {
> this.discount = discount;
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
8 years, 1 month
[JBoss JIRA] (JBRULES-1058) nested accessors with Sets - "not contains" is not a valid operator for MVEL
by Rahul Vanimisetty (JIRA)
[ https://issues.jboss.org/browse/JBRULES-1058?page=com.atlassian.jira.plug... ]
Rahul Vanimisetty commented on JBRULES-1058:
--------------------------------------------
Any update on this issue? Is the 'not contains' operator bug fixed in mvel ? I am asking because I am still not able to use this operator.
> nested accessors with Sets - "not contains" is not a valid operator for MVEL
> ----------------------------------------------------------------------------
>
> Key: JBRULES-1058
> URL: https://issues.jboss.org/browse/JBRULES-1058
> Project: JBRULES
> Issue Type: Bug
> Components: drools-compiler
> Affects Versions: 4.0.0.GA
> Reporter: Mark McNally
> Assignee: Edson Tirelli
> Fix For: 4.0.1
>
>
> Following does not work:
> rule StateMatch
> when
> $ca:CandidateAssociation(nurseDetails.stateLicensures excludes patientDetails.state )
> then
> retract( $ca );
> end
>
>
> public class CandidateAssociation {
> private PatientDetails patientDetails;
> private NurseDetails nurseDetails;
> private int overlapHours;
>
> public CandidateAssociation( PatientDetails patientDetails, NurseDetails nurseDetails) {
> super();
> this.patientDetails = patientDetails;
> this.nurseDetails = nurseDetails;
> overlapHours = participantDetails.getNumberOverlapHourCnt(nurseDetails);
> }
> [...]
> }
>
> public class NurseDetails {
> private Set stateLicensures = new HashSet();
> [...]
> }
> public class PatientDetails {
> private String state;
> [...]
> }
> Edson suggested that the problem is that "not contains" is not a valid operator for MVEL.
> Also Noticed that the following workaround did not work:
> rule State
> dialect "mvel"
> when
> $ca:CandidateAssociation( eval ( ! nurseDetails.stateLicensures.contains( patientDetails.state ) ) )
> then
> retract( $ca );
> end
>
> This produced this Exception:
> org.drools.rule.InvalidRulePackage: Unable to determine the used declarations : [Rule name=State, agendaGroup=MAIN, salience=0, no-loop=false]
> at org.drools.rule.Package.checkValidity(Package.java:408)
> at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:288)
> at [...]
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
8 years, 1 month
[JBoss JIRA] (DROOLS-2428) Sample Issues
by Deepak Reddy Kasu (JIRA)
Deepak Reddy Kasu created DROOLS-2428:
-----------------------------------------
Summary: Sample Issues
Key: DROOLS-2428
URL: https://issues.jboss.org/browse/DROOLS-2428
Project: Drools
Issue Type: Bug
Components: eclipse plugin
Affects Versions: 7.3.0.Final
Environment: API Calls
Reporter: Deepak Reddy Kasu
Assignee: Kris Verlaenen
Priority: Trivial
Fix For: 7.1.0.Beta3
created to test the api calls
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
8 years, 1 month
[JBoss JIRA] (WFBUILD-38) Allow for additional resources or filtering resources in the feature-pack-maven-plugin
by James Perkins (JIRA)
James Perkins created WFBUILD-38:
------------------------------------
Summary: Allow for additional resources or filtering resources in the feature-pack-maven-plugin
Key: WFBUILD-38
URL: https://issues.jboss.org/browse/WFBUILD-38
Project: WildFly Build Tools
Issue Type: Enhancement
Reporter: James Perkins
Assignee: James Perkins
It would be useful to allow resources in a feature pack to be filtered for expressions. For example static html files may want different branding depending the project.
As a side effect this will also allow resources from other directories to be added and optionally overwrite resources.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
8 years, 1 month
[JBoss JIRA] (ELY-1516) Digest HTTP/SASL refactoring
by Jan Kalina (JIRA)
[ https://issues.jboss.org/browse/ELY-1516?page=com.atlassian.jira.plugin.s... ]
Jan Kalina closed ELY-1516.
---------------------------
Resolution: Won't Fix
As discussed, refactoring can make backporting other patches difficult - closing for now.
> Digest HTTP/SASL refactoring
> ----------------------------
>
> Key: ELY-1516
> URL: https://issues.jboss.org/browse/ELY-1516
> Project: WildFly Elytron
> Issue Type: Enhancement
> Components: HTTP, SASL
> Affects Versions: 1.2.0.Final
> Reporter: Jan Kalina
> Assignee: Jan Kalina
>
> There is a lot of code in HTTP and SASL Digest mechanism which do the same thing and should be moved into DigestUtil because of it.
> * realm selection / availableRealms handling
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
8 years, 1 month