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.SearchType; |
19 | |
import org.kuali.student.contract.writer.XmlWriter; |
20 | |
|
21 | |
import java.io.PrintStream; |
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
public class SearchTypeWriter extends XmlWriter { |
28 | |
|
29 | |
private SearchType searchType; |
30 | |
|
31 | |
public SearchTypeWriter(PrintStream out, int indent, SearchType searchType) { |
32 | 0 | super(out, indent); |
33 | 0 | this.searchType = searchType; |
34 | 0 | } |
35 | |
|
36 | |
public void write() { |
37 | 0 | println(""); |
38 | 0 | indentPrint("<search:searchType"); |
39 | |
|
40 | 0 | incrementIndent(); |
41 | 0 | writeAttribute("id", searchType.getKey()); |
42 | 0 | println(">"); |
43 | |
|
44 | |
|
45 | 0 | writeComment(searchType.getComments()); |
46 | |
|
47 | 0 | writeTag("search:name", searchType.getName()); |
48 | 0 | writeTag("search:desc", searchType.getDescription()); |
49 | 0 | indentPrint("<search:searchResultTypeInfo>"); |
50 | 0 | print(calcRefBean(searchType.getSearchResult().getKey())); |
51 | 0 | println("</search:searchResultTypeInfo>"); |
52 | 0 | indentPrint("<search:searchCriteriaTypeInfo>"); |
53 | 0 | print(calcRefBean(searchType.getSearchCriteria().getKey())); |
54 | 0 | println("</search:searchCriteriaTypeInfo>"); |
55 | |
|
56 | |
|
57 | 0 | indentPrintln("</search:searchType>"); |
58 | 0 | decrementIndent(); |
59 | 0 | } |
60 | |
|
61 | |
private String calcRefBean(String id) { |
62 | 0 | return "<ref bean=\"" + id + "\" />"; |
63 | |
} |
64 | |
} |