Types

In Contendo Server, types are used to define the structure and behavior of content objects within the repository. They dictate how content objects are categorized, what metadata they contain, and how they can be interacted with. Types serve as templates for creating and managing objects.

Contendo Server comes out-of-the-box with a set of base types. They can be used as is for basic document storing and organising. See Base Type Details for a detailed overview of base types.

Custom types are user-defined types that extend the base types, allowing you to define specific metadata and additional properties relevant to your application’s needs. You can create custom types based on any existing type, including base types or any other custom types.

Check Type Management for details about creating new, retrieving, updating or deleting types.

Type Definition

Type building blocks:

Type definition JSON

Type definitions are represented via JSON. These are used for creating, updating and retrieving type definitions.

When creating or updating types, optional attributes may be omitted and only changing property definitions should be included.
When retrieving types, all attributes and property definitions are included.
Every field in the root of the type definition JSON object is a Type Attribute. The exception is the propertyDefinitions field which contains the list of Property Defintions.

Example:

{
  "id": "dog",
  "localName": "dog",
  "displayName": "Dog",
  "description": "A document for dogs.",
  "baseId": "cmis:document",
  "parentId": "animal",
  "show": true,
  "propertyDefinitions": {
    "color": {
      "id": "color",
      "localName": "color",
      "displayName": "Color",
      "description": "Dog color",
      "propertyType": "string",
      "choices": [
        "White",
        "Brown",
        "Black",
        "Unknown"
      ],
      "openChoice": false,
      "defaultValue": "Unknown",
      "order": 10
    },
    "height": {
      "id": "height",
      "localName": "height",
      "displayName": "Height",
      "description": "Dog height",
      "propertyType": "integer",
      "required": true,
      "order": 20
    }
  }
}

Let's break down the example:

  • it's a type definition for custom “Dog” objects
  • it's a custom type definition of the Document (cmis:document) base type which inherits from the “animal” type.
  • many type attributes are omitted (e.g. creatable and queryable) so their default values are used.
  • There is a custom “show” type attribute could mark whether a type (or even objects of a type) should be displayed in the UI.
  • It has two property definitions - “color” and “height”.
  • many property definition attributes are omitted so their default values are used.
  • the “color” property definition has 4 choices defined and “openChoice” set to false - the values of the “color” > property must be one of these choices.
  • both property definitions have a custom “order” type definition attribute which could be used to define the order > in which properties are displayed in the UI.
  • This representation omits non-mandatory type attributes and inherited property definitions. As such it can be used for creating and updating types. When a type is retrieved, all type attributes as well as inherited property definitions would be present.

Type Attributes

Type attributes define the metadata and behavior of an object type. Type attributes are not inherited when creating new types. All types share a set of common type attributes, but Document and Relationship types have additional ones specific to them.

Name Required Default Description Example Value
id Yes - Unique identifier for the object type. dog
localName Yes - The local name of the object type. Dog
localNamespace No - The namespace URI associated with the object type. https://contendo.io
displayName No - Display name of the object type. Dog
queryName No Value of id Query name used for the object type. dog
description No - Description of the object type. Document representation of dogs
baseId Yes - The ID of the Base Type this object is derived from. cmis:document
parentId Yes - The ID the parent Type this object extends. Animal
creatable No true Whether objects of this type can be created. true
fileable No true Whether objects of this type can be assigned to folders. true
queryable No true Whether objects of this type can be queried with the query operation. true
fulltextIndexed No false Whether objects of this type are full-text indexed. true
includedInSupertypeQuery No false Whether objects of this type are included in queries for its supertype. true
controllablePolicy No false Whether objects of this type are controllable via policies. true
controllableACL No true Whether objects of this type are controllable via ACL. true
typeMutability.create No true Whether new child types may be created with this type as the parent true
typeMutability.update No true Whether this type may be updated. true
typeMutability.delete No true Whether this type may be deleted. true
versionable No true Document Whether the object type is versionable. true
contentStreamAllowed No allowed Document Whether content streams are allowed for the object type. Possible values:
  • notallowed: Content may not be set.
  • allowed: Content may be set, but isn't required.
  • required: Content must be set when the object is created and may not be deleted.
allowed
allowedSourceTypes No - Relationship List of IDs of types allowed to be used as relationship sources. If not specified, all types are allowed. [“cmis:document, Animal, Dog”]
allowedTargetTypes No - Relationship List of IDs of types allowed to be used as relationship targets. If not specified, all types are allowed. [“cmis:document, Animal, Cat”]

It is possible to add additional type attributes when creating or updating types. These can be used applications leveraging Contendo Server to add custom metadata to the types themselves. E.g. a custom “show” type attribute could mark whether a type (or even objects of a type) should be displayed in the UI.


Property Definitions

Properties define the metadata associated with content objects. This includes updatable properties like a (e.g. name, description) as well as readonly, automatic values set by the system (e.g. createdBy, creationDate). Which properties are available for objects created from a type is defined by the type's property definitions. Property definitions are inherited when creating new types.

See Base Type Details for a detailed overview of which property definitions are available on which base type.

Property Definition Attributes

Each property definition consists of a set of predefined attributes. Every property definition has a common set of attributes. Depending on the type, some have additional attributes. Furthermore, custom attributes may be added to any property definition.

Name Required Default Description Example Value
id Yes - The unique identifier of the property definition. color
localName Yes - The local name of the property definition. color
localNamespace No - The namespace of the local name. http://example.com/ns
queryName No Value of id The name used for querying this property. color
displayName No Value of id A human-readable name for the property. Color
description No - A human-readable description of the property. The color of the Animal.
propertyType No string The data type of the property. Possible values:
  • string: Text values.
  • integer: Whole numbers.
  • boolean: true or false.
  • datetime: Date/time values in form of Unix timestamp.
  • decimal: Floating-point numbers.
  • id: Identifiers.
  • html: HTML content.
  • uri: A URL value.
string
cardinality No single Defines if the property holds a single or multiple values. Possible values:
  • single: A single value.
  • multi: A list of values.
single
updatability No readwrite Specifies how the property can be updated. Possible values:
  • readwrite: Can be read and modified.
  • readonly: Can only be read.
  • oncreate: Set only at creation.
readwrite
inherited No - Whether the property is inherited from a parent type. Automatically resolved and not settable on type creation/update. false
required No false Whether the property must always have a value. false
queryable No true Whether the property can be used in queries. true
orderable No true Whether the property can be used in ordering query results. true
choices No - A list of predefined choices for the property, if applicable. [“White”, “Brown”, “Unknown”]
openChoice No true Whether values outside of choices are allowed. false
defaultValue No - The default value for the property, if applicable. Unknown
minValue No - integer decimal The minimum allowed value. 0, 0.2
maxValue No - integer decimal The maximum allowed value. 100, 2.5
precision No - decimal The precision in bits. Possible values:
  • 32: 32-bit precision (“single” as specified in IEEE-754-1985).
  • 64: 64-bit precision (“double” as specified in IEEE-754-1985).
32
maxLength No - string The maximum length of the string. 255
resolution No - datetime The granularity of the datetime value. Possible values:
  • year: Year-level granularity.
  • date: Date-level granularity.
  • time: Time-level granularity.
  • timestamp: Full timestamp.
timestamp

As with type attributes, it is possible to add custom type definition attributes. These add additional meaning to property definitions. E.g. a custom “order” type definition attribute can be added to define the order in which properties are displayed in the UI.