passwordChangeReminder.bpmn20.xml revision a60d77aaed3324cd783f4e648fedfecd54f8e551
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
xmlns:activiti="http://activiti.org/bpmn"
xsi:schemaLocation="
<process id="passwordChangeReminder" name="Password Change Reminder Process">
<startEvent id="start" activiti:initiator="startUserId" />
<sequenceFlow sourceRef="start" targetRef="sendFirstNotification"/>
<scriptTask id="sendFirstNotification" name="Send First Notification" scriptFormat="groovy">
<script>
user = openidm.read(userId)
lastPasswordChange = user.lastPasswordSet
java.text.SimpleDateFormat formatUTC = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'");
requestDate = formatUTC.format(new Date());
def firstNotification = [
"receiverId": user['_id'],
"requesterId" : "",
"requester" : "",
"createDate" : requestDate,
"notificationType" : "info",
"notificationSubtype" : "",
"message" : "Your password will expire soon, change it!"
];
</script>
</scriptTask>
<sequenceFlow sourceRef="sendFirstNotification" targetRef="timer1"/>
<intermediateCatchEvent id="timer1">
<timerEventDefinition>
<timeDuration>PT5M</timeDuration>
</timerEventDefinition>
</intermediateCatchEvent>
<sequenceFlow sourceRef="timer1" targetRef="checkSecondNotification"></sequenceFlow>
<scriptTask id="checkSecondNotification" name="Check Second Notification" scriptFormat="groovy">
<script>
user = openidm.read(userId)
passwordChanged = (user.lastPasswordSet != lastPasswordChange)
</script>
</scriptTask>
<sequenceFlow sourceRef="checkSecondNotification" targetRef="secondNotificationGateway"></sequenceFlow>
<exclusiveGateway id="secondNotificationGateway" name="Second Notification"></exclusiveGateway>
<sequenceFlow sourceRef="secondNotificationGateway" targetRef="end">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[ ${passwordChanged} ]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow sourceRef="secondNotificationGateway" targetRef="sendSecondNotification">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[ ${!passwordChanged} ]]>
</conditionExpression>
</sequenceFlow>
<scriptTask id="sendSecondNotification" name="Send Second Notification" scriptFormat="groovy">
<script>
java.text.SimpleDateFormat formatUTC = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'");
requestDate = formatUTC.format(new Date());
def secondNotification = [
"receiverId": user['_id'],
"requesterId" : "",
"requester" : "",
"createDate" : requestDate,
"notificationType" : "info",
"notificationSubtype" : "",
"message" : "Your password will expire now, change it!"
];
</script>
</scriptTask>
<sequenceFlow sourceRef="sendSecondNotification" targetRef="timer2"></sequenceFlow>
<intermediateCatchEvent id="timer2">
<timerEventDefinition>
<timeDuration>PT2M</timeDuration>
</timerEventDefinition>
</intermediateCatchEvent>
<sequenceFlow sourceRef="timer2" targetRef="checkInactivate"></sequenceFlow>
<scriptTask id="checkInactivate" name="Check Inactivation" scriptFormat="groovy">
<script>
user = openidm.read(userId)
passwordChanged = (user.lastPasswordSet != lastPasswordChange)
</script>
</scriptTask>
<sequenceFlow sourceRef="checkInactivate" targetRef="inactivateGateway"></sequenceFlow>
<exclusiveGateway id="inactivateGateway" name="Inactivation"></exclusiveGateway>
<sequenceFlow sourceRef="inactivateGateway" targetRef="end">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[ ${passwordChanged} ]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow sourceRef="inactivateGateway" targetRef="inactivateAccount">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[ ${!passwordChanged} ]]>
</conditionExpression>
</sequenceFlow>
<scriptTask id="inactivateAccount" name="Inactivate Account" scriptFormat="groovy">
<script>
params.put('_action', 'patch')
list = [[replace:'accountStatus',value:'inactive']]
params.put('_entity', list)
openidm.action(userId, params)
</script>
</scriptTask>
<sequenceFlow sourceRef="inactivateAccount" targetRef="end"/>
<endEvent id="end"/>
</process>
</definitions>