Rev 1814 | Rev 1835 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1814 | Rev 1830 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | package pt.estgp.estgweb.web.controllers.widgetmodel; |
1 | package pt.estgp.estgweb.web.controllers.widgetmodel; |
2 | 2 | ||
3 | import jomm.dao.impl.AbstractDao; |
3 | import jomm.utils.StreamsUtils; |
4 | import org.apache.struts.action.ActionForm; |
4 | import org.apache.struts.action.ActionForm; |
5 | import org.json.JSONArray; |
5 | import org.json.JSONArray; |
6 | import org.json.JSONException; |
- | |
7 | import org.json.JSONObject; |
6 | import org.json.JSONObject; |
8 | import pt.estgp.estgweb.domain.SigesUser; |
- | |
9 | import pt.estgp.estgweb.domain.Student; |
- | |
10 | import pt.estgp.estgweb.domain.Teacher; |
7 | import pt.estgp.estgweb.utils.Globals; |
11 | import pt.estgp.estgweb.domain.User; |
- | |
12 | import pt.estgp.estgweb.domain.dao.DaoFactory; |
- | |
13 | import pt.estgp.estgweb.domain.views.UserView; |
- | |
14 | import pt.estgp.estgweb.filters.exceptions.NotFoundException; |
- | |
15 | import pt.estgp.estgweb.web.controllers.utils.AbstractWidgetAjaxController; |
8 | import pt.estgp.estgweb.web.controllers.utils.AbstractWidgetAjaxController; |
16 | import pt.estgp.estgweb.web.form.widgetmodel.WidgetModelForm; |
- | |
17 | import pt.estgp.estgweb.web.utils.RequestUtils; |
9 | import pt.estgp.estgweb.web.utils.RequestUtils; |
18 | import pt.utl.ist.berserk.logic.serviceManager.IServiceManager; |
10 | import pt.utl.ist.berserk.logic.serviceManager.IServiceManager; |
19 | import pt.utl.ist.berserk.logic.serviceManager.ServiceManager; |
11 | import pt.utl.ist.berserk.logic.serviceManager.ServiceManager; |
20 | 12 | ||
21 | import javax.servlet.http.HttpServletRequest; |
13 | import javax.servlet.http.HttpServletRequest; |
22 | import javax.servlet.http.HttpServletResponse; |
14 | import javax.servlet.http.HttpServletResponse; |
- | 15 | import java.io.InputStream; |
|
23 | import java.util.List; |
16 | import java.net.URL; |
24 | 17 | ||
25 | /** |
18 | /** |
26 | * Created by jorgemachado on 06/01/17. |
19 | * Created by jorgemachado on 06/01/17. |
27 | */ |
20 | */ |
28 | public class ModelWidgetController extends AbstractWidgetAjaxController |
21 | public class CoursesServicesWidgetController extends AbstractWidgetAjaxController |
29 | { |
22 | { |
30 | 23 | ||
31 | public JSONObject findUser(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws JSONException { |
- | |
32 | 24 | ||
33 | WidgetModelForm frm = (WidgetModelForm) form; |
- | |
34 | 1.5.0/docs/api/java/lang/String.html">String query = frm.getQ(); |
- | |
35 | 1.5.0/docs/api/java/lang/String.html">String qType = frm.getQtype(); |
- | |
36 | 25 | ||
37 | JSONObject result = new JSONObject(); |
- | |
38 | JSONArray usersArray = new JSONArray(); |
- | |
39 | result.put("results",usersArray); |
- | |
40 | - | ||
41 | if(query==null || query.trim().length() == 0) |
- | |
42 | return result; |
- | |
43 | - | ||
44 | AbstractDao.getCurrentSession().beginTransaction(); |
- | |
45 | - | ||
46 | //result.put("results",usersArray); |
- | |
47 | List<User> users; |
- | |
48 | if(qType != null && qType.length() > 0) |
- | |
49 | users = DaoFactory.getUserDaoImpl().findUsers(query,qType); |
- | |
50 | else |
- | |
51 | users = DaoFactory.getUserDaoImpl().findUsers(query); |
- | |
52 | getUsersInJson(usersArray, users); |
- | |
53 | AbstractDao.getCurrentSession().getTransaction().commit(); |
- | |
54 | return result; |
- | |
55 | } |
- | |
56 | - | ||
57 | - | ||
58 | - | ||
59 | - | ||
60 | public JSONObject getUserForUsername(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws JSONException, NotFoundException { |
- | |
61 | - | ||
62 | WidgetModelForm frm = (WidgetModelForm) form; |
- | |
63 | 1.5.0/docs/api/java/lang/String.html">String username = frm.getQ(); |
- | |
64 | - | ||
65 | JSONObject result; |
- | |
66 | - | ||
67 | AbstractDao.getCurrentSession().beginTransaction(); |
- | |
68 | - | ||
69 | // |
- | |
70 | User user = DaoFactory.getUserDaoImpl().loadByUsername(username); |
- | |
71 | if(user != null) |
- | |
72 | result = getJsonUser(user); |
- | |
73 | else |
- | |
74 | throw new NotFoundException("Username: " + username + " not found"); |
- | |
75 | AbstractDao.getCurrentSession().getTransaction().commit(); |
- | |
76 | return result; |
- | |
77 | } |
- | |
78 | - | ||
79 | - | ||
80 | - | ||
81 | - | ||
82 | public JSONObject findUserRoles(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws JSONException { |
- | |
83 | - | ||
84 | WidgetModelForm frm = (WidgetModelForm) form; |
- | |
85 | 1.5.0/docs/api/java/lang/String.html">String query = frm.getQ(); |
- | |
86 | 26 | ||
87 | JSONObject result = new JSONObject(); |
- | |
88 | JSONArray usersArray = new JSONArray(); |
- | |
89 | result.put("results",usersArray); |
- | |
90 | 27 | ||
91 | if(query==null || query.trim().length() == 0) |
- | |
92 | return result; |
- | |
93 | 28 | ||
94 | AbstractDao.getCurrentSession().beginTransaction(); |
- | |
95 | 29 | ||
96 | result.put("results",usersArray); |
- | |
97 | List<User> users = DaoFactory.getUserDaoImpl().loadRoleUsers(query); |
- | |
98 | getUsersInJson(usersArray, users); |
- | |
99 | AbstractDao.getCurrentSession().getTransaction().commit(); |
- | |
100 | return result; |
- | |
101 | } |
- | |
102 | 30 | ||
103 | private void getUsersInJson(JSONArray usersArray, List<User> users) throws JSONException { |
- | |
104 | for(User u: users) |
- | |
105 | { |
- | |
106 | JSONObject user = getJsonUser(u); |
- | |
107 | usersArray.put(user); |
- | |
108 | } |
- | |
109 | } |
- | |
110 | 31 | ||
111 | public static JSONObject getJsonUser(User u) throws JSONException { |
32 | /****************************************************************************/ |
112 | JSONObject user = new JSONObject(); |
- | |
113 | user.put("id",u.getId()); |
- | |
114 | user.put("username",u.getUsername()); |
- | |
115 | user.put("name",u.getName()); |
- | |
116 | if(u instanceof SigesUser) |
- | |
117 | { |
33 | /* SERVICOS WS-API |
118 | user.put("sigesCode",((SigesUser)u).getSigesCode()); |
34 | /****************************************************************************/ |
119 | } |
- | |
120 | if(u instanceof Teacher) |
- | |
121 | { |
- | |
122 | user.put("type","teacher"); |
- | |
123 | } |
- | |
124 | if(u instanceof Student) |
- | |
125 | { |
- | |
126 | user.put("type","student"); |
- | |
127 | } |
- | |
128 | return user; |
- | |
129 | } |
- | |
130 | 35 | ||
131 | 36 | ||
132 | /** |
37 | /** |
133 | * q json object: |
- | |
134 | * { |
- | |
135 | * userId:Long, |
- | |
136 | * role:String, |
- | |
137 | * } |
- | |
138 | * Adds a role to a user |
- | |
139 | * |
38 | * |
140 | * @param form |
39 | * @param form |
141 | * @param request |
40 | * @param request |
142 | * @param response |
41 | * @param response |
143 | * @return Users in Json |
42 | * @return |
144 | * @throws JSONException |
43 | * @throws Throwable |
145 | */ |
44 | */ |
146 | public JSONObject addRole2User(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable { |
- | |
147 | 45 | ||
148 | WidgetModelForm frm = (WidgetModelForm) form; |
46 | public JSONObject findPedagogicReport4Period(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable { |
149 | 1.5.0/docs/api/java/lang/String.html">String query = frm.getQ(); |
- | |
150 | JSONObject roleUser = new JSONObject(query); |
- | |
151 | 1.5.0/docs/api/java/lang/Long.html">Long userId = roleUser.getLong("userId"); |
- | |
152 | 1.5.0/docs/api/java/lang/String.html">String role = roleUser.getString("role"); |
- | |
153 | 47 | ||
- | 48 | 1.5.0/docs/api/java/lang/String.html">String year = request.getParameter("year"); |
|
- | 49 | 1.5.0/docs/api/java/lang/String.html">String code = request.getParameter("code"); |
|
- | 50 | 1.5.0/docs/api/java/lang/String.html">String period = request.getParameter("period"); |
|
- | 51 | ||
- | 52 | if(Globals.SYSTEM_WSJSON_SERVICE_COURSE_REPORT_RESULTS.indexOf("localhost")>=0) |
|
- | 53 | { |
|
154 | IServiceManager sm = ServiceManager.getInstance(); |
54 | IServiceManager sm = ServiceManager.getInstance(); |
155 | 1.5.0/docs/api/java/lang/String.html">String[] names = new 1.5.0/docs/api/java/lang/String.html">String[]{"userId","role_2_addRemove"}; //colocacao do nome de parametro role_2_add obrigatoria para validacao no filtro do serviço |
55 | 1.5.0/docs/api/java/lang/String.html">String json = (1.5.0/docs/api/java/lang/String.html">String) sm.execute(RequestUtils.getRequester(request, response), "QuestionariosReportLoadReportUnidadesSalasJson", new 5+0%2Fdocs%2Fapi+Object">Object[]{code, year, period}); |
156 | 5+0%2Fdocs%2Fapi+Object">Object[] args = new 5+0%2Fdocs%2Fapi+Object">Object[]{userId,role}; |
56 | return new JSONObject(json); |
- | 57 | } |
|
- | 58 | else |
|
- | 59 | { |
|
157 | sm.execute(RequestUtils.getRequester(request, response), "AddRole2User", args, names); |
60 | 1.5.0/docs/api/java/net/URL.html">URL url = new 1.5.0/docs/api/java/net/URL.html">URL(Globals.SYSTEM_WSJSON_SERVICE_COURSE_REPORT_RESULTS + "?code=" + code + "&year=" + year + "&period=" + period); |
- | 61 | 5+0%2Fdocs%2Fapi+InputStream">InputStream is = url.openStream(); |
|
158 | 62 | ||
- | 63 | 1.5.0/docs/api/java/lang/String.html">String json = StreamsUtils.readString(is); |
|
159 | frm.setQ(role); |
64 | is.close(); |
160 | addMessageAsString(request,"Utilizador adicionado com sucesso ao papel institucional"); |
65 | JSONObject jsonObject = new JSONObject(json); |
161 | return findUserRoles(frm,request,response); |
66 | return jsonObject; |
- | 67 | } |
|
162 | } |
68 | } |
163 | 69 | ||
164 | /** |
- | |
165 | * q json object: |
- | |
166 | * { |
- | |
167 | * userId:Long, |
- | |
168 | * role:String, |
- | |
169 | * } |
- | |
170 | * Adds a role to a user |
70 | public JSONObject getCourseUnitsEvaluations(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable { |
171 | * |
71 | |
172 | * @param form |
- | |
173 | * @param request |
72 | 1.5.0/docs/api/java/lang/String.html">String year = request.getParameter("year"); |
174 | * @param response |
- | |
175 | * @return Users in Json |
73 | 1.5.0/docs/api/java/lang/String.html">String code = request.getParameter("code"); |
176 | * @throws JSONException |
- | |
177 | */ |
- | |
178 | public JSONObject removeRole2User(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable { |
- | |
179 | 74 | ||
180 | WidgetModelForm frm = (WidgetModelForm) form; |
- | |
181 | 1.5.0/docs/api/java/lang/String.html">String query = frm.getQ(); |
- | |
182 | JSONObject roleUser = new JSONObject(query); |
- | |
183 | 1.5.0/docs/api/java/lang/Long.html">Long userId = roleUser.getLong("userId"); |
- | |
184 | 1.5.0/docs/api/java/lang/String.html">String role = roleUser.getString("role"); |
- | |
185 | 75 | ||
186 | IServiceManager sm = ServiceManager.getInstance(); |
76 | IServiceManager sm = ServiceManager.getInstance(); |
187 | 1.5.0/docs/api/java/lang/String.html">String[] names = new 1.5.0/docs/api/java/lang/String.html">String[]{"userId","role_2_addRemove"}; //colocacao do nome de parametro role_2_add obrigatoria para validacao no filtro do serviço |
- | |
188 | 5+0%2Fdocs%2Fapi+Object">Object[] args = new 5+0%2Fdocs%2Fapi+Object">Object[]{userId,role}; |
- | |
189 | sm.execute(RequestUtils.getRequester(request, response), "RemoveRole2User", args, names); |
77 | 1.5.0/docs/api/java/lang/String.html">String json = (1.5.0/docs/api/java/lang/String.html">String) sm.execute(RequestUtils.getRequester(request, response), "LoadCourseEvaluationSections", new 5+0%2Fdocs%2Fapi+Object">Object[]{code, year}); |
190 | - | ||
191 | frm.setQ(role); |
- | |
192 | addMessageAsString(request,"Utilizador removido com sucesso do papel institucional"); |
- | |
193 | return findUserRoles(frm,request,response); |
78 | return new JSONObject(json); |
194 | } |
79 | } |
195 | 80 | ||
196 | 81 | ||
197 | 82 | ||
- | 83 | public JSONObject getCourseUnitDtpStats(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable { |
|
198 | 84 | ||
199 | /** |
- | |
200 | * For Json Services |
- | |
201 | * @param form |
- | |
202 | * @param request |
85 | 1.5.0/docs/api/java/lang/String.html">String year = request.getParameter("year"); |
203 | * @param response |
- | |
204 | * @return |
- | |
205 | * @throws Throwable |
86 | 1.5.0/docs/api/java/lang/String.html">String code = request.getParameter("code"); |
206 | */ |
- | |
207 | public boolean wsLoginMobileChallenge(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable { |
- | |
208 | 87 | ||
209 | 1.5.0/docs/api/java/lang/String.html">String username = request.getParameter("username"); |
- | |
210 | 1.5.0/docs/api/java/lang/String.html">String chaveAppsMoveis = request.getParameter("chaveAppsMoveis"); |
- | |
211 | IServiceManager sm = ServiceManager.getInstance(); |
- | |
212 | 1.5.0/docs/api/java/lang/String.html">String[] names = new 1.5.0/docs/api/java/lang/String.html">String[]{}; |
- | |
213 | 5+0%2Fdocs%2Fapi+Object">Object[] args = new 5+0%2Fdocs%2Fapi+Object">Object[]{username,chaveAppsMoveis}; |
- | |
214 | UserView u = (UserView) sm.execute(RequestUtils.getRequester(request, response), "WSAPILoginChallenge", args, names); |
- | |
215 | return u != null; |
- | |
216 | } |
- | |
217 | - | ||
218 | /** |
- | |
219 | * * For Json Services |
- | |
220 | * @param form |
- | |
221 | * @param request |
- | |
222 | * @param response |
- | |
223 | * @return |
- | |
224 | * @throws Throwable |
- | |
225 | */ |
- | |
226 | public JSONObject wsListStudents(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable { |
- | |
227 | 88 | ||
228 | IServiceManager sm = ServiceManager.getInstance(); |
89 | IServiceManager sm = ServiceManager.getInstance(); |
229 | 1.5.0/docs/api/java/lang/String.html">String[] names = new 1.5.0/docs/api/java/lang/String.html">String[]{}; |
- | |
230 | 5+0%2Fdocs%2Fapi+Object">Object[] args = new 5+0%2Fdocs%2Fapi+Object">Object[]{}; |
- | |
231 | JSONObject result = (JSONObject) sm.execute(RequestUtils.getRequester(request, response), "WSAPIListStudents", args, names); |
90 | 1.5.0/docs/api/java/lang/String.html">String json = (1.5.0/docs/api/java/lang/String.html">String) sm.execute(RequestUtils.getRequester(request, response), "LoadCourseUnitDtpStats", new 5+0%2Fdocs%2Fapi+Object">Object[]{code, year}); |
232 | return result; |
91 | return new JSONObject(json); |
233 | } |
92 | } |
234 | 93 | ||
235 | /** |
- | |
236 | * * For Json Services |
- | |
237 | * @param form |
- | |
238 | * @param request |
- | |
239 | * @param response |
- | |
240 | * @return |
- | |
241 | * @throws Throwable |
- | |
242 | */ |
- | |
243 | public JSONObject wsListTeachers(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable { |
- | |
244 | 94 | ||
245 | IServiceManager sm = ServiceManager.getInstance(); |
- | |
246 | 1.5.0/docs/api/java/lang/String.html">String[] names = new 1.5.0/docs/api/java/lang/String.html">String[]{}; |
- | |
247 | 5+0%2Fdocs%2Fapi+Object">Object[] args = new 5+0%2Fdocs%2Fapi+Object">Object[]{}; |
- | |
248 | JSONObject result = (JSONObject) sm.execute(RequestUtils.getRequester(request, response), "WSAPIListTeachers", args, names); |
- | |
249 | return result; |
- | |
250 | } |
- | |
251 | 95 | ||
252 | /** |
96 | /** |
253 | * * For Json Services |
97 | * * For Json Services |
254 | * @param form |
98 | * @param form |
255 | * @param request |
99 | * @param request |
Line 259... | Line 103... | ||
259 | */ |
103 | */ |
260 | public JSONObject wsListServices(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable { |
104 | public JSONObject wsListServices(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable { |
261 | 105 | ||
262 | JSONObject result = new JSONObject(); |
106 | JSONObject result = new JSONObject(); |
263 | JSONObject wsServices = new JSONObject(); |
107 | JSONObject wsServices = new JSONObject(); |
264 | result.put("ws-services",wsServices); |
108 | result.put("ws-course-services",wsServices); |
265 | wsServices.put("info-Developers","Precisa de uma chave de API fornecida pelos administradores de sistema, com a chave poderá autênticar-se com o serviço ws-authenticate cada vez que a sua APP comunicar"); |
- | |
266 | wsServices.put("info-Users","O utilizador final necessita de ser encaminhado via WEB para gerar a sua chaveAppsMoveis entrando no PAE/BACO no seguinte URL /startGenerateChaveApps.do"); |
- | |
- | 109 | ||
267 | 110 | ||
268 | JSONObject wsAuthenticate = new JSONObject(); |
111 | JSONObject service1 = new JSONObject(); |
269 | wsAuthenticate.put("service","/wsjson/api/app/ws-authenticate"); |
112 | service1.put("service","/wsjson/api/app/ws-units-report-list"); |
- | 113 | service1.put("name","getCourseUnitsEvaluations"); |
|
270 | wsAuthenticate.put("parameter1","apikey"); |
114 | service1.put("parameter1","code = siges code"); |
271 | wsAuthenticate.put("return1","certificate: este serviço devolve a chave de comunicação seguinte que deverá ser usada como certificado"); |
115 | service1.put("parameter3","year = \"201617,201718,...\""); |
272 | wsAuthenticate.put("return2","certificateExpire: este serviço devolve a data em que o seu certificado de API expira"); |
116 | service1.put("return","uma tabela em JSON com toda a com um array objetos do tipo CourseUnitSection"); |
273 | 117 | ||
274 | JSONObject wsLoginChallenge = new JSONObject(); |
118 | JSONObject service2 = new JSONObject(); |
275 | wsLoginChallenge.put("service","/wsjson/api/app/secure/ws-login-challenge"); |
119 | service2.put("service","/wsjson/api/app/ws-course-pedagogic-results-list"); |
276 | wsLoginChallenge.put("parameter1","certificate"); |
120 | service2.put("name","getPedagogicReport4Period"); |
277 | wsLoginChallenge.put("parameter2","username"); |
121 | service2.put("parameter1","code = siges code"); |
278 | wsLoginChallenge.put("parameter3","chaveAppsMoveis"); |
122 | service2.put("parameter2","period = \"S1,S2\""); |
279 | wsLoginChallenge.put("descricao","usa o certificado para garantir autenticidade da APP e verifica se o utilizador e a chave fornecida pelo mesmo estão correctas"); |
- | |
280 | wsLoginChallenge.put("return1","se estiver correcto devolve -> service-simple-response\",\"ok\");"); |
123 | service2.put("parameter3","year = \"201617,201718,...\""); |
281 | wsLoginChallenge.put("return2","se estiver incorreto devolve -> service-simple-response\",\"fail\");"); |
124 | service2.put("return","uma tabela em JSON com toda a informação de reusltados do pedagogico nesse ano"); |
282 | 125 | ||
283 | JSONObject wsLoginListStudents = new JSONObject(); |
126 | JSONObject service3 = new JSONObject(); |
284 | wsLoginListStudents.put("service","/wsjson/api/app/secure/ws-student-list"); |
127 | service3.put("service","/wsjson/api/app/ws-units-dtp-stats"); |
285 | wsLoginListStudents.put("parameter1","certificate"); |
128 | service3.put("name","getCourseUnitDtpStats"); |
286 | wsLoginListStudents.put("descricao","usa o certificado para garantir autenticidade da APP e devolve a lista total de estudantes do sistema no parametro response"); |
- | |
287 | wsLoginListStudents.put("return1","lista total de estudantes do sistema no parametro response"); |
- | |
288 | - | ||
289 | - | ||
290 | JSONObject wsLoginListTeachers = new JSONObject(); |
129 | service3.put("parameter1","code = siges code"); |
291 | wsLoginListTeachers.put("service","/wsjson/api/app/secure/ws-teacher-list"); |
130 | service3.put("parameter2","period = \"S1,S2\""); |
292 | wsLoginListTeachers.put("parameter","certificate"); |
131 | service3.put("parameter3","year = \"201617,201718,...\""); |
293 | wsLoginListTeachers.put("descricao","usa o certificado para garantir autenticidade da APP e devolve a lista total de professores do sistema no parametro response"); |
- | |
294 | wsLoginListTeachers.put("return1","devolve a lista total de professores do sistema no parametro response"); |
132 | service3.put("return","uma tabela em JSON com toda a informação de estatistica do preenchimento das pastas DTP"); |
- | 133 | ||
295 | 134 | ||
296 | JSONArray services = new JSONArray(); |
135 | JSONArray services = new JSONArray(); |
297 | services.put(wsAuthenticate); |
136 | services.put(service1); |
298 | services.put(wsLoginChallenge); |
137 | services.put(service2); |
299 | services.put(wsLoginListStudents); |
- | |
300 | services.put(wsLoginListTeachers); |
138 | services.put(service3); |
301 | wsServices.put("services",services); |
139 | wsServices.put("services",services); |
302 | 140 | ||
303 | return result; |
141 | return result; |
304 | } |
142 | } |
- | 143 | ||
- | 144 | /* |
|
- | 145 | ||
- | 146 | public static void main(String[] args) throws Throwable |
|
- | 147 | { |
|
- | 148 | URL url = new URL(Globals.SYSTEM_WSJSON_SERVICE_COURSE_UNITS_EVALUATION + "?code=9119&year=201516&period=S2"); |
|
- | 149 | InputStream is = url.openStream(); |
|
- | 150 | ||
- | 151 | String json = StreamsUtils.readString(is); |
|
- | 152 | is.close(); |
|
- | 153 | JSONObject jsonObject = new JSONObject(json); |
|
- | 154 | System.out.println(jsonObject.toString()); |
|
- | 155 | ||
- | 156 | IServiceManager sm = ServiceManager.getInstance(); |
|
- | 157 | json = (String) sm.execute("123", "LoadCourseReportsSections", new Object[]{"9119","201516"}); |
|
- | 158 | System.out.println(json); |
|
- | 159 | } |
|
- | 160 | */ |
|
305 | } |
161 | } |