1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
package org.kuali.student.contract.model.util; |
6 | |
|
7 | |
import java.io.PrintStream; |
8 | |
|
9 | |
import org.kuali.student.contract.model.ServiceMethod; |
10 | |
import org.kuali.student.contract.model.ServiceMethodError; |
11 | |
import org.kuali.student.contract.model.ServiceMethodParameter; |
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
public class ServiceMethodDumper |
18 | |
{ |
19 | |
|
20 | |
private ServiceMethod method; |
21 | |
private PrintStream out; |
22 | |
|
23 | |
public ServiceMethodDumper (ServiceMethod method, PrintStream out) |
24 | 0 | { |
25 | 0 | this.method = method; |
26 | 0 | this.out = out; |
27 | 0 | } |
28 | |
|
29 | |
public void dump () |
30 | |
{ |
31 | 0 | out.println (method.getService () + "." + method.getName () + " - " + method. |
32 | |
getDescription ()); |
33 | 0 | for (ServiceMethodParameter param : method.getParameters ()) |
34 | |
{ |
35 | 0 | out.println (" Param: " + param.getName () + " (" + param.getType () + ") " + param. |
36 | |
getDescription () + " http://XXX" + param.getUrl ()); |
37 | |
} |
38 | 0 | for (ServiceMethodError param : method.getErrors ()) |
39 | |
{ |
40 | 0 | out.println (" Error: " + param.getType () + " - " + param.getDescription ()); |
41 | |
} |
42 | 0 | out.println (" return: " + method.getReturnValue ().getType () + " - " + method. |
43 | |
getReturnValue (). |
44 | |
getDescription () + " http://XXX" + method.getReturnValue ().getUrl ()); |
45 | 0 | } |
46 | |
|
47 | |
public void writeTabbedHeader () |
48 | |
{ |
49 | 0 | out.print ("Service"); |
50 | 0 | out.print ("\t"); |
51 | 0 | out.print ("Key"); |
52 | 0 | out.print ("\t"); |
53 | 0 | out.print ("ShortName"); |
54 | 0 | out.print ("\t"); |
55 | 0 | out.print ("LongName"); |
56 | 0 | out.print ("\t"); |
57 | 0 | out.print ("Description"); |
58 | 0 | out.print ("\t"); |
59 | 0 | out.print ("url"); |
60 | 0 | out.println (""); |
61 | 0 | } |
62 | |
|
63 | |
public void writeTabbedData () |
64 | |
{ |
65 | 0 | out.print (method.getService ()); |
66 | 0 | out.print ("\t"); |
67 | 0 | out.print ("Method"); |
68 | 0 | out.print ("\t"); |
69 | 0 | out.print (method.getName ()); |
70 | 0 | out.print ("\t"); |
71 | 0 | out.print (""); |
72 | 0 | out.print ("\t"); |
73 | 0 | out.print (""); |
74 | 0 | out.print ("\t"); |
75 | 0 | out.print (method.getUrl ()); |
76 | 0 | out.println (); |
77 | |
|
78 | 0 | out.print (method.getService ()); |
79 | 0 | out.print ("\t"); |
80 | 0 | out.print ("Description"); |
81 | 0 | out.print ("\t"); |
82 | 0 | out.print (method.getDescription ()); |
83 | 0 | out.print ("\t"); |
84 | 0 | out.print (""); |
85 | 0 | out.println (); |
86 | 0 | if (method.getParameters ().size () == 0) |
87 | |
{ |
88 | 0 | out.print (method.getService ()); |
89 | 0 | out.print ("\t"); |
90 | 0 | out.print ("Parameters"); |
91 | 0 | out.print ("\t"); |
92 | 0 | out.print ("None"); |
93 | 0 | out.print ("\t"); |
94 | 0 | out.print ("None"); |
95 | 0 | out.print ("\t"); |
96 | 0 | out.print ("No parameters"); |
97 | 0 | out.print ("\t"); |
98 | 0 | out.print (""); |
99 | 0 | out.println (); |
100 | |
} |
101 | |
else |
102 | |
{ |
103 | 0 | String parameters = "Parameters"; |
104 | 0 | for (ServiceMethodParameter param : method.getParameters ()) |
105 | |
{ |
106 | 0 | out.print (method.getService ()); |
107 | 0 | out.print ("\t"); |
108 | 0 | out.print (parameters); |
109 | 0 | parameters = ""; |
110 | 0 | out.print ("\t"); |
111 | 0 | out.print (param.getType ()); |
112 | 0 | out.print ("\t"); |
113 | 0 | out.print (param.getName ()); |
114 | 0 | out.print ("\t"); |
115 | 0 | out.print (param.getDescription ()); |
116 | 0 | out.print ("\t"); |
117 | 0 | out.print (param.getUrl ()); |
118 | 0 | out.println (); |
119 | |
} |
120 | |
} |
121 | |
|
122 | 0 | out.print (method.getService ()); |
123 | 0 | out.print ("\t"); |
124 | 0 | out.print ("Return"); |
125 | 0 | out.print ("\t"); |
126 | 0 | out.print (method.getReturnValue ().getType ()); |
127 | 0 | out.print ("\t"); |
128 | 0 | out.print (method.getReturnValue ().getDescription ()); |
129 | 0 | out.print ("\t"); |
130 | 0 | out.print (""); |
131 | 0 | out.print ("\t"); |
132 | 0 | out.print (method.getReturnValue ().getUrl ()); |
133 | 0 | out.println (); |
134 | |
|
135 | 0 | String errors = "Errors"; |
136 | 0 | for (ServiceMethodError error : method.getErrors ()) |
137 | |
{ |
138 | 0 | out.print (method.getService ()); |
139 | 0 | out.print ("\t"); |
140 | 0 | out.print (errors); |
141 | 0 | errors = ""; |
142 | 0 | out.print ("\t"); |
143 | 0 | out.print (error.getType ()); |
144 | 0 | out.print ("\t"); |
145 | 0 | out.print (error.getDescription ()); |
146 | 0 | out.print ("\t"); |
147 | 0 | out.print (""); |
148 | 0 | out.print ("\t"); |
149 | 0 | out.print (""); |
150 | 0 | out.println (); |
151 | |
} |
152 | |
|
153 | 0 | out.print (method.getService ()); |
154 | 0 | out.print ("\t"); |
155 | 0 | out.print ("Capabilities"); |
156 | 0 | out.print ("\t"); |
157 | 0 | out.print (""); |
158 | 0 | out.print ("\t"); |
159 | 0 | out.print (""); |
160 | 0 | out.print ("\t"); |
161 | 0 | out.print (""); |
162 | 0 | out.print ("\t"); |
163 | 0 | out.print (""); |
164 | 0 | out.println (); |
165 | |
|
166 | 0 | out.print (method.getService ()); |
167 | 0 | out.print ("\t"); |
168 | 0 | out.print ("Use Cases"); |
169 | 0 | out.print ("\t"); |
170 | 0 | out.print (""); |
171 | 0 | out.print ("\t"); |
172 | 0 | out.print (""); |
173 | 0 | out.print ("\t"); |
174 | 0 | out.print (""); |
175 | 0 | out.print ("\t"); |
176 | 0 | out.print (""); |
177 | 0 | out.println (); |
178 | |
|
179 | 0 | out.print (method.getService ()); |
180 | 0 | out.print ("\t"); |
181 | 0 | out.print ("Comments/Feedback"); |
182 | 0 | out.print ("\t"); |
183 | 0 | out.print (""); |
184 | 0 | out.print ("\t"); |
185 | 0 | out.print (""); |
186 | 0 | out.print ("\t"); |
187 | 0 | out.print (""); |
188 | 0 | out.print ("\t"); |
189 | 0 | out.print (""); |
190 | 0 | out.println (); |
191 | 0 | } |
192 | |
|
193 | |
} |