Search in sources :

Example 1 with XXServiceResource

use of org.apache.ranger.entity.XXServiceResource in project ranger by apache.

the class RangerServiceResourceService method getByServiceId.

public List<RangerServiceResource> getByServiceId(Long serviceId) {
    List<RangerServiceResource> ret = new ArrayList<RangerServiceResource>();
    List<XXServiceResource> xxServiceResources = daoMgr.getXXServiceResource().findByServiceId(serviceId);
    if (CollectionUtils.isNotEmpty(xxServiceResources)) {
        for (XXServiceResource xxServiceResource : xxServiceResources) {
            RangerServiceResource serviceResource = populateViewBean(xxServiceResource);
            ret.add(serviceResource);
        }
    }
    return ret;
}
Also used : XXServiceResource(org.apache.ranger.entity.XXServiceResource) RangerServiceResource(org.apache.ranger.plugin.model.RangerServiceResource) ArrayList(java.util.ArrayList)

Example 2 with XXServiceResource

use of org.apache.ranger.entity.XXServiceResource in project ranger by apache.

the class RangerServiceResourceService method getServiceResourceByGuid.

public RangerServiceResource getServiceResourceByGuid(String guid) {
    RangerServiceResource ret = null;
    XXServiceResource xxServiceResource = daoMgr.getXXServiceResource().findByGuid(guid);
    if (xxServiceResource != null) {
        ret = populateViewBean(xxServiceResource);
    }
    return ret;
}
Also used : XXServiceResource(org.apache.ranger.entity.XXServiceResource) RangerServiceResource(org.apache.ranger.plugin.model.RangerServiceResource)

Example 3 with XXServiceResource

use of org.apache.ranger.entity.XXServiceResource 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 + ")");
    }
}
Also used : XXTagResourceMap(org.apache.ranger.entity.XXTagResourceMap) XXServiceResource(org.apache.ranger.entity.XXServiceResource) RangerServiceNotFoundException(org.apache.ranger.plugin.util.RangerServiceNotFoundException) XXServiceResourceElementValue(org.apache.ranger.entity.XXServiceResourceElementValue) XXTag(org.apache.ranger.entity.XXTag) XXService(org.apache.ranger.entity.XXService) XXTagAttribute(org.apache.ranger.entity.XXTagAttribute) XXServiceResourceElement(org.apache.ranger.entity.XXServiceResourceElement)

Example 4 with XXServiceResource

use of org.apache.ranger.entity.XXServiceResource in project ranger by apache.

the class RangerServiceResourceService method getTaggedResourcesInServiceId.

public List<RangerServiceResource> getTaggedResourcesInServiceId(Long serviceId) {
    List<RangerServiceResource> ret = new ArrayList<RangerServiceResource>();
    List<XXServiceResource> xxServiceResources = daoMgr.getXXServiceResource().findByServiceId(serviceId);
    if (CollectionUtils.isNotEmpty(xxServiceResources)) {
        for (XXServiceResource xxServiceResource : xxServiceResources) {
            RangerServiceResource serviceResource = populateViewBean(xxServiceResource);
            ret.add(serviceResource);
        }
    }
    return ret;
}
Also used : XXServiceResource(org.apache.ranger.entity.XXServiceResource) RangerServiceResource(org.apache.ranger.plugin.model.RangerServiceResource) ArrayList(java.util.ArrayList)

Example 5 with XXServiceResource

use of org.apache.ranger.entity.XXServiceResource in project ranger by apache.

the class RangerServiceResourceService method getByServiceAndResourceSignature.

public RangerServiceResource getByServiceAndResourceSignature(Long serviceId, String resourceSignature) {
    RangerServiceResource ret = null;
    XXServiceResource xxServiceResource = daoMgr.getXXServiceResource().findByServiceAndResourceSignature(serviceId, resourceSignature);
    if (xxServiceResource != null) {
        ret = populateViewBean(xxServiceResource);
    }
    return ret;
}
Also used : XXServiceResource(org.apache.ranger.entity.XXServiceResource) RangerServiceResource(org.apache.ranger.plugin.model.RangerServiceResource)

Aggregations

XXServiceResource (org.apache.ranger.entity.XXServiceResource)5 RangerServiceResource (org.apache.ranger.plugin.model.RangerServiceResource)4 ArrayList (java.util.ArrayList)2 XXService (org.apache.ranger.entity.XXService)1 XXServiceResourceElement (org.apache.ranger.entity.XXServiceResourceElement)1 XXServiceResourceElementValue (org.apache.ranger.entity.XXServiceResourceElementValue)1 XXTag (org.apache.ranger.entity.XXTag)1 XXTagAttribute (org.apache.ranger.entity.XXTagAttribute)1 XXTagResourceMap (org.apache.ranger.entity.XXTagResourceMap)1 RangerServiceNotFoundException (org.apache.ranger.plugin.util.RangerServiceNotFoundException)1