private int inActivityList(grdActivityRow row, LocationServiceActivityVoCollection voVollAct) { if (voVollAct != null && voVollAct.size() > 0) { for (int i = 0; i < voVollAct.size(); i++) { if (voVollAct.get(i).getServiceActivity().equals(row.getValue())) { return i; } } } return -1; }
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 String checkLSALinks(ServiceActivityVo voServiceActivity) throws DomainInterfaceException { if (voServiceActivity != null) { // check if an active Location Service Activity records LocationService impl = (LocationService) getDomainImpl(LocationServiceImpl.class); LocationServiceActivityVo voLocSerAct = new LocationServiceActivityVo(); voLocSerAct.setServiceActivity(voServiceActivity); voLocSerAct.setIsActive(new Boolean(true)); LocationServiceVo voLocSer = new LocationServiceVo(); ServiceVo voSer = new ServiceVo(); voSer.setID_Service(voServiceActivity.getService().getID_Service()); voSer.setIsActive(voServiceActivity.getService().getIsActive()); voLocSer.setService(voSer); voLocSerAct.setLocationService(voLocSer); LocationServiceActivityVoCollection voColl = impl.listLocationServiceActivity(voLocSerAct.getLocationService(), voLocSerAct.getServiceActivity().getActivity()); if (voColl != null && voColl.size() > 0) { String activeMessage = "The following " + ConfigFlag.UI.DISPLAY_NAME_LOCATION.getValue(false) + "," + ConfigFlag.UI.DISPLAY_NAME_SERVICE.getValue(false) + "," + ConfigFlag.UI.DISPLAY_NAME_ACTIVITY.getValue(false) + " links are still active.\r\n"; for (int j = 0; j < voColl.size(); j++) { activeMessage += "\r\n" + ConfigFlag.UI.DISPLAY_NAME_LOCATION.getValue(false) + " : " + (voColl.get(j).getLocationService().getLocation().getNameIsNotNull() ? voColl.get(j).getLocationService().getLocation().getName() : ""); activeMessage += " " + ConfigFlag.UI.DISPLAY_NAME_SERVICE.getValue(false) + " : " + (voColl.get(j).getLocationService().getService().getServiceNameIsNotNull() ? voColl.get(j).getLocationService().getService().getServiceName() : ""); for (int k = 0; k < voColl.get(j).getLocationService().getActivities().size(); k++) { if (voColl.get(j).getLocationService().getActivities().get(k).getServiceActivity().getActivityIsNotNull()) { activeMessage += "\r\n" + ConfigFlag.UI.DISPLAY_NAME_ACTIVITY.getValue(false) + " : " + (voColl.get(j).getLocationService().getActivities().get(k).getServiceActivity().getActivity().getNameIsNotNull() ? voColl.get(j).getLocationService().getActivities().get(k).getServiceActivity().getActivity().getName() : ""); } } } return activeMessage; } } return null; }
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)); }
private String checkActiveLSALinksForInactiveSA(ims.core.vo.ServiceActivityVoCollection voCollServiceActivity) throws DomainInterfaceException { // for all inactive records, check that there are no active // LocationServiceActivity links for (int i = 0; i < voCollServiceActivity.size(); i++) { if (!voCollServiceActivity.get(i).getIsActive().booleanValue()) { // check if an active Location Service Activity records LocationService impl = (LocationService) getDomainImpl(LocationServiceImpl.class); LocationServiceActivityVo voLocSerAct = new LocationServiceActivityVo(); voLocSerAct.setServiceActivity(voCollServiceActivity.get(i)); voLocSerAct.setIsActive(new Boolean(true)); LocationServiceVo voLocSer = new LocationServiceVo(); ServiceVo voService = new ServiceVo(); voService.setID_Service(voCollServiceActivity.get(i).getService().getID_Service()); voService.setIsActive(voCollServiceActivity.get(i).getService().getIsActive()); voLocSer.setService(voService); voLocSerAct.setLocationService(voLocSer); LocationServiceActivityVoCollection voColl = impl.listLocationServiceActivity(voLocSerAct.getLocationService(), voLocSerAct.getServiceActivity().getActivity()); if (voColl != null && voColl.size() > 0 && voLocSerAct.getIsActiveIsNotNull()) { String text = "The following " + ConfigFlag.UI.DISPLAY_NAME_LOCATION.getValue(false) + "," + ConfigFlag.UI.DISPLAY_NAME_SERVICE.getValue(false) + "," + ConfigFlag.UI.DISPLAY_NAME_ACTIVITY.getValue(false) + " links are still used and active.\r\n"; String activeMessage = null; for (int j = 0; j < voColl.size(); j++) { if (voColl.get(j).getIsActiveIsNotNull() && voColl.get(j).getIsActive().booleanValue()) { activeMessage += "\r\n" + ConfigFlag.UI.DISPLAY_NAME_LOCATION.getValue(false) + " : " + (voColl.get(j).getLocationService().getLocation().getNameIsNotNull() ? voColl.get(j).getLocationService().getLocation().getName() : ""); activeMessage += " " + ConfigFlag.UI.DISPLAY_NAME_SERVICE.getValue(false) + " : " + (voColl.get(j).getLocationService().getService().getServiceNameIsNotNull() ? voColl.get(j).getLocationService().getService().getServiceName() : ""); for (int k = 0; k < voColl.get(j).getLocationService().getActivities().size(); k++) { if (voColl.get(j).getLocationService().getActivities().get(k).getServiceActivity().getActivityIsNotNull() && voColl.get(j).getLocationService().getActivities().get(k).getServiceActivity().equals(voCollServiceActivity.get(i)) && voColl.get(j).getLocationService().getActivities().get(k).getLocationService().getActivities().get(k).getIsActive().booleanValue() && !voCollServiceActivity.get(i).getIsActive().booleanValue()) { activeMessage += "\r\n" + ConfigFlag.UI.DISPLAY_NAME_ACTIVITY.getValue(false) + " : " + (voColl.get(j).getLocationService().getActivities().get(k).getServiceActivity().getActivity().getNameIsNotNull() ? voColl.get(j).getLocationService().getActivities().get(k).getServiceActivity().getActivity().getName() : ""); } } } } if (activeMessage != null) return text + activeMessage.replace("null", ""); } } } return null; }