...
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. |
...
- Set-up yuuvis® API system (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
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.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<propertyStringDefinition> <id>editor</id> <propertyType>string</propertyType> <cardinality>single</cardinality> <required>true</required> </propertyStringDefinition> |
...
Overwriting by an Object Type
...
Definition
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.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<typeDocumentDefinition> <id>imported1</id> <baseId>system:document</baseId> <propertyReference required="false">editor</propertyReference> <contentStreamAllowed>allowed</contentStreamAllowed> </typeDocumentDefinition> |
Overwriting by a Secondary Object Type
...
Definition
An alternative possibility is the usage of a secondary object type on which the object type definition can be based. 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.
...
If an object of type imported3
has non none of the two secondary object types, the property editor
is optional.
If an object of type imported3
has the secondary object type noeditor
, it does not change anything. The property editor
is still optional.
But if an object of type imported3
has the secondary object type witheditor
, the property editor
is mandatory in this object.
...