Bug 1263294

Summary: There in only String as data type for local process variable
Product: [Retired] JBoss BPMS Platform 6 Reporter: Jozef Marko <jomarko>
Component: Eclipse ToolingAssignee: Kris Verlaenen <kverlaen>
Status: CLOSED EOL QA Contact: Jozef Marko <jomarko>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.0CC: jomarko
Target Milestone: ---   
Target Release: ---   
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:38:57 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:
Description Flags
ilustrating project none

Description Jozef Marko 2015-09-15 13:50:56 UTC
*** 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):
jbds-9.0.0.CR1_jbdsis-9.0.0.Alpha1


*** 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 05:52:07 UTC
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 05:53:07 UTC
#c0. == https://bugzilla.redhat.com/show_bug.cgi?id=1263294#c0

Comment 3 Jozef Marko 2015-09-16 08:56:37 UTC
Created attachment 1073920 [details]
ilustrating project

Comment 4 Jozef Marko 2015-09-16 09:00:48 UTC
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 18:17:12 UTC
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

WDYT?

Comment 6 Robert (Bob) Brodt 2015-09-16 18:24:53 UTC
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 07:31:15 UTC
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:incoming>_4A23768D-5BC6-4E5A-B223-EDE080485374</bpmn2:incoming>
      <bpmn2:outgoing>_75F058DD-E136-47EB-A08A-5322EA87B5F3</bpmn2:outgoing>
      <bpmn2:ioSpecification id="_tfqBcWD3EeWsad8FvJC0Cg">
        <bpmn2:dataInput id="_AC7F9A0D-F0E8-4544-B91D-0A6DCCCB07A4_input" name="iColl"/>
        <bpmn2:inputSet id="_tfqBcmD3EeWsad8FvJC0Cg">
          <bpmn2:dataInputRefs>_AC7F9A0D-F0E8-4544-B91D-0A6DCCCB07A4_input</bpmn2:dataInputRefs>
        </bpmn2:inputSet>
      </bpmn2:ioSpecification>
      <bpmn2:dataInputAssociation id="_tfqBc2D3EeWsad8FvJC0Cg">
        <bpmn2:sourceRef>iColl</bpmn2:sourceRef>
        <bpmn2:targetRef>_AC7F9A0D-F0E8-4544-B91D-0A6DCCCB07A4_input</bpmn2:targetRef>
      </bpmn2:dataInputAssociation>
      <bpmn2:multiInstanceLoopCharacteristics id="_tfqBdGD3EeWsad8FvJC0Cg">
        <bpmn2:loopDataInputRef>_AC7F9A0D-F0E8-4544-B91D-0A6DCCCB07A4_input</bpmn2:loopDataInputRef>
        <bpmn2:inputDataItem xsi:type="bpmn2:tDataInput" id="miDataInput" itemSubjectRef="_AC7F9A0D-F0E8-4544-B91D-0A6DCCCB07A4_multiInstanceItemType"/>
      </bpmn2:multiInstanceLoopCharacteristics>
    </bpmn2:subProcess>

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 19:51:56 UTC
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 1.1.4.201510291907
Mars build 1.2.1.201510291906

The selection list now contains all of the native Java data types.

Comment 9 Jozef Marko 2015-11-02 07:28:34 UTC
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 14:58:35 UTC
Verified on jbds-9.1.0.Beta2_jbdsis-9.0.0.Beta1
BPMN2 Modeler - 1.2.3.CR2-v20160209-2002