cancel
Showing results for 
Search instead for 
Did you mean: 

Custom content model and CMIS

romschn
Star Collaborator
Star Collaborator
Hi,

I have created a custom content model and defined a custom content type.

<type name="my:my_type">
<title>My Content Type</title>
<parent>[b]cm:content[/b]</parent>
<properties>
<property name="my:empNumber">
<type>d:text</type>
</property>
<property name="my:empName">
<type>d:text</type>
</property>
</properties>
</type>

As I understand from CMIS model mapping - Document object in CMIS(cmis:document) is mapped to cm:content in content model.

Could anyone please let me know - out-of-the-box CMIS webscripts will be able to fetch me a content of type - my:my_type created in repository?
Which webscript shall I use to get this content?

Thanks for your help in advance.
3 REPLIES 3

fmui
Champ in-the-making
Champ in-the-making
You can use the CMIS Workbench [1] to check if your new type is correctly visible through CMIS.

Florian


[1] http://chemistry.apache.org/java/developing/tools/dev-tools-workbench.html

llivadas
Champ in-the-making
Champ in-the-making
Hi,

I have a related query. Is it possible to create documents whose type is a subtype of cmis:document? That is, I can create new documents with

Map<String, Object> properties = new HashMap<String, Object>();     
        properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");    
        properties.put(PropertyIds.NAME, filename);    
        ObjectId id = ((Folder) targetFolder).createDocument(properties, contentStream, VersioningState.MAJOR);


However, is it possible to do something on the following lines:

// Start creating extendedSOP document
         // First get the parent folder object
        CmisObject extendedSOPFolder = session.getObjectByPath("/ExtendedSOP");
        System.out.println("crete a new document in folder " +extendedSOPFolder.getName());
         
        final String extendedSOPFileName = "extendedSOPtest.txt";     
        System.out.println("creating a simple text file, " + extendedSOPFileName);     
        String extendedSOPmimetype = "text/plain; charset=UTF-8";     
        String extendedSOPcontent = "This is an extendedSOP test.";     
        String extendedSOPfilename = extendedSOPFileName;
        String extendedSOPvisibility = "Public"
        int extendedSOPreviewPeriod = 365;

        byte[] extendedSOPbuf = null;     
        try {
           extendedSOPbuf = extendedSOPcontent.getBytes("UTF-8");     
        }
        catch (UnsupportedEncodingException e) {
           e.printStackTrace();     
        }     
        ByteArrayInputStream extendedSOPStream = new ByteArrayInputStream(extendedSOPbuf);
        ContentStream extendedSOPcontentStream = session.getObjectFactory().createContentStream(extendedSOPfilename, extendedSOPbuf.length, extendedSOPmimetype, extendedSOPStream);

        Map<String, Object> extendedSOPproperties = new HashMap<String, Object>();    
        extendedSOPproperties.put(PropertyIds.OBJECT_TYPE_ID, "extendedSOP:extendedSOP");    
        extendedSOPproperties.put(PropertyIds.NAME, extendedSOPfilename);
        
        extendedSOPproperties.put(PropertyIds.visibility, extendedSOPvisibility);
       
        ObjectId extendedSOPid = ((Folder) extendedSOPFolder).createDocument(extendedSOPproperties, extendedSOPcontentStream, VersioningState.MAJOR);
    
        System.out.println("Created a new extendedSOP document " +extendedSOPFileName + " and its ID is " +extendedSOPid.getId());



where the extendedSOP type is defined in the content model as

<!– Definition of new Content Type: Extended Standard Operating Procedure –>
      <type name="extendedSOP:extendedSOP">
         <title>Standard Operating Procedure</title>
       <!– This inherits from cm:content and thus has all the standard content attributes –>
        
         <parent>cm:content</parent>
         …..
      </type>

Thank you.
Lelia

fagnersouza
Champ in-the-making
Champ in-the-making
I have the same problem.

Via CMIS touring the folder / repository list the documents.

But via the CMIS query returns me empty.

It only happens with custom model.

Any suggestions?

thank

Fagner Souza