Document

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 two ways of creating new document definitions in Valtimo.

  • Import a case definition, see here.

  • 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.

Create an empty case

  • Go to the Admin menu

  • Go to the Cases menu

  • Click on Create

  • Enter the name, version and description, and optionally edit the key

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

  • Click on the Document tab to see the document definition

Creating a document definition

The chosen title will be validated and based upon the title a read-only case definition key 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 by default. This section contains the data structure for the case. The 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, make sure that the $id and title fields both have the correct value. These fields should match the case definition key.

Editing a document definition

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

  • Edit the document definition directly via the UI.

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

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