use of org.apache.ranger.entity.XXTag in project ranger by apache.
the class TagDBStore method deleteAllTagObjectsForService.
@Override
public void deleteAllTagObjectsForService(String serviceName) throws Exception {
if (LOG.isDebugEnabled()) {
LOG.debug("==> TagDBStore.deleteAllTagObjectsForService(" + serviceName + ")");
}
XXService service = daoManager.getXXService().findByName(serviceName);
if (service != null) {
Long serviceId = service.getId();
List<XXTagAttribute> xxTagAttributes = daoManager.getXXTagAttribute().findByServiceIdAndOwner(serviceId, RangerTag.OWNER_SERVICERESOURCE);
List<XXTag> xxTags = daoManager.getXXTag().findByServiceIdAndOwner(serviceId, RangerTag.OWNER_SERVICERESOURCE);
List<XXTagResourceMap> xxTagResourceMaps = daoManager.getXXTagResourceMap().findByServiceId(serviceId);
if (CollectionUtils.isNotEmpty(xxTagResourceMaps)) {
for (XXTagResourceMap xxTagResourceMap : xxTagResourceMaps) {
try {
daoManager.getXXTagResourceMap().remove(xxTagResourceMap);
} catch (Exception e) {
LOG.error("Error deleting RangerTagResourceMap with id=" + xxTagResourceMap.getId(), e);
throw e;
}
}
}
if (CollectionUtils.isNotEmpty(xxTagAttributes)) {
for (XXTagAttribute xxTagAttribute : xxTagAttributes) {
try {
daoManager.getXXTagAttribute().remove(xxTagAttribute);
} catch (Exception e) {
LOG.error("Error deleting RangerTagAttribute with id=" + xxTagAttribute.getId(), e);
throw e;
}
}
}
if (CollectionUtils.isNotEmpty(xxTags)) {
for (XXTag xxTag : xxTags) {
try {
daoManager.getXXTag().remove(xxTag);
} catch (Exception e) {
LOG.error("Error deleting RangerTag with id=" + xxTag.getId(), e);
throw e;
}
}
}
List<XXServiceResourceElementValue> xxServiceResourceElementValues = daoManager.getXXServiceResourceElementValue().findByServiceId(serviceId);
if (CollectionUtils.isNotEmpty(xxServiceResourceElementValues)) {
for (XXServiceResourceElementValue xxServiceResourceElementValue : xxServiceResourceElementValues) {
try {
daoManager.getXXServiceResourceElementValue().remove(xxServiceResourceElementValue);
} catch (Exception e) {
LOG.error("Error deleting ServiceResourceElementValue with id=" + xxServiceResourceElementValue.getId(), e);
throw e;
}
}
}
List<XXServiceResourceElement> xxServiceResourceElements = daoManager.getXXServiceResourceElement().findByServiceId(serviceId);
if (CollectionUtils.isNotEmpty(xxServiceResourceElements)) {
for (XXServiceResourceElement xxServiceResourceElement : xxServiceResourceElements) {
try {
daoManager.getXXServiceResourceElement().remove(xxServiceResourceElement);
} catch (Exception e) {
LOG.error("Error deleting ServiceResourceElement with id=" + xxServiceResourceElement.getId(), e);
throw e;
}
}
}
List<XXServiceResource> xxServiceResources = daoManager.getXXServiceResource().findByServiceId(serviceId);
if (CollectionUtils.isNotEmpty(xxServiceResources)) {
for (XXServiceResource xxServiceResource : xxServiceResources) {
try {
daoManager.getXXServiceResource().remove(xxServiceResource);
} catch (Exception e) {
LOG.error("Error deleting RangerServiceResource with id=" + xxServiceResource.getId(), e);
throw e;
}
}
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("<== TagDBStore.deleteAllTagObjectsForService(" + serviceName + ")");
}
}
use of org.apache.ranger.entity.XXTag in project ranger by apache.
the class RangerTagService method getTagsForResourceGuid.
public List<RangerTag> getTagsForResourceGuid(String resourceGuid) {
List<RangerTag> ret = new ArrayList<RangerTag>();
List<XXTag> xxTags = daoMgr.getXXTag().findForResourceGuid(resourceGuid);
if (CollectionUtils.isNotEmpty(xxTags)) {
for (XXTag xxTag : xxTags) {
RangerTag tag = populateViewBean(xxTag);
ret.add(tag);
}
}
return ret;
}
use of org.apache.ranger.entity.XXTag in project ranger by apache.
the class RangerTagService method getTagByGuid.
public RangerTag getTagByGuid(String guid) {
RangerTag ret = null;
XXTag xxTag = daoMgr.getXXTag().findByGuid(guid);
if (xxTag != null) {
ret = populateViewBean(xxTag);
}
return ret;
}
use of org.apache.ranger.entity.XXTag in project ranger by apache.
the class RangerTagService method getTagsByServiceId.
public List<RangerTag> getTagsByServiceId(Long serviceId) {
List<RangerTag> ret = new ArrayList<RangerTag>();
List<XXTag> xxTags = daoMgr.getXXTag().findByServiceId(serviceId);
if (CollectionUtils.isNotEmpty(xxTags)) {
for (XXTag xxTag : xxTags) {
RangerTag tag = populateViewBean(xxTag);
ret.add(tag);
}
}
return ret;
}
use of org.apache.ranger.entity.XXTag in project ranger by apache.
the class RangerTagService method getTagsByType.
public List<RangerTag> getTagsByType(String name) {
List<RangerTag> ret = new ArrayList<RangerTag>();
List<XXTag> xxTags = daoMgr.getXXTag().findByName(name);
if (CollectionUtils.isNotEmpty(xxTags)) {
for (XXTag xxTag : xxTags) {
RangerTag tag = populateViewBean(xxTag);
ret.add(tag);
}
}
return ret;
}
Aggregations