ZepHakase22 commented on issue #54: ATLAS-3219: New REST APIs for serviceType. URL: https://github.com/apache/atlas/pull/54#issuecomment-496748406 It was exactly what I did but it works only for > GET / typedefs? serviceype = {servicetype} how you can see here in the code. But if you want to maintain compatibility with the other REST APIs, that is how the ones for guid and name are made, you need to work in another way, because these APIs refer to the cache. Furthermore, DELETE, obviously needs a separate code. public static Predicate getPredicateFromSearchFilter(SearchFilter searchFilter) { List<Predicate> predicates = new ArrayList<>(); final String type = searchFilter.getParam(SearchFilter.PARAM_TYPE); final String name = searchFilter.getParam(SearchFilter.PARAM_NAME); final String supertype = searchFilter.getParam(SearchFilter.PARAM_SUPERTYPE); final String serviceType = searchFilter.getParam(SearchFilter.PARAM_SERVICETYPE); final String notSupertype = searchFilter.getParam(SearchFilter.PARAM_NOT_SUPERTYPE); final String notServiceType = searchFilter.getParam(SearchFilter.PARAM_NOT_SERVICETYPE); final List<String> notNames = searchFilter.getParams(SearchFilter.PARAM_NOT_NAME); // Add filter for the type/category if (StringUtils.isNotBlank(type)) { predicates.add(getTypePredicate(type)); } // Add filter for the name if (StringUtils.isNotBlank(name)) { predicates.add(getNamePredicate(name)); } //Add filter for the serviceType if(StringUtils.isNotBlank(serviceType)) { predicates.add(getServiceTypePredicate(serviceType)); } // Add filter for the supertype if (StringUtils.isNotBlank(supertype)) { predicates.add(getSuperTypePredicate(supertype)); } // Add filter for the supertype negation if (StringUtils.isNotBlank(notSupertype)) { predicates.add(new NotPredicate(getSuperTypePredicate(notSupertype))); } // Add filter for the serviceType negation // NOTE: Creating code for the exclusion of multiple service types is currently useless. // In fact the getSearchFilter in TypeREST.java uses the HttpServletRequest.getParameter(key) // that if the key takes more values it takes only the first the value. Could be usefull // to change the getSearchFilter to use getParameterValues instead of getParameter. if (StringUtils.isNotBlank(notServiceType)) { predicates.add(new NotPredicate(getServiceTypePredicate(notServiceType))); } // Add filter for the type negation if (CollectionUtils.isNotEmpty(notNames)) { for (String notName : notNames) { predicates.add(new NotPredicate(getNamePredicate(notName))); } } return PredicateUtils.allPredicate(predicates); }
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services