public PatientNoAllergyInfoVo savePatientNoAllergyInfo(PatientNoAllergyInfoVo patientNoAllergyInfo) throws StaleObjectException, UniqueKeyViolationException { if(!patientNoAllergyInfo.isValidated()) { throw new CodingRuntimeException("PatientNoAllergyInfoVo Value Object Alert has not been validated"); } DomainFactory factory = getDomainFactory(); PatientNoAllergyInfo doPatientNoAllergyInfo = PatientNoAllergyInfoVoAssembler.extractPatientNoAllergyInfo(factory, patientNoAllergyInfo); try { factory.save(doPatientNoAllergyInfo); } catch(UnqViolationUncheckedException e) { PatientNoAllergyInfo noAllergyInfo = PatientNoAllergyInfo.getPatientNoAllergyInfoFromPatient(factory, patientNoAllergyInfo.getPatient().getID_Patient()); if (noAllergyInfo != null && noAllergyInfo.getId() != null && !(noAllergyInfo.getId().equals(patientNoAllergyInfo.getID_PatientNoAllergyInfo()))) { throw new UniqueKeyViolationException("A No Known Allergy record already exists for this patient. Duplicates not allowed.", e); } throw (e); } return (PatientNoAllergyInfoVoAssembler.create(doPatientNoAllergyInfo)); }
public PatientNoAllergyInfoVo getPatientNoAllergyInfo(PatientRefVo patientRefVo) { DomainFactory factory = getDomainFactory(); PatientNoAllergyInfo patientNoAllergyInfo = PatientNoAllergyInfo.getPatientNoAllergyInfoFromPatient(factory, patientRefVo.getID_Patient()); return PatientNoAllergyInfoVoAssembler.create(patientNoAllergyInfo); }