Bug 1127303
Summary: | Guided Editor breaks free form DRL which includes setter method with multi parameters | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Retired] JBoss BRMS Platform 6 | Reporter: | Anton Giertli <agiertli> | ||||||||||||||
Component: | Business Central | Assignee: | manstis | ||||||||||||||
Status: | CLOSED EOL | QA Contact: | Marián Macik <mmacik> | ||||||||||||||
Severity: | unspecified | Docs Contact: | Dawn Eisner <deisner> | ||||||||||||||
Priority: | high | ||||||||||||||||
Version: | 6.0.1 | CC: | kverlaen | ||||||||||||||
Target Milestone: | ER6 | ||||||||||||||||
Target Release: | 6.1.0 | ||||||||||||||||
Hardware: | Unspecified | ||||||||||||||||
OS: | Unspecified | ||||||||||||||||
Whiteboard: | |||||||||||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||||||||||
Doc Text: | Story Points: | --- | |||||||||||||||
Clone Of: | Environment: | ||||||||||||||||
Last Closed: | 2020-03-27 19:34:49 UTC | Type: | Bug | ||||||||||||||
Regression: | --- | Mount Type: | --- | ||||||||||||||
Documentation: | --- | CRM: | |||||||||||||||
Verified Versions: | Category: | --- | |||||||||||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||||||||||
Embargoed: | |||||||||||||||||
Attachments: |
|
Created attachment 924518 [details]
[2] rule after refresh
Created attachment 924519 [details]
[3] rule after re-save
Screenshots documents the whole process: -- initial version -- how is it changed after refreshed -- how it can't pass validation after changing the value and re-saving the rule I tried a contrieved case with Community 6.2.0.CR1 (i.e. Product 6.1.0.CR1):- 1. | package org.mortgages; 2. | 3. | import java.lang.Number; 4. | 5. | rule "rr" 6. | dialect "mvel" 7. | when 8. | $r : R( ) 9. | then 10. | $r.aTwoParamMethod( "11", "22" ); 11. | end This worked fine (saving, closing and re-opening). There have been changes to the handling of method parameters since 6.0.1 (the version this BZ has been reported against). I suspect this is already fixed. I also created the RHS of the above rule with "Free Format DRL" and re-opening the rule worked fine. Please note, where possible, the Guided Rule Editor presents "Free Format DRL" with guided widgets when re-opening; so when re-opening this rule the RHS was represented with "Call Method on xxx" widgets and not a "Free Format DRL" block. Michael, I have tested with 6.2.0.CR1 and these are my results: generated source code - looks just fine http://ctrlv.cz/shots/2014/11/06/0p2J.png guided editor after refresh: http://ctrlv.cz/shots/2014/11/06/bL5e.png Two error messages are present, and the guided part is sort of trimmed/deformed. Please re-test with setter method - i.e. $r.setTwoParamMethod("11","22"); instead of $.aTwoParammethod("11","22"); Created attachment 966709 [details] ER2 - deformed guided editor The source is okay (just like Anton says in comment 7), validation is without errors, project builds just fine. The guided editor though is a bit deformed (similarly to Anton's observation in comment 7). The problem was that methods starting with "set" were assumed to be field mutators - for which only single parameters are supported. I've enhanced the handling of methods beginning with "set" so that they are handled as method calls - which can accept multiple parameters.. tested with a $a.setMultipleFields(1, 2) in the RHS and it works OK now. I've tested it with a setVariable method of WorkflowProcessInstance and it works now. Two separate fields for two parameters are displayed. One field (like before this fix) is displayed only when a rule is not valid, e.g. call method on an object which does not have such method. But it is OK, since whole rule is not valid in this situation. But I might have found another issue. When I have a class with a String field and I call $p.getString( ).indexOf("a", 1 ); - so I call two methods in a chain, it displays two fields, first with value ).indexOf("a" and second with value 1. I don't know if this method chaining should be supported by guided rule editor, but I think I should let you know about it. What do you think? Created attachment 991043 [details]
Method chaining in editor
Created attachment 991059 [details]
Method chaining - source code of the rule
Verified on 6.1.0.ER6. |
Created attachment 924517 [details] [1] initial version of the rule Description of problem: If you use a Free Form DRL in a Guided Editor which includes call of a setter method with multiple parameters after saving and refreshing such a rule Guided Editor simply "breaks it". You are probably asking why would I setter method with multiple parameters, but one real use case is to call WorkflowProcessInstance.setVariable("param","value") Version-Release number of selected component (if applicable): BPM 6.0.2 How reproducible: always Steps to Reproduce: 1. Create Guided rule, with free form DRL in the RHS. Make sure there is call of a sether method which includes multiple params 2. save the rule, refresh the page 3. open the rule again, type something in the setter field 4. save the rule again Following exception is displayed: 17:03:53,400 ERROR [org.drools.compiler.kie.builder.impl.AbstractKieModule] (EJB default - 4) Unable to build KieBaseModel:defaultKieBase Unable to Analyse Expression $process.setVariable( "5ne\",\"two" );: [Error: unable to resolve method using strict-mode: org.kie.api.runtime.process.WorkflowProcessInstance.setVariable(java.lang.String)] [Near : {... $process.setVariable( "5ne\",\"two" ); ....}] ^ [Line: 3, Column: 0] : [Rule name='sampleRule'] Actual results: Guided Editor is not able to cope with the Free Form DRL which includes call of a setter method with multiple parameters Expected results: