...
Page Properties | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||
ResourcesRemarks
|
...
Excerpt |
---|
This tutorial shows how to use the same property type in different object types, in some of them as a required property type and in others as a non-required property type. |
Section | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
|
Introduction
The metadata structure of object types has to be defined in the schema. In this definition, properties are selected 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 selected or not selected in object type definitions, but their attributes are fixed and can not be modified. There 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 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 minikube setup, for example)
- 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.
Property Definition
In an import management system, documents might 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 property editor
, it is possible to use the same property throughout the entire lifecycle.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<propertyStringDefinition> <id>editor</id> <propertyType>string</propertyType> <cardinality>single</cardinality> <required>true</required> </propertyStringDefinition> |
Overwriting Using an Object Type Definition
In an object type definition, a propertyReference
can be used to set a value for the required
attribute of 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 soecified in the object type definition.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<typeDocumentDefinition> <id>imported1</id> <baseId>system:document</baseId> <propertyReference required="false">editor</propertyReference> <contentStreamAllowed>allowed</contentStreamAllowed> </typeDocumentDefinition> |
Overwriting Using a Secondary Object Type Definition
An alternative possibility is using a secondary object type on which the object type definition can be based. Also, a propertyReference
can be used to set a value for the required
attribute for a property in the definition of the secondary object type. The required
attribute value specified in the original property definition is again overwritten.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<typeDocumentDefinition> <id>imported2</id> <baseId>system:document</baseId> <contentStreamAllowed>allowed</contentStreamAllowed> <secondaryObjectTypeId static="false">noeditor</secondaryObjectTypeId> </typeDocumentDefinition> <typeSecondaryDefinition> <id>noeditor</id> <baseId>system:secondary</baseId> <propertyReference required="false">editor</propertyReference> </typeSecondaryDefinition> |
Handling Multiple Property References
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 one definition implies required=true
, this attribute will be true
for every object of the corresponding type. The value true
dominates over false
regardless of the location of the propertyReference
.
...
If an object of type imported3
has none of the two secondary object types, the editor
property is optional.
If an object of type imported3
has the secondary object type noeditor
, nothing changes. The editor
property is still optional.
But if an object 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 for you.
Info | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||
Read on
|
...