/** * Get */ public ims.core.vo.BatchPricingVo getBatch(ims.core.clinical.vo.BatchPricingRefVo batchRefVo) { DomainFactory factory = getDomainFactory(); BatchPricing domBatch = (BatchPricing) factory.getDomainObject(BatchPricing.class, batchRefVo.getID_BatchPricing()); return BatchPricingVoAssembler.create(domBatch); }
/** * List * */ @SuppressWarnings("unchecked") public ims.core.vo.BatchPricingVoCollection listBatches(ims.core.resource.place.vo.LocationRefVo location) { DomainFactory factory = getDomainFactory(); String hql = " from BatchPricing bp "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); StringBuffer condStr = new StringBuffer(); String andStr = " "; condStr.append(andStr + " bp.location.id = :loc" ); markers.add("loc"); values.add(location.getID_Location()); andStr = " and "; condStr.append(andStr + " bp.status = :status" ); markers.add("status"); values.add(getDomLookup(BatchStatus.PREACTIVE)); andStr = " and "; if(andStr.equals( " and ")) hql += " where "; hql += condStr.toString(); List batches = factory.find(hql,markers,values); return BatchPricingVoAssembler.createBatchPricingVoCollectionFromBatchPricing(batches).sort(); }
/** * Save */ public ims.core.vo.BatchPricingVo saveBatch(ims.core.vo.BatchPricingVo batchVo) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException { if (!batchVo.isValidated()) { throw new DomainRuntimeException("Batch has not been validated"); } DomainFactory factory = getDomainFactory(); BatchPricing domBatch = BatchPricingVoAssembler.extractBatchPricing(factory, batchVo); factory.save(domBatch); return BatchPricingVoAssembler.create(domBatch); }