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 | |
private ServiceMethod method; |
20 | |
private PrintStream out; |
21 | |
|
22 | 0 | public ServiceMethodDumper(ServiceMethod method, PrintStream out) { |
23 | 0 | this.method = method; |
24 | 0 | this.out = out; |
25 | 0 | } |
26 | |
|
27 | |
public void dump() { |
28 | 0 | out.println(method.getService() + "." + method.getName() + " - " + method.getDescription()); |
29 | 0 | for (ServiceMethodParameter param : method.getParameters()) { |
30 | 0 | out.println(" Param: " + param.getName() + " (" + param.getType() + ") " + param.getDescription() + " http://XXX" + param.getUrl()); |
31 | |
} |
32 | 0 | for (ServiceMethodError param : method.getErrors()) { |
33 | 0 | out.println(" Error: " + param.getType() + " - " + param.getDescription()); |
34 | |
} |
35 | 0 | out.println(" return: " + method.getReturnValue().getType() + " - " + method.getReturnValue(). |
36 | |
getDescription() + " http://XXX" + method.getReturnValue().getUrl()); |
37 | 0 | } |
38 | |
|
39 | |
public void writeTabbedHeader() { |
40 | 0 | out.print("Service"); |
41 | 0 | out.print("\t"); |
42 | 0 | out.print("Key"); |
43 | 0 | out.print("\t"); |
44 | 0 | out.print("ShortName"); |
45 | 0 | out.print("\t"); |
46 | 0 | out.print("LongName"); |
47 | 0 | out.print("\t"); |
48 | 0 | out.print("Description"); |
49 | 0 | out.print("\t"); |
50 | 0 | out.print("url"); |
51 | 0 | out.println(""); |
52 | 0 | } |
53 | |
|
54 | |
public void writeTabbedData() { |
55 | 0 | out.print(method.getService()); |
56 | 0 | out.print("\t"); |
57 | 0 | out.print("Method"); |
58 | 0 | out.print("\t"); |
59 | 0 | out.print(method.getName()); |
60 | 0 | out.print("\t"); |
61 | 0 | out.print(""); |
62 | 0 | out.print("\t"); |
63 | 0 | out.print(""); |
64 | 0 | out.print("\t"); |
65 | 0 | out.print(method.getUrl()); |
66 | 0 | out.println(); |
67 | |
|
68 | 0 | out.print(method.getService()); |
69 | 0 | out.print("\t"); |
70 | 0 | out.print("Description"); |
71 | 0 | out.print("\t"); |
72 | 0 | out.print(method.getDescription()); |
73 | 0 | out.print("\t"); |
74 | 0 | out.print(""); |
75 | 0 | out.println(); |
76 | 0 | if (method.getParameters().size() == 0) { |
77 | 0 | out.print(method.getService()); |
78 | 0 | out.print("\t"); |
79 | 0 | out.print("Parameters"); |
80 | 0 | out.print("\t"); |
81 | 0 | out.print("None"); |
82 | 0 | out.print("\t"); |
83 | 0 | out.print("None"); |
84 | 0 | out.print("\t"); |
85 | 0 | out.print("No parameters"); |
86 | 0 | out.print("\t"); |
87 | 0 | out.print(""); |
88 | 0 | out.println(); |
89 | |
} else { |
90 | 0 | String parameters = "Parameters"; |
91 | 0 | for (ServiceMethodParameter param : method.getParameters()) { |
92 | 0 | out.print(method.getService()); |
93 | 0 | out.print("\t"); |
94 | 0 | out.print(parameters); |
95 | 0 | parameters = ""; |
96 | 0 | out.print("\t"); |
97 | 0 | out.print(param.getType()); |
98 | 0 | out.print("\t"); |
99 | 0 | out.print(param.getName()); |
100 | 0 | out.print("\t"); |
101 | 0 | out.print(param.getDescription()); |
102 | 0 | out.print("\t"); |
103 | 0 | out.print(param.getUrl()); |
104 | 0 | out.println(); |
105 | |
} |
106 | |
} |
107 | |
|
108 | 0 | out.print(method.getService()); |
109 | 0 | out.print("\t"); |
110 | 0 | out.print("Return"); |
111 | 0 | out.print("\t"); |
112 | 0 | out.print(method.getReturnValue().getType()); |
113 | 0 | out.print("\t"); |
114 | 0 | out.print(method.getReturnValue().getDescription()); |
115 | 0 | out.print("\t"); |
116 | 0 | out.print(""); |
117 | 0 | out.print("\t"); |
118 | 0 | out.print(method.getReturnValue().getUrl()); |
119 | 0 | out.println(); |
120 | |
|
121 | 0 | String errors = "Errors"; |
122 | 0 | for (ServiceMethodError error : method.getErrors()) { |
123 | 0 | out.print(method.getService()); |
124 | 0 | out.print("\t"); |
125 | 0 | out.print(errors); |
126 | 0 | errors = ""; |
127 | 0 | out.print("\t"); |
128 | 0 | out.print(error.getType()); |
129 | 0 | out.print("\t"); |
130 | 0 | out.print(error.getDescription()); |
131 | 0 | out.print("\t"); |
132 | 0 | out.print(""); |
133 | 0 | out.print("\t"); |
134 | 0 | out.print(""); |
135 | 0 | out.println(); |
136 | |
} |
137 | |
|
138 | 0 | out.print(method.getService()); |
139 | 0 | out.print("\t"); |
140 | 0 | out.print("Capabilities"); |
141 | 0 | out.print("\t"); |
142 | 0 | out.print(""); |
143 | 0 | out.print("\t"); |
144 | 0 | out.print(""); |
145 | 0 | out.print("\t"); |
146 | 0 | out.print(""); |
147 | 0 | out.print("\t"); |
148 | 0 | out.print(""); |
149 | 0 | out.println(); |
150 | |
|
151 | 0 | out.print(method.getService()); |
152 | 0 | out.print("\t"); |
153 | 0 | out.print("Use Cases"); |
154 | 0 | out.print("\t"); |
155 | 0 | out.print(""); |
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.println(); |
163 | |
|
164 | 0 | out.print(method.getService()); |
165 | 0 | out.print("\t"); |
166 | 0 | out.print("Comments/Feedback"); |
167 | 0 | out.print("\t"); |
168 | 0 | out.print(""); |
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.println(); |
176 | 0 | } |
177 | |
} |