chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject svn commit: r1082899 - /chemistry/site/trunk/content/java/how-to/how-to-process-query.mdtext
Date Fri, 18 Mar 2011 13:04:52 GMT
Author: jens
Date: Fri Mar 18 13:04:52 2011
New Revision: 1082899

add one more section to test failing page


Modified: chemistry/site/trunk/content/java/how-to/how-to-process-query.mdtext
--- chemistry/site/trunk/content/java/how-to/how-to-process-query.mdtext (original)
+++ chemistry/site/trunk/content/java/how-to/how-to-process-query.mdtext Fri Mar 18 13:04:52
@@ -80,3 +80,46 @@ Note: There is currently no predefined w
 you need to support JOINS you have to build your own walker for this part
 as outlined in the previous section.
+## Using QueryObject
+The class `QueryObject` provides all the basic functionality for resolving
+types and properties and performs common validation tasks. The `QueryObject`
+processes the `SELECT` and `FROM` parts as well as all property references from
+the `WHERE` part. It maintains a list of Java objects and interface that you
+can use to access the property and type definitions given your current
+position in the statement. For an example refer to the class
+`StoreManagerImpl` of the InMemory Server and method `query()`.
+To be able to use this object `QueryObj` needs to get access to the types contained in your
+repository. For this purpose you need to pass an interface to a `TypeManager`
+as input parameter. The second parameter is your query walker implementing
+`IQueryConditionProcessor`. Your code will typically look like this:
+    :::java
+    TypeManager tm = new MyTypeManager(); // implements interface TypeManager
+    IQueryConditionProcessor myWalker = new MyWalker();
+                             // implements interface IQueryConditionProcessor
+                             // or extends AbstractQueryConditionProcessor
+    queryObj = new QueryObject(tm, myWalker);
+`queryObj` then will process the statement and call the interface methods of
+your walker:
+    :::java
+    try {
+        CmisQueryWalker walker = QueryObject.getWalker(statement);
+        walker.query(queryObj);
+    } catch (RecognitionException e) {
+        throw new RuntimeException("Walking of statement failed with RecognitionException
error:\n " + e);
+    } catch (Exception e) {
+        throw new RuntimeException("Walking of statement failed with exception:\n " + e);
+    }
+After this method returns you may for example ask your walker object
+`myWalker` for the generated SQL string.

View raw message