Skip to content

Commit

Permalink
RANGER-4630: updated tag REST APIs to support multiple resourceIDs
Browse files Browse the repository at this point in the history
Signed-off-by: Madhan Neethiraj <madhan@apache.org>
  • Loading branch information
anandN872 authored and mneethiraj committed Feb 21, 2024
1 parent e686c24 commit f47db0c
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public class SearchFilter {
public static final String TAG_IDS = "tagIds"; // search
public static final String TAG_GUID = "tagGuid"; // search
public static final String TAG_RESOURCE_ID = "resourceId"; // search
public static final String TAG_RESOURCE_IDS = "resourceIds"; // search
public static final String TAG_RESOURCE_GUID = "resourceGuid"; // search
public static final String TAG_RESOURCE_SERVICE_NAME = "resourceServiceName"; // search
public static final String TAG_RESOURCE_SIGNATURE = "resourceSignature"; // search
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ private StringBuilder buildWhereClause(SearchFilter searchCriteria,
whereClause.append(" ) ");
}

logger.debug("Where clause ... :: " + whereClause);
} else {
whereClause.append(" and ")
.append(searchField.getFieldName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,7 @@ public PList<RangerServiceResource> getServiceResources(@Context HttpServletRequ

try {
SearchFilter filter = searchUtil.getSearchFilter(request, rangerServiceResourceService.sortFields);
searchUtil.extractIntList(request, filter, SearchFilter.TAG_RESOURCE_IDS, "Tag resource list");

ret = tagStore.getPaginatedServiceResources(filter);
} catch (Exception excp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public RangerServiceResourceService() {
searchFields.add(new SearchField(SearchFilter.TAG_SERVICE_NAME_PARTIAL, "service.name", DATA_TYPE.STRING, SEARCH_TYPE.PARTIAL, "XXService service", "obj.serviceId = service.id"));
searchFields.add(new SearchField(SearchFilter.TAG_RESOURCE_GUID, "obj.guid", DATA_TYPE.STRING, SEARCH_TYPE.FULL));
searchFields.add(new SearchField(SearchFilter.TAG_RESOURCE_SIGNATURE, "obj.resourceSignature", DATA_TYPE.STRING, SEARCH_TYPE.FULL));
searchFields.add(new SearchField(SearchFilter.TAG_RESOURCE_IDS, "obj.id", SearchField.DATA_TYPE.INT_LIST, SearchField.SEARCH_TYPE.FULL));

sortFields.add(new SortField(SearchFilter.TAG_RESOURCE_ID, "obj.id", true, SortField.SORT_ORDER.ASC));
sortFields.add(new SortField(SearchFilter.TAG_SERVICE_ID, "obj.serviceId"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public RangerTagResourceMapService() {
searchFields.add(new SearchField(SearchFilter.TAG_DEF_ID, "obj.id", DATA_TYPE.INTEGER, SEARCH_TYPE.FULL));
searchFields.add(new SearchField(SearchFilter.TAG_RESOURCE_ID, "obj.resourceId", DATA_TYPE.INTEGER, SearchField.SEARCH_TYPE.FULL));
searchFields.add(new SearchField(SearchFilter.TAG_ID, "obj.tagId", DATA_TYPE.INTEGER, SearchField.SEARCH_TYPE.FULL));
searchFields.add(new SearchField(SearchFilter.TAG_SERVICE_NAME, "svc.name", DATA_TYPE.STRING, SEARCH_TYPE.FULL, "XXServiceResource svcr, XXService svc", "obj.resourceId = svcr.id and svcr.serviceId = svc.id"));

sortFields.add(new SortField(SearchFilter.TAG_DEF_ID, "obj.id", true, SortField.SORT_ORDER.ASC));
sortFields.add(new SortField(SearchFilter.TAG_RESOURCE_ID, "obj.resourceId"));
Expand Down

0 comments on commit f47db0c

Please sign in to comment.