You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by Alexandru Deliu <de...@ca.objectiflune.com> on 2012/06/07 22:17:16 UTC

Get the list of metadata properties for a CMIS repository

Hello,
We are currently developing connectors to enable publishing documents to CMIS compliant systems along with document properties. I would like to know how to retrieve the list of this properties before uploading a document, not after the document is uploaded.

Another question is how can we handle with OpenCMIS the properties that are set by an Content Type like in SharePoint.

Thanks for any info on that.

Alex.


RE: Get the list of metadata properties for a CMIS repository

Posted by Alexandru Deliu <de...@ca.objectiflune.com>.
Hello,

The code bellow I use to get the properties for cmis:document type. If in Sharepoint 2010 I create a new content type (document type) it is not detected as new type by the code bellow. Using OpenCMIS can we see more than one cmis:document type ? Also is there a way to determine if the repository allows using the content type ? 


	ItemIterable<ObjectType> types = session.getTypeChildren(null, true);

    for (ObjectType type : types)
    {       
        String docType = type.getId().toString();        
        System.out.println("type display name: " + type.getDisplayName());

        if ("cmis:document".equalsIgnoreCase(docType)){
        	
	        Map<String, PropertyDefinition<?>> props = type.getPropertyDefinitions();
	        for (PropertyDefinition<?> prop : props.values())
	        {
	            System.out.println("  id  : " + prop.getId());
	            System.out.println("  display name: " + prop.getDisplayName());
	        }
        }

    }

Thank you clarifying me on that.

Alexandru

-----Message d'origine-----
De : Florian Müller [mailto:fmui@apache.org] 
Envoyé : 7 juin 2012 16:33
À : dev@chemistry.apache.org; Alexandru Deliu
Objet : Re: Get the list of metadata properties for a CMIS repository

Hi Alex,

The following line of code returns all property definitions of a type:

Map<String, PropertyDefinition<?>> propDefs = session.getTypeDefinition("your:type").getPropertyDefinitions()
(Replace "your:type" with the object type id you want to use.)

You can discover which object types are available by calling session.getTypeChildren(...) and getTypeDescendants(...).


Florian



> Hello,
> We are currently developing connectors to enable publishing documents to CMIS compliant systems along with document properties. I would like to know how to retrieve the list of this properties before uploading a document, not after the document is uploaded.
> 
> Another question is how can we handle with OpenCMIS the properties that are set by an Content Type like in SharePoint.
> 
> Thanks for any info on that.
> 
> Alex.
> 
> 



Re: Get the list of metadata properties for a CMIS repository

Posted by Florian Müller <fm...@apache.org>.
Hi Alex,

The following line of code returns all property definitions of a type:

Map<String, PropertyDefinition<?>> propDefs = session.getTypeDefinition("your:type").getPropertyDefinitions()
(Replace "your:type" with the object type id you want to use.)

You can discover which object types are available by calling session.getTypeChildren(...) and getTypeDescendants(...).


Florian



> Hello,
> We are currently developing connectors to enable publishing documents to CMIS compliant systems along with document properties. I would like to know how to retrieve the list of this properties before uploading a document, not after the document is uploaded.
> 
> Another question is how can we handle with OpenCMIS the properties that are set by an Content Type like in SharePoint.
> 
> Thanks for any info on that.
> 
> Alex.
> 
>