Search in sources :

Example 1 with XXPolicyResourceMapDao

use of org.apache.ranger.db.XXPolicyResourceMapDao in project ranger by apache.

the class ServiceDBStore method deleteExistingPolicyResources.

private Boolean deleteExistingPolicyResources(RangerPolicy policy) {
    if (policy == null) {
        return false;
    }
    List<XXPolicyResource> resources = daoMgr.getXXPolicyResource().findByPolicyId(policy.getId());
    XXPolicyResourceDao resDao = daoMgr.getXXPolicyResource();
    for (XXPolicyResource resource : resources) {
        List<XXPolicyResourceMap> resMapList = daoMgr.getXXPolicyResourceMap().findByPolicyResId(resource.getId());
        XXPolicyResourceMapDao resMapDao = daoMgr.getXXPolicyResourceMap();
        for (XXPolicyResourceMap resMap : resMapList) {
            resMapDao.remove(resMap);
        }
        resDao.remove(resource);
    }
    return true;
}
Also used : XXPolicyResource(org.apache.ranger.entity.XXPolicyResource) XXPolicyResourceDao(org.apache.ranger.db.XXPolicyResourceDao) XXPolicyResourceMap(org.apache.ranger.entity.XXPolicyResourceMap) XXPolicyResourceMapDao(org.apache.ranger.db.XXPolicyResourceMapDao)

Example 2 with XXPolicyResourceMapDao

use of org.apache.ranger.db.XXPolicyResourceMapDao in project ranger by apache.

the class ServiceDBStore method deleteXXPolicyResource.

public void deleteXXPolicyResource(XXPolicyResource xPolRes) {
    List<XXPolicyResourceMap> polResMapList = daoMgr.getXXPolicyResourceMap().findByPolicyResId(xPolRes.getId());
    XXPolicyResourceMapDao polResMapDao = daoMgr.getXXPolicyResourceMap();
    for (XXPolicyResourceMap xxPolResMap : polResMapList) {
        polResMapDao.remove(xxPolResMap);
    }
    daoMgr.getXXPolicyResource().remove(xPolRes);
}
Also used : XXPolicyResourceMap(org.apache.ranger.entity.XXPolicyResourceMap) XXPolicyResourceMapDao(org.apache.ranger.db.XXPolicyResourceMapDao)

Aggregations

XXPolicyResourceMapDao (org.apache.ranger.db.XXPolicyResourceMapDao)2 XXPolicyResourceMap (org.apache.ranger.entity.XXPolicyResourceMap)2 XXPolicyResourceDao (org.apache.ranger.db.XXPolicyResourceDao)1 XXPolicyResource (org.apache.ranger.entity.XXPolicyResource)1