public LocationServiceActivityVoCollection listLocationServiceActivity(LocationServiceVo filterLocationService) { DomainFactory factory = getDomainFactory(); String hql = " from LocationServiceActivity locServiceActivity "; StringBuffer condStr = new StringBuffer(); String andStr = " "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); if (filterLocationService != null && filterLocationService.getID_LocationServiceIsNotNull()) { condStr.append(andStr + " locServiceActivity.locationService.id = :locService"); markers.add("locService"); values.add(filterLocationService.getID_LocationService()); andStr = " and "; } if (andStr.equals(" and ")) hql += " where "; else return new LocationServiceActivityVoCollection(); hql += condStr.toString(); return LocationServiceActivityVoAssembler.createLocationServiceActivityVoCollectionFromLocationServiceActivity(factory.find(hql, markers, values)).sort(); }
public LocationServiceActivityVoCollection listProcedureinLocationServiceActivity(ActivityVo voActivity) { DomainFactory factory = getDomainFactory(); String hql = " from LocationServiceActivity locServiceActivity "; StringBuffer condStr = new StringBuffer(); String andStr = " "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); if(voActivity != null) { if(voActivity.getIsActiveIsNotNull()) { condStr.append(andStr + " locServiceActivity.serviceActivity.activity.isActive = :isActive"); markers.add("isActive"); values.add(voActivity.getIsActive()); andStr = " and "; } if(voActivity.getNameIsNotNull() && !voActivity.getID_ActivityIsNotNull()) { condStr.append(andStr + " upper(locServiceActivity.serviceActivity.activity.name) like :activityName"); markers.add("activityName"); values.add("%" + voActivity.getName().toUpperCase() + "%"); andStr = " and "; } else if(voActivity.getID_ActivityIsNotNull()) { condStr.append(andStr + "locServiceActivity.serviceActivity.activity.id = :activityId"); markers.add("activityId"); values.add(voActivity.getID_Activity()); andStr = " and "; } } if (andStr.equals(" and ")) hql += " where "; hql += condStr.toString(); return LocationServiceActivityVoAssembler.createLocationServiceActivityVoCollectionFromLocationServiceActivity(factory.find(hql, markers, values)).sort(); }
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 LocationServiceActivityVoCollection listLocationServiceActivity(LocationServiceVo locationService, ActivityVo activity) throws DomainInterfaceException { DomainFactory factory = getDomainFactory(); if (locationService == null && activity == null) return LocationServiceActivityVoAssembler.createLocationServiceActivityVoCollectionFromLocationServiceActivity(factory.listDomainObjects(LocationServiceActivity.class)); String hql = " from LocationServiceActivity locServiceActivity "; StringBuffer condStr = new StringBuffer(); String andStr = " "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); if (locationService != null) { if (locationService.getID_LocationServiceIsNotNull()) { condStr.append(andStr + " locServiceActivity.locationService.id = :locServiceId"); markers.add("locServiceId"); values.add(locationService.getID_LocationService()); andStr = " and "; } else if ((locationService.getLocationIsNotNull()) && (locationService.getLocation().getID_LocationIsNotNull())) { // filter by location condStr.append(andStr + " locServiceActivity.locationService.location.id = :locId"); markers.add("locId"); values.add(locationService.getLocation().getID_Location()); andStr = " and "; } else if ((locationService.getServiceIsNotNull()) && (locationService.getService().getID_ServiceIsNotNull())) { // filter by location condStr.append(andStr + " locServiceActivity.locationService.service.id = :serId"); markers.add("serId"); values.add(locationService.getService().getID_Service()); andStr = " and "; } } if (activity != null) { // filter Active if (activity.getIsActiveIsNotNull()) { condStr.append(andStr + " locServiceActivity.serviceActivity.activity.isActive = :isActive"); markers.add("isActive"); values.add(activity.getIsActive()); andStr = " and "; } // filter Name if (activity.getNameIsNotNull() && !activity.getID_ActivityIsNotNull()) { condStr.append(andStr + " upper(locServiceActivity.serviceActivity.activity.name) like :activityName"); markers.add("activityName"); values.add("%" + activity.getName().toUpperCase() + "%"); andStr = " and "; } else if (activity.getID_ActivityIsNotNull()) { // filter by Activity condStr.append(andStr + "locServiceActivity.serviceActivity.activity.id = :activityId"); markers.add("activityId"); values.add(activity.getID_Activity()); andStr = " and "; } } if (andStr.equals(" and ")) hql += " where "; hql += condStr.toString(); return LocationServiceActivityVoAssembler.createLocationServiceActivityVoCollectionFromLocationServiceActivity(factory.find(hql, markers, values)).sort(); }
public LocationServiceActivityVoCollection listLocationServiceActivityKeyWords(LocationServiceVo locationService, ActivityVo activity) throws DomainInterfaceException { DomainFactory factory = getDomainFactory(); if (locationService == null && activity == null) return LocationServiceActivityVoAssembler.createLocationServiceActivityVoCollectionFromLocationServiceActivity(factory.listDomainObjects(LocationServiceActivity.class)); 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 (locationService != null) { if (locationService.getID_LocationServiceIsNotNull()) { condStr.append(andStr + " locServiceActivity.locationService.id = :locServiceId"); markers.add("locServiceId"); values.add(locationService.getID_LocationService()); andStr = " and "; } else if ((locationService.getLocationIsNotNull()) && (locationService.getLocation().getID_LocationIsNotNull())) { // filter by location condStr.append(andStr + " locServiceActivity.locationService.location.id = :locId"); markers.add("locId"); values.add(locationService.getLocation().getID_Location()); andStr = " and "; } else if ((locationService.getServiceIsNotNull()) && (locationService.getService().getID_ServiceIsNotNull())) { // filter by location condStr.append(andStr + " locServiceActivity.locationService.service.id = :serId"); markers.add("serId"); values.add(locationService.getService().getID_Service()); andStr = " and "; } if (locationService.getIsActiveIsNotNull()) { condStr.append(andStr + " locServiceActivity.isActive = :isLSActive"); markers.add("isLSActive"); values.add(locationService.getIsActive()); andStr = " and "; } } if (activity != null) { // filter Active if (activity.getIsActiveIsNotNull()) { condStr.append(andStr + " locServiceActivity.serviceActivity.activity.isActive = :isActive"); markers.add("isActive"); values.add(activity.getIsActive()); andStr = " and "; } if (activity.getID_ActivityIsNotNull()) { // filter by Activity condStr.append(andStr + "locServiceActivity.serviceActivity.activity.id = :activityId"); markers.add("activityId"); values.add(activity.getID_Activity()); andStr = " and "; } } hql += condStr.toString(); return LocationServiceActivityVoAssembler.createLocationServiceActivityVoCollectionFromLocationServiceActivity(Keywords.searchByKeywords(factory, activity.getName(), hql.toString(), markers, values)); }