| Summary: | Dependent enumerations using external data source - data not loaded | ||
|---|---|---|---|
| Product: | [Retired] JBoss BRMS Platform 6 | Reporter: | Zuzana Krejčová <zkrejcov> |
| Component: | Business Central | Assignee: | manstis |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Zuzana Krejčová <zkrejcov> |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | 6.0.0 | CC: | etirelli, lpetrovi, rzhang |
| Target Milestone: | CR1 | ||
| Target Release: | 6.0.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2014-08-06 20:18:38 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: | |
| Bug Depends On: | |||
| Bug Blocks: | 1013693 | ||
Where did you place the class containing com.org.Helper2 (so I can replicate)? (In reply to manstis from comment #1) > Where did you place the class containing com.org.Helper2 (so I can > replicate)? Both classes are in the usual place - business-central.war/WEB-INF/classes/<package_structure>/SomeClass.class. OK, so they're in the business-central WAR; as opposed to (1) in a JAR added as a project dependency, or (2) in EAP's /lib folder, (3) in the Project itself. Have you tried any of these workarounds (#2 might work). Personally, I think it should work for #1 and #3 but would like to know your opinion before implementing any fix. IIRC a change was made recently to allow "custom accumulate functions" to be added as either #1 and #3 and doing the same for "custom enum functions" would be consistent. (In reply to manstis from comment #3) > OK, so they're in the business-central WAR; as opposed to (1) in a JAR added > as a project dependency, or (2) in EAP's /lib folder, (3) in the Project > itself. > > Have you tried any of these workarounds (#2 might work). Personally, I think > it should work for #1 and #3 but would like to know your opinion before > implementing any fix. IIRC a change was made recently to allow "custom > accumulate functions" to be added as either #1 and #3 and doing the same for > "custom enum functions" would be consistent. None of that makes it work. I'm not sure whether any of that should help anyway, since the problem is only with the dependent enumeration list, when you put the method call into apostrophes (''). The enumeration list for Fact.field1 loads just fine. And of course, the same thing happens if you try to use this in a test scenario, guided rule template, and it break guided decision table. OK, re-reading the initial comment:
"The trouble seems to be with the '' escaped expression. This should cause the expression to be evaluated only when needed, e.g. when used in a guided rule, but it seems it is not evaluated at all."
What makes you think '' works in that way?
Re-reading your other comment:
"Static dependent enumeration are ok as well as normal (not dependent) enumeration from external datasource. Using 'Fact.field2[field1=value]' : (new com.org.Helper2()).getList2() works as well."
Why not make your dependent enumeration this:
Enum: 'Fact.field1' : (new com.org.Helper1()).getList1()
'Fact.field2[field1]' : (new com.org.Helper2()).getList2("@{field1}")'
* I've removed a single ' form the 2nd line, before the "(new..."
(In reply to manstis from comment #5) > > What makes you think '' works in that way? Documentation - http://docs.jboss.org/drools/release/6.0.0.Final/drools-docs/html/drools.AuthoringAssets.html#drools.AdvancedEnumConcepts "Similar to above, but note that we have just specified what fields are needed, and also on the right of the ":" there are quotes around the expression. This expression will then be evaluated, only when needed, substituting the values from the fields specified..." As far as I know, it always worked like that, or at least was supposed to work like that (I haven't seen the 5.x bits for quite some time). > > Why not make your dependent enumeration this: > > Enum: 'Fact.field1' : (new com.org.Helper1()).getList1() > 'Fact.field2[field1]' : (new com.org.Helper2()).getList2("@{field1}")' > > * I've removed a single ' form the 2nd line, before the "(new..." I don't see how removing only one ' could help. It only results in validation errors. If I remove both of the apostrophes around the method call, the method is called once when I open the rule and the field is not substituted of course. The method is called with "@{field1}". It is not called again. Therefore, it would never give me a correct list. Ignore me ;) I didn't see the ' before the :.. I'll look into and replicate, before I ask any more (stupid) questions. |
Description of problem: POJO: class Fact with String field1, String field2; Enum: 'Fact.field1' : (new com.org.Helper1()).getList1() 'Fact.field2[field1]' : '(new com.org.Helper2()).getList2("@{field1}")' com.org.Helper1().getList1() returns a list with "a", "b", "c"; com.org.Helper2().getList2(String value) returns a list with value+"a", value+"b", value+"c" (for argument "a" this would mean "aa", "ab", "ac"). Just to check, before returning, getList2(..) prints the list to stdout. The Problem: When trying to use this in a guided rule, the dropdown for the dependent field is empty. The debug print is not in the log. The trouble seems to be with the '' escaped expression. This should cause the expression to be evaluated only when needed, e.g. when used in a guided rule, but it seems it is not evaluated at all. Version-Release number of selected component (if applicable): BPMS 6.0 ER5 Additional info: Static dependent enumeration are ok as well as normal (not dependent) enumeration from external datasource. Using 'Fact.field2[field1=value]' : (new com.org.Helper2()).getList2() works as well.