private SpecimenWorkListItemVoCollection saveWorkListItems(DomainFactory factory, SpecimenWorkListItemVoCollection workListitems, HashMap objMap, ORDERSTATE state) throws StaleObjectException { if (workListitems == null) throw new CodingRuntimeException("No workListitems to save - method saveWorkListItems()"); List items = SpecimenWorkListItemVoAssembler.extractSpecimenWorkListItemList(factory, workListitems, null, objMap); Iterator it = items.iterator(); while (it.hasNext()) { SpecimenWorkListItem item = (SpecimenWorkListItem) it.next(); if(state.equals(ORDERSTATE.REQUESTING_AUTHORISATION)) item.setCollectionStatus(getDomLookup(ims.ocrr.vo.lookups.SpecimenCollectionStatus.AWAITING_AUTHORISATION)); factory.save(item); } workListitems = SpecimenWorkListItemVoAssembler.createSpecimenWorkListItemVoCollectionFromSpecimenWorkListItem(items); return workListitems; }
public SpecimenWorkListItemVo getWorkListItemRecord(Integer id) { return SpecimenWorkListItemVoAssembler.create( (SpecimenWorkListItem)getDomainFactory().getDomainObject(SpecimenWorkListItem.class, id)); }
public SpecimenWorkListItemListVo saveWorkListItemRecord(SpecimenWorkListItemVo record, OrderSpecimenVo specimenVo) throws StaleObjectException { DomainFactory factory = getDomainFactory(); SpecimenWorkListItem newBo = null; SpecimenWorkListItem bo = SpecimenWorkListItemVoAssembler.extractSpecimenWorkListItem(factory, record); bo.getSpecimen().setCollectorComment(specimenVo.getCollectorComment()); if(record.getCollectionStatus().equals(SpecimenCollectionStatus.COULDNOTCOLLECT)) { SpecimenWorkListItemVo newItem = new SpecimenWorkListItemVo(); newItem.setListType(SpecimenCollectionMethod.WARDCOLLECTION); newItem.setDateToCollect(new Date()); newItem.setTimeToCollect(new Time()); newItem.setCollectionStatus(SpecimenCollectionStatus.PHLEBCOULDNOTCOLLECT); newBo = SpecimenWorkListItemVoAssembler.extractSpecimenWorkListItem(factory, newItem); newBo.setSpecimen(bo.getSpecimen()); } else if(record.getCollectionStatus().equals(SpecimenCollectionStatus.COLLECTIONCOMPLETE)) { bo.getSpecimen().setCollDateTimePlacer(specimenVo.getCollDateTimePlacer().getJavaDate()); bo.getSpecimen().setCollectingMos((MemberOfStaff) factory.getDomainObject(MemberOfStaff.class, specimenVo.getCollectingMos().getID_MemberOfStaff())); java.util.Set investigations = bo.getSpecimen().getInvestigations(); for (java.util.Iterator iter = investigations.iterator(); iter.hasNext();) { Object obj = iter.next(); if (obj instanceof OrderInvestigation) { OrderInvestigation element = (OrderInvestigation) obj; element.setDisplayDateTime(bo.getSpecimen().getCollDateTimePlacer()); element.setDisplayFlag(getDomLookup(OcsDisplayFlag.SPEC_COLL)); } } } factory.save(bo); if(newBo != null) factory.save(newBo); return SpecimenWorkListItemListVoAssembler.create(bo); }