use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class RangerTagDefService method mapEntityToViewBean.
@Override
protected RangerTagDef mapEntityToViewBean(RangerTagDef vObj, XXTagDef xObj) {
RangerTagDef ret = super.mapEntityToViewBean(vObj, xObj);
List<RangerTagDef.RangerTagAttributeDef> attributeDefs = RangerTagDBRetriever.gsonBuilder.fromJson(xObj.getTagAttrDefs(), RangerTagDBRetriever.subsumedDataType);
ret.setAttributeDefs(attributeDefs);
return ret;
}
use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class RangerServiceTagsDeltaUtil method pruneUnusedAttributes.
public static void pruneUnusedAttributes(ServiceTags serviceTags) {
if (serviceTags != null) {
serviceTags.setTagUpdateTime(null);
for (Map.Entry<Long, RangerTagDef> entry : serviceTags.getTagDefinitions().entrySet()) {
RangerTagDef tagDef = entry.getValue();
tagDef.setCreatedBy(null);
tagDef.setCreateTime(null);
tagDef.setUpdatedBy(null);
tagDef.setUpdateTime(null);
tagDef.setGuid(null);
}
for (Map.Entry<Long, RangerTag> entry : serviceTags.getTags().entrySet()) {
RangerTag tag = entry.getValue();
tag.setCreatedBy(null);
tag.setCreateTime(null);
tag.setUpdatedBy(null);
tag.setUpdateTime(null);
tag.setGuid(null);
}
for (RangerServiceResource serviceResource : serviceTags.getServiceResources()) {
serviceResource.setCreatedBy(null);
serviceResource.setCreateTime(null);
serviceResource.setUpdatedBy(null);
serviceResource.setUpdateTime(null);
serviceResource.setGuid(null);
serviceResource.setServiceName(null);
}
}
}
use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class TagPredicateUtil method addPredicateForTagType.
private Predicate addPredicateForTagType(final String type, List<Predicate> predicates) {
if (StringUtils.isEmpty(type)) {
return null;
}
Predicate ret = new Predicate() {
@Override
public boolean evaluate(Object object) {
boolean ret = false;
if (object == null) {
return ret;
}
if (object instanceof RangerTagDef) {
RangerTagDef tagDef = (RangerTagDef) object;
ret = StringUtils.equals(type, tagDef.getName());
} else if (object instanceof RangerTag) {
RangerTag tag = (RangerTag) object;
ret = StringUtils.equals(type, tag.getType());
}
return ret;
}
};
if (predicates != null) {
predicates.add(ret);
}
return ret;
}
use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class TagPredicateUtil method addPredicateForTagDefGuid.
private Predicate addPredicateForTagDefGuid(final String guid, List<Predicate> predicates) {
if (StringUtils.isEmpty(guid)) {
return null;
}
Predicate ret = new Predicate() {
@Override
public boolean evaluate(Object object) {
boolean ret = false;
if (object == null) {
return ret;
}
if (object instanceof RangerTagDef) {
RangerTagDef tagDef = (RangerTagDef) object;
ret = StringUtils.equals(guid, tagDef.getGuid());
}
return ret;
}
};
if (predicates != null) {
predicates.add(ret);
}
return ret;
}
use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class TagPredicateUtil method addPredicateForTagDefId.
private Predicate addPredicateForTagDefId(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 RangerTagDef) {
RangerTagDef tagDef = (RangerTagDef) object;
ret = StringUtils.equals(id, tagDef.getId().toString());
}
return ret;
}
};
if (predicates != null) {
predicates.add(ret);
}
return ret;
}
Aggregations