Document definition

A document definition is the blueprint for the JSON documents that are created when creating new cases in Valtimo. It defines the structure of the case and contains validation rules for the data that is stored by the actual JSON documents that are created when executing processes for that case in Valtimo. This page shows how to create a document definition, and how to add validation to properties.

This page requires:

Creating a document definition

There are three ways of creating new document definitions in Valtimo.

  • Upload a valid JSON schema via the UI

  • Create an empty case via the UI

  • Place a valid JSON schema in the codebase via an IDE

Best practices:

  • Always create a JSON schema. A JSON schema enforces a certain quality for each document. Experience shows that a JSON schema is necessary for production-grade systems.

  • Ensure a stable design and minimize changes to the model. Discuss the impact of changes thoroughly before implementing them. For example, if in a version 2 of the schema an attribute is made mandatory that wasn't required in version 1, the forms that provide this data must be duplicated and adapted to the new Document Definition.

  • The case detail object must be usable for Formio forms. Complexities such as arrays within arrays can complicate the form-building process. Tip: do not blindly adopt a JSON schema from a source.

  • Do not store technical or control information in the JSON document. Process variables are available for this.

  • Do store information that is needed in case search and case list pages. Though information from external sources can be displayed in a Case, it cannot be used to search or filter on.

Upload a valid JSON schema

  • Go to the Admin menu

  • Go to the Cases menu

  • Click on Upload case-definition

  • Upload the document definition

It's possible to upload valid JSON schemas to create new cases since Valtimo 5. During the upload the JSON schema structure is validated and the uniqueness of the case ID is checked. If no validation errors occur, the JSON schema is uploaded and the case definition is created.

In Valtimo 12 the case configuration upload has been improved by adding all the newly available case configurations to the upload functionality. More detailed information on this functionality can be found here.

Uploading a document definition

Create an empty case

  • Go to the Admin menu

  • Go to the Cases menu

  • Click on Create

  • Enter the title, and optionally edit the name

  • Click on Save, this takes you to the document definition overview

Creating a document definition

The chosen title will be validated and based upon the title a read-only case definition name will be generated. This is to create a unique identifier for that case definition without spaces or special characters. Click the Save button to create the case with the chosen title. The case definition is created and the case details page is displayed upon completion. A valid empty JSON schema is created with the title and id based on the given title.

Newly created example case

Please note

The properties section is empty. This section contains the data structure for the case. The case JSON schema validation has to be placed here.

The option additionalProperties is set to false by default. This disables the possibility to save other data than configured in the properties section of the document definition.

When uploading a JSON schema to create a new case, make sure that the $id and title fields both have the correct value. These fields are used when a case definition is uploaded and will be displayed in the case list view.

Editing a document definition

Same as for creating cases there are three ways of editing document definitions.

  • Upload a valid JSON schema with the same ID.

  • Edit the document definition directly via the UI.

  • Edit the document definition in the codebase via an IDE.

Upload a valid JSON schema with the same ID

  • Go to the Admin menu

  • Go to the Cases menu

Click on the Upload button to open the Import case definition modal*. This modal contains a wizard that will guide users through the import process. The following steps are defined in this wizard.

  1. Informative step regarding plugins.

  2. Select the edited document definition from your system When the file is successfully uploaded a warning is displayed that current configurations for that case can be overwritten by this upload.

  3. Start the upload The file will be validated and if it passes all checks the document definition is updated.

Edit the document definition

  • Go to the Admin menu

  • Go to the Cases menu

  • Select the case that you want to edit

  • Click on Edit

  • Edit the document definition as per the JSON schema standard

  • Click on Save

Visually nothing happens when switching to edit mode. Only the Download and Edit buttons are replaced by a Cancel and a Save button. The Save button is disabled by default until valid changes are made.

Constant validation

In edit mode, the UI editor will constantly validate the JSON file structure. The Save button is only available when the JSON structure is valid. Errors in the file structure will be indicated with a red curly line below or near the issue. In large files, errors can easily be found with the minimised tree view on the right side of the editor.

JSON structure validation in edit mode

Access control

Access to document definitions can be configured through access control. More information about access control can be found here.

Resources and actions

Resource type
Action
Effect

com.ritense.document.domain.impl.JsonSchemaDocument

assign

Allows assigning users to a case document.

assignable

Allows users to be assigned to a case document.

create

Allows creating of a case document.

claim

Allows claiming of a case document.

delete

Allows deleting of a case document.

modify

Allows modifying of a case document.

view

Allows viewing of a case document.

view_list

Allows viewing of case documents.

com.ritense.document.domain.impl.JsonSchemaDocumentDefinition

create

Allows creating of a case document definition.

delete

Allows deleting of a case document definition.

modify

Allows modifying of a case document definition.

view

Allows viewing of a case document definition.

view_list

Allows viewing of case document definitions.

Examples

Permission to view access to all case document definitions
{
    "resourceType": "com.ritense.document.domain.impl.JsonSchemaDocumentDefinition",
    "action": "view",
    "conditions": []
}
Permission to view access to all documents of one case document definition
{
   "resourceType": "com.ritense.document.domain.impl.JsonSchemaDocument",
   "action": "view",
   "conditions": [
      {
         "type": "field",
         "field": "documentDefinitionId.name",
         "operator": "==",
         "value": "evenementenvergunning"
      }
   ]
}
Permission to view access to one specific document definition
{ 
   "resourceType": "com.ritense.document.domain.impl.JsonSchemaDocumentDefinition",
   "action": "view",
   "conditions": [
      {
         "type": "field",
         "field": "id.name",
         "operator": "==",
         "value": "evenementenvergunning"
      }
   ]
}

Last updated