In the spec we should have standardized property query names, in the
same way that we did for standard object types. This would avoid these
contortions for standard properties.
I opened http://tools.oasis-open.org/issues/browse/CMIS-658 for this.

Florent


On Sat, Jun 12, 2010 at 11:42 AM, Florian Müller <[email protected]> wrote:
> 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
>



-- 
Florent Guillaume, Director of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87

Reply via email to