...
Page Properties | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
| Status
| status
| |||||||||
colour | Yellow | title | progress | Priority |
Resources & Remarks RemarksChange for an object property whether it is optional or mandatory
| ||||||
Excerpt | |||||||||||
Modification History
|
Excerpt |
---|
This tutorial shows how to reference the same property definition in different object type definitions, in some of them as a required property and in others as a non-required property. |
Section | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
|
Introduction
Any property definition needs The metadata structure of object types has to be defined in the schema. In this definition, properties are referenced that should be connected to the object type. Each property is in turn defined in the schema by the specification of its attributes. The properties can be referenced or not referenced in object type definitions, but their attributes are fixed and cannot be modified. The required
attribute is the only exception as it can be overwritten by a propertyReference
in object type definitions. This makes it possible to decide for each property individually whether it is required in every single object type definition or not. Since schema structures can even be changed at runtime, yuuvis® Momentum offers a high flexibility in terms of document lifecycle management.
Requirements
To work through this tutorial, the following is required:
- Set-up yuuvis® Momentumsystem (see Installation Guide)
- A user with read and write permissions on a document type in the system (see tutorial for permissions)
Overwriting the required
Attribute of Properties
All property definitions in the schema need 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.
Tutorial Content
Handling Object Type Definitions
In an object .
Property Definition
In an import management system, documents may be imported with less properties than they will have lateron in their lifecycle. A freshly imported object for example does not necessarily have an editor. Later in the document lifecycle, this information may be required. By overwriting the required
attribute of the editor
property, it is possible to use the same property throughout the entire lifecycle.
In the example code below, the editor
property is defined. The required
attribute of the editor
property is set to true
. If not overwritten by a propertyReference
, the editor
property will be mandatory for any object of a type containing the editor
property in its definition.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<propertyStringDefinition>
<id>editor</id>
<propertyType>string</propertyType>
<cardinality>single</cardinality>
<required>true</required>
</propertyStringDefinition> |
Overwriting Using a Document Type Definition
In a document type definition, a propertyReference
can be used to set a value for the required
attribute for of a property. This value can be different from the value specified in the property definition. In this case, the value of the required
attribute will have the value from the object be specified in the document type definition.In the example code below, the property name
is defined first. The required
attribute of the property name
is set to true
. Afterwards, the document
type definition uses the property name
and sets its required
attribute
Since the editor
property should be optional for an imported1
document, the required
attribute is set to false
by means of a propertyReference
.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<propertyStringDefinition> <id>name<<id>editor</id> <propertyType>string</propertyType> <cardinality>single</cardinality> <required>true</required> </propertyStringDefinition> <typeDocumentDefinition> <id>document<<id>imported1</id> <baseId>system:document</baseId> <propertyReference required="false">name<>editor</propertyReference> <contentStreamAllowed>allowed</contentStreamAllowed> </typeDocumentDefinition> |
...
Overwriting Using a Secondary Object Type
...
Definition
An alternative option to reference a property in an object type definition can be based on a is to include a floating secondary object type. Also in In the definition of the secondary object type definition, a 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 editor
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 is not included directly in the imported2
document type definition. But it is based on the non-static (floating) secondary object type invoice
. Finally, the secondary object type is defined. It uses the property name
noeditor
. The definition of noeditor
uses the editor
property and sets its required
attribute to true
false
by means of a propertyReference
. Thus, for objects documents of the type document
imported2
, the property name
editor
property will be mandatoryavailable and optional.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<propertyStringDefinition> <id>name<<id>editor</id> <propertyType>string</propertyType> <cardinality>single</cardinality> <required>false<<required>true</required> </propertyStringDefinition> <typeDocumentDefinition> <id>document<<id>imported2</id> <baseId>system:document</baseId> <contentStreamAllowed>allowed</contentStreamAllowed> <secondaryObjectTypeId static="false">invoice<>noeditor</secondaryObjectTypeId> </typeDocumentDefinition> <typeSecondaryDefinition> <id>invoice<<id>noeditor</id> <baseId>system:secondary</baseId> <propertyReference required="truefalse">name<>editor</propertyReference> </typeSecondaryDefinition> |
Handling
...
Multiple Property References
In an object a document type definition, it is possible to set a value for the required
attribute of a property, and additionally include multiple secondary object types specifying the required
attribute for the same property as well. If at least in one definition among the others implies required=true
, it this attribute will be true
for every object document of the corresponding type. The value true
dominates over false
independently on regardless of 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 mandatorya document type imported3
is defined. The editor
property is included, but the required
attribute is overwritten to false
which makes the editor
property optional. However, the two secondary object types noeditor
and witheditor
may have different values specified for the required
attribute of the editor
property.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<propertyStringDefinition> <id>name<<id>editor</id> <propertyType>string</propertyType> <cardinality>single</cardinality> <required>false<<required>true</required> </propertyStringDefinition> <typeDocumentDefinition> <id>document<<id>imported3</id> <baseId>system:document</baseId> <propertyReference required="false">editor</propertyReference> <contentStreamAllowed>allowed</contentStreamAllowed> <secondaryObjectTypeId static="false">invoice<>noeditor</secondaryObjectTypeId> <secondaryObjectTypeId static="false">deliverySlip<>witheditor</secondaryObjectTypeId> </typeDocumentDefinition> <typeSecondaryDefinition> <id>invoice<<id>noeditor</id> <baseId>system:secondary</baseId> <propertyReference required="truefalse">name<>editor</propertyReference> </typeSecondaryDefinition> <typeSecondaryDefinition> <id>deliverySlip<<id>witheditor</id> <baseId>system:secondary</baseId> <propertyReference>name<<propertyReference>editor</propertyReference> </typeSecondaryDefinition> |
Summarizing Example
A property name
is defined. It is mandatory, since the required
attribute is set to true
.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<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 is overwritten to false
. Thus, the property name would be optional. But there are two secondary object types included invoice
and deliverySlip
, that might have specified different values for the required
attribute of the property name
.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<typeDocumentDefinition>
<id>document</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
editor
property to false
. This value equals the specification in the imported3
document object type definition. In contrast, the definition of deliverySlip
witheditor
includes the editor
property 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
. Since the object type document includes invoice
and deliverySlip
at the same time, the dominating value of the required
attribute for name
will be taken into account. Since true
dominates over false
, for the objects of type document
, the property name
will be mandatory.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<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> |
witheditor
.
If a document of type imported3
has none of the two secondary object types, the editor
property is optional.
If a document of type imported3
has the secondary object type noeditor
, nothing changes. The editor
property is still optional.
But if a document of type imported3
has the secondary object type witheditor
, the property editor
is mandatory in this object.
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 to you.
Info | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||
Read on
|
...