Workflow examples - check for tags
In this tutorial, you create a workflow that is triggered automatically when a tag is added ta column and the technical steward automatically receives a task to tapprove or reject the tag. If the technical steward approves the tag, a boolean attribute is added to the corresponding column.
Prerequisites
- Java SE Development Kit:
- Download link: ZULU JDK 8 .
- Eclipse:
- Download link: Eclipse .
- Select the Eclipse IDE for Java Developers version.
- Flowable designer:
- Open Eclipse.
- In the menu bar, click Help → Install New Software....
- In the Available Software window, click Add.
- Enter the required information:
- Name: Flowable BPMN 2.0 designer.
- Location: https://www.flowable.org/designer/update/.
Each attendee has an individual Collibra Data Intelligence Platform environment. Find yours at:
To check the setup:
- Navigate to your environemnt.
- Sign in with:
- Username: Admin
- Password: uth19
- Go to Catalog → Data Sources.
- Check if you can see a list of columns.
You need a sample column to test your workflow during this workshop.
Use-case overview
Generate a workflow project and diagram
- Open Eclipse.
- Select File → New → Other….
- Search for Flowable.
- Select Flowable Project.
- Enter the project name: uth-dc19.
- Click Finish.
- Navigate to ~/src/main/resources/diagrams.
- Right-click the diagrams folder and select New → Other….
- Search for Flowable and choose Flowable Diagram.
- Enter the process Name: PIITagApproval.
- Open the PIITagApproval workflow using the Flowable Diagram Editor.
Deploying a workflow
After each step of the use-case workshop you can deploy your workflow and test the changes you have implemented. To deploy your workflow:
- Go to Collibra Data Intelligence Platform.
- Go to Settings → Workflows → Workflow definitions.
- Click Upload a file and select the BPMN file to deploy.
- If the deployment was successful, search for the PII Tag Approval workflow.
- In the Applies To section, select Asset.
- In the upper-right part of the Applies To section, click Add.
- Search for the Column asset type and click Save.
- To enable the workflow, click the play button in the upper-right part of the page.
- Check the status to verify the workflow is enabled.
Use-case step 1
During use-case step 1, you create the initial process structure using pools and swim lanes for the different stakeholders. Next, you add a user task for the Technical Steward to check if there is a PII tag and manually mark the column as containing personal identifiable information.
Add the process pool
- Go to the Flowable Palette.
- Go to the Container section and drag a Pool inside the empty canvas.
- Select the pool and go to the Properties panel.
- Enter the required information:
- Id: tagApprovalPool
- Name: Tag Approval
- Go to the Process panel.
- Enter the required information:
- Id: piiTagApprovalWorkflow
The process ID must be unique at the Collibra environment level.
Uploading a workflow with the same process ID as an existing workflow in Collibra will replace the existing workflow.
- Name: PII Tag Approval
The name will be displayed as the workflow name in Collibra.
Collibra does not accept two workflows with the same display name.
- Namespace: http://www.collibra.com/apiv2
By referencing version 2 of the Collibra Java API, the workflow will be validated against V2 methods and deprecated V1 methods will trigger a method does not exist error when called.
- Documentation: The contents of the field will become the description of the workflow in Collibra.
- Id: piiTagApprovalWorkflow
Set up the swim lanes
Each pool contains by default one lane. To add a second one and configure them:
- Go to the Flowable Palette.
- Go the Container section and drag a Lane inside the pool.
- Configure the first lane:
- Select the lane.
- Go to the Properties panel.
- Enter the required information:
- Id: systemLane
- Name: System
- Configure the second lane:
- Select the lane.
- Go to the Properties panel.
- Enter the required information:
- Id: technicalStewardLane
- Name: Technical Steward
Add start and end events
- Go to the Flowable Palette.
- Go to the Start event container and drag a StartEvent inside the System lane.
- Select the start event.
- Go to the Properties panel.
- Select the Form tab.
- Add an approverUserExpression variable:
The variable can be changed from the worfklow definition page in Collibra Data Intelligence Platform.
- Click New.
- Enter the required information:
- ID: approverUserExpression
- Name: Approver User Expression
- Type: string
- Default: role(Technical Steward)
- Required: true
- Readable: false
- Writeable: true
- Go to the End event container and drag an EndEvent inside the System lane.
Add the Check Tag user task for the technical steward
- Go to the Flowable Palette.
- Go to the Task container and drag a UserTask inside the Technical Steward lane.
- Select the user task.
- Go to the Properties pane.
- Enter the task name: Check Tag.
- Go to the Documentation tab and enter a task description.
This description will be displayed in task bar in Collibra to give the user more context and guidance on how to complete the task.
- Go to the Main config tab.
- Enter a Canditate users expression as defined in the start form variables:
${approverUserExpression}
.
Deploy your workflow by following the steps from the Deploying a workflow section. Test the workflow by going to a column asset and clicking the PII Tag Approval button.
Use-case step 2
During use-case step 2, you add a script task to automatically check if the column has a PII tag or not and route the workflow accordingly. When the column is not tagged as PII you end the workflow. When the column is tagged as PII you create a task for the technical steward to manually add the personal identifiable informationflag to the column asset.
Ad get and filter tags script
- Remove the connection between the start event and the user task.
- Go to the Flowable Palette.
- Go to the Task container and drag a ScriptTask inside the System lane.
- Select the script task.
- Go to the Properties pane.
- Enter a script task Name: Get and filter tags.
- Go to the Main config tab.
- Select the Groovy script language.
- Add the Get and filter tags script:
loggerApi.info("Get & filter tags script started...") //Variables def tags = [] def piiTagName = execution.getVariable("piiTagName") def isPII = false def assetUuid = item.id tags = tagApi.getTagsByAssetId(assetUuid) loggerApi.info("Number of tags found: " + tags.size()) //Loop over the tag list and check for PII tag for(tag in tags){ if(tag.getName().equals(piiTagName)){ isPII = true } } loggerApi.info("isPII status: " + isPII) //Set variables to be used in workflow execution.setVariable("isPII",isPII) loggerApi.info("Get & filter tags script ended.")
Route the workflow when PII data is found or not
- Go to the Flowable Palette.
- Go to the Gateway container and drag an ExclusiveGateway to the System lane, after the Get and filter tags script task.
- Go to the End event container and drag a second EndEvent to the System lane, above the exclusive gateway.
- Connect the second end event with the exclusive gateway using a SequenceFlow.
- Select the sequence flow and enter the Name: No PII Found.
- Go to the Properties pane.
- Click the Main config tab, enter the Condition for PII not found:
${!isPII}
. - Connect the exclusive gateway with the user task using a SequenceFlow.
- Select the sequence flow and enter the Name: PII Found.
- Go to the Properties pane.
- In the Main config tab, enter the Condition for PII found:
${isPII}
. - Change the user task name and documentation to reflect the change in behavior of use-case step 2:
- Name: Add PII Attribute
- Documentation: Manually flag this asset as PII by adding the PII boolean attribute.
Deploy your workflow by following the steps from the Deploying a workflow section. Test the workflow by going to a column asset and clicking the PII Tag Approval button.
Use-case step 3
During use-case step 3, you add an approval user task, which is created when the column is flagged as PII. The technical steward needs to complete the approval user task by approving or rejecting and providing a reason. The reason is automatically saved to the comments section in the Collibra. When the technical steward approves the PII tag, the steward must add the PII attribute manually to the corresponding column.
Create the approval user task
- Select the user task from Use-case step 1.
- Go to the Properties pane and change
the name and documentation:
- Name: Approve PII Tag
- Documentation: Approve whether this asset with tag "${piiTagName}" has personal identifiable information. If you approve, add the PII boolean attribute to this column.
- Create the dialog box used to complete the approval user task:
- Click the Form tab and click New to add a new form field.
-
Add a comment box to allow the technical steward to provide a reason:
- Id: commentBox
- Name: Reason
- Type: textarea
- Required: true
- Readable: true
- Writeable: true
-
Add a task button to clearly define what action needs to be done in the task:
- Id: taskButton1
- Name: Approve/Reject
- Type: taskButton
- Required: false
- Readable: true
- Writeable: true
-
Add an approve button to the dialog box:
- Id: approveButton
- Name: Approve
- Type: button
- Required: false
- Readable: true
- Writeable: true
-
Add a reject button to the dialog box:
- Id: rejectButton
- Name: Reject
- Type: button
- Required: false
- Readable: true
- Writeable: true
Save the reason to the comments section
- Go to the Flowable Palette.
- Go to the Task container and drag a ScriptTask inside the System lane.
- Select the script task.
- Go to the Properties pane.
- Enter a script task Name: Save Comment.
- Go to the Main config tab.
- Select the Groovy script language.
-
Add the Add comment script:
import com.collibra.dgc.core.api.dto.instance.comment.AddCommentRequest import com.collibra.dgc.core.api.model.ResourceType loggerApi.info("Add comment script started...") //Variables def commentBox = execution.getVariable("commentBox") def commentBoxContent = commentBox.toString() def assetUuid = item.id loggerApi.info("Comment box content: " + commentBoxContent) commentApi.addComment(AddCommentRequest.builder() .baseResourceId(assetUuid) .baseResourceType(ResourceType.Asset) .content(commentBoxContent) .build() ) loggerApi.info("Add comment script ended.")
- Connect the Save Comment script to the end event using a SequenceFlow.
Deploy your workflow by following the steps from the Deploying a workflow section. Test the workflow by going to a column asset and clicking the PII Tag Approval button.
Use-case step 4
During use-case step 4, you trigger the workflow automatically when a tag is added ta column and the technical steward automatically receives a task to tapprove or reject the PII tag. If the technical steward approves the tag, the PII boolean attribute is added to the corresponding column.
Route the workflow based on approval or rejection
- Go to the Flowable Palette.
- Gto the Gateway container and drag an ExclusiveGateway to the system lane right after the save comment script task.
- Go to the End event container and drag a third EndEvent to the System lane, above the exclusive gateway.
- Connect the third end event with the exclusive gateway using a SequenceFlow.
- Select the sequence flow and go to the Properties pane.
- In the Main config tab, enter the Condition for when the tag is rejected:
${rejectButton}
. - Go to the Flowable Palette.
- Go to the Task container and drag a ScriptTask after the exclusive gateway.
- Connect the script task with the exclusive gateway using a sequence flow.
- Select the sequence flow and go to the Properties pane.
- In the Main Config tab, enter the condition for when the tag is approved:
${approveButton}
. - Connect the script task with the last end event using a SequenceFlow.
Automatically set the PII attribute using a script task
- Select the last added script task.
- Go to the Properties pane.
- Enter a script name: Set PII Attribute.
- Go to the Main config tab.
- Select the Groovy script language.
-
Add the Set PII Attribute script:
import com.collibra.dgc.core.api.dto.instance.attribute.AddAttributeRequest loggerApi.info("Set PII Attribute script started...") //Variables def assetUuid = item.id def piiAttributeTypeId = execution.getVariable("piiAttributeTypeId") def piiAttributeTypeUuid = string2Uuid(piiAttributeTypeId) //Set PII Attribute attributeApi.addAttribute(AddAttributeRequest.builder() .assetId(assetUuid) .typeId(piiAttributeTypeUuid) .value(true) .build() ) loggerApi.info("Set PII Attribute script ended")
Automatically trigger the workflow when a tag is added to a column
- Go to Collibra Data Intelligence Platform.
- Go to Settings → Workflows → Workflow definitions.
- Select the PII Tag Approval workflow.
- Go to the Start Event section.
- Select the Asset Tag Event.
- Click Save.
Deploy your workflow by following the steps from the Deploying a workflow section. Test the workflow by going to a column asset and clicking the PII Tag Approval button.