Thursday 11 April 2019

openCMIS: Document Object type definition


Every cmis object has set of properties, these properties defined by the object type. Within an object, each property is uniquely identified by its property definition id.

Following table summarizes the cmis object and corresponding types associated with them.

Object
Type corresponding to thie object
Document
DocumentType
Folder
FolderType
Item
ItemType
Policy
PolicyType
RelationShip
RelationshipType
        
Every DocumentType instance has set of attributes that describes about itself and collection of property definitions that describes about the document object.

Following table summarizes the attributes associated with DocumentType.

Attribute
Value
Id
cmis:document
localName
<repository-specific>
localNamespace
<repository-specific>
queryName
cmis:document
displayName
<repository-specific>
baseId
cmis:document
parentId
MUST NOT be set
description
<repository-specific>
Creatable
<repository-specific>
fileable
SHOULD be TRUE
queryable
SHOULD be TRUE
controllablePolicy
<repository-specific>
controllableACL
<repository-specific>
includedInSupertypeQuery
<repository-specific>
fulltextIndexed
<repository-specific>
typeMutability.create
<repository-specific>
typeMutability.update
<repository-specific>
typeMutability.delete
<repository-specific>
versionable
<repository-specific>
contentStreamAllowed
<repository-specific>

Note:        
A value of <repository-specific> indicates that the value of the property MAY be set to any valid value for the attribute type.

Property definitions
Document type has list of property definitions associated with it. These property definitions are used to describe about the document. To know about all the property definiations refer the setion ‘2.1.4.3.3 Property Definitions’ of cmis specification.

For example, name, description, objectId are the property definitions that are used to describe about document name, description and object id associated with the document.

cmis:name Name of the object.
Attribute
Description
Property Type
String
Inherited
False
Required
TRUE
Cardinality
single
Updatability
SHOULD be readwrite or whencheckedout
Choices
Not Applicable
Open Choice
Not Applicable
Queryable
SHOULD be TRUE
Orderable
SHOULD be TRUE

Below program prints all the property definitions associated with DocumentType.

TestCmis.java
package com.sample.util;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.apache.chemistry.opencmis.client.api.ObjectType;
import org.apache.chemistry.opencmis.client.api.Session;
import org.apache.chemistry.opencmis.client.api.SessionFactory;
import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl;
import org.apache.chemistry.opencmis.commons.SessionParameter;
import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
import org.apache.chemistry.opencmis.commons.enums.BindingType;

public class TestCmis {

 private static String serverURL = "http://localhost:8080/chemistry-opencmis-server-inmemory-1.1.0/browser";
 private static String repositoryId = "A1";

 private static Session getSession() {
  Map<String, String> parameters = new HashMap<>();
  parameters.put(SessionParameter.BINDING_TYPE, BindingType.BROWSER.value());

  parameters.put(SessionParameter.USER, "");
  parameters.put(SessionParameter.PASSWORD, "");

  parameters.put(SessionParameter.REPOSITORY_ID, repositoryId);
  parameters.put(SessionParameter.BROWSER_URL, serverURL);

  SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
  return sessionFactory.createSession(parameters);
 }

 public static void main(String args[]) throws IOException {

  Session session = getSession();

  ObjectType objectType = session.getTypeDefinition("cmis:document");

  Map<String, PropertyDefinition<?>> propDefinitions = objectType.getPropertyDefinitions();

  for (String property : propDefinitions.keySet()) {
   System.out.println("\n****************************************");
   System.out.println(property);
   System.out.println("****************************************");

   PropertyDefinition<?> propDefinition = propDefinitions.get(property);

   System.out.println("Property Type : " + propDefinition.getPropertyType());
   System.out.println("Inherited : " + propDefinition.isInherited());
   System.out.println("Required : " + propDefinition.isRequired());
   System.out.println("Cardinality : " + propDefinition.getCardinality());
   System.out.println("Updatability : " + propDefinition.getUpdatability());
   System.out.println("Choices : " + propDefinition.getChoices());
   System.out.println("Open Choice : " + propDefinition.isOpenChoice());
   System.out.println("Queryable : " + propDefinition.isQueryable());
   System.out.println("Orderable : " + propDefinition.isOrderable());

  }

 }

}


Output

****************************************
cmis:name
****************************************
Property Type : STRING
Inherited : false
Required : true
Cardinality : SINGLE
Updatability : READWRITE
Choices : []
Open Choice : null
Queryable : true
Orderable : true

****************************************
cmis:description
****************************************
Property Type : STRING
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READWRITE
Choices : []
Open Choice : null
Queryable : false
Orderable : false

****************************************
cmis:objectId
****************************************
Property Type : ID
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : true
Orderable : false

****************************************
cmis:baseTypeId
****************************************
Property Type : ID
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : true
Orderable : false

****************************************
cmis:objectTypeId
****************************************
Property Type : ID
Inherited : false
Required : true
Cardinality : SINGLE
Updatability : ONCREATE
Choices : []
Open Choice : null
Queryable : true
Orderable : false

****************************************
cmis:secondaryObjectTypeIds
****************************************
Property Type : ID
Inherited : false
Required : false
Cardinality : MULTI
Updatability : READWRITE
Choices : []
Open Choice : null
Queryable : true
Orderable : false

****************************************
cmis:createdBy
****************************************
Property Type : STRING
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : true
Orderable : true

****************************************
cmis:creationDate
****************************************
Property Type : DATETIME
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : true
Orderable : true

****************************************
cmis:lastModifiedBy
****************************************
Property Type : STRING
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : true
Orderable : true

****************************************
cmis:lastModificationDate
****************************************
Property Type : DATETIME
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : true
Orderable : true

****************************************
cmis:changeToken
****************************************
Property Type : STRING
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : false
Orderable : false

****************************************
cmis:isImmutable
****************************************
Property Type : BOOLEAN
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : false
Orderable : false

****************************************
cmis:isLatestVersion
****************************************
Property Type : BOOLEAN
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : false
Orderable : false

****************************************
cmis:isMajorVersion
****************************************
Property Type : BOOLEAN
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : false
Orderable : false

****************************************
cmis:isLatestMajorVersion
****************************************
Property Type : BOOLEAN
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : false
Orderable : false

****************************************
cmis:isPrivateWorkingCopy
****************************************
Property Type : BOOLEAN
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : true
Orderable : false

****************************************
cmis:versionLabel
****************************************
Property Type : STRING
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : true
Orderable : false

****************************************
cmis:versionSeriesId
****************************************
Property Type : ID
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : true
Orderable : false

****************************************
cmis:isVersionSeriesCheckedOut
****************************************
Property Type : BOOLEAN
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : true
Orderable : false

****************************************
cmis:versionSeriesCheckedOutBy
****************************************
Property Type : STRING
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : false
Orderable : false

****************************************
cmis:versionSeriesCheckedOutId
****************************************
Property Type : ID
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : false
Orderable : false

****************************************
cmis:checkinComment
****************************************
Property Type : STRING
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : false
Orderable : false

****************************************
cmis:contentStreamLength
****************************************
Property Type : INTEGER
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : false
Orderable : false

****************************************
cmis:contentStreamMimeType
****************************************
Property Type : STRING
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : false
Orderable : false

****************************************
cmis:contentStreamFileName
****************************************
Property Type : STRING
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : false
Orderable : false

****************************************
cmis:contentStreamId
****************************************
Property Type : ID
Inherited : false
Required : false
Cardinality : SINGLE
Updatability : READONLY
Choices : []
Open Choice : null
Queryable : false
Orderable : false




Previous                                                 Next                                                 Home

No comments:

Post a Comment