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 | |
|
30 | |
private SearchType searchType; |
31 | |
|
32 | |
public SearchTypeWriter (PrintStream out, int indent, SearchType searchType) |
33 | |
{ |
34 | 0 | super (out, indent); |
35 | 0 | this.searchType = searchType; |
36 | 0 | } |
37 | |
|
38 | |
public void write () |
39 | |
{ |
40 | 0 | println (""); |
41 | 0 | indentPrint ("<search:searchType"); |
42 | |
|
43 | 0 | incrementIndent (); |
44 | 0 | writeAttribute ("id", searchType.getKey ()); |
45 | 0 | println (">"); |
46 | |
|
47 | |
|
48 | 0 | writeComment (searchType.getComments ()); |
49 | |
|
50 | 0 | writeTag ("search:name", searchType.getName ()); |
51 | 0 | writeTag ("search:desc", searchType.getDescription ()); |
52 | 0 | indentPrint ("<search:searchResultTypeInfo>"); |
53 | 0 | print (calcRefBean (searchType.getSearchResult ().getKey ())); |
54 | 0 | println ("</search:searchResultTypeInfo>"); |
55 | 0 | indentPrint ("<search:searchCriteriaTypeInfo>"); |
56 | 0 | print (calcRefBean (searchType.getSearchCriteria ().getKey ())); |
57 | 0 | println ("</search:searchCriteriaTypeInfo>"); |
58 | |
|
59 | |
|
60 | 0 | indentPrintln ("</search:searchType>"); |
61 | 0 | decrementIndent (); |
62 | 0 | } |
63 | |
|
64 | |
private String calcRefBean (String id) |
65 | |
{ |
66 | 0 | return "<ref bean=\"" + id + "\" />"; |
67 | |
} |
68 | |
} |