use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class RangerTagResourceMapService method getTagResourceMapsByServiceId.
public List<RangerTagResourceMap> getTagResourceMapsByServiceId(Long serviceId) {
List<RangerTagResourceMap> ret = new ArrayList<RangerTagResourceMap>();
List<XXTagResourceMap> xxTagResourceMaps = daoMgr.getXXTagResourceMap().findByServiceId(serviceId);
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 getByResourceId.
public List<RangerTagResourceMap> getByResourceId(Long resourceId) {
List<RangerTagResourceMap> ret = new ArrayList<RangerTagResourceMap>();
List<XXTagResourceMap> xxTagResourceMaps = daoMgr.getXXTagResourceMap().findByResourceId(resourceId);
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 getByTagAndResourceGuid.
public RangerTagResourceMap getByTagAndResourceGuid(String tagGuid, String resourceGuid) {
RangerTagResourceMap ret = null;
XXTagResourceMap xxTagResourceMap = daoMgr.getXXTagResourceMap().findByTagAndResourceGuid(tagGuid, resourceGuid);
if (xxTagResourceMap != null) {
ret = populateViewBean(xxTagResourceMap);
}
return ret;
}
use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class TagPredicateUtil method addPredicateForResourceId.
private Predicate addPredicateForResourceId(final String id, List<Predicate> predicates) {
if (StringUtils.isEmpty(id)) {
return null;
}
Predicate ret = new Predicate() {
@Override
public boolean evaluate(Object object) {
boolean ret = false;
if (object == null) {
return ret;
}
if (object instanceof RangerServiceResource) {
RangerServiceResource resource = (RangerServiceResource) object;
ret = StringUtils.equals(id, resource.getId().toString());
} else if (object instanceof RangerTagResourceMap) {
RangerTagResourceMap tagResourceMap = (RangerTagResourceMap) object;
ret = StringUtils.equals(id, tagResourceMap.getId().toString());
}
return ret;
}
};
if (predicates != null) {
predicates.add(ret);
}
return ret;
}
use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class TagPredicateUtil method addPredicateForTagResourceMapId.
private Predicate addPredicateForTagResourceMapId(final String id, List<Predicate> predicates) {
if (StringUtils.isEmpty(id)) {
return null;
}
Predicate ret = new Predicate() {
@Override
public boolean evaluate(Object object) {
boolean ret = false;
if (object == null) {
return ret;
}
if (object instanceof RangerTagResourceMap) {
RangerTagResourceMap tagResourceMap = (RangerTagResourceMap) object;
ret = StringUtils.equals(id, tagResourceMap.getId().toString());
}
return ret;
}
};
if (predicates != null) {
predicates.add(ret);
}
return ret;
}
Aggregations