Chemistry
  1. Chemistry
  2. CMIS-480

Create an alternative version of Query that returns ItemIterable<CmisObject>

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: OpenCMIS 0.6.0
    • Fix Version/s: OpenCMIS 0.6.0
    • Component/s: opencmis-client
    • Labels:
      None
    • Environment:

      n/a

      Description

      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.

        Activity

        jay brown created issue -
        Florian Müller made changes -
        Field Original Value New Value
        Assignee Florian Müller [ fmui ]
        Hide
        jay brown added a comment -

        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.

        Show
        jay brown added a comment - 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.
        Hide
        jay brown added a comment -

        Just cleaning up some old issues that were already resolved.

        Show
        jay brown added a comment - Just cleaning up some old issues that were already resolved.
        jay brown made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s OpenCMIS 0.6.0 [ 12317858 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Florian Müller
            Reporter:
            jay brown
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development