Source:
public synchronized @ResponseBody Surveillance createSurveillance( @RequestBody(required = true) Surveillance survToInsert) throws Exception { survToInsert.getErrorMessages().clear(); survManager.validate(survToInsert); if(survToInsert.getErrorMessages() != null && survToInsert.getErrorMessages().size() > 0) { throw new ValidationException(survToInsert.getErrorMessages(), null); } updateAuthority(survToInsert); CertifiedProductSearchDetails beforeCp = cpdetailsManager.getCertifiedProductDetails(survToInsert.getCertifiedProduct().getId()); CertificationBodyDTO owningAcb = null; try { owningAcb = acbManager.getById(new Long(beforeCp.getCertifyingBody().get("id").toString())); } catch(AccessDeniedException ex) { throw new CertificationBodyAccessException("User does not have permission to add surveillance to a certified product under ACB " + beforeCp.getCertifyingBody().get("name")); } catch(EntityRetrievalException ex) { logger.error("Error looking up ACB associated with surveillance.", ex); throw new EntityRetrievalException("Error looking up ACB associated with surveillance."); } Long insertedSurv = survManager.createSurveillance(owningAcb.getId(), survToInsert); if(insertedSurv == null) { throw new EntityCreationException("Error creating new surveillance."); } CertifiedProductSearchDetails afterCp = cpdetailsManager.getCertifiedProductDetails(survToInsert.getCertifiedProduct().getId()); activityManager.addActivity(ActivityConcept.ACTIVITY_CONCEPT_CERTIFIED_PRODUCT, afterCp.getId(), "Surveillance was added to certified product " + afterCp.getChplProductNumber(), beforeCp, afterCp); return survManager.getById(insertedSurv); }

Target:
public synchronized @ResponseBody Surveillance createSurveillance( @RequestBody(required = true) Surveillance survToInsert) throws ValidationException, EntityRetrievalException, CertificationBodyAccessException, UserPermissionRetrievalException, EntityCreationException, JsonProcessingException, SurveillanceAuthorityAccessDeniedException { survToInsert.getErrorMessages().clear(); survManager.validate(survToInsert); if(survToInsert.getErrorMessages() != null && survToInsert.getErrorMessages().size() > 0) { throw new ValidationException(survToInsert.getErrorMessages(), null); } CertifiedProductSearchDetails beforeCp = cpdetailsManager.getCertifiedProductDetails(survToInsert.getCertifiedProduct().getId()); CertificationBodyDTO owningAcb = null; try { owningAcb = acbManager.getById(new Long(beforeCp.getCertifyingBody().get("id").toString())); } catch(AccessDeniedException ex) { throw new CertificationBodyAccessException("User does not have permission to add surveillance to a certified product under ACB " + beforeCp.getCertifyingBody().get("name")); } catch(EntityRetrievalException ex) { logger.error("Error looking up ACB associated with surveillance.", ex); throw new EntityRetrievalException("Error looking up ACB associated with surveillance."); } Long insertedSurv = null; try{ insertedSurv = survManager.createSurveillance(owningAcb.getId(), survToInsert); } catch(SurveillanceAuthorityAccessDeniedException ex){ logger.error("User lacks authority to delete surveillance"); throw new SurveillanceAuthorityAccessDeniedException("User lacks authority to delete surveillance"); } if(insertedSurv == null) { throw new EntityCreationException("Error creating new surveillance."); } CertifiedProductSearchDetails afterCp = cpdetailsManager.getCertifiedProductDetails(survToInsert.getCertifiedProduct().getId()); activityManager.addActivity(ActivityConcept.ACTIVITY_CONCEPT_CERTIFIED_PRODUCT, afterCp.getId(), "Surveillance was added to certified product " + afterCp.getChplProductNumber(), beforeCp, afterCp); return survManager.getById(insertedSurv); }