public AdviceLeafletsVoCollection listAdviceLeaflets(CareContextRefVo refCareContext) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from AdviceLeaflets t "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (refCareContext != null) { hql.append(andStr + " t.careContext.id = :cc"); markers.add("cc"); values.add(refCareContext.getID_CareContext()); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); List adviceList = factory.find(query, markers, values); return AdviceLeafletsVoAssembler.createAdviceLeafletsVoCollectionFromAdviceLeaflets(adviceList); }
public AdviceLeafletsVo getAdviceLeaflets(AdviceLeafletsRefVo record) { if(record == null || record.getID_AdviceLeaflets() == null) throw new CodingRuntimeException("Can not get AdviceLeaflet on null Id."); DomainFactory factory = getDomainFactory(); AdviceLeaflets doLeaflet = (AdviceLeaflets) factory.getDomainObject(AdviceLeaflets.class, record.getID_AdviceLeaflets()); return AdviceLeafletsVoAssembler.create(doLeaflet); }
public AdviceLeafletsVo saveAdviceLeafletsDetails(AdviceLeafletsVo adviceleaflets) throws StaleObjectException { if(adviceleaflets == null) throw new RuntimeException("Cannot save null value for AdviceLeafletsVo "); if (!adviceleaflets.isValidated()) throw new DomainRuntimeException("Advice leaflets has not been validated"); DomainFactory factory = getDomainFactory(); ims.core.clinical.domain.objects.AdviceLeaflets doAdviceLeaflets = AdviceLeafletsVoAssembler.extractAdviceLeaflets(factory, adviceleaflets); factory.save(doAdviceLeaflets); return AdviceLeafletsVoAssembler.create(doAdviceLeaflets); }