You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by "jay brown (Commented) (JIRA)" <ji...@apache.org> on 2011/12/02 00:22:40 UTC

[jira] [Commented] (CMIS-480) Create an alternative version of Query that returns ItemIterable

    [ https://issues.apache.org/jira/browse/CMIS-480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13161287#comment-13161287 ] 

jay brown commented on CMIS-480:
--------------------------------

Just grabbed the snapshot build with this change in it and tested with some simple code like this:

appended to hello.java sample code: (and pointing to a p8 cmis repository)

        OperationContext operationContext = new OperationContextImpl();
		operationContext.setCacheEnabled(true);
        // use new query objects to obtain just documents in the root folder
        ItemIterable<CmisObject> docsInRoot = session.queryObjects("cmis:document", " IN_FOLDER('" + root.getId() + "')", true, operationContext);
 
        System.out.println("Found the following docs in the root folder:-");
        for (CmisObject doc : docsInRoot) {
            System.out.println(doc.getName());
        }
            
        ItemIterable<CmisObject> foldersInRoot = session.queryObjects("cmis:folder", " IN_FOLDER('" + root.getId() + "')", true, operationContext);
        
        System.out.println("Found the following folders in the root folder:-");
        for (CmisObject folder : foldersInRoot) {
            System.out.println(folder.getName());
        }

And it works perfectly and is very fast.   This is an extremely efficient way to get just the documents (for example) in a folder - as objects.  
                
> Create an alternative version of Query that returns ItemIterable<CmisObject>
> ----------------------------------------------------------------------------
>
>                 Key: CMIS-480
>                 URL: https://issues.apache.org/jira/browse/CMIS-480
>             Project: Chemistry
>          Issue Type: New Feature
>          Components: opencmis-client
>    Affects Versions: OpenCMIS 0.6.0
>         Environment: n/a
>            Reporter: jay brown
>            Assignee: Florian Müller
>
> Add one alternative Query method that returns  ItemIterable<CmisObject> to augment the current version that returns an iterator of QueryResult.  Perhaps we could call it QueryObjects(...)
> This would allow creation of complex queries where the objects contained in the result set would not then have to be individually retrieved before they are used in other Chemistry methods that require native CmisObject to operate. 
> I understand this would be giving some folks a lot of rope, since they could create queries that would not naturally map to CmisObjects.  If they did that then the resulting objects would just be incomplete and might not work as normal.  That is just a normal constraint on the function.     I would expect that this function might actually get as much use (or more) than the legacy query - eventually. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira