AnsweredAssumed Answered

Access for endOperations

Question asked by aram on Mar 30, 2012
Hello.
I am new in activity, and my question is more about concept.

Lets say I have document which need to be displayed with few "endOperations"(buttons) for example 'STORE', 'ACCEPT'.
Operation STORE is available only for 'ROLE_STORE' and Operation ACCEPT is available only for 'ROLE_ACCEPT'

I like to cover all logic in .bpmn20.xml definition and do not have any additional check ( regarding available tasks (operations) for user) in my codes.

I implemented following and it works, but i have a feeling that it is "workaround"(at least because I am defining same information twice )


<definitions id="definitions"
             targetNamespace="http://activiti.org/bpmn20" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
             xmlns:activiti="http://activiti.org/bpmn">

    <process id="FormX" name="FormX Application Workflow">
        <startEvent id="theStart"/>

        <sequenceFlow id='flow0' sourceRef='theStart' targetRef='storeFormX'/>
        <userTask id="storeFormX" name="Store FormX">
            <documentation>Store FormX</documentation>
            <potentialOwner>
                <resourceAssignmentExpression>
                    <formalExpression>ROLE_STORE</formalExpression>
                </resourceAssignmentExpression>
            </potentialOwner>
        </userTask>


        <sequenceFlow id='flow6' sourceRef='storeFormX' targetRef='retrieveStored'/>

        <userTask id="retrieveStored" name="Retrieve Stored FormX">
            <documentation>Retrieve Stored FormX</documentation>
            <extensionElements>
                <activiti:formProperty id="endOperationsForROLE_ACCEPT" type="enum" required="true">
                    <activiti:value id="Accept"/>
                </activiti:formProperty>
                <activiti:formProperty id="endOperationsForROLE_STORE" type="enum" required="true">
                    <activiti:value id="Store"/>
                </activiti:formProperty>
            </extensionElements>
            <potentialOwner>
                <resourceAssignmentExpression>
                    <formalExpression>group(ROLE_STORE), group(ROLE_ACCEPT)</formalExpression>
                </resourceAssignmentExpression>
            </potentialOwner>

        </userTask>


        <sequenceFlow id='flow7' sourceRef='retrieveStored' targetRef='updateStored'/>


        <exclusiveGateway id="updateStored" name="Update Retrieved (in Stored status ) document" default="flow4"/>

        <sequenceFlow id="flow4" sourceRef="updateStored" targetRef="retrieveStored">
            <conditionExpression xsi:type="tFormalExpression">
                <![CDATA[${endOperation == "Store"}]]>
            </conditionExpression>
        </sequenceFlow>

        <sequenceFlow id="flow5" sourceRef="updateStored" targetRef="acceptFormX">
            <conditionExpression xsi:type="tFormalExpression">
                <![CDATA[${endOperation == "Accept"}]]>
            </conditionExpression>
        </sequenceFlow>

        <userTask id="acceptFormX" name="Accept FormX">
            <documentation>Accept FormX</documentation>
            <potentialOwner>
                <resourceAssignmentExpression>
                    <formalExpression>ROLE_ACCEPT</formalExpression>
                </resourceAssignmentExpression>
            </potentialOwner>
        </userTask>

        <sequenceFlow id='flow2' sourceRef='acceptFormX' targetRef='submitFormX'/>

        <userTask id="submitFormX" name="Submit FormX">
            <documentation>Submit FormX</documentation>
            <potentialOwner>
                <resourceAssignmentExpression>
                    <formalExpression>ROLE_SUBMIT</formalExpression>
                </resourceAssignmentExpression>
            </potentialOwner>
        </userTask>

        <sequenceFlow id='flow3' sourceRef='submitFormX' targetRef='theEnd'/>

        <endEvent id="theEnd"/>
    </process>
</definitions>

So My question is - From Activity concept's point of view is it possible to cover such logic?

Outcomes