View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   package org.kuali.student.contract.model.util;
6   
7   import java.io.PrintStream;
8   
9   import org.kuali.student.contract.model.MessageStructure;
10  
11  /**
12   *
13   * @author nwright
14   */
15  public class MessageStructureDumper {
16  
17      private MessageStructure messageStructure;
18      private PrintStream out;
19  
20      public MessageStructureDumper(MessageStructure messageStructure,
21              PrintStream out) {
22          this.messageStructure = messageStructure;
23          this.out = out;
24      }
25  
26      public void dump() {
27          out.println(
28                  messageStructure.getXmlObject() + "." + messageStructure.getShortName()
29                  + " - " + messageStructure.getName() + " - " + messageStructure.getType()
30                  + " http:XXX" + messageStructure.getUrl() + " - " + messageStructure.getDescription());
31      }
32  
33      public void writeTabbedHeader() {
34          out.print("id");
35          out.print("\t");
36          out.print("Action");
37          out.print("\t");
38          out.print("xmlObject");
39          out.print("\t");
40          out.print("ShortName");
41          out.print("\t");
42          out.print("Name");
43          out.print("\t");
44          out.print("Type");
45          out.print("\t");
46          out.print("Description");
47          out.print("\t");
48          out.print("Required");
49          out.print("\t");
50          out.print("Cardinality");
51          out.print("\t");
52          out.print("XMLAttribute");
53          out.print("\t");
54          out.print("Status");
55          out.print("\t");
56          out.print("Feedback");
57          out.println("");
58      }
59  
60      private String clean(String str) {
61          str = str.replace("\n", " ");
62          str = str.replace("\t", " ");
63          str = str.replace("\r", str);
64          str = str.replace("\f", " ");
65          return str;
66      }
67  
68      public void writeTabbedData() {
69          out.print(messageStructure.getId());
70          out.print("\t");
71          out.print("");
72          out.print("\t");
73          out.print(messageStructure.getXmlObject());
74          out.print("\t");
75          out.print(messageStructure.getShortName());
76          out.print("\t");
77          out.print(messageStructure.getName());
78          out.print("\t");
79          out.print(messageStructure.getType());
80          out.print("\t");
81          out.print(clean(messageStructure.getDescription()));
82          out.print("\t");
83          out.print(messageStructure.getRequired());
84          out.print("\t");
85          out.print(messageStructure.getCardinality());
86          out.print("\t");
87          out.print(messageStructure.getXmlAttribute());
88          out.print("\t");
89          out.print(messageStructure.getStatus());
90          out.print("\t");
91          out.print(messageStructure.getImplNotes());
92          out.println("");
93      }
94  }