JBoss Community

jBPM 5 - How to Pass parameters in a WorkItem BPMN2 file

created by scurvo in jBPM - View the full discussion

Hi all again :D

 

I am trying to create a work item that receives certain parameters, and does stuff depending on them.

Through the examples i created this BPMN2 file:

 

<?xml version="1.0" encoding="UTF-8"?>

<definitions id="Definition"

             targetNamespace="http://www.example.org/MinimalExample"

             typeLanguage="http://www.java.com/javaTypes"

             expressionLanguage="http://www.mvel.org/2.0"

             xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"

             xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"

             xs:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"

             xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"

             xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"

             xmlns:di="http://www.omg.org/spec/DD/20100524/DI"

             xmlns:tns="http://www.jboss.org/drools">

 

    <itemDefinition id="_sItem" structureRef="java.lang.String"/>

    <itemDefinition id="_int" structureRef="java.lang.Integer"/>

 

    <process id="TestWI" name="Test the WI" >

 

        <!-- process variables -->

        <property id="data_provider_ID" itemSubjectRef="_sItem"/>

        <property id="data_source_ID" itemSubjectRef="_sItem"/>

        <property id="source_url" itemSubjectRef="_sItem"/>

        <property id="source_set" itemSubjectRef="_sItem"/>

        <property id="metadata_format" itemSubjectRef="_sItem"/>

        <property id="record_count" itemSubjectRef="_int"/>

 

        <startEvent id="_1" name="StartProcess"/>

        <sequenceFlow sourceRef="_1" targetRef="_2"/>

        <task id="_2" name="Harvest" tns:taskName="Harvest" >

            <ioSpecification>

                <dataInput id="dpID" name="DATA_PROVIDER_ID" />

                <dataInput id="dsID" name="DATA_SOURCE_ID" />

                <dataInput id="src_url" name="SOURCE_URL" />

                <dataInput id="src_set" name="SOURCE_SET" />

                <dataInput id="mtd_format" name="METADATA_FORMAT" />

                <dataInput id="rcrd_count" name="RECORD_COUNT" />

                <inputSet>

                    <dataInputRefs>dpID</dataInputRefs>

                    <dataInputRefs>dsID</dataInputRefs>

                    <dataInputRefs>src_url</dataInputRefs>

                    <dataInputRefs>src_set</dataInputRefs>

                    <dataInputRefs>mtd_format</dataInputRefs>

                    <dataInputRefs>rcrd_count</dataInputRefs>

                </inputSet>

                <outputSet>

                </outputSet>

            </ioSpecification>

            <dataInputAssociation>

                <sourceRef>data_provider_ID</sourceRef>

                <targetRef>dpID</targetRef>

            </dataInputAssociation>

            <dataInputAssociation>

                <sourceRef>data_source_ID</sourceRef>

                <targetRef>dsID</targetRef>

            </dataInputAssociation>

            <dataInputAssociation>

                <sourceRef>source_url</sourceRef>

                <targetRef>src_url</targetRef>

            </dataInputAssociation>

            <dataInputAssociation>

                <sourceRef>source_set</sourceRef>

                <targetRef>src_set</targetRef>

            </dataInputAssociation>

            <dataInputAssociation>

                <sourceRef>metadata_format</sourceRef>

                <targetRef>mtd_format</targetRef>

            </dataInputAssociation>

            <dataInputAssociation>

                <sourceRef>record_count</sourceRef>

                <targetRef>rcrd_count</targetRef>

            </dataInputAssociation>

        </task>

        <sequenceFlow sourceRef="_2" targetRef="_3"/>

        <endEvent id="_3" name="EndProcess">

            <terminateEventDefinition/>

        </endEvent>

    </process>

 

</definitions>

 

 

I was able with this to get the parameters i defined in the corresponding work item's handler.

Although i made it now that i want to have multiple work items like this on a single process i have a para meter problem :( .

Is it possible to define my parameters right on the bpmn2 file?

If not, is there a way of getting the ID of the task of a workItem (i wana get that <task id="_2"...)?

Reply to this message by going to Community

Start a new discussion in jBPM at Community