/** * save an adaptation */ public ims.therapies.vo.AdaptationsVo save(ims.therapies.vo.AdaptationsVo voAdaptation) throws ims.domain.exceptions.StaleObjectException { if(!voAdaptation.isValidated()) { throw new DomainRuntimeException("Adaptation Value Object has not been validated"); } DomainFactory factory = getDomainFactory(); ims.therapies.domain.objects.Adaptations adaptBo = AdaptationsVoAssembler.extractAdaptations(factory,voAdaptation); factory.save(adaptBo); return AdaptationsVoAssembler.create(adaptBo); }
public AdaptationsVoCollection listByCareContext(CareContextRefVo voCareContextRef) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); String query = "from Adaptations ad "; ArrayList markers= new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if(voCareContextRef != null) { hql.append(andStr + " ad.careContext.id = :cc"); markers.add("cc"); values.add(voCareContextRef.getID_CareContext()); } if (markers.size() > 0) query += " where "; query += hql.toString(); java.util.List Adaptations = factory.find(query,markers,values); AdaptationsVoCollection voAdaptationsColl = AdaptationsVoAssembler.createAdaptationsVoCollectionFromAdaptations(Adaptations); return voAdaptationsColl; }