public ims.clinical.vo.DischargeFuturePlanSthkVo getFuturePlan(ims.core.admin.vo.CareContextRefVo careContext) { // Check passed care context if (careContext == null || !careContext.getID_CareContextIsNotNull()) throw new DomainRuntimeException("DOMAIN getFuturePlan() - Selected care context is null"); // Build query and parameter to retrieve the record from database String query = "from FuturePlan as futurePlan where futurePlan.careContext.id = :ID"; ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("ID"); paramValues.add(careContext.getID_CareContext()); // Query database for the record // Create the VO form the record database return DischargeFuturePlanSthkVoAssembler.create((FuturePlan) getDomainFactory().findFirst(query, paramNames, paramValues)); }
public DischargeFuturePlanSthkVo saveFuturePlan(DischargeFuturePlanSthkVo futurePlan, EDischargeSTHKSummaryVo dischargeSummary) throws StaleObjectException, ForeignKeyViolationException, UniqueKeyViolationException { // Check for null VO passed to save if (futurePlan == null) throw new DomainRuntimeException("DOMAIN saveFuturePlan() - Can not save a null object"); // Check if the VO is validated if (!futurePlan.isValidated()) throw new DomainRuntimeException("DOMAIN saveFuturePlan() - Value object to save is not validated"); // Extract domain object needed DomainFactory domainFactory = getDomainFactory(); FuturePlan futurePlanDomObj = DischargeFuturePlanSthkVoAssembler.extractFuturePlan(domainFactory, futurePlan); // Save domain object domainFactory.save(futurePlanDomObj); futurePlan = DischargeFuturePlanSthkVoAssembler.create(futurePlanDomObj); IEDischargeHelper impl = (IEDischargeHelper) getDomainImpl(EDischargeHelper.class); impl.updateSummaryIfRequired(futurePlan, dischargeSummary, getDomainFactory()); // Return a refreshed version of the VO return futurePlan; }