Metadata authoring examples
Metadata authoring examples retrieve property template, class definitions, shape, and
define choice lists, property templates, class definitions, property definitions of a class
definition.
- Retrieving property templates
- Example to retrieve property templates, shape several general and data type specific
fields:
{ admPropertyTemplate( repositoryIdentifier: "OS1" identifier: "{2311C51E-03A4-46F7-B424-FD3D4C2120F0}" ) { symbolicName dataType isNameProperty isHidden owner descriptiveText ... on PropertyTemplateBoolean { propertyDefaultBoolean } ... on PropertyTemplateDateTime { isDateOnly propertyMaximumDateTime propertyDefaultDateTime } ... on PropertyTemplateFloat64 { propertyDefaultFloat64 propertyMinimumFloat64 propertyMaximumFloat64 } ... on PropertyTemplateId { propertyDefaultId } ... on PropertyTemplateObject { allowsForeignObject } ... on PropertyTemplateInteger32 { propertyMaximumInteger32 propertyDefaultInteger32 } } } - Retrieving class definitions
- Example to retrieve a class definition and shape many of the class definition
fields:
{ admClassDefinition( repositoryIdentifier: "OS1" identifier: "{D508E302-7E74-42F4-A7D7-B985DD333509}" ) { id symbolicName descriptiveText displayNames { id localeName localizedText } descriptiveTexts { id localeName localizedText } allowsInstances allowsSubclasses allowsPropertyAdditions updateSequenceNumber defaultInstanceOwnerPrincipal { className ... on User { displayName } ... on Group { displayName } } defaultInstancePermissions { ... on Permission { className granteeName } } } }
- Defining choice lists
- Example to create a choice list and add a couple of choice values including the localized
display names of those values:
mutation { admCreateChoiceList( repositoryIdentifier: "P8ObjectStore" choiceListProperties: { dataType: STRING, displayName: "GQLTestChoiceList", descriptiveText: "GraphQL Test Choice List", choiceValues: { replace: [ { insertAction: {}, choiceType: STRING, choiceStringValue: "ValueOne", displayNames: { replace: [ { localeName: "en-us", localizedText: "Value One" }, { localeName: "fr-fr", localizedText: "French Value One" } ] } }, { choiceType: STRING, choiceStringValue: "ValueTwo", displayNames: { replace: [ { localeName: "en-us", localizedText: "Value Two" }, { localeName: "fr-fr", localizedText: "French Value Two" } ] } } ] } } ) { id displayName } }
- Defining property templates
- Example to create a property template whose type is integer:
mutation { admCreatePropertyTemplate( repositoryIdentifier:"P8ObjectStore" dataType:LONG propertyTemplateProperties:{ cardinality:SINGLE displayNames:{ replace:[ { localeName:"en-us" localizedText:"GQL Test Prop Integer32" } ] } symbolicName:"GQLTestPropInteger32" subPropertyTemplateInteger32Properties:{ propertyDefaultInteger32: 5 propertyMinimumInteger32: 1 propertyMaximumInteger32: 10 } } ) { id } }
- Defining class definitions
- Example is a basic mutation to create a class definition:
mutation { admCreateClassDefinition( repositoryIdentifier:"P8ObjectStore" superclassIdentifier:"CustomObject" classDefinitionProperties:{ allowsInstances:true displayNames:{ replace:[ { localeName:"en-us" localizedText:"GQL Test Custom Object" } ] } isHidden:false symbolicName:"GQLTestCustomObject" subSubscribableClassDefinitionProperties:{ } } ) { className id symbolicName displayName } }
- Defining the Property Definitions of a Class Definition
- The following example updates a class definition by modifying an existing property definition
and adding two new property definitions:
mutation { admUpdateClassDefinition( repositoryIdentifier:"P8ObjectStore" identifier: "GQLTestCustomObject" classDefinitionProperties:{ propertyDefinitions:{ modify:[ { updateAction:{ itemReference:{ identifier:"GQLTestPropBoolean" } } aliasIds:[ "{78e29f53-62fd-437f-9e40-267f89d86415}" ] copyToReservation:false isHidden:false isValueRequired:false modificationAccessRequired:3 settability:READ_WRITE subPropertyDefinitionBoolean:{ propertyDefaultBoolean:false } }, { propertyTemplate:{ identifier:"GQLTestPropInteger32" } isHidden:true isValueRequired:true settability:SETTABLE_ONLY_ON_CREATE subPropertyDefinitionInteger32: { propertyMinimumInteger32: 0 propertyMaximumInteger32: 10 } }, { propertyTemplate:{ identifier:"GQLTestPropString" } copyToReservation:false isHidden:true isValueRequired:true settability:READ_ONLY subPropertyDefinitionString: { maximumLengthString: 128 propertyDefaultString: "test_only" } } ] } } ) { className id symbolicName displayName } }