Property definitions editing
They determine what properties are present on a class in the repository and the attributes of those properties – such as minimum and maximum values. Property definitions are a type of dependent object and the concepts of editing dependent objects as described in a previous section apply to property definitions.
extend type Mutation {
admUpdateClassDefinition(
# … Other mutation arguments
classDefinitionProperties: ClassDefinitionPropertiesInput
): ClassDefinition
# … Other mutations
}
input ClassDefinitionPropertiesInput {
propertyDefinitions: PropertyDefinitionListInput
# … Other ClassDefinition property fields
}
input PropertyDefinitionListInput {
# Only modify is supported for lists of property definitions
modify: [PropertyDefinitionInput!]
}
input PropertyDefinitionInput {
insertAction: InsertDependentActionInput
updateAction: UpdateDependentActionInput
moveAction: MoveDependentActionInput
deleteAction: DeleteDependentActionInput
propertyTemplate: ObjectReferenceInput
choiceList: ObjectReferenceInput
isHidden: Boolean
# … Other general property definition attributes
subPropertyDefinitionBoolean: SubPropertyDefinitionBooleanInput
subPropertyDefinitionInteger32: SubPropertyDefinitionInteger32Input
subPropertyDefinitionString: SubPropertyDefinitionStringInput
# … Other sub-fields for other types of properties
}
input SubPropertyDefinitionBooleanInput {
propertyDefaultBoolean: Boolean
}
input SubPropertyDefinitionInteger32Input {
propertyDefaultInteger32: Int
propertyMaximumInteger32: Int
propertyMinimumInteger32: Int
}
input SubPropertyDefinitionStringInput {
isCBREnabled: Boolean
maximumLengthString: Int
propertyDefaultString: String
}
# … Other input types for other types of properties
To modify the property definitions of a class definition, a mutation such as updateClassDefinition is called. Similar to other mutations, the update mutation has a classDefinitionProperties argument where properties specific to class definitions can be specified. One such field of ClassDefinitionPropertiesInput is propertyDefinitions. The type of this input field is PropertyDefinitionListInput and through this input type the list of property definitions to insert, update, move, or delete can be passed.
Unlike other types of dependent objects, the only field in PropertyDefinitionListInput is modify. The list of property definitions can only be modified, they cannot be replaced. When creating a new class definition, you start out with the list of definitions that are inherited from the superclass. Certain attributes of the inherited property definitions can be modified as well as adding new property definitions to the class.
Each item in the list of property definitions has the input type PropertyDefinitionInput. This input type holds general fields for any type of property. For property type specific attributes, there are various “sub” fields – subPropertyDefinitionBoolean, subPropertyDefinitionInteger32. To set specific attributes, specify a value for the subfield appropriate for the type of property.
When you insert a new property definition, the propertyTemplate field must be specified and determines the type of the property. When you are updating an existing property definition, the propertyTemplate field is optional but if specified it must match the current property template. The property template of a property definition cannot be modified once it is added.
When you are referencing existing property definitions, the identifier field of a DependentItemReferenceInput object can be used in addition to originalIndex and is a more natural way of referencing property definitions. The identifier can be set to either the symbolic name or the primary ID (the ID of the property template) of the existing property definition.
You cannot delete an inherited property definition. If you are inserting a new property definition at an index or moving an existing property definition to a new index, the index must be after any inherited property definitions.
Examples of mutations-modifying property definitions as well as creating and updating class definitions in general are contained in later sections.