/** * Save a Massage Record for a Clinical Contact */ public ims.therapies.vo.MassageVo saveMassageVo(ims.therapies.vo.MassageVo voMassage) throws ims.domain.exceptions.StaleObjectException { // Ensure the value object has been validated if (!voMassage.isValidated()) throw new DomainRuntimeException("Massage has not been validated"); //if a new massage record must be saved check if exist a massage record for this clinical contact (only one massage record must exist per clinical contact) if(voMassage.getID_Massage() == null) { if(voMassage.getClinicalContactIsNotNull()) { ims.therapies.vo.MassageVo voMassagetemp = getMassageVoByClinicalContact(voMassage.getClinicalContact()); if( voMassagetemp != null) throw new DomainRuntimeException("A Massage record already exists for the current Clinical Contact"); } } DomainFactory factory = getDomainFactory(); Massage doMassage = MassageVoAssembler.extractMassage(factory, voMassage); factory.save(doMassage); return MassageVoAssembler.create(doMassage); }
public MassageVo getMassageVoByClinicalContact(ClinicalContactRefVo voClinicalContactRef) { if (voClinicalContactRef == null) throw new RuntimeException("Cannot get Massage record for null ClinicalContactRefVo"); StringBuffer query = new StringBuffer("from Massage as m1_1 where m1_1.clinicalContact.id = :CCID order by m1_1.systemInformation.creationDateTime desc"); List list = getDomainFactory().find(query.toString(), "CCID", voClinicalContactRef.getID_ClinicalContact()); if (list == null || list.size() == 0) return null; MassageVoCollection voColl = MassageVoAssembler.createMassageVoCollectionFromMassage(list); if (voColl.size() > 0) return voColl.get(0); return null; }
public MassageVo getMassageVo(Integer massageId) { DomainFactory factory = getDomainFactory(); Massage doMassage = (Massage)factory.getDomainObject(Massage.class, massageId); return MassageVoAssembler.create(doMassage); }