Session interface provides 'getTypeDefinition' method, to
get the type definition of given object type.
For example, following statement prints the type
defintion of cmis document.
ObjectType objectType =
session.getTypeDefinition("cmis:document");
TestCmis.java
package com.sample.util; 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.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"; public 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[]) { Session session = getSession(); ObjectType objectType = session.getTypeDefinition("cmis:document"); System.out.println(objectType); } }
Output
Type Definition [base id=CMIS_DOCUMENT, id=cmis:document, display Name=Document, description=Document, local name=cmis:document, local namespace=http://apache.org, query name=cmis:document, parent id=null, is controllable ACL=true, is controllable policy=true, is creatable=true, is fileable=true, is fulltext indexed=false, is included in supertype query=true, is queryable=true, property definitions={cmis:name=Property Definition [id=cmis:name, display name=Name, description=Name, local name=cmis:name, local namespace=null, query name=cmis:name, property type=STRING, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=true, is required=true, updatability=READWRITE][extensions=null], cmis:description=Property Definition [id=cmis:description, display name=Description, description=Description, local name=cmis:description, local namespace=null, query name=cmis:description, property type=STRING, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=false, is required=false, updatability=READWRITE][extensions=null], cmis:objectId=Property Definition [id=cmis:objectId, display name=Object Id, description=Object Id, local name=cmis:objectId, local namespace=null, query name=cmis:objectId, property type=ID, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=true, is required=false, updatability=READONLY][extensions=null], cmis:baseTypeId=Property Definition [id=cmis:baseTypeId, display name=Base Type Id, description=Base Type Id, local name=cmis:baseTypeId, local namespace=null, query name=cmis:baseTypeId, property type=ID, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=true, is required=false, updatability=READONLY][extensions=null], cmis:objectTypeId=Property Definition [id=cmis:objectTypeId, display name=Object Type Id, description=Object Type Id, local name=cmis:objectTypeId, local namespace=null, query name=cmis:objectTypeId, property type=ID, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=true, is required=true, updatability=ONCREATE][extensions=null], cmis:secondaryObjectTypeIds=Property Definition [id=cmis:secondaryObjectTypeIds, display name=Secondary Type Ids, description=Secondary Type Ids, local name=cmis:secondaryObjectTypeIds, local namespace=null, query name=cmis:secondaryObjectTypeIds, property type=ID, cardinality=MULTI, choice list=null, default value=[], is inherited=false, is open choice=null, is queryable=true, is required=false, updatability=READWRITE][extensions=null], cmis:createdBy=Property Definition [id=cmis:createdBy, display name=Created By, description=Created By, local name=cmis:createdBy, local namespace=null, query name=cmis:createdBy, property type=STRING, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=true, is required=false, updatability=READONLY][extensions=null], cmis:creationDate=Property Definition [id=cmis:creationDate, display name=Creation Date, description=Creation Date, local name=cmis:creationDate, local namespace=null, query name=cmis:creationDate, property type=DATETIME, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=true, is required=false, updatability=READONLY][extensions=null], cmis:lastModifiedBy=Property Definition [id=cmis:lastModifiedBy, display name=Last Modified By, description=Last Modified By, local name=cmis:lastModifiedBy, local namespace=null, query name=cmis:lastModifiedBy, property type=STRING, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=true, is required=false, updatability=READONLY][extensions=null], cmis:lastModificationDate=Property Definition [id=cmis:lastModificationDate, display name=Last Modification Date, description=Last Modification Date, local name=cmis:lastModificationDate, local namespace=null, query name=cmis:lastModificationDate, property type=DATETIME, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=true, is required=false, updatability=READONLY][extensions=null], cmis:changeToken=Property Definition [id=cmis:changeToken, display name=Change Token, description=Change Token, local name=cmis:changeToken, local namespace=null, query name=cmis:changeToken, property type=STRING, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=false, is required=false, updatability=READONLY][extensions=null], cmis:isImmutable=Property Definition [id=cmis:isImmutable, display name=Is Immutable, description=Is Immutable, local name=cmis:isImmutable, local namespace=null, query name=cmis:isImmutable, property type=BOOLEAN, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=false, is required=false, updatability=READONLY][extensions=null], cmis:isLatestVersion=Property Definition [id=cmis:isLatestVersion, display name=Is Latest Version, description=Is Latest Version, local name=cmis:isLatestVersion, local namespace=null, query name=cmis:isLatestVersion, property type=BOOLEAN, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=false, is required=false, updatability=READONLY][extensions=null], cmis:isMajorVersion=Property Definition [id=cmis:isMajorVersion, display name=Is Major Version, description=Is Major Version, local name=cmis:isMajorVersion, local namespace=null, query name=cmis:isMajorVersion, property type=BOOLEAN, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=false, is required=false, updatability=READONLY][extensions=null], cmis:isLatestMajorVersion=Property Definition [id=cmis:isLatestMajorVersion, display name=Is Latest Major Version, description=Is Latest Major Version, local name=cmis:isLatestMajorVersion, local namespace=null, query name=cmis:isLatestMajorVersion, property type=BOOLEAN, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=false, is required=false, updatability=READONLY][extensions=null], cmis:isPrivateWorkingCopy=Property Definition [id=cmis:isPrivateWorkingCopy, display name=Is Private Working Copy, description=Is Private Working Copy, local name=cmis:isPrivateWorkingCopy, local namespace=null, query name=cmis:isPrivateWorkingCopy, property type=BOOLEAN, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=true, is required=false, updatability=READONLY][extensions=null], cmis:versionLabel=Property Definition [id=cmis:versionLabel, display name=Version Label, description=Version Label, local name=cmis:versionLabel, local namespace=null, query name=cmis:versionLabel, property type=STRING, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=true, is required=false, updatability=READONLY][extensions=null], cmis:versionSeriesId=Property Definition [id=cmis:versionSeriesId, display name=Version Series Id, description=Version Series Id, local name=cmis:versionSeriesId, local namespace=null, query name=cmis:versionSeriesId, property type=ID, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=true, is required=false, updatability=READONLY][extensions=null], cmis:isVersionSeriesCheckedOut=Property Definition [id=cmis:isVersionSeriesCheckedOut, display name=Is Verison Series Checked Out, description=Is Verison Series Checked Out, local name=cmis:isVersionSeriesCheckedOut, local namespace=null, query name=cmis:isVersionSeriesCheckedOut, property type=BOOLEAN, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=true, is required=false, updatability=READONLY][extensions=null], cmis:versionSeriesCheckedOutBy=Property Definition [id=cmis:versionSeriesCheckedOutBy, display name=Version Series Checked Out By, description=Version Series Checked Out By, local name=cmis:versionSeriesCheckedOutBy, local namespace=null, query name=cmis:versionSeriesCheckedOutBy, property type=STRING, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=false, is required=false, updatability=READONLY][extensions=null], cmis:versionSeriesCheckedOutId=Property Definition [id=cmis:versionSeriesCheckedOutId, display name=Version Series Checked Out Id, description=Version Series Checked Out Id, local name=cmis:versionSeriesCheckedOutId, local namespace=null, query name=cmis:versionSeriesCheckedOutId, property type=ID, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=false, is required=false, updatability=READONLY][extensions=null], cmis:checkinComment=Property Definition [id=cmis:checkinComment, display name=Checkin Comment, description=Checkin Comment, local name=cmis:checkinComment, local namespace=null, query name=cmis:checkinComment, property type=STRING, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=false, is required=false, updatability=READONLY][extensions=null], cmis:contentStreamLength=Property Definition [id=cmis:contentStreamLength, display name=Content Stream Length, description=Content Stream Length, local name=cmis:contentStreamLength, local namespace=null, query name=cmis:contentStreamLength, property type=INTEGER, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=false, is required=false, updatability=READONLY][extensions=null], cmis:contentStreamMimeType=Property Definition [id=cmis:contentStreamMimeType, display name=MIME Type, description=MIME Type, local name=cmis:contentStreamMimeType, local namespace=null, query name=cmis:contentStreamMimeType, property type=STRING, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=false, is required=false, updatability=READONLY][extensions=null], cmis:contentStreamFileName=Property Definition [id=cmis:contentStreamFileName, display name=Filename, description=Filename, local name=cmis:contentStreamFileName, local namespace=null, query name=cmis:contentStreamFileName, property type=STRING, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=false, is required=false, updatability=READONLY][extensions=null], cmis:contentStreamId=Property Definition [id=cmis:contentStreamId, display name=Content Stream Id, description=Content Stream Id, local name=cmis:contentStreamId, local namespace=null, query name=cmis:contentStreamId, property type=ID, cardinality=SINGLE, choice list=null, default value=null, is inherited=false, is open choice=null, is queryable=false, is required=false, updatability=READONLY][extensions=null]}, typeMutability=TypeMutability [canCreate=true, canUpdate=false, canDelete=false][extensions=null]][extensions=null]
No comments:
Post a Comment