chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1444699 - /chemistry/opencmis/trunk/chemistry-opencmis-samples/chemistry-opencmis-queryparser/src/main/java/org/apache/chemistry/opencmis/query/example/ExampleQueryProcessor.java
Date Mon, 11 Feb 2013 09:55:55 GMT
Author: jens
Date: Mon Feb 11 09:55:55 2013
New Revision: 1444699

URL: http://svn.apache.org/r1444699
Log:
Query Parser example: add some inline comments

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-samples/chemistry-opencmis-queryparser/src/main/java/org/apache/chemistry/opencmis/query/example/ExampleQueryProcessor.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-samples/chemistry-opencmis-queryparser/src/main/java/org/apache/chemistry/opencmis/query/example/ExampleQueryProcessor.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-samples/chemistry-opencmis-queryparser/src/main/java/org/apache/chemistry/opencmis/query/example/ExampleQueryProcessor.java?rev=1444699&r1=1444698&r2=1444699&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-samples/chemistry-opencmis-queryparser/src/main/java/org/apache/chemistry/opencmis/query/example/ExampleQueryProcessor.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-samples/chemistry-opencmis-queryparser/src/main/java/org/apache/chemistry/opencmis/query/example/ExampleQueryProcessor.java
Mon Feb 11 09:55:55 2013
@@ -49,23 +49,35 @@ public class ExampleQueryProcessor {
     
     public String parseQuery(String queryString) {
         StringBuffer generatedResponse = new StringBuffer();
+        
+        // Instantiate a walker traversing the WHERE clause and generating the output string
         ExampleQueryWalker walker = new ExampleQueryWalker();
 
         // create type definitions, for this example we just create cmis:document
         TypeManager typeManager = ExampleTypeManager.getInstance();
 
+        // create the parser helper class with type manager and walker
         QueryUtilStrict queryUtil= new QueryUtilStrict(queryString, typeManager, walker);
         try {
+            // parse the statement, then traverse it using out query walker
             queryUtil.processStatement();
             
             QueryObject qo = queryUtil.getQueryObject();
+            
+            // The SELECT and FROM part is handled in the QueryObject, we just need to retrieve
+            // the results, and generte the SELECT string
             String selFromPart = getSelectFromString(qo);
             generatedResponse.append(selFromPart);
             
+            // get the generated string from our query walker and append it
             String whereClause = walker.getResult();
             generatedResponse.append(whereClause);
+            
+            // The ORDER BY part is handled in the QueryObject, we just need to retrieve
+            // the results, and generte the ORDER BY string
             generatedResponse.append(getOrderBy(qo));
             
+            // Finally we have the full statement and return is as result
             return generatedResponse.toString();
             
         } catch (RecognitionException e) {



Mime
View raw message