View Javadoc

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.SearchCriteriaParameter;
19  import org.kuali.student.contract.writer.XmlWriter;
20  
21  import java.io.PrintStream;
22  
23  /**
24   * Writes out a constraint in XML format.
25   * @author nwright
26   */
27  public class SearchCriteriaParameterWriter extends XmlWriter {
28  
29      private SearchCriteriaParameter parm;
30  
31      public SearchCriteriaParameterWriter(PrintStream out, int indent,
32              SearchCriteriaParameter parm) {
33          super(out, indent);
34          this.parm = parm;
35      }
36  
37      public void write() {
38          println("");
39          indentPrint("<search:queryParam");
40          //TODO: not sure what to put in the key attribute
41          incrementIndent();
42          writeAttribute("id", parm.getKey());
43          println(">");
44          incrementIndent();
45  
46          // write out comments
47          writeComment(parm.getComments());
48          indentPrintln("<dict:fieldDescriptor>");
49  
50          writeTag("dict:name", parm.getName());
51          writeTag("dict:desc", parm.getDescription());
52          writeTag("dict:dataType", parm.getDataType());
53          indentPrintln("</dict:fieldDescriptor>");
54          decrementIndent();
55          indentPrintln("</search:queryParam>");
56          decrementIndent();
57      }
58  }