public SpecimenCollectionListConfigVo getSpecimenCollectionConfig(SpecimenCollectionMethod lookUpId) { if(lookUpId == null) throw new DomainRuntimeException("Id has not been provided for get call. "); DomainFactory factory = getDomainFactory(); List listSpecCollectionList = factory.find("from SpecimenCollectionListConfig sclc where sclc.listType = :ltype",new String[]{"ltype"},new Object[]{getDomLookup(lookUpId)}); if(listSpecCollectionList != null && listSpecCollectionList.size() > 0) { SpecimenCollectionListConfigVoCollection voCollSpecimen = SpecimenCollectionListConfigVoAssembler.createSpecimenCollectionListConfigVoCollectionFromSpecimenCollectionListConfig(listSpecCollectionList); if(voCollSpecimen != null && voCollSpecimen.size() > 0) return voCollSpecimen.get(0); } return null; }
public SpecimenCollectionListConfigVo saveSpecimenCollectionConfig(SpecimenCollectionListConfigVo specimenCollectionConfig) throws StaleObjectException { if(specimenCollectionConfig == null) throw new CodingRuntimeException("specimenCollectionConfig parameter is null - method saveSpecimenCollectionConfig"); if(!specimenCollectionConfig.isValidated()) throw new DomainRuntimeException("SpecimenCollectionListConfigVo has not been validated"); DomainFactory factory = getDomainFactory(); SpecimenCollectionListConfig domSpecimenCollectionListConfig = SpecimenCollectionListConfigVoAssembler.extractSpecimenCollectionListConfig(factory, specimenCollectionConfig); factory.save(domSpecimenCollectionListConfig); return SpecimenCollectionListConfigVoAssembler.create(domSpecimenCollectionListConfig); }