1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
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 | |
|
26 | |
|
27 | |
|
28 | |
public class SearchCriteriaWriter extends XmlWriter { |
29 | |
|
30 | |
private SearchCriteria searchCriteria; |
31 | |
|
32 | |
public SearchCriteriaWriter(PrintStream out, int indent, |
33 | |
SearchCriteria searchCriteria) { |
34 | 0 | super(out, indent); |
35 | 0 | this.searchCriteria = searchCriteria; |
36 | 0 | } |
37 | |
|
38 | |
public void write() { |
39 | |
|
40 | 0 | println(""); |
41 | 0 | indentPrint("<search:searchCriteriaTypeInfo"); |
42 | |
|
43 | 0 | writeAttribute("id", searchCriteria.getKey()); |
44 | 0 | println(">"); |
45 | 0 | incrementIndent(); |
46 | |
|
47 | |
|
48 | 0 | writeComment(searchCriteria.getComments()); |
49 | |
|
50 | 0 | writeTag("search:name", searchCriteria.getName()); |
51 | 0 | writeTag("search:desc", searchCriteria.getDescription()); |
52 | 0 | indentPrintln("<search:queryParams>"); |
53 | 0 | incrementIndent(); |
54 | 0 | for (SearchCriteriaParameter col : searchCriteria.getParameters()) { |
55 | 0 | indentPrintln(calcRefBean(col.getKey())); |
56 | |
} |
57 | 0 | decrementIndent(); |
58 | 0 | indentPrintln("</search:queryParams>"); |
59 | |
|
60 | 0 | indentPrintln("</search:searchCriteriaTypeInfo>"); |
61 | 0 | decrementIndent(); |
62 | 0 | } |
63 | |
|
64 | |
private String calcRefBean(String id) { |
65 | 0 | return "<ref bean=\"" + id + "\" />"; |
66 | |
} |
67 | |
} |