contractorOnboarding.bpmn20.xml revision dc53767f6614db736c8a95a165beae870ac1e3d9
<?xml version="1.0" encoding="UTF-8"?>
<!--
The contents of this file are subject to the terms of the Common Development and
Distribution License (the License). You may not use this file except in compliance with the
License.
You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
specific language governing permission and limitations under the License.
When distributing Covered Software, include this CDDL Header Notice in each file and include
the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
Header, with the fields enclosed by brackets [] replaced by your own identifying
information: "Portions Copyrighted [year] [name of copyright owner]".
Copyright (c) 2011-2015 ForgeRock AS. All rights reserved.
-->
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="Examples" id="definitions" xsi:schemaLocation=" http://www.omg.org/spec/BPMN/20100524/MODEL http://local.openicf.forgerock.org/BPMN20.xsd">
<process id="contractorOnboarding" name="Contractor onboarding process" isExecutable="true">
<startEvent id="start" activiti:initiator="startUserId" activiti:formKey="contractorForm.xhtml">
<extensionElements>
<activiti:formProperty id="userName" name="Username" type="string" required="true"></activiti:formProperty>
<activiti:formProperty id="givenName" name="First Name" type="string" required="true"></activiti:formProperty>
<activiti:formProperty id="sn" name="Last Name" type="string" required="true"></activiti:formProperty>
<activiti:formProperty id="department" name="Department" type="string"></activiti:formProperty>
<activiti:formProperty id="jobTitle" name="Job Title" type="string"></activiti:formProperty>
<activiti:formProperty id="telephoneNumber" name="Phone Number" type="string"></activiti:formProperty>
<activiti:formProperty id="mail" name="Email" type="string" required="true"></activiti:formProperty>
<activiti:formProperty id="startDate" name="Start Date" type="string" required="true"></activiti:formProperty>
<activiti:formProperty id="endDate" name="End Date" type="string"></activiti:formProperty>
<activiti:formProperty id="description" name="Description" type="string" required="true"></activiti:formProperty>
<activiti:formProperty id="provisionToXML" name="Create in XMLFile" type="boolean"></activiti:formProperty>
</extensionElements>
</startEvent>
<sequenceFlow id="sequenceFlow-c16dcbfa-d7e7-46e3-91e5-23eee02710fc" sourceRef="start" targetRef="requestMadeGateway"></sequenceFlow>
<exclusiveGateway id="requestMadeGateway" name="Request Made"></exclusiveGateway>
<scriptTask id="decisionPrep" name="Prepare Task" scriptFormat="groovy" activiti:autoStoreVariables="false">
<script>
decisionOptions = [ 'accept' : 'common.form.accept' , 'reject' : 'common.form.reject', '__null' : ' ']
readStartUserFromRepoParams = [_queryId:'for-userName',uid:startUserId]
startUserFromRepo = openidm.query('managed/user', readStartUserFromRepoParams)
execution.setVariable("startUserFromRepo", startUserFromRepo)
execution.setVariable("decisionOptions", decisionOptions)
</script>
</scriptTask>
<userTask id="decideApprovalTask" name="Approve Contractor" activiti:candidateGroups="manager" activiti:formKey="contractorForm.xhtml">
<extensionElements>
<activiti:formProperty id="decision" name="Decision" type="enum" required="true">
<activiti:value id="accept" name="Accept"></activiti:value>
<activiti:value id="reject" name="Reject"></activiti:value>
</activiti:formProperty>
</extensionElements>
</userTask>
<sequenceFlow id="sequenceFlow-247f944c-b753-4ff7-aa7e-01d60fb3cd0a" sourceRef="requestMadeGateway" targetRef="decisionPrep"></sequenceFlow>
<sequenceFlow id="sequenceFlow-079d1a0b-6e48-43d6-92d6-40e4dbb6c476" sourceRef="decisionPrep" targetRef="decideApprovalTask"></sequenceFlow>
<scriptTask name="Create User" id="createManagedUser" scriptFormat="groovy" activiti:autoStoreVariables="false">
<script>
def userQry = openidm.query("managed/user", ["_queryFilter": '/userName eq "'+startUserId+'"'])
def manager = (userQry.result.size() == 1) ? ("managed/user/" + userQry.result[0]._id) : null
user = [
userName:userName,
givenName:givenName,
sn:sn,
manager: manager ? [_ref: manager] : null,
department:department,
jobTitle:jobTitle,
telephoneNumber:telephoneNumber,
mail:mail,
startDate:startDate,
endDate:endDate,
description:description,
provisionToXML:provisionToXML
]
openidm.create('managed/user',null, user)
readNewUserFromRepoParams = [_queryId:'for-userName',uid:userName]
execution.setVariable("readNewUserFromRepoParams", readNewUserFromRepoParams)
</script>
</scriptTask>
<exclusiveGateway id="decisionMadeGateway" name="Decision Made"></exclusiveGateway>
<sequenceFlow id="sequenceFlow-36485ea6-34b3-4b41-a410-3e2350ce87cb" sourceRef="decideApprovalTask" targetRef="decisionMadeGateway"></sequenceFlow>
<sequenceFlow id="sequenceFlow-44cc7d49-7d8d-40d1-95c6-0336928f7f52" sourceRef="decisionMadeGateway" targetRef="createManagedUser">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${decision=='accept'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sequenceFlow-555821a9-be87-43cb-82e4-9bf7315c4537" sourceRef="decisionMadeGateway" targetRef="sendDenyNotification">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${decision=='reject'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sequenceFlow-be5420cd-79a9-4cf9-80bc-8edbcf6a831c" sourceRef="createManagedUser" targetRef="serviceTask"></sequenceFlow>
<serviceTask name="Read User" id="serviceTask" activiti:expression="${openidm.query('managed/user', readNewUserFromRepoParams)}" activiti:resultVariableName="newUserFromRepo"></serviceTask>
<sequenceFlow id="sequenceFlow-a51ec10e-158d-48f1-b3bd-f60e01eabbf8" sourceRef="serviceTask" targetRef="sendAcceptNotification"></sequenceFlow>
<scriptTask name="Accept Notice" id="sendAcceptNotification" scriptFormat="groovy" activiti:autoStoreVariables="false">
<script>
java.text.SimpleDateFormat formatUTC = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'");
formatUTC.setTimeZone(TimeZone.getTimeZone("UTC"));
requestDate = formatUTC.format(new Date());
// Automatically send the user a password reset email
openidm.action("selfservice/reset", "submitRequirements", [
input: [
username: newUserFromRepo.result[0].userName
]
])
def newContractorNotification = [
"receiverId": newUserFromRepo.result[0]._id,
"requesterId" : "",
"requester" : "",
"createDate" : requestDate,
"notificationType" : "info",
"notificationSubtype" : "",
"message" : "Welcome! Your work days are from " + startDate + " to " + endDate
];
if (startUserFromRepo.result[0] != null) {
def newRequesterNotification = [
"receiverId": startUserFromRepo.result[0]._id,
"requesterId" : "",
"requester" : "",
"createDate" : requestDate,
"notificationType" : "info",
"notificationSubtype" : "",
"message" : "OpenIDM created user " +userName
];
openidm.create("repo/ui/notification/", null, newRequesterNotification)
}
openidm.create("repo/ui/notification/", null, newContractorNotification)
</script>
</scriptTask>
<sequenceFlow id="sequenceFlow-3e10ce94-e84a-4c0c-9365-7acc6a815d7a" sourceRef="sendAcceptNotification" targetRef="end"></sequenceFlow>
<scriptTask name="Deny Notice" id="sendDenyNotification" scriptFormat="groovy" activiti:autoStoreVariables="false">
<script>
java.text.SimpleDateFormat formatUTC = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'");
formatUTC.setTimeZone(TimeZone.getTimeZone("UTC"));
requestDate = formatUTC.format(new Date());
if (startUserFromRepo.result[0] != null) {
def newRequesterNotification = [
"receiverId": startUserFromRepo.result[0]._id,
"requesterId" : "",
"requester" : "",
"createDate" : requestDate,
"notificationType" : "warning",
"notificationSubtype" : "",
"message" : "Your request to create user " + userName + " was denied."
];
openidm.create("repo/ui/notification/", null, newRequesterNotification)
}
</script>
</scriptTask>
<sequenceFlow id="sequenceFlow-1ac31d77-3566-4d1b-8d18-3fb79d455cfd" sourceRef="sendDenyNotification" targetRef="end"></sequenceFlow>
<endEvent id="end"></endEvent>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_contractorOnboarding">
<bpmndi:BPMNPlane bpmnElement="contractorOnboarding" id="BPMNPlane_contractorOnboarding">
<bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
<omgdc:Bounds height="35.0" width="35.0" x="0.0" y="95.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="requestMadeGateway" id="BPMNShape_requestMadeGateway">
<omgdc:Bounds height="40.0" width="40.0" x="80.0" y="90.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="decisionPrep" id="BPMNShape_decisionPrep">
<omgdc:Bounds height="60.0" width="100.0" x="170.0" y="80.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="decideApprovalTask" id="BPMNShape_decideApprovalTask">
<omgdc:Bounds height="60.0" width="100.0" x="320.0" y="80.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="createManagedUser" id="BPMNShape_createManagedUser">
<omgdc:Bounds height="60.0" width="100.0" x="560.0" y="160.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="decisionMadeGateway" id="BPMNShape_decisionMadeGateway">
<omgdc:Bounds height="40.0" width="40.0" x="470.0" y="90.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="serviceTask" id="BPMNShape_serviceTask">
<omgdc:Bounds height="60.0" width="100.0" x="710.0" y="145.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sendAcceptNotification" id="BPMNShape_sendAcceptNotification">
<omgdc:Bounds height="60.0" width="100.0" x="860.0" y="130.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sendDenyNotification" id="BPMNShape_sendDenyNotification">
<omgdc:Bounds height="60.0" width="100.0" x="560.0" y="0.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
<omgdc:Bounds height="35.0" width="35.0" x="1010.0" y="80.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow-c16dcbfa-d7e7-46e3-91e5-23eee02710fc" id="BPMNEdge_sequenceFlow-c16dcbfa-d7e7-46e3-91e5-23eee02710fc">
<omgdi:waypoint x="35.0" y="112.0"></omgdi:waypoint>
<omgdi:waypoint x="80.0" y="110.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow-247f944c-b753-4ff7-aa7e-01d60fb3cd0a" id="BPMNEdge_sequenceFlow-247f944c-b753-4ff7-aa7e-01d60fb3cd0a">
<omgdi:waypoint x="120.0" y="110.0"></omgdi:waypoint>
<omgdi:waypoint x="170.0" y="110.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow-079d1a0b-6e48-43d6-92d6-40e4dbb6c476" id="BPMNEdge_sequenceFlow-079d1a0b-6e48-43d6-92d6-40e4dbb6c476">
<omgdi:waypoint x="270.0" y="110.0"></omgdi:waypoint>
<omgdi:waypoint x="320.0" y="110.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow-36485ea6-34b3-4b41-a410-3e2350ce87cb" id="BPMNEdge_sequenceFlow-36485ea6-34b3-4b41-a410-3e2350ce87cb">
<omgdi:waypoint x="420.0" y="110.0"></omgdi:waypoint>
<omgdi:waypoint x="470.0" y="110.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow-44cc7d49-7d8d-40d1-95c6-0336928f7f52" id="BPMNEdge_sequenceFlow-44cc7d49-7d8d-40d1-95c6-0336928f7f52">
<omgdi:waypoint x="510.0" y="110.0"></omgdi:waypoint>
<omgdi:waypoint x="522.0" y="110.0"></omgdi:waypoint>
<omgdi:waypoint x="522.0" y="190.0"></omgdi:waypoint>
<omgdi:waypoint x="560.0" y="190.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow-555821a9-be87-43cb-82e4-9bf7315c4537" id="BPMNEdge_sequenceFlow-555821a9-be87-43cb-82e4-9bf7315c4537">
<omgdi:waypoint x="510.0" y="110.0"></omgdi:waypoint>
<omgdi:waypoint x="522.0" y="110.0"></omgdi:waypoint>
<omgdi:waypoint x="522.0" y="30.0"></omgdi:waypoint>
<omgdi:waypoint x="560.0" y="30.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow-be5420cd-79a9-4cf9-80bc-8edbcf6a831c" id="BPMNEdge_sequenceFlow-be5420cd-79a9-4cf9-80bc-8edbcf6a831c">
<omgdi:waypoint x="660.0" y="190.0"></omgdi:waypoint>
<omgdi:waypoint x="672.0" y="190.0"></omgdi:waypoint>
<omgdi:waypoint x="672.0" y="175.0"></omgdi:waypoint>
<omgdi:waypoint x="710.0" y="175.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow-a51ec10e-158d-48f1-b3bd-f60e01eabbf8" id="BPMNEdge_sequenceFlow-a51ec10e-158d-48f1-b3bd-f60e01eabbf8">
<omgdi:waypoint x="810.0" y="175.0"></omgdi:waypoint>
<omgdi:waypoint x="822.0" y="175.0"></omgdi:waypoint>
<omgdi:waypoint x="822.0" y="160.0"></omgdi:waypoint>
<omgdi:waypoint x="860.0" y="160.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow-3e10ce94-e84a-4c0c-9365-7acc6a815d7a" id="BPMNEdge_sequenceFlow-3e10ce94-e84a-4c0c-9365-7acc6a815d7a">
<omgdi:waypoint x="960.0" y="160.0"></omgdi:waypoint>
<omgdi:waypoint x="972.0" y="160.0"></omgdi:waypoint>
<omgdi:waypoint x="972.0" y="95.0"></omgdi:waypoint>
<omgdi:waypoint x="1010.0" y="97.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow-1ac31d77-3566-4d1b-8d18-3fb79d455cfd" id="BPMNEdge_sequenceFlow-1ac31d77-3566-4d1b-8d18-3fb79d455cfd">
<omgdi:waypoint x="660.0" y="30.0"></omgdi:waypoint>
<omgdi:waypoint x="672.0" y="30.0"></omgdi:waypoint>
<omgdi:waypoint x="672.0" y="95.0"></omgdi:waypoint>
<omgdi:waypoint x="1010.0" y="97.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>