001 /* 002 * To change this template, choose Tools | Templates 003 * and open the template in the editor. 004 */ 005 package org.kuali.student.contract.model.util; 006 007 import java.io.PrintStream; 008 009 import org.kuali.student.contract.model.MessageStructure; 010 011 /** 012 * 013 * @author nwright 014 */ 015 public class MessageStructureDumper { 016 017 private MessageStructure messageStructure; 018 private PrintStream out; 019 020 public MessageStructureDumper(MessageStructure messageStructure, 021 PrintStream out) { 022 this.messageStructure = messageStructure; 023 this.out = out; 024 } 025 026 public void dump() { 027 out.println( 028 messageStructure.getXmlObject() + "." + messageStructure.getShortName() 029 + " - " + messageStructure.getName() + " - " + messageStructure.getType() 030 + " http:XXX" + messageStructure.getUrl() + " - " + messageStructure.getDescription()); 031 } 032 033 public void writeTabbedHeader() { 034 out.print("id"); 035 out.print("\t"); 036 out.print("Action"); 037 out.print("\t"); 038 out.print("xmlObject"); 039 out.print("\t"); 040 out.print("ShortName"); 041 out.print("\t"); 042 out.print("Name"); 043 out.print("\t"); 044 out.print("Type"); 045 out.print("\t"); 046 out.print("Description"); 047 out.print("\t"); 048 out.print("Required"); 049 out.print("\t"); 050 out.print("Cardinality"); 051 out.print("\t"); 052 out.print("XMLAttribute"); 053 out.print("\t"); 054 out.print("Status"); 055 out.print("\t"); 056 out.print("Feedback"); 057 out.println(""); 058 } 059 060 private String clean(String str) { 061 str = str.replace("\n", " "); 062 str = str.replace("\t", " "); 063 str = str.replace("\r", str); 064 str = str.replace("\f", " "); 065 return str; 066 } 067 068 public void writeTabbedData() { 069 out.print(messageStructure.getId()); 070 out.print("\t"); 071 out.print(""); 072 out.print("\t"); 073 out.print(messageStructure.getXmlObject()); 074 out.print("\t"); 075 out.print(messageStructure.getShortName()); 076 out.print("\t"); 077 out.print(messageStructure.getName()); 078 out.print("\t"); 079 out.print(messageStructure.getType()); 080 out.print("\t"); 081 out.print(clean(messageStructure.getDescription())); 082 out.print("\t"); 083 out.print(messageStructure.getRequired()); 084 out.print("\t"); 085 out.print(messageStructure.getCardinality()); 086 out.print("\t"); 087 out.print(messageStructure.getXmlAttribute()); 088 out.print("\t"); 089 out.print(messageStructure.getStatus()); 090 out.print("\t"); 091 out.print(messageStructure.getImplNotes()); 092 out.println(""); 093 } 094 }