Red Hat Bugzilla – Bug 1263294
There in only String as data type for local process variable
Last modified: 2016-02-16 09:58:35 EST
*** Description of problem:
If user wants to define local process variable. there is only String as data type in given combo. Other data types need to be added manually.
*** Version-Release number of selected component (if applicable):
*** Steps to Reproduce:
1. Create new process
2. Try to define new local variable
If you wants to use other type as String, you will have to add it manually by plus button next to 'Item Subject' combo
*** Additional info:
Notice, that also labels in this area are little bit strange:
Property list for process xyz
I would expect something like this:
Local variable list for process xyz
Local variable details
The same situation for local variables of subprocess. Even basic data types as String, Float, Object must be added manually and there are wrong labels as mentioned in #c0.
#c0. == https://bugzilla.redhat.com/show_bug.cgi?id=1263294#c0
Created attachment 1073920 [details]
Please try to run illustrating project attachment.
There is error like:
ForEach node 'Sub Process 1'  has no collection expression]]
But if you check given variable (numbers). it is declared as java.util.ArrayList.
I hope this helps you in solving this BZ Bob.
Jozef, the data type definition for the java.util.ArrayList type in the sample project looks like this:
<bpmn2:itemDefinition id="ItemDefinition_1" isCollection="false" structureRef="java.util.ArrayList"/>
here, "isCollection" is false, indicating that ArrayList is NOT a collection and I see now that there is no way to set this attribute in the jBPM flavor of the editor (the generic editor does allow you to set this attribute true/false). This is a problem...
Unfortunately, BPMN2 and Java have different ideas about what a "collection" is: in Java, it has certain behavioral characteristics (i.e., it must implement the Collection interface) but BPMN2 is only a descriptive language and does not natively understand that Java Collections are indeed "collections".
We have some options here:
1. I could inspect the structureRef if it is a Java type (note that this could also be an XSD type!) and check if it implements Collection, and set the "isCollection" attribute accordingly. For XSD types I would have to check minOccurs and maxOccurs to determine if it's a collection.
2. I can expose the "isCollection" as a checkbox in the UI and make the user responsible for figuring out if the referenced type is a collection.
3. do both 1 and 2
Actually, thinking about this some more...
the "isCollection" indicates whether the item definition is to be handled by the Process engine as a collection, and the "structureRef" indicates the data type of each element in the collection. So, if we define this:
<bpmn2:itemDefinition id="ItemDefinition_1" isCollection="true" structureRef="java.util.ArrayList"/>
it represents a collection of java.util.ArrayList elements which, I think, is not what was intended. It's possible that the jBPM engine ignores the "isCollection" attribute and just inspects the Java type itself to see if it makes sense in the context it is being used (or just lets the Java VM throw a runtime exception if it can't be cast to Collection).
Ouch, my brain hurts ;)
Bob, expression 'isCollection' is probably not so important in this case.
I checked web bpmn2 designer and I found this. If I model MI Subprocess there, I obtain something like this:
<bpmn2:subProcess id="_AC7F9A0D-F0E8-4544-B91D-0A6DCCCB07A4" drools:selectable="true" color:background-color="#fafad2" color:border-color="#000000" color:color="#000000" name="">
<bpmn2:dataInput id="_AC7F9A0D-F0E8-4544-B91D-0A6DCCCB07A4_input" name="iColl"/>
<bpmn2:inputDataItem xsi:type="bpmn2:tDataInput" id="miDataInput" itemSubjectRef="_AC7F9A0D-F0E8-4544-B91D-0A6DCCCB07A4_multiInstanceItemType"/>
I tried to add manually ioSpecification and dataInputAssociation to bpmn2 generated by eclipse modeler and error message about missing collection expression disappeared. There occurred another problem, but it was probably something with generated id's and item definitions from web bpmn2 designer.
@Bob please, can you have a look at this?
Hi Jozef, the problem you describe above has been reported in https://bugzilla.redhat.com/show_bug.cgi?id=1265413 as a separate issue.
The problem reported is fixed in:
Luna build 220.127.116.11510291907
Mars build 18.104.22.168510291906
The selection list now contains all of the native Java data types.
Hi Bob. Fix looks good. I will mark as verified when fix will be mirrored in JBDS integration stack.
Verified on jbds-9.1.0.Beta2_jbdsis-9.0.0.Beta1
BPMN2 Modeler - 1.2.3.CR2-v20160209-2002