Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Excerpt

Use the same property in different object types. In some of them, the property is required and in others it is not. This tutorial explains the possibilities by means of a document import example.


Section
bordertrue


Column

Table of Contents

Table of Contents
maxLevel3
exclude(Table of Contents|Read on|Another Tutorial|Another Concept Article|Another interesting Tutorial|Managing the Schema|Schema - Defining Object Types|DMS Endpoints)


Introduction

Any property definition in the schema needs the specification of the required attribute. Its boolean value decides if the corresponding property is mandatory (true) or optional (false) for an object.  However, the value of the required attribute can be overwritten by a The metadata structure of object types has to be defined in the schema. In this definition, properties are selected that should be connected the object type. Each property itself is defined in the schema as well by the specification of its attributes. The properties can be selected or not selected in object type definitions, but their attributes are fixed and can not be modified. There is only one exception for the required attribute, that can actually be overwritten by a propertyReference in object type definitions or secondary object type definitions. This provides the possibility to decide for each property if it is required or not in each single object type. Since  Since schema structures can even be changed at runtime, yuuvis

Tutorial Content

Handling Object Type Definitions

In an object type definition, a propertyReference can be used to set a value for the required attribute for a property. This value can be different from the value specified in the property definition. In this case, the required attribute will have the value from the object type definitionyuuvis® Momentum offers a high flexibility in terms of document lifecycle management. In this tutorial, a simple document import will be considered as an example for the need of changing the requirement of properties.

Overwriting the 'required' Attribute of properties

Any property definition in the schema needs the specification of the required attribute. Its boolean value decides if the corresponding property is mandatory (true) or optional (false) for an object.  However, the value of the required attribute can be overwritten by a propertyReference in object type definitions or secondary object type definitions.

Property Definition

In an import management system, documents might be imported with less properties than they will have later in their lifecycle. A fresh imported object for example, does not necessarily have an editor. Later in the document lifecycle, this information might be required. By overwriting the required attribute of the property editor, it is possible to use the same property throughout the whole lifecycle.

In the example code below, the property name editor is defined first. The required attribute of the property name editor is set to true. Afterwards, the document type definition uses the property name and sets its required attribute to false by means of a propertyReference. Thus, for objects of the type document, the property name will be optional  If not overwritten by a propertyReference, the property editor will be mandatory for any object of a type including the editor property in its definition.

Code Block
languageyml
titleOverwriting of the required attribute by object type definition
linenumberstrue
<propertyStringDefinition>
    <id>name<<id>editor</id>
    <propertyType>string</propertyType>
    <cardinality>single</cardinality>
    <required>true</required>
</propertyStringDefinition>
 

Overwriting by Object Type Definitions

In an object type definition, a propertyReference can be used to set a value for the required attribute for a property. This value can be different from the value specified in the property definition. In this case, the required attribute will have the value from the object type definition.

Since for an imported1 document the editor property should be optional, the required attribute is set to false by means of a propertyReference.

Code Block
languageyml
titleOverwriting of the required attribute by object type definition
linenumberstrue
<typeDocumentDefinition>
    <id>document<<id>imported1</id>
    <baseId>system:document</baseId>
    <propertyReference required="false">name<>editor</propertyReference>
    <contentStreamAllowed>allowed</contentStreamAllowed>
</typeDocumentDefinition>

...

Overwriting by Secondary Object Type Definitions

An alternative possibility is the usage of a secondary object type on which the object type definition can be based on a secondary object type. Also in the definition of the secondary object type, a propertyReference can be used to set a value for the required attribute for a property. The required attribute value specified in the original property definition is again overwritten.

In the example code below, the property name is defined first. The required attribute of the property name is set to false. Afterwards, a document type definition is done without overwriting the required attribute, but editor is not included directly in the imported2 document type definition. But it is based on the non-static secondary object type invoice. Finally, the secondary object type is defined. It noeditor. The definition of noeditor uses the property nameeditor and sets its required attribute to truefalse by means of a propertyReference. Thus, for objects of the type documentimported2, the property nameeditor will be mandatoryavailable and optional.

Code Block
languageyml
titleOverwriting of the required attribute by secondary object type definition
linenumberstrue
<propertyStringDefinition>
    <id>name</id>
    <propertyType>string</propertyType>
    <cardinality>single</cardinality>
    <required>false</required>
</propertyStringDefinition>
 
<typeDocumentDefinition>
    <id>document<<id>imported2</id>
    <baseId>system:document</baseId>
    <contentStreamAllowed>allowed</contentStreamAllowed>
    <secondaryObjectTypeId static="false">invoice</secondaryObjectTypeId>
</typeDocumentDefinition>
 
<typeSecondaryDefinition>
    <id>invoice<<id>noeditor</id>
    <baseId>system:secondary</baseId>
    <propertyReference required="truefalse">name<>editor</propertyReference>
</typeSecondaryDefinition>

...

In an object type definition, it is possible to set a value for the required attribute, and additionally include multiple secondary object types specifying the required attribute as well. If at least in one definition among the others implies required=true, it will be true for every object of the corresponding type. The value true dominates over false independently on the location of the definition propertyReference.

In the example code below, the property name is defined first. The required attribute of the property name is set to false. Afterwards, a document type definition is done without overwriting the required attribute of name and thus keeping the value false from the property definition. Additionally, the non-static secondary object types invoice and deliverySlip are included. The definition of deliverySlip uses the required=false from the property definition as well, since it does not overwrite it. But in the definition of invoice, it is set required=true. This value dominates over all the other definitions. Thus, for objects of the type document, the property name will be mandatory.

Code Block
languageyml
titleOverwriting of the required attribute by an object type definition and different secondary object type definitions
linenumberstrue
<propertyStringDefinition>
    <id>name</id>
    <propertyType>string</propertyType>
    <cardinality>single</cardinality>
    <required>false</required>
</propertyStringDefinition>
 
<typeDocumentDefinition>
    <id>document</id>
    <baseId>system:document</baseId>
    <contentStreamAllowed>allowed</contentStreamAllowed>
    <secondaryObjectTypeId static="false">invoice</secondaryObjectTypeId>
    <secondaryObjectTypeId static="false">deliverySlip</secondaryObjectTypeId>
</typeDocumentDefinition>
 
<typeSecondaryDefinition>
    <id>invoice</id>
    <baseId>system:secondary</baseId>
    <propertyReference required="true">name</propertyReference>
</typeSecondaryDefinition>
 
<typeSecondaryDefinition>
    <id>deliverySlip</id>
    <baseId>system:secondary</baseId>
    <propertyReference>name</propertyReference>
</typeSecondaryDefinition>

Summarizing Example

A property name is defined. It is mandatory, since the required attribute is set to true.

Code Block
languageyml
titleProperty definition
linenumberstrue
<propertyStringDefinition>
    <id>name</id>
    <propertyType>string</propertyType>
    <cardinality>single</cardinality>
    <required>true</required>
</propertyStringDefinition>

An object type document is defined. The property name is included, but the required attribute an object type imported3 is defined. The property editor is included, but the required attribute is overwritten to false. Thus, the property name property editor would be optional. But there are two secondary object types included invoice noeditor and deliverySlip witheditor, that might have specified different values for the required attribute of the property name editor.

Code Block
languageyml
titleObject type definition
linenumberstrue
<typeDocumentDefinition>
    <id>document<<id>imported3</id>
    <baseId>system:document</baseId>
    <propertyReference required="false">name</propertyReference>
    <contentStreamAllowed>allowed</contentStreamAllowed>
    <secondaryObjectTypeId static="false">invoice</secondaryObjectTypeId>
    <secondaryObjectTypeId static="false">deliverySlip</secondaryObjectTypeId>
</typeDocumentDefinition>

The definition of the secondary object type invoice noeditor overwrites the required attribute of the property name to editor to false. This value equals the specification in the document imported3 object type. In contrast, the definition of deliverySlip of witheditor includes the property editor by means of a propertyReference but does not explicitly specify a value for the required attributerequired attribute. This means, that the value true from the property definition will be used for deliverySlip witheditor. Since the object type document imported3 includes invoice noeditor and deliverySlip at witheditor at the same time, the dominating value of the required attribute for name editor will be taken into account. Since true dominates over false, for the objects of type document imported3, the property name editor will be mandatory.

Code Block
languageyml
titleDifferent secondary object type definitions
linenumberstrue
<typeSecondaryDefinition>
    <id>invoice</id>
    <baseId>system:secondary</baseId>
    <propertyReference required="false">name</propertyReference>
</typeSecondaryDefinition>
 
<typeSecondaryDefinition>
    <id>deliverySlip</id>
    <baseId>system:secondary</baseId>
    <propertyReference>name</propertyReference>
</typeSecondaryDefinition>

Summary

This tutorial gave an introduction into the possibilities provided by the option of overwriting the required attribute of properties. Since this topic plays a role in the handling of the schema, also the following pages might be interesting for you.

Info
iconfalse

Read on

Section


Column
width25%

Managing the Schema

Insert excerpt
Managing the Schema
Managing the Schema
nopaneltrue
 Keep reading


Column
width25%

Schema - Defining Object Types

Insert excerpt
Schema - Defining Object Types
Schema - Defining Object Types
nopaneltrue
 Keep reading


Column
width25%

DMS Endpoints

To update the instance of an object type with the property group of a floating secondary object type as well as specific values use one of the two endpoints for updating metadata. Keep reading



...