Bug 1263294 - There in only String as data type for local process variable
There in only String as data type for local process variable
Product: JBoss BPMS Platform 6
Classification: JBoss
Component: Eclipse Tooling (Show other bugs)
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Kris Verlaenen
Jozef Marko
Depends On:
  Show dependency treegraph
Reported: 2015-09-15 09:50 EDT by Jozef Marko
Modified: 2018-01-30 07:39 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
ilustrating project (19.14 KB, application/zip)
2015-09-16 04:56 EDT, Jozef Marko
no flags Details

  None (edit)
Description Jozef Marko 2015-09-15 09:50:56 EDT
*** 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
Property details
Item Subject

I would expect something like this:

Local variable list for process xyz
Local variable details
Data Type
Comment 1 Jozef Marko 2015-09-16 01:52:07 EDT
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.
Comment 2 Jozef Marko 2015-09-16 01:53:07 EDT
#c0. == https://bugzilla.redhat.com/show_bug.cgi?id=1263294#c0
Comment 3 Jozef Marko 2015-09-16 04:56:37 EDT
Created attachment 1073920 [details]
ilustrating project
Comment 4 Jozef Marko 2015-09-16 05:00:48 EDT
Please try to run illustrating project attachment. 

There is error like:
ForEach node 'Sub Process 1' [3] 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.
Comment 5 Robert (Bob) Brodt 2015-09-16 14:17:12 EDT
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

Comment 6 Robert (Bob) Brodt 2015-09-16 14:24:53 EDT
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 ;)
Comment 7 Jozef Marko 2015-09-22 03:31:15 EDT
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:ioSpecification id="_tfqBcWD3EeWsad8FvJC0Cg">
        <bpmn2:dataInput id="_AC7F9A0D-F0E8-4544-B91D-0A6DCCCB07A4_input" name="iColl"/>
        <bpmn2:inputSet id="_tfqBcmD3EeWsad8FvJC0Cg">
      <bpmn2:dataInputAssociation id="_tfqBc2D3EeWsad8FvJC0Cg">
      <bpmn2:multiInstanceLoopCharacteristics id="_tfqBdGD3EeWsad8FvJC0Cg">
        <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?
Comment 8 Robert (Bob) Brodt 2015-10-29 15:51:56 EDT
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
Mars build

The selection list now contains all of the native Java data types.
Comment 9 Jozef Marko 2015-11-02 02:28:34 EST
Hi Bob. Fix looks good. I will mark as verified when fix will be mirrored in JBDS integration stack.
Comment 10 Jozef Marko 2016-02-16 09:58:35 EST
Verified on jbds-9.1.0.Beta2_jbdsis-9.0.0.Beta1
BPMN2 Modeler - 1.2.3.CR2-v20160209-2002

Note You need to log in before you can comment on or make changes to this bug.