Coverage Report - org.kuali.student.contract.writer.search.SearchResultWriter
 
Classes in this File Line Coverage Branch Coverage Complexity
SearchResultWriter
0%
0/21
0%
0/2
1.333
 
 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.SearchResult;
 19  
 import org.kuali.student.contract.model.SearchResultColumn;
 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 SearchResultWriter extends XmlWriter
 29  
 {
 30  
 
 31  
  private SearchResult searchResult;
 32  
 
 33  
  public SearchResultWriter (PrintStream out, int indent,
 34  
                             SearchResult searchResult)
 35  
  {
 36  0
   super (out, indent);
 37  0
   this.searchResult = searchResult;
 38  0
  }
 39  
 
 40  
  public void write ()
 41  
  {
 42  
 
 43  0
   println ("");
 44  0
   indentPrint ("<search:searchResultTypeInfo");
 45  
   //TODO: not sure what to put in the key attribute
 46  0
   writeAttribute ("id", searchResult.getKey ());
 47  0
   println (">");
 48  0
   incrementIndent ();
 49  
   // write out comments
 50  0
   writeComment (searchResult.getComments ());
 51  
 
 52  0
   writeTag ("search:name", searchResult.getName ());
 53  0
   writeTag ("search:desc", searchResult.getDescription ());
 54  0
   indentPrintln ("<search:resultColumns>");
 55  0
   incrementIndent ();
 56  0
   for (SearchResultColumn col : searchResult.getResultColumns ())
 57  
   {
 58  0
    indentPrintln (calcRefBean (col.getKey ()));
 59  
   }
 60  0
   decrementIndent ();
 61  0
   indentPrintln ("</search:resultColumns>");
 62  0
   indentPrintln ("</search:searchResultTypeInfo>");
 63  0
   decrementIndent ();
 64  0
  }
 65  
 
 66  
  private String calcRefBean (String id)
 67  
  {
 68  0
   return "<ref bean=\"" + id + "\" />";
 69  
  }
 70  
 
 71  
 }