/** * List Transfer Notes */ public TransferNoteCollection listTransferNotes(CareContextShortVo careContextShortVo) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from TransferNote t "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (careContextShortVo != null) { hql.append(andStr + " t.careContext.id = :rcc"); markers.add("rcc"); values.add(careContextShortVo.getID_CareContext()); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); List procs = factory.find(query, markers, values); return TransferNoteAssembler.createTransferNoteCollectionFromTransferNote(procs).sort(SortOrder.DESCENDING); }
/** * Save Transfer note */ public TransferNote saveTransferNote(TransferNote voTransferNote) throws StaleObjectException { if (!voTransferNote.isValidated()) throw new DomainRuntimeException("The transfer note value object has not been validated"); DomainFactory factory = getDomainFactory(); ims.nursing.domain.objects.TransferNote doTransferNote = TransferNoteAssembler.extractTransferNote(factory, voTransferNote); factory.save(doTransferNote); return (TransferNoteAssembler.create(doTransferNote)); }