[jboss-jira] [JBoss JIRA] (DROOLS-1654) Don'ing a Map-Based Fact Loses the Fact

KimJohn Quinn (JIRA) issues at jboss.org
Sat Jul 8 09:10:00 EDT 2017


    [ https://issues.jboss.org/browse/DROOLS-1654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13433153#comment-13433153 ] 

KimJohn Quinn commented on DROOLS-1654:
---------------------------------------

I tried a few different scenarios and it all seems to come back to the map.

*If I replace the map-based fact with a strong-typed class the output is what I would expect:*

{quote}Rule 1
Rule 2A: 1.0 (before don)
Rule 2B: 1.0 (after don)
Rule 2C: 1.0
Rule 3: 1.0
Rule 4A: 2.0
Rule 4B: 1.0
Rule 5: 3.0
Model: 1
Trait: 1{quote}

If I make that class extend HashMap, even though I have the properties in the trait, it reverts back to the non-working result set.

{quote}Rule 1
Rule 2A: 1.0 (before don)
Rule 2B: 1.0 (after don)
Rule 2C: null
Rule 3: null
Model: 0
Trait: 1{quote}

> Don'ing a Map-Based Fact Loses the Fact
> ---------------------------------------
>
>                 Key: DROOLS-1654
>                 URL: https://issues.jboss.org/browse/DROOLS-1654
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine
>    Affects Versions: 7.0.0.Final
>         Environment: * Alpine Linux (in a Docker container)
> * Oracle JDK 8
> * Drools 7.0.0.Final
> * Spring Boot v1.5.4.RELEASE (though testing without any Spring) 
>            Reporter: KimJohn Quinn
>            Assignee: Mario Fusco
>              Labels: traits
>         Attachments: TraitDonningTest.java, traits.drl
>
>
> It appears that after don'ing the trait the map-based fact it is proxying disappears (or gets retracted).
> There does not seem to be any issue using the trait properties to access the model properties.
> We are trying to use the model, mostly for constraints and updates, then within the rules apply and use traits to give us a stronger-typed fact and easier rule constraining.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list