public ActivityVoCollection listActivitiesByService(ServiceRefVo serviceRef, Boolean isFlexible) { if( serviceRef == null ) return null; DomainFactory factory = getDomainFactory(); // For profile Slot, we want to list // all activities for appointment activity type String hql= null; if( Boolean.TRUE.equals(isFlexible)) { hql = "select s1_1.activity from ServiceActivity as s1_1 left join s1_1.activity as a1_1 where (s1_1.isActive = 1 and a1_1.isActive = 1 and s1_1.service.id = :serviceId and s1_1.isFlexible = 1 )"; //wdev-20262 } else { hql = "select s1_1.activity from ServiceActivity as s1_1 left join s1_1.activity as a1_1 where (s1_1.isActive = 1 and a1_1.isActive = 1 and s1_1.service.id = :serviceId and (s1_1.isFlexible = 0 or s1_1.isFlexible is null))"; //wdev-20262 } List lst = factory.find(hql, new String[]{"serviceId"}, new Object[]{new Integer(serviceRef.getID_Service())}); return (ActivityVoAssembler.createActivityVoCollectionFromActivity(lst)); }
/** * listActivities */ public ActivityVoCollection listActivities() { DomainFactory factory = getDomainFactory(); // For profile Slot, we want to list // all activities for appointment activity type String hql = " from Activity act where act.activityType.id = :activityType and act.isActive = :active"; List lst = factory.find(hql, new String[]{"activityType", "active"}, new Object[]{new Integer(ActivityType.APPOINTMENTTYPES.getId()), Boolean.TRUE}); return (ActivityVoAssembler.createActivityVoCollectionFromActivity(lst)); }
/** * Returns a list of all activities, or a list of active activities */ public ims.core.vo.ActivityVoCollection listActivities(Boolean bActive) { DomainFactory factory = getDomainFactory(); List activities = null; StringBuffer hql = new StringBuffer(" "); String query = "from Activity a "; if (bActive.equals(Boolean.TRUE)) { ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); hql.append(" a.isActive = :isActive"); markers.add("isActive"); values.add(bActive); if (markers.size() > 0) query += " where "; query += hql.toString(); activities = factory.find(query, markers, values, 1000); } else { activities = factory.find(query,1000); } return ActivityVoAssembler.createActivityVoCollectionFromActivity(activities).sort(); }
public ims.core.vo.ActivityVo getActivity(Integer activityId) { DomainFactory factory = getDomainFactory(); ims.core.resource.place.domain.objects.Activity domActivity = (ims.core.resource.place.domain.objects.Activity) factory.getDomainObject(Activity.class, activityId); return (ActivityVoAssembler.create(domActivity)); }
public ActivityVo saveActivity(ActivityVo activityVo) throws StaleObjectException, UniqueKeyViolationException { if (!activityVo.isValidated()) { throw new DomainRuntimeException("Activity has not been validated"); } DomainFactory factory = getDomainFactory(); if(Activity.recordExistForNameAndIsActiveAndActivityType(factory, activityVo.getName(), activityVo.getIsActive(), getDomLookup( activityVo.getActivityType()))) { if(activityVo.getID_ActivityIsNotNull()) { Activity doConflictingActivity = Activity.getActivityFromactivity_unq1(factory, activityVo.getName(), activityVo.getIsActive(), getDomLookup( activityVo.getActivityType())); if(!doConflictingActivity.getId().equals(activityVo.getID_Activity())) throw new UniqueKeyViolationException("An " + (activityVo.getIsActive() ? "active" : "inactive") + " Activity of this Type and Name already exists"); } else throw new UniqueKeyViolationException("An " + (activityVo.getIsActive() ? "active" : "inactive") + " Activity of this Type and Name already exists"); } ims.core.resource.place.domain.objects.Activity domActivity = ActivityVoAssembler.extractActivity(factory, activityVo); try { factory.save(domActivity); } catch (UnqViolationUncheckedException e) { throw new UniqueKeyViolationException("An activity with the same code mapping exists"); } return ActivityVoAssembler.create(domActivity); }
public ActivityVoCollection listNTPFActivities(Boolean isActive, LookupInstanceCollection activityTypeInstancesToExclude) { DomainFactory factory = getDomainFactory(); String hql = " from Activity act "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); StringBuffer condStr = new StringBuffer(); String andStr = " "; if(isActive != null) { condStr.append(andStr + " act.isActive = :isActive" ); markers.add("isActive"); values.add(isActive); andStr = " and "; } if(activityTypeInstancesToExclude != null) { for(int i=0;i<activityTypeInstancesToExclude.size();i++) { String paramName = "actType" + String.valueOf(i); condStr.append(andStr + " act.activityType <> " + ":" + paramName ); markers.add(paramName); values.add(getDomLookup(activityTypeInstancesToExclude.getIndex(i))); andStr = " and "; } } if(andStr.equals( " and ")) hql += " where "; hql += condStr.toString(); List activities = factory.find(hql,markers,values); return ActivityVoAssembler.createActivityVoCollectionFromActivity(activities).sort(); }
/** * listActivities */ //WDEV-22973 public ActivityVoCollection listActivities(CatsReferralRefVo catsReferralRef, ServiceRefVo serviceRef) { if (catsReferralRef != null && serviceRef != null) { DomainFactory factory = getDomainFactory(); String query = null; Long noConsultationActivityRequiredForReferral = factory.countWithHQL("select count(cats.id) from CatsReferral as cats where cats.id = :CatsReferralId and (cats.consultationActivityRequired = 0 or cats.consultationActivityRequired is null) ", new String[] {"CatsReferralId"}, new Object[] {catsReferralRef.getID_CatsReferral()}); if (noConsultationActivityRequiredForReferral == null || noConsultationActivityRequiredForReferral == 0) //WDEV-22672 { Long appointmentsCount = factory.countWithHQL("select count(appts.id) from CatsReferral as cats right join cats.appointments as appts where appts.theatreBooking is null and cats.id = :CatsReferralId", new String[] {"CatsReferralId"}, new Object[] {catsReferralRef.getID_CatsReferral()}); query = "select act from ServiceActivity as servActivity left join servActivity.activity as act left join servActivity.service as serv where serv.id = :serviceID and act.activityType.id = :actType and servActivity.isActive = :isActive" + ((appointmentsCount == null || appointmentsCount == 0) ? " and (act.firstAppointment = 1 or act.diagnostic = 1)" : "") + " order by act.name asc"; } else { query = "select act from ServiceActivity as servActivity left join servActivity.activity as act left join servActivity.service as serv where serv.id = :serviceID and act.activityType.id = :actType and servActivity.isActive = :isActive order by act.name asc"; } if(query != null && query.length() > 0) { List<?> results = factory.find(query, new String[]{"serviceID", "actType", "isActive"}, new Object[]{serviceRef.getID_Service(), ActivityType.APPOINTMENTTYPES.getId(), Boolean.TRUE}); if (results == null || results.isEmpty()) return null; return ActivityVoAssembler.createActivityVoCollectionFromActivity(results); } } ProfilesSlotGeneric impl = (ProfilesSlotGeneric) getDomainImpl(ProfilesSlotGenericImpl.class); return impl.listActivities(); }
public ActivityVoCollection listActivity(LocationServiceActivityVo locationServiceActivity) throws DomainInterfaceException { DomainFactory factory = getDomainFactory(); if (locationServiceActivity == null) return ActivityVoAssembler.createActivityVoCollectionFromActivity(factory.listDomainObjects(Activity.class)); ActivityVoCollection voCollActivity = new ActivityVoCollection(); String hql = "select locServiceActivity from LocationServiceActivity locServiceActivity, Procedure proc join proc.keywords as kw"; StringBuffer condStr = new StringBuffer(); String andStr = " "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); condStr.append(andStr + " where locServiceActivity.serviceActivity is not null and locServiceActivity.serviceActivity.activity = proc.activity"); andStr = " and "; if (locationServiceActivity.getLocationService() != null) { condStr.append(andStr + " locServiceActivity.locationService.id = :locService"); markers.add("locService"); values.add(locationServiceActivity.getLocationService().getID_LocationService()); andStr = " and "; } if ((locationServiceActivity.getServiceActivityIsNotNull()) && (locationServiceActivity.getServiceActivity().getActivityIsNotNull()) && (locationServiceActivity.getServiceActivity().getActivity().getIsActiveIsNotNull())) { condStr.append(andStr + " locServiceActivity.serviceActivity.activity.isActive = :isActive"); markers.add("isActive"); values.add(locationServiceActivity.getServiceActivity().getActivity().getIsActive()); andStr = " and "; } if ((locationServiceActivity.getLocationServiceIsNotNull()) && (locationServiceActivity.getLocationService().getIsActiveIsNotNull())) { condStr.append(andStr + " locServiceActivity.isActive = :isLSActive"); markers.add("isLSActive"); values.add(locationServiceActivity.getLocationService().getIsActive()); andStr = " and "; } hql += condStr.toString(); LocationServiceActivityVoCollection voCollLocServiceActivity = null; voCollLocServiceActivity = LocationServiceActivityVoAssembler.createLocationServiceActivityVoCollectionFromLocationServiceActivity(Keywords.searchByKeywords(factory, locationServiceActivity.getServiceActivity().getActivity().getName(), hql.toString(), markers, values)); factory.getDomainSession().clearMessages(); for (int i = 0; i < voCollLocServiceActivity.size(); i++) { if (voCollLocServiceActivity.get(i).getServiceActivityIsNotNull()) voCollActivity.add(voCollLocServiceActivity.get(i).getServiceActivity().getActivity()); } return voCollActivity.sort(); }
public ActivityVoCollection listActivity(ActivityVo filterActivity, Boolean checkDuplicate) { DomainFactory factory = getDomainFactory(); if (filterActivity == null) return ActivityVoAssembler.createActivityVoCollectionFromActivity(factory.listDomainObjects(Activity.class)); String hql = " from Activity activity "; StringBuffer condStr = new StringBuffer(); String andStr = " "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); if (filterActivity.getNameIsNotNull()) { // Checks the exact match if (checkDuplicate != null && checkDuplicate.booleanValue()) condStr.append(andStr + " upper(activity.name) = :activityName"); else condStr.append(andStr + " upper(activity.name) like :activityName"); markers.add("activityName"); values.add("%" + filterActivity.getName().toUpperCase() + "%"); andStr = " and "; } if (filterActivity.getIsActiveIsNotNull()) { condStr.append(andStr + " activity.isActive = :active"); markers.add("active"); values.add(filterActivity.getIsActive()); andStr = " and "; } if (filterActivity.getActivityTypeIsNotNull()) { condStr.append(andStr + " activity.activityType = :activityType"); markers.add("activityType"); values.add(getDomLookup(filterActivity.getActivityType())); andStr = " and "; } if (filterActivity.getIsWorkQueueIsNotNull()) { condStr.append(andStr + " activity.isWorkQueue = :workQ "); markers.add("workQ"); values.add(filterActivity.getIsWorkQueue()); andStr = " and "; } if (andStr.equals(" and ")) hql += " where "; hql += condStr.toString(); return ActivityVoAssembler.createActivityVoCollectionFromActivity(factory.find(hql, markers, values)).sort(); }
public ActivityVoCollection listActivity(String nameFilter, ActivityType activityType, Boolean bActive) throws DomainInterfaceException { ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); StringBuffer condStr = new StringBuffer(); String andStr = " "; String hql = null; DomainFactory factory = getDomainFactory(); if (ConfigFlag.DOM.LINK_ACTIVITY_TO_PROCEDURE.getValue() && activityType.equals(ActivityType.PROCEDURE)) { hql = "select act from Activity act, Procedure proc join proc.keywords as kw"; condStr.append(andStr + " where act = proc.activity"); andStr = " and "; } else { hql = "select act from Activity act"; condStr.append(" where"); andStr = " "; } if (bActive != null) { condStr.append(andStr + " act.isActive = :isActive"); markers.add("isActive"); values.add(bActive); andStr = " and "; } if (activityType != null) { condStr.append(andStr + " act.activityType =:actType"); markers.add("actType"); values.add(getDomLookup(activityType)); andStr = " and "; } if (!ConfigFlag.DOM.LINK_ACTIVITY_TO_PROCEDURE.getValue() && nameFilter != "") { condStr.append(andStr + " act.name like :filterStr "); markers.add("filterStr"); values.add(nameFilter + "%"); } hql += condStr.toString(); List activities = null; if (ConfigFlag.DOM.LINK_ACTIVITY_TO_PROCEDURE.getValue() && activityType.equals(ActivityType.PROCEDURE)) activities = Keywords.searchByKeywords(factory, nameFilter, hql.toString(), markers, values); else activities = factory.find(hql, markers, values, 1000); return ActivityVoAssembler.createActivityVoCollectionFromActivity(activities).sort(); }