You can add as many stencils you want and each stencil defines the elements you can model with in the palette you see on the left-hand side when modeling a process definition. Per element you can also define which attributes or properties should be made available to the model user. Let's look at an example of a stencil.
In this every simple example, we have reduced the number of BPMN elements quite a bit. Only a start event, some activities, gateways, connection objects and an end event are remaining. That's nice for some use cases, but it becomes a lot more useful when you can add your own elements as well. So let's a new element to our custom stencil.
In this example we are adding a Validate order element to our custom stencil and we can define if it needs to be generated as a Java service task, an expression or a delegate expression. In this example we define it as a Java service task that executes the org.activiti.task.ValidateOrderTask class. In addition to the name, description and group you can also choose an icon for the custom element (which is shown in the palette and the canvas element) and choose a color for the canvas element. So in addition to the common BPMN elements, we now have a custom element Validate order that we can use in a process definition.
In addition to the basic element definition it's also possible to add custom attributes or properties to an element as well. For each attribute you can choose if it needs to be generated as part of the BPMN XML as a field extension or if it's just meta data that doesn't need to be in the BPMN XML. Let's add a validation identifier property so the validate order task can be instructed to use a specific validation method.
You can define the name, id, description and property type when creating a new property. When you want to include the property in the BPMN XML as a field extension as well, you can define the field extension name as well.
When you are ready with the stencil definition it can be saved and you start creating process definitions directly with this new stencil. In the create process popup you will get an additional dropdown where you can choose the stencil you want to model with. This can be default BPMN, but also a stencil from the stencil editor.
It will come as no surprise that the process editor will now show the palette according to the newly defined stencil. And when adding the validate order element to the canvas you'll see it uses the icon and the element color we've chosen in the stencil editor.
This opens up a lot of possibilities to make process modeling easier for model users. And it's directly integrated in the BPMN XML generation and can be deployed on the Activiti Engine. Stencils can be shared across model users in an easy way and versioning is applied automatically. When needed, you can go back to an earlier version of your stencil by choosing the specific version from the stencil history.
We'll be interested to get any feedback on this new feature. If you want to experiment with this new feature let me know and we can get in contact to upgrade your trial account to an enterprise account.