Hi Aaron,

I've added a section to the OpenCMIS cookbook that hopefully answers your 
question. [1]

Please note that the code snippet in the cookbook is the save way that should 
work with all CMIS repositories. 
If you know that your repository always returns property ids in the query 
results (which is not mandatory), you can simplify the code. In this case, you 
don't need to determine the query name of the object id. You can get the object 
id with this line of code:

String objectId = qResult.getPropertyValueById(PropertyIds.OBJECT_ID);


- Florian


[1] 
https://cwiki.apache.org/CMIS/opencmis-cookbook.html#OpenCMISCookbook-RetrievingDocumentobjectsfromqueryresults

-----Original Message-----
From: Aaron Korver [mailto:[email protected]] 
Sent: Samstag, 12. Juni 2010 00:13
To: [email protected]
Subject: Best way to create a Document from a QueryResult?

 See the below code.  Note that tcg:contract is my own custom type that
extends the cmis:document with a few added properties.
        String queryString = "SELECT * FROM tcg:contract";
        ItemIterable<QueryResult> results = session.query(queryString,
false);

        assertEquals(1, results.getTotalNumItems());
        for(QueryResult qResult: results)
        {
            //How do I get Documents from QueryResult?
        }

Thanks,
Aaron Korver

Reply via email to