public ims.core.vo.CommunityServiceVoCollection listCommunityServicesByCareContext(ims.core.admin.vo.CareContextRefVo voCareContextRef, Boolean activeOnly) { if (voCareContextRef == null) throw new CodingRuntimeException("Care Context was not supplied. Mandatory argument"); DomainFactory factory = getDomainFactory(); String hqlQuery = " from CommunityServices cs "; StringBuffer condStr = new StringBuffer(); ArrayList<String> markerNames = new ArrayList<String>(); ArrayList<Object> markerValues = new ArrayList<Object>(); condStr.append(" where "); if(voCareContextRef != null) { condStr.append(" cs.careContext.id = :careContext and cs.isCurrentlyActive = :active"); markerNames.add("careContext"); markerValues.add(voCareContextRef.getID_CareContext()); markerNames.add("active"); markerValues.add(activeOnly); } hqlQuery += condStr.toString(); hqlQuery += " order by systemInformation.creationDateTime asc"; java.util.List<?> lst = factory.find(hqlQuery,markerNames,markerValues); return CommunityServiceVoAssembler.createCommunityServiceVoCollectionFromCommunityServices(lst).sort(); }
public ims.core.vo.CommunityServiceVo saveCommunitService(ims.core.vo.CommunityServiceVo communityService) throws ims.domain.exceptions.StaleObjectException { if(!communityService.isValidated()) throw new DomainRuntimeException("communityService Value Object has not been validated"); DomainFactory factory = getDomainFactory(); CommunityServices doComService = CommunityServiceVoAssembler.extractCommunityServices(factory, communityService); factory.save(doComService); return CommunityServiceVoAssembler.create(doComService); }