public ComplementaryTherapyTreatmentVo save(ComplementaryTherapyTreatmentVo voComplementaryTherapyTreat) throws StaleObjectException, UniqueKeyViolationException { if(!voComplementaryTherapyTreat.isValidated()) throw new DomainRuntimeException("This Complementary Therapy Treatment has not been validated"); if (voComplementaryTherapyTreat.getID_ComplementaryTherapyTreatment() == null && getComplementaryTherapyByClinicalContact(voComplementaryTherapyTreat.getClinicalContact()) != null) throw new UniqueKeyViolationException("The screen will be refreshed."); DomainFactory factory = getDomainFactory(); ComplementaryTherapyTreatment doComplementary = ComplementaryTherapyTreatmentVoAssembler.extractComplementaryTherapyTreatment(factory, voComplementaryTherapyTreat); factory.save(doComplementary); return ComplementaryTherapyTreatmentVoAssembler.create(doComplementary); }
private ComplementaryTherapyTreatmentVo getComplementaryTherapyByClinicalContact(ClinicalContactRefVo voClinicalContactRef) { if (voClinicalContactRef == null) throw new RuntimeException("Cannot get Complementary Therapy for null Clinical Contact"); StringBuffer query = new StringBuffer("from ComplementaryTherapyTreatment ctt where ctt.clinicalContact.id = :CCID and ctt.isRIE is null"); return ComplementaryTherapyTreatmentVoAssembler.create((ComplementaryTherapyTreatment) getDomainFactory().findFirst(query.toString(), "CCID", voClinicalContactRef.getID_ClinicalContact())); }
/** * WDEV-13581 * Function used to retrieve the Complementary Therapy Treatment record by ID */ public ComplementaryTherapyTreatmentVo getComplementaryTherapy(ComplementaryTherapyTreatmentRefVo complementaryTherapy) { // For null parameter or not saved record return null if (complementaryTherapy == null || !complementaryTherapy.getID_ComplementaryTherapyTreatmentIsNotNull()) return null; return ComplementaryTherapyTreatmentVoAssembler.create((ComplementaryTherapyTreatment) getDomainFactory().getDomainObject(ComplementaryTherapyTreatment.class, complementaryTherapy.getID_ComplementaryTherapyTreatment())); }