Exemple #1
0
 /**
  * Validate the exclusion delete request.
  *
  * @param exclusionDelRq Exclusion delete request.
  * @throws StatusException Throws a status exception if validation fails.
  */
 private void validate(ExclusionDelRq exclusionDelRq) throws StatusException {
   if (exclusionDelRq == null) {
     throw new StatusException("105", "ExclusionDelRq must not be null.");
   }
   if (exclusionDelRq.getRequestHeader() == null) {
     throw new StatusException("105", "ExclusionDelRq.requestHeader must not be null");
   }
   if (exclusionDelRq.getExclusionId() == null) {
     throw new StatusException("105", "ExclusionDelRq.exclusionId must not be null.");
   }
 }
Exemple #2
0
 /**
  * Exclusion delete.
  *
  * @param request Exclusion delete request message.
  * @return Exclusion delete response message.
  */
 @RequestMapping(value = "exclusionDel", method = RequestMethod.POST)
 public @ResponseBody String exclusionDel(@RequestBody String request) {
   Gson gson = new Gson();
   ExclusionDelRq exclusionDelRq = null;
   ExclusionDelRs exclusionDelRs = new ExclusionDelRs();
   Status status = new Status("999", "Status not set.");
   try {
     exclusionDelRq = gson.fromJson(request, ExclusionDelRq.class);
     validate(exclusionDelRq);
     exclusionDelRs.setResponseHeader(new ResponseHeader());
     exclusionDelRs.getResponseHeader().setRquid(exclusionDelRq.getRequestHeader().getRquid());
     delete(exclusionDelRq.getExclusionId());
     status = new Status("0", "Success");
   } catch (StatusException se) {
     status = se.getStatus();
   } catch (Exception e) {
     status = new Status("999", e.toString());
     e.printStackTrace();
   }
   exclusionDelRs.setStatus(status);
   return null;
 }