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

	<!--  Moderated Invitation Workflow -->

<process-definition xmlns="urn:jbpm.org:jpdl-3.1"
	name="imwf:invitation-moderated">

	<swimlane name="initiator">
		<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
			<actor>#{bpm_assignee.properties['cm:userName']}</actor>
		</assignment>
	</swimlane>

	<start-state name="start">
		<task name="imwf:moderatedInvitationSubmitTask" swimlane="initiator" />
		<transition to="review" name=""></transition>
	</start-state>

	<swimlane name="approver">
		<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
			<pooledactors>#{bpm_groupAssignee}</pooledactors>
		</assignment>
	</swimlane>

	<task-node name="review">
		<task name="imwf:moderatedInvitationReviewTask" swimlane="approver" />
		<transition name="approve" to="approved">
			<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
		    	<script>
		        	<variable name="imwf_reviewer" access="write" />     
                	<expression>person.properties.userName</expression>
		    	</script>
		    </action>
		</transition>
		<transition name="reject" to="rejected">
		 	<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
				<script>
		        	<variable name="imwf_reviewer" access="write" />     
                	<expression>person.properties.userName</expression>
		    	</script>
		    </action>
		</transition>
	</task-node>

	<task-node name="rejected">
		<transition name="" to="end" >
		    <action class="org.alfresco.repo.invitation.ModeratedActionReject"/>
		</transition>   
	</task-node>

	<task-node name="approved">
		<transition name="" to="end" >
		    <action class="org.alfresco.repo.invitation.ModeratedActionApprove"/>
		</transition>
	</task-node>

	<end-state name="end" />

</process-definition>
