public SplintDetailsVoCollection listSplintDetails(CareContextRefVo voCareContextRef) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); String query = "from SplintDetails sd "; ArrayList markers= new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if(voCareContextRef != null) { hql.append(andStr + " sd.clinicalContact.careContext.id = :cc"); markers.add("cc"); values.add(voCareContextRef.getID_CareContext()); } if (markers.size() > 0) query += " where "; query += hql.toString(); java.util.List splintList = factory.find(query,markers,values); SplintDetailsVoCollection voSplintDetailsColl = SplintDetailsVoAssembler.createSplintDetailsVoCollectionFromSplintDetails(splintList); if(voSplintDetailsColl.size()>0) return voSplintDetailsColl.sort(SortOrder.DESCENDING); else return null; }
/** * saves Splint Details */ public SplintDetailsVo saveSplintDetails(ims.therapies.vo.SplintDetailsVo voSplintDetails) throws ims.domain.exceptions.StaleObjectException { if(!voSplintDetails.isValidated()) throw new DomainRuntimeException("These Splint Details have not been validated"); DomainFactory factory = getDomainFactory(); SplintDetails doSplintDetails = SplintDetailsVoAssembler.extractSplintDetails(factory, voSplintDetails); factory.save(doSplintDetails); return SplintDetailsVoAssembler.create(doSplintDetails); }