public ims.clinical.vo.SurgicalOperationNotesDiagramVo save(ims.clinical.vo.SurgicalOperationNotesDiagramVo record) throws ims.domain.exceptions.DomainInterfaceException, ims.domain.exceptions.UniqueKeyViolationException, ims.domain.exceptions.StaleObjectException { if (record == null) throw new DomainInterfaceException("Surgical Op Notes Vo must be not null"); if (!record.isValidated()) throw new DomainInterfaceException("Surgical Op Notes Vo must be validated"); if (!record.getID_SurgicalOperationNotesIsNotNull()) { String countQ = "from SurgicalOperationNotes as s1_1 where (s1_1.careContext.id = :CareContext_id) and s1_1.isRIE is null"; int count = getDomainFactory().count(countQ,new String[]{"CareContext_id"}, new Object[]{record.getCareContext().getID_CareContext()}); if (count > 0 ) throw new StaleObjectException(null,"A record is already created for this care context"); } SurgicalOperationNotes domObj = SurgicalOperationNotesDiagramVoAssembler.extractSurgicalOperationNotes(getDomainFactory(),record); getDomainFactory().save(domObj); return SurgicalOperationNotesDiagramVoAssembler.create(domObj); }
public ims.clinical.vo.SurgicalOperationNotesDiagramVo getSurgicalOperationNotes(ims.core.admin.vo.CareContextRefVo careContextRef) { String query = "select s1_1 from SurgicalOperationNotes as s1_1 left join s1_1.careContext as c1_1 where (c1_1.id = :CareContext_id)"; List<?> domObjs = getDomainFactory().find(query, new String[]{"CareContext_id"}, new Object[]{careContextRef.getID_CareContext()}); if (domObjs == null || domObjs.size() == 0) return null; return SurgicalOperationNotesDiagramVoAssembler.create((SurgicalOperationNotes) domObjs.get(0)); }