1

I have Multiple Custom content types, and based on individual type i am able to query documents. But my requirement is i want to get all types of document.

I wrote query select * from hr:hrdoctype, Because my hr:hrdoctype is my parent type for all other types. But its not working.

But if i will write select * from hr:hrReimbursment, This is working fine.

So how can i get all All Custom types of documents with single parent type or with single condition. Please see the Below configuration.

in this case if i will use specific content type then its working fine. but i want to get all type of document using single query.

Please help me how can i write CMIS Query for this requirement.

Share-config-custom.xml:-

                <type name="cm:content">
                   <subtype name="hr:hrdoctype" />
                </type>

                <type name="hr:hrdoctype">
                   <subtype name="hr:hrReimbursment" />
                   <subtype name="hr:hrMISCELLANEOUS" />
                   <subtype name="hr:hrWELFARE_POLICIES" />
                   <subtype name="hr:hrGENERAL_POLICIES" />
                   <subtype name="hr:hrPOLICIES_SIGNOFF_NOTES_FILE_NOTES" />
                   <subtype name="hr:hrPHOTOGRAPH" />
                   <subtype name="hr:hrPIF_PROFILE_OVERVIEW" />
                   <subtype name="hr:hrMPR_FORM" />
                   <subtype name="hr:hrPSYOMETRIC_REPORT" />
                   <subtype name="hr:hrTECHNICAL_TEST_ASSESSEMENT" />
                   <subtype name="hr:hrINTERVIEW_ASSESSEMENT_SHEET" />                                     

            </type>

Custom-content-model.xml:-

     <types>
         <type name="hr:hrdoctype">
            <title>HR Document</title>
            <parent>cm:content</parent>

            <properties>
                <property name="hr:employeeNumber">
                        <title>Employee Number</title>
                        <type>d:text</type>
                        </property>
                <property name="hr:employeeName">
                        <title>Employee Name</title>
                        <type>d:text</type>
                </property>                             
            </properties>

        </type>

        <type name="hr:hrReimbursment">
            <title>REIMBURSEMENT</title>
            <parent>hr:hrdoctype</parent>


            <properties>
                <property name="hr:DocumentDescription">
                        <title>Document Description</title>
                        <type>d:text</type>                         
                </property> 

                <property name="hr:ReimbursmentDate">
                        <title>Reimbursment Date</title>
                        <type>d:text</type>                         
                </property> 

            </properties>

        </type>

        <type name="hr:hrMISCELLANEOUS">
            <title>MISCELLANEOUS</title>
            <parent>hr:hrdoctype</parent>   

            <properties>
                <property name="hr:DocumentDescription1">
                        <title>Document Description</title>
                        <type>d:text</type>                         
                </property> 

            </properties>

        </type>
</types>                
2
  • It looks like you've pasted in a snippet of Share configuration. What we need to see is your content model XML to show that each of those types really is a sub-type of hr:hrdoctype. Commented Oct 7, 2016 at 13:11
  • @Jeff Potts I have Edited my question, and added sample snipet of my custom content model. Please check it once. Thanks in advance. Commented Oct 13, 2016 at 7:32

1 Answer 1

3

I just tested simillar case on my repository.

There are four base CMIS types: cmis:document, cmis:folder, cmis:relationship, cmis:policy. Types cmis:document and cmis:folder must be supported by any repository.

I my case the myc:xyz type inherits from the cmis:folder type.

  1. CMIS query selecting all folders:

    select * from cmis:folder where cmis:name='ABCD'
    

    returns folder:

    {
        "cmis:objectId": "5b97929c-553b-4494-91cc-2c18e50b2f1c",
        "cmis:objectTypeId": "F:myc:xyz",
        "cmis:baseTypeId": "cmis:folder",
        "cmis:name": "ABCD"
    }
    
  2. CMIS query selecting all myc:xyz folders:

    select * from myc:xyz where cmis:name='ABCD'
    

    return the same folder with some myc:xyz type's additional properties:

    {
        "cmis:objectId": "5b97929c-553b-4494-91cc-2c18e50b2f1c",
        "cmis:objectTypeId": "F:myc:xyz",
        "cmis:baseTypeId": "cmis:folder",
        "cmis:name": "ABCD",
    
        "myc:AdditionalProperty1": "1111",
        "myc:AdditionalProperty2": "2222"
    }
    

Hope this helps.

OpenCMIS Client API Developer's Guide

PS. You can test queries with Alfresco CMIS 1.1 "The Browser binding". For example, this is URL for the query select * from cmis:folder where cmis:name='ABCD' (Firefox automatically decoding encoded parameters in URL, it is very comfortable):

http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/?cmisselector=query&succinct=true&q=select * from cmis:folder where cmis:name='ABCD'
Sign up to request clarification or add additional context in comments.

6 Comments

I wrote the query, select * from cmis:document, But Its giving Some Unnecessary fileslike ftl, xml and js. Here my requirement is, I have 72 custom types of documents. and I want node reference of only those 72 types using Single parent type.
Try this one, it should be working: select cmis:name, cmis:objectTypeId, cmis:baseTypeId from hr:hrdoctype
In my Application, After query it returns only first 100 records from repository. So how can i get more than 100 records??
use parameters: &maxItems=10&skipCount=20
Where do i use this parameter?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.