public WheelchairCushionVoCollection listByCareContext(CareContextRefVo refCareContext) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from WheelchairCushion w "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (refCareContext != null) { hql.append(andStr + " w.careContext.id = :id_CareContext"); markers.add("id_CareContext"); values.add(refCareContext.getID_CareContext()); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); List cushions = factory.find(query, markers, values); WheelchairCushionVoCollection collWheelchairCushion = WheelchairCushionVoAssembler.createWheelchairCushionVoCollectionFromWheelchairCushion(cushions); return collWheelchairCushion; }
public WheelchairCushionVo save(WheelchairCushionVo voWheelchairCushion) throws StaleObjectException { DomainFactory factory = getDomainFactory(); if (!voWheelchairCushion.isValidated()) { throw new DomainRuntimeException("This HomeVisitVo has not been validated"); } WheelchairCushion domWheelchairCushion = WheelchairCushionVoAssembler.extractWheelchairCushion(factory, voWheelchairCushion); factory.save(domWheelchairCushion); return WheelchairCushionVoAssembler.create(domWheelchairCushion); }