Clover Coverage Report - KS Contract Documentation Generator 0.0.1-SNAPSHOT
Coverage timestamp: Wed Dec 31 1969 19:00:00 EST
../../../../../../img/srcFileCovDistChart0.png 0% of files have more coverage
19   73   3   6.33
0   40   0.16   3
3     1  
1    
 
  SearchCriteriaWriter       Line # 28 19 0% 3 22 0% 0.0
 
No Tests
 
1    /*
2    * Copyright 2009 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.osedu.org/licenses/ECL-2.0
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an "AS IS" BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
15    */
16    package org.kuali.student.contract.writer.search;
17   
18    import org.kuali.student.contract.model.SearchCriteria;
19    import org.kuali.student.contract.model.SearchCriteriaParameter;
20    import org.kuali.student.contract.writer.XmlWriter;
21   
22    import java.io.PrintStream;
23   
24    /**
25    * Writes out a constraint in XML format.
26    * @author nwright
27    */
 
28    public class SearchCriteriaWriter extends XmlWriter
29    {
30   
31    private SearchCriteria searchCriteria;
32   
 
33  0 toggle public SearchCriteriaWriter (PrintStream out, int indent,
34    SearchCriteria searchCriteria)
35    {
36  0 super (out, indent);
37  0 this.searchCriteria = searchCriteria;
38    }
39   
 
40  0 toggle public void write ()
41    {
42   
43  0 println ("");
44  0 indentPrint ("<search:searchCriteriaTypeInfo");
45    //TODO: not sure what to put in the key attribute
46  0 writeAttribute ("id", searchCriteria.getKey ());
47  0 println (">");
48  0 incrementIndent ();
49   
50    // write out comments
51  0 writeComment (searchCriteria.getComments ());
52   
53  0 writeTag ("search:name", searchCriteria.getName ());
54  0 writeTag ("search:desc", searchCriteria.getDescription ());
55  0 indentPrintln ("<search:queryParams>");
56  0 incrementIndent ();
57  0 for (SearchCriteriaParameter col : searchCriteria.getParameters ())
58    {
59  0 indentPrintln (calcRefBean (col.getKey ()));
60    }
61  0 decrementIndent ();
62  0 indentPrintln ("</search:queryParams>");
63    // end
64  0 indentPrintln ("</search:searchCriteriaTypeInfo>");
65  0 decrementIndent ();
66    }
67   
 
68  0 toggle private String calcRefBean (String id)
69    {
70  0 return "<ref bean=\"" + id + "\" />";
71    }
72   
73    }