You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2011/03/31 11:46:12 UTC

svn commit: r1087227 - /chemistry/site/trunk/content/java/examples/example-process-query-results.mdtext

Author: fmui
Date: Thu Mar 31 09:46:12 2011
New Revision: 1087227

URL: http://svn.apache.org/viewvc?rev=1087227&view=rev
Log:
added simple qurey example

Modified:
    chemistry/site/trunk/content/java/examples/example-process-query-results.mdtext

Modified: chemistry/site/trunk/content/java/examples/example-process-query-results.mdtext
URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/examples/example-process-query-results.mdtext?rev=1087227&r1=1087226&r2=1087227&view=diff
==============================================================================
--- chemistry/site/trunk/content/java/examples/example-process-query-results.mdtext (original)
+++ chemistry/site/trunk/content/java/examples/example-process-query-results.mdtext Thu Mar 31 09:46:12 2011
@@ -1,6 +1,26 @@
 Title: Perform a query 
 
-# Perform a query and process results
+# Simple query pattern
+
+This example demonstrates a simple query that selects all properties from all documents and then prints them.  
+(This query shouldn't be used in a real application. Always select only the properties and objects you need!)
+
+    :::java
+    ItemIterable<QueryResult> results = session.query("SELECT * FROM cmis:document", false);
+
+    for(QueryResult hit: results) {  
+        for(PropertyData<?> property: hit.getProperties()) {
+        
+            String queryName = property.getQueryName();
+            Object value = property.getFirstValue();
+    
+            System.out.println(queryName + ": " + value);
+        }
+        System.out.println("--------------------------------------");
+    }
+
+
+# Get document objects from a query
 
     :::java
     String myType = "my:documentType";