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