Search in sources :

Example 1 with XXSecurityZoneRefResourceDao

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

the class SecurityZoneRefUpdater method cleanupRefTables.

public Boolean cleanupRefTables(RangerSecurityZone rangerSecurityZone) {
    final Long zoneId = rangerSecurityZone == null ? null : rangerSecurityZone.getId();
    if (zoneId == null) {
        return false;
    }
    XXSecurityZoneRefServiceDao xZoneServiceDao = daoMgr.getXXSecurityZoneRefService();
    XXSecurityZoneRefTagServiceDao xZoneTagServiceDao = daoMgr.getXXSecurityZoneRefTagService();
    XXSecurityZoneRefResourceDao xZoneResourceDao = daoMgr.getXXSecurityZoneRefResource();
    XXSecurityZoneRefUserDao xZoneUserDao = daoMgr.getXXSecurityZoneRefUser();
    XXSecurityZoneRefGroupDao xZoneGroupDao = daoMgr.getXXSecurityZoneRefGroup();
    for (XXSecurityZoneRefService service : xZoneServiceDao.findByZoneId(zoneId)) {
        xZoneServiceDao.remove(service);
    }
    for (XXSecurityZoneRefTagService service : xZoneTagServiceDao.findByZoneId(zoneId)) {
        xZoneTagServiceDao.remove(service);
    }
    for (XXSecurityZoneRefResource resource : xZoneResourceDao.findByZoneId(zoneId)) {
        xZoneResourceDao.remove(resource);
    }
    for (XXSecurityZoneRefUser user : xZoneUserDao.findByZoneId(zoneId)) {
        xZoneUserDao.remove(user);
    }
    for (XXSecurityZoneRefGroup group : xZoneGroupDao.findByZoneId(zoneId)) {
        xZoneGroupDao.remove(group);
    }
    return true;
}
Also used : XXSecurityZoneRefGroup(org.apache.ranger.entity.XXSecurityZoneRefGroup) XXSecurityZoneRefTagServiceDao(org.apache.ranger.db.XXSecurityZoneRefTagServiceDao) XXSecurityZoneRefResourceDao(org.apache.ranger.db.XXSecurityZoneRefResourceDao) XXSecurityZoneRefTagService(org.apache.ranger.entity.XXSecurityZoneRefTagService) XXSecurityZoneRefServiceDao(org.apache.ranger.db.XXSecurityZoneRefServiceDao) XXSecurityZoneRefUserDao(org.apache.ranger.db.XXSecurityZoneRefUserDao) XXSecurityZoneRefUser(org.apache.ranger.entity.XXSecurityZoneRefUser) XXSecurityZoneRefGroupDao(org.apache.ranger.db.XXSecurityZoneRefGroupDao) XXSecurityZoneRefResource(org.apache.ranger.entity.XXSecurityZoneRefResource) XXSecurityZoneRefService(org.apache.ranger.entity.XXSecurityZoneRefService)

Aggregations

XXSecurityZoneRefGroupDao (org.apache.ranger.db.XXSecurityZoneRefGroupDao)1 XXSecurityZoneRefResourceDao (org.apache.ranger.db.XXSecurityZoneRefResourceDao)1 XXSecurityZoneRefServiceDao (org.apache.ranger.db.XXSecurityZoneRefServiceDao)1 XXSecurityZoneRefTagServiceDao (org.apache.ranger.db.XXSecurityZoneRefTagServiceDao)1 XXSecurityZoneRefUserDao (org.apache.ranger.db.XXSecurityZoneRefUserDao)1 XXSecurityZoneRefGroup (org.apache.ranger.entity.XXSecurityZoneRefGroup)1 XXSecurityZoneRefResource (org.apache.ranger.entity.XXSecurityZoneRefResource)1 XXSecurityZoneRefService (org.apache.ranger.entity.XXSecurityZoneRefService)1 XXSecurityZoneRefTagService (org.apache.ranger.entity.XXSecurityZoneRefTagService)1 XXSecurityZoneRefUser (org.apache.ranger.entity.XXSecurityZoneRefUser)1