chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian Müller <fmuel...@opentext.com>
Subject RE: Best way to create a Document from a QueryResult?
Date Sat, 12 Jun 2010 09:42:34 GMT
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:aaron.korver@gmail.com] 
Sent: Samstag, 12. Juni 2010 00:13
To: chemistry-dev@incubator.apache.org
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

Mime
View raw message