use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class RangerTagResourceMapService method postCreate.
@Override
public RangerTagResourceMap postCreate(XXTagResourceMap tagResMap) {
RangerTagResourceMap ret = super.postCreate(tagResMap);
daoMgr.getXXServiceVersionInfo().updateServiceVersionInfoForServiceResourceUpdate(tagResMap.getResourceId(), tagResMap.getUpdateTime());
return ret;
}
use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class TagREST method createTagResourceMap.
@POST
@Path(TagRESTConstants.TAGRESOURCEMAPS_RESOURCE)
@Produces({ "application/json", "application/xml" })
@PreAuthorize("hasRole('ROLE_SYS_ADMIN')")
public RangerTagResourceMap createTagResourceMap(@QueryParam("tag-guid") String tagGuid, @QueryParam("resource-guid") String resourceGuid, @DefaultValue("false") @QueryParam("lenient") boolean lenient) {
if (LOG.isDebugEnabled()) {
LOG.debug("==> TagREST.createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ")");
}
RangerTagResourceMap tagResourceMap;
try {
tagResourceMap = tagStore.getTagResourceMapForTagAndResourceGuid(tagGuid, resourceGuid);
if (tagResourceMap == null) {
tagResourceMap = validator.preCreateTagResourceMap(tagGuid, resourceGuid);
tagResourceMap = tagStore.createTagResourceMap(tagResourceMap);
} else if (!lenient) {
throw new Exception("tagResourceMap with tag-guid=" + tagGuid + " and resource-guid=" + resourceGuid + " already exists");
}
} catch (Exception excp) {
LOG.error("createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ") failed", excp);
throw restErrorUtil.createRESTException(HttpServletResponse.SC_BAD_REQUEST, excp.getMessage(), true);
}
if (LOG.isDebugEnabled()) {
LOG.debug("==> TagREST.createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ")");
}
return tagResourceMap;
}
use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class RangerTagResourceMapService method getByResourceGuid.
public List<RangerTagResourceMap> getByResourceGuid(String resourceGuid) {
List<RangerTagResourceMap> ret = new ArrayList<RangerTagResourceMap>();
List<XXTagResourceMap> xxTagResourceMaps = daoMgr.getXXTagResourceMap().findByResourceGuid(resourceGuid);
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 getByTagId.
public List<RangerTagResourceMap> getByTagId(Long tagId) {
List<RangerTagResourceMap> ret = new ArrayList<RangerTagResourceMap>();
List<XXTagResourceMap> xxTagResourceMaps = daoMgr.getXXTagResourceMap().findByTagId(tagId);
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 getByGuid.
public RangerTagResourceMap getByGuid(String guid) {
RangerTagResourceMap ret = null;
XXTagResourceMap xxTagResourceMap = daoMgr.getXXTagResourceMap().findByGuid(guid);
if (xxTagResourceMap != null) {
ret = populateViewBean(xxTagResourceMap);
}
return ret;
}
Aggregations