public WheelchairDetailsVoCollection listByPatient(Integer idPatient) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from WheelchairDetails w "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (idPatient != null) { hql.append(andStr + " w.careContext.episodeOfCare.careSpell.patient.id = :id_Patient"); markers.add("id_Patient"); values.add(idPatient); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); List details = factory.find(query, markers, values); WheelchairDetailsVoCollection collWheelchairDetails = WheelchairDetailsVoAssembler.createWheelchairDetailsVoCollectionFromWheelchairDetails(details); return collWheelchairDetails; }
public WheelchairDetailsVo save(WheelchairDetailsVo voWheelchairDetails) throws StaleObjectException { DomainFactory factory = getDomainFactory(); if (!voWheelchairDetails.isValidated()) { throw new DomainRuntimeException("This WheelchairDetailsVo has not been validated"); } WheelchairDetails domWheelchairDetail = WheelchairDetailsVoAssembler.extractWheelchairDetails(factory, voWheelchairDetails); factory.save(domWheelchairDetail); return WheelchairDetailsVoAssembler.create(domWheelchairDetail); }