Saturday 13 April 2019

cmis: How to create custom policy type


By using workbench, you can create new policy type. Easiest way is to download existing policy type (For Ex: cmis:policy) definition and update as per your needs and upload it using cmis workbench.

Below step-by-step procedure explain how to create custom type ‘ConfidentialDocPolicy’.

1.   Open work bench
2.   Click on the button Types



3.   Select the Policy type and click on the button ‘Save Type Definition’ and select the option ‘Save Type Definition to JSON.



cmis_policy.json
{
 "id": "cmis:policy",
 "localName": "cmis:policy",
 "localNamespace": "http:\/\/apache.org",
 "displayName": "Policy",
 "queryName": "cmis:policy",
 "description": "Policy",
 "baseId": "cmis:policy",
 "creatable": true,
 "fileable": false,
 "queryable": true,
 "fulltextIndexed": false,
 "includedInSupertypeQuery": true,
 "controllablePolicy": true,
 "controllableACL": true,
 "typeMutability": {
  "create": true,
  "update": false,
  "delete": false
 },
 "propertyDefinitions": {
  "cmis:name": {
   "id": "cmis:name",
   "localName": "cmis:name",
   "displayName": "Name",
   "queryName": "cmis:name",
   "description": "Name",
   "propertyType": "string",
   "cardinality": "single",
   "updatability": "readwrite",
   "inherited": false,
   "required": true,
   "queryable": true,
   "orderable": true
  },
  "cmis:description": {
   "id": "cmis:description",
   "localName": "cmis:description",
   "displayName": "Description",
   "queryName": "cmis:description",
   "description": "Description",
   "propertyType": "string",
   "cardinality": "single",
   "updatability": "readwrite",
   "inherited": false,
   "required": false,
   "queryable": false,
   "orderable": false
  },
  "cmis:objectId": {
   "id": "cmis:objectId",
   "localName": "cmis:objectId",
   "displayName": "Object Id",
   "queryName": "cmis:objectId",
   "description": "Object Id",
   "propertyType": "id",
   "cardinality": "single",
   "updatability": "readonly",
   "inherited": false,
   "required": false,
   "queryable": true,
   "orderable": false
  },
  "cmis:baseTypeId": {
   "id": "cmis:baseTypeId",
   "localName": "cmis:baseTypeId",
   "displayName": "Base Type Id",
   "queryName": "cmis:baseTypeId",
   "description": "Base Type Id",
   "propertyType": "id",
   "cardinality": "single",
   "updatability": "readonly",
   "inherited": false,
   "required": false,
   "queryable": true,
   "orderable": false
  },
  "cmis:objectTypeId": {
   "id": "cmis:objectTypeId",
   "localName": "cmis:objectTypeId",
   "displayName": "Object Type Id",
   "queryName": "cmis:objectTypeId",
   "description": "Object Type Id",
   "propertyType": "id",
   "cardinality": "single",
   "updatability": "oncreate",
   "inherited": false,
   "required": true,
   "queryable": true,
   "orderable": false
  },
  "cmis:secondaryObjectTypeIds": {
   "defaultValue": [],
   "id": "cmis:secondaryObjectTypeIds",
   "localName": "cmis:secondaryObjectTypeIds",
   "displayName": "Secondary Type Ids",
   "queryName": "cmis:secondaryObjectTypeIds",
   "description": "Secondary Type Ids",
   "propertyType": "id",
   "cardinality": "multi",
   "updatability": "readwrite",
   "inherited": false,
   "required": false,
   "queryable": true,
   "orderable": false
  },
  "cmis:createdBy": {
   "id": "cmis:createdBy",
   "localName": "cmis:createdBy",
   "displayName": "Created By",
   "queryName": "cmis:createdBy",
   "description": "Created By",
   "propertyType": "string",
   "cardinality": "single",
   "updatability": "readonly",
   "inherited": false,
   "required": false,
   "queryable": true,
   "orderable": true
  },
  "cmis:creationDate": {
   "id": "cmis:creationDate",
   "localName": "cmis:creationDate",
   "displayName": "Creation Date",
   "queryName": "cmis:creationDate",
   "description": "Creation Date",
   "propertyType": "datetime",
   "cardinality": "single",
   "updatability": "readonly",
   "inherited": false,
   "required": false,
   "queryable": true,
   "orderable": true
  },
  "cmis:lastModifiedBy": {
   "id": "cmis:lastModifiedBy",
   "localName": "cmis:lastModifiedBy",
   "displayName": "Last Modified By",
   "queryName": "cmis:lastModifiedBy",
   "description": "Last Modified By",
   "propertyType": "string",
   "cardinality": "single",
   "updatability": "readonly",
   "inherited": false,
   "required": false,
   "queryable": true,
   "orderable": true
  },
  "cmis:lastModificationDate": {
   "id": "cmis:lastModificationDate",
   "localName": "cmis:lastModificationDate",
   "displayName": "Last Modification Date",
   "queryName": "cmis:lastModificationDate",
   "description": "Last Modification Date",
   "propertyType": "datetime",
   "cardinality": "single",
   "updatability": "readonly",
   "inherited": false,
   "required": false,
   "queryable": true,
   "orderable": true
  },
  "cmis:changeToken": {
   "id": "cmis:changeToken",
   "localName": "cmis:changeToken",
   "displayName": "Change Token",
   "queryName": "cmis:changeToken",
   "description": "Change Token",
   "propertyType": "string",
   "cardinality": "single",
   "updatability": "readonly",
   "inherited": false,
   "required": false,
   "queryable": false,
   "orderable": false
  },
  "cmis:policyText": {
   "id": "cmis:policyText",
   "localName": "cmis:policyText",
   "displayName": "Policy Text",
   "queryName": "cmis:policyText",
   "description": "Policy Text",
   "propertyType": "string",
   "cardinality": "single",
   "updatability": "readwrite",
   "inherited": false,
   "required": false,
   "queryable": false,
   "orderable": false
  }
 }
}


4.   Update the downloaded json. For example, I created new policy for the organization ‘ABC’.

abc_policy.json
{
 "id": "abc:policy",
 "localName": "abc:policy",
 "localNamespace": "http:\/\/apache.org",
 "displayName": "abc organization Policy",
 "queryName": "abc:policy",
 "description": "Builtin InMemory type definition abc:policy",
 "baseId": "cmis:policy",
 "parentId": "cmis:policy",
 "creatable": true,
 "fileable": false,
 "queryable": true,
 "fulltextIndexed": false,
 "includedInSupertypeQuery": true,
 "controllablePolicy": true,
 "controllableACL": true,
 "typeMutability": {
  "create": true,
  "update": true,
  "delete": true
 },
 "propertyDefinitions": {
  "abc:typeOfPolicy": {
   "id": "abc:typeOfPolicy",
   "localName": "abc:typeOfPolicy",
   "displayName": "Type of policy",
   "queryName": "abc:typeOfPolicy",
   "description": "type of the policy",
   "propertyType": "string",
   "cardinality": "single",
   "updatability": "readwrite",
   "inherited": false,
   "required": true,
   "queryable": true,
   "orderable": true
  },
  "abc:namespace": {
   "id": "abc:namespace",
   "localName": "abc:namespace",
   "displayName": "Name",
   "queryName": "abc:namespace",
   "description": "name space",
   "propertyType": "string",
   "cardinality": "single",
   "updatability": "readwrite",
   "inherited": false,
   "required": true,
   "queryable": true,
   "orderable": true
  }
 }
}


5.   On the workbench click on the button ‘Create Type’ and select the option ‘Load Type Definition from JSON’.


That’s it, you are done. Now you can create policys using this custom type.
Previous                                                 Next                                                 Home

No comments:

Post a Comment