Content models are used in Flowable Work or Engage to define a type for uploading of a document or other file type. Content models can also be used to define a versioning scheme, or define metadata values, or define the type or state values for the content item. Content models are deployed on the Content engine, and they follow the same deployment and definition pattern like other Engines, for example, Process definitions in the BPMN engine or Action definitions in the Action engine. Like other definition types, the key value of a content model is important, because that uniquely identifies a content definition within the Content engine. When a content definition already exists with a key that is specified for a new content deployment, a new version of the existing content definition is created, and the new deployment is the most recent content definition.
In addition to the regular content metadata like file name, name, file size, date created, created by etc. values, the Content engine supports adding custom metadata values as well. The definition of these metadata values are part of the content model and are defined with a form. When there is, for example, a need to store metadata values like policy name and document number, a form with two text fields can be created that have a policy name and document number text field. The content model then references this form and when deployed to the Content engine, these metadata values can be edited by the user when a content item is connected to this content model.
Adding a Content Model in Flowable Design
For a content model with two metadata values, policy name, and
document number, the first step is to create a new Form in Flowable Design.
The form is basic with two simple
Data entry>Text fields. If one of the metadata
values is required, then the field must have the
Validation>Required checkbox set.
With the Form defined, the next step is to create the Content model, which can be done in the Work section of Flowable Design. The initial state and sub-state can be filled-in to define the initial values when a new content item is created connected to this content model. This is left empty for this example. To connect the metadata Form to this content model, the Action value edit should be filled-in, and the newly created Form should be selected from the dropdown.
To be able to use the content model in a simple BPMN Process, a Process with one user task is created.
The start event and user task should point to the same Form to show that
the metadata values that are filled-in when starting the process are available
in the task form. Let us create the new Form with a
Data entry>Text field with
the label Product name and
Data entry>Attachment labeled
To enable the content model selection possibility for a user of
Flowable Work or Engage the
Details>Has content model checkbox is enabled.
To make the content model selection required before completing the form also
Details>Require content model checkbox must be enabled.
In the final step in Flowable Design, a new app definition is created, and the newly created BPMN model, the metadata Form and the Content model (part of the Work section) are selected. Now the app definition can be published.
Using a Content Model in Flowable Work or Engage
With the newly created app and included models published, a new process instance can be created in the Work or Process App. After choosing the process definition, the following start form is presented and notice that the content type is red because it is required and not selected at this point.
After selecting the content type that was created in the previous section, the metadata form is shown in the start form. Now the user can fill in the metadata values for the content item.
After filling in the metadata values and completing the start form, the process instance gets created, and the uploaded file gets stored in the content engine together with the filled-in metadata values. In the task form, the selected content type and filled-in metadata values should now be available as well.
The user can now still change the metadata values to update them and could even select another content type for the uploaded file and fill in the metadata values for that content type. With the Java and REST API the content item, the rendition items (thumbnail and PDF) are created for the uploaded file, and the metadata values are retrieved as needed.