...
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> |
...
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>editor</id> <propertyType>string</propertyType> <cardinality>single</cardinality> <required>true</required> </propertyStringDefinition> <typeDocumentDefinition> <id>imported1</id> <baseId>system:document</baseId> <propertyReference required="false">editor</propertyReference> <contentStreamAllowed>allowed</contentStreamAllowed> </typeDocumentDefinition> |
...
In the example code below, the editor
property is not included directly in the imported2
document type definition. But it is based on the non-static (floating) secondary object type noeditor
. The definition of noeditor
uses the editor
property and sets its required
attribute to false
by means of a propertyReference
. Thus, for documents of the type imported2
, the editor
property will be available and optional.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<propertyStringDefinition> <id>editor</id> <propertyType>string</propertyType> <cardinality>single</cardinality> <required>true</required> </propertyStringDefinition> <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> |
...
In the example code below, a 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>editor</id> <propertyType>string</propertyType> <cardinality>single</cardinality> <required>true</required> </propertyStringDefinition> <typeDocumentDefinition> <id>imported3</id> <baseId>system:document</baseId> <propertyReference required="false">editor</propertyReference> <contentStreamAllowed>allowed</contentStreamAllowed> <secondaryObjectTypeId static="false">noeditor</secondaryObjectTypeId> <secondaryObjectTypeId static="false">witheditor</secondaryObjectTypeId> </typeDocumentDefinition> <typeSecondaryDefinition> <id>noeditor</id> <baseId>system:secondary</baseId> <propertyReference required="false">editor</propertyReference> </typeSecondaryDefinition> <typeSecondaryDefinition> <id>witheditor</id> <baseId>system:secondary</baseId> <propertyReference>editor</propertyReference> </typeSecondaryDefinition> |
...