1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.query.xwql.internal.hql

File Printer.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart9.png
38% of files have more coverage

Code metrics

0
13
6
1
79
47
6
0.46
2.17
6
1

Classes

Class Line # Actions
Printer 27 13 0% 6 2
0.894736889.5%
 

Contributing tests

This file is covered by 12 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.query.xwql.internal.hql;
21   
22    import org.xwiki.query.xwql.internal.QueryContext;
23    import org.xwiki.query.xwql.internal.QueryContext.ObjectInfo;
24    import org.xwiki.query.xwql.internal.QueryContext.PropertyInfo;
25    import org.xwiki.bridge.DocumentAccessBridge;
26   
 
27    public class Printer
28    {
29    QueryContext context;
30   
31    XWQLtoHQLTranslator parent;
32   
33    ObjectPrinter objectPrinter = new ObjectPrinter();
34   
35    PropertyPrinter propertyPrinter = new PropertyPrinter();
36   
37    StringBuilder from = new StringBuilder();
38   
39    StringBuilder where = new StringBuilder();
40   
 
41  1032 toggle public Printer(QueryContext context, XWQLtoHQLTranslator parent)
42    {
43  1032 this.context = context;
44  1032 this.parent = parent;
45    }
46   
 
47  113 toggle QueryContext getContext()
48    {
49  113 return context;
50    }
51   
 
52  0 toggle DocumentAccessBridge getAccessBridge()
53    {
54  0 return parent.getDocumentAccessBridge();
55    }
56   
 
57  396 toggle public ObjectPrinter getObjectPrinter()
58    {
59  396 return objectPrinter;
60    }
61   
 
62  149 toggle public PropertyPrinter getPropertyPrinter()
63    {
64  149 return propertyPrinter;
65    }
66   
 
67  1032 toggle String print() throws Exception
68    {
69  1032 for (ObjectInfo obj : context.getObjects()) {
70  396 getObjectPrinter().print(obj, this);
71  396 for (PropertyInfo prop : obj.properties.values()) {
72  149 getPropertyPrinter().print(prop, this);
73    }
74    }
75  1032 TreePrinter treePrinter = new TreePrinter(this);
76  1032 context.getTree().apply(treePrinter);
77  1032 return treePrinter.toString();
78    }
79    }