use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class TagREST method deleteTagResourceMap.
@DELETE
@Path(TagRESTConstants.TAGRESOURCEMAPS_RESOURCE)
@Produces({ "application/json", "application/xml" })
@PreAuthorize("hasRole('ROLE_SYS_ADMIN')")
public void deleteTagResourceMap(@QueryParam("tag-guid") String tagGuid, @QueryParam("resource-guid") String resourceGuid) {
if (LOG.isDebugEnabled()) {
LOG.debug("==> TagREST.deleteTagResourceMap(" + tagGuid + ", " + resourceGuid + ")");
}
try {
RangerTagResourceMap exist = validator.preDeleteTagResourceMap(tagGuid, resourceGuid);
tagStore.deleteTagResourceMap(exist.getId());
} catch (Exception excp) {
LOG.error("deleteTagResourceMap(" + tagGuid + ", " + resourceGuid + ") failed", excp);
throw restErrorUtil.createRESTException(HttpServletResponse.SC_BAD_REQUEST, excp.getMessage(), true);
}
if (LOG.isDebugEnabled()) {
LOG.debug("==> TagREST.deleteTagResourceMap(" + tagGuid + ", " + resourceGuid + ")");
}
}
use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class TagREST method deleteTagResourceMapByGuid.
@DELETE
@Path(TagRESTConstants.TAGRESOURCEMAP_RESOURCE + "guid/{guid}")
@Produces({ "application/json", "application/xml" })
@PreAuthorize("hasRole('ROLE_SYS_ADMIN')")
public void deleteTagResourceMapByGuid(@PathParam("guid") String guid) {
if (LOG.isDebugEnabled()) {
LOG.debug("==> TagREST.deleteTagResourceMapByGuid(" + guid + ")");
}
try {
RangerTagResourceMap exist = validator.preDeleteTagResourceMapByGuid(guid);
tagStore.deleteServiceResource(exist.getId());
} catch (Exception excp) {
LOG.error("deleteTagResourceMapByGuid(" + guid + ") failed", excp);
throw restErrorUtil.createRESTException(HttpServletResponse.SC_BAD_REQUEST, excp.getMessage(), true);
}
if (LOG.isDebugEnabled()) {
LOG.debug("<== TagREST.deleteTagResourceMapByGuid(" + guid + ")");
}
}
use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class RangerTagResourceMapService method getByTagAndResourceId.
public RangerTagResourceMap getByTagAndResourceId(Long tagId, Long resourceId) {
RangerTagResourceMap ret = null;
XXTagResourceMap xxTagResourceMap = daoMgr.getXXTagResourceMap().findByTagAndResourceId(tagId, resourceId);
if (xxTagResourceMap != null) {
ret = populateViewBean(xxTagResourceMap);
}
return ret;
}
use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class RangerTagResourceMapService method getByTagGuid.
public List<RangerTagResourceMap> getByTagGuid(String tagGuid) {
List<RangerTagResourceMap> ret = new ArrayList<RangerTagResourceMap>();
List<XXTagResourceMap> xxTagResourceMaps = daoMgr.getXXTagResourceMap().findByTagGuid(tagGuid);
if (CollectionUtils.isNotEmpty(xxTagResourceMaps)) {
for (XXTagResourceMap xxTagResourceMap : xxTagResourceMaps) {
RangerTagResourceMap tagResourceMap = populateViewBean(xxTagResourceMap);
ret.add(tagResourceMap);
}
}
return ret;
}
use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class RangerTagResourceMapService method postUpdate.
@Override
public RangerTagResourceMap postUpdate(XXTagResourceMap tagResMap) {
RangerTagResourceMap ret = super.postUpdate(tagResMap);
daoMgr.getXXServiceVersionInfo().updateServiceVersionInfoForServiceResourceUpdate(tagResMap.getResourceId(), tagResMap.getUpdateTime());
return ret;
}
Aggregations