comparison src/main/java/de/intevation/lada/rest/StatusService.java @ 1036:4e0a9c7a8f23 schema-update

Removed verbose logging.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 31 Aug 2016 16:24:04 +0200
parents 4d95cc7f0a43
children f92c96efa976
comparison
equal deleted inserted replaced
1035:4d95cc7f0a43 1036:4e0a9c7a8f23
89 */ 89 */
90 @Path("rest/status") 90 @Path("rest/status")
91 @RequestScoped 91 @RequestScoped
92 public class StatusService { 92 public class StatusService {
93 93
94 @Inject
95 private Logger logger = Logger.getLogger(StatusService.class);
96
97 /** 94 /**
98 * The data repository granting read/write access. 95 * The data repository granting read/write access.
99 */ 96 */
100 @Inject 97 @Inject
101 @RepositoryConfig(type=RepositoryType.RW) 98 @RepositoryConfig(type=RepositoryType.RW)
282 279
283 // Check if the user is allowed to change to the requested 280 // Check if the user is allowed to change to the requested
284 // status_kombi 281 // status_kombi
285 // 1. The old 'status_wert' is 'rückfrage' 282 // 1. The old 'status_wert' is 'rückfrage'
286 // User has 'funktion' 1 for the given mstId 283 // User has 'funktion' 1 for the given mstId
287 logger.debug("old: " + oldKombi.getStatusStufe().getStufe());
288 logger.debug("new: " + newKombi.getStatusStufe().getStufe());
289 logger.debug("mstold: " + oldStatus.getMstId());
290 logger.debug("mstnew: " + status.getMstId());
291 logger.debug("user: ");
292 for (int i = 0; i < userInfo.getMessstellen().size(); i++) {
293 logger.debug(userInfo.getMessstellen().get(i));
294 }
295 if (oldKombi.getStatusWert().getId() == 4) { 284 if (oldKombi.getStatusWert().getId() == 4) {
296 logger.debug("old status is rueckfrage");
297 if (userInfo.getFunktionenForMst(status.getMstId()).contains(1)) { 285 if (userInfo.getFunktionenForMst(status.getMstId()).contains(1)) {
298 // Set the new status. 286 // Set the new status.
299 logger.debug("user is allowed to set the status");
300 return setNewStatus(status, newKombi, messung, request); 287 return setNewStatus(status, newKombi, messung, request);
301 } 288 }
302 else { 289 else {
303 logger.debug("not allowed");
304 // Not allowed. 290 // Not allowed.
305 return new Response(false, 699, null); 291 return new Response(false, 699, null);
306 } 292 }
307 } 293 }
308 // 2. user wants to edit the status (stufe stays the same.) 294 // 2. user wants to edit the status (stufe stays the same.)
313 status.getMstId().equals(oldStatus.getMstId()) 299 status.getMstId().equals(oldStatus.getMstId())
314 ) { 300 ) {
315 // a) user wants to reset the current status 301 // a) user wants to reset the current status
316 // 'status wert' == 8 302 // 'status wert' == 8
317 if (newKombi.getStatusWert().getId() == 8) { 303 if (newKombi.getStatusWert().getId() == 8) {
318 logger.debug("reset the status");
319 return authorization.filter( 304 return authorization.filter(
320 request, 305 request,
321 resetStatus(status, oldStatus, messung), 306 resetStatus(status, oldStatus, messung),
322 StatusProtokoll.class); 307 StatusProtokoll.class);
323 } 308 }
324 // b) update the status by the setting the new one. 309 // b) update the status by the setting the new one.
325 logger.debug("set edited status");
326 return setNewStatus(status, newKombi, messung, request); 310 return setNewStatus(status, newKombi, messung, request);
327 } 311 }
328 // 3. user wants to advance to the next 'status_stufe' 312 // 3. user wants to advance to the next 'status_stufe'
329 // Users 'funktion' equals old 'stufe' + 1 313 // Users 'funktion' equals old 'stufe' + 1
330 else if (userInfo.getFunktionenForMst(status.getMstId()).contains( 314 else if (userInfo.getFunktionenForMst(status.getMstId()).contains(
331 oldKombi.getStatusStufe().getId() + 1) && 315 oldKombi.getStatusStufe().getId() + 1) &&
332 newKombi.getStatusStufe().getId() == 316 newKombi.getStatusStufe().getId() ==
333 oldKombi.getStatusStufe().getId() + 1) { 317 oldKombi.getStatusStufe().getId() + 1) {
334 // Set the next status 318 // Set the next status
335 logger.debug("set next status");
336 return setNewStatus(status, newKombi, messung, request); 319 return setNewStatus(status, newKombi, messung, request);
337 } 320 }
338 } 321 }
339 logger.debug("something other....");
340 return new Response(false, 699, null); 322 return new Response(false, 699, null);
341 } 323 }
342 324
343 private Response setNewStatus( 325 private Response setNewStatus(
344 StatusProtokoll status, 326 StatusProtokoll status,
500 break; 482 break;
501 } 483 }
502 } 484 }
503 StatusProtokoll copy = new StatusProtokoll(); 485 StatusProtokoll copy = new StatusProtokoll();
504 StatusProtokoll orig = proto.get(ndx); 486 StatusProtokoll orig = proto.get(ndx);
505 logger.debug(orig.getStatusKombi());
506 logger.debug(orig.getMstId());
507 copy.setDatum(new Timestamp(new Date().getTime())); 487 copy.setDatum(new Timestamp(new Date().getTime()));
508 copy.setMstId(orig.getMstId()); 488 copy.setMstId(orig.getMstId());
509 copy.setMessungsId(orig.getMessungsId()); 489 copy.setMessungsId(orig.getMessungsId());
510 copy.setStatusKombi(orig.getStatusKombi()); 490 copy.setStatusKombi(orig.getStatusKombi());
511 copy.setText(""); 491 copy.setText("");
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)