List of usage examples for org.springframework.security.acls.model ChildrenExistException ChildrenExistException
public ChildrenExistException(String msg)
ChildrenExistException
with the specified message. From source file:eu.europeana.aas.acl.CassandraMutableAclService.java
@Override public void deleteAcl(ObjectIdentity objectIdentity, boolean deleteChildren) throws ChildrenExistException { Assert.notNull(objectIdentity, "Object Identity required"); Assert.notNull(objectIdentity.getIdentifier(), "Object Identity doesn't provide an identifier"); if (LOG.isDebugEnabled()) { LOG.debug("BEGIN deleteAcl: objectIdentity: " + objectIdentity + ", deleteChildren: " + deleteChildren); }//w w w . j a va 2 s .c o m List<AclObjectIdentity> objIdsToDelete = new ArrayList<>(); List<ObjectIdentity> objectsToDelete = new ArrayList<>(); objectsToDelete.add(objectIdentity); List<ObjectIdentity> children = findChildren(objectIdentity); if (deleteChildren) { for (ObjectIdentity child : children) { objectsToDelete.addAll(calculateChildrenReccursively(child)); } } else if (children != null && !children.isEmpty()) { throw new ChildrenExistException( "Cannot delete '" + objectIdentity + "' (has " + children.size() + " children)"); } for (ObjectIdentity objId : objectsToDelete) { objIdsToDelete.add(new AclObjectIdentity(objId)); } aclRepository.deleteAcls(objIdsToDelete); // Clear the cache if (aclCache != null) { for (ObjectIdentity obj : objectsToDelete) { aclCache.evictFromCache(obj); } } if (LOG.isDebugEnabled()) { LOG.debug("END deleteAcl"); } }
From source file:com.cedac.security.acls.mongo.MongoMutableAclService.java
@Override public void deleteAcl(ObjectIdentity objectIdentity, boolean deleteChildren) throws ChildrenExistException { Assert.notNull(objectIdentity, "Object Identity required"); Assert.notNull(objectIdentity.getIdentifier(), "Object Identity doesn't provide an identifier"); if (deleteChildren) { LOG.trace(ACL, "Recursively removing all the child acl entries."); List<ObjectIdentity> children = findChildren(objectIdentity); if (children != null) { for (ObjectIdentity child : children) { deleteAcl(child, true);// ww w.j a va 2 s. com } } } else if (findChildren(objectIdentity) != null) { LOG.warn(ACL, "Children exists for object identity {}.", objectIdentity); throw new ChildrenExistException("Children exists for object identity " + objectIdentity); } LOG.debug(ACL, "Removing object identity {} from acl", objectIdentity); getAclCollection().remove(queryByObjectIdentity(objectIdentity), writeConcern); LOG.trace(ACL, "Evict the object identity {} from cache", objectIdentity); aclCache.evictFromCache(objectIdentity); }
From source file:com.kylinolap.rest.service.AclService.java
@Override public void deleteAcl(ObjectIdentity objectIdentity, boolean deleteChildren) throws ChildrenExistException { HTableInterface htable = null;//from w w w. j a v a 2 s.c om try { htable = HBaseConnection.get(hbaseUrl).getTable(aclTableName); Delete delete = new Delete(Bytes.toBytes(String.valueOf(objectIdentity.getIdentifier()))); List<ObjectIdentity> children = findChildren(objectIdentity); if (!deleteChildren && children.size() > 0) { throw new ChildrenExistException("Children exists for " + objectIdentity); } for (ObjectIdentity oid : children) { deleteAcl(oid, deleteChildren); } htable.delete(delete); htable.flushCommits(); logger.debug("ACL of " + objectIdentity + " deleted successfully."); } catch (IOException e) { logger.error(e.getLocalizedMessage(), e); } finally { IOUtils.closeQuietly(htable); } }
From source file:org.apache.kylin.rest.service.AclService.java
@Override public void deleteAcl(ObjectIdentity objectIdentity, boolean deleteChildren) throws ChildrenExistException { HTableInterface htable = null;//from ww w. j av a 2s. c o m try { htable = aclHBaseStorage.getTable(aclTableName); Delete delete = new Delete(Bytes.toBytes(String.valueOf(objectIdentity.getIdentifier()))); List<ObjectIdentity> children = findChildren(objectIdentity); if (!deleteChildren && children.size() > 0) { throw new ChildrenExistException("Children exists for " + objectIdentity); } for (ObjectIdentity oid : children) { deleteAcl(oid, deleteChildren); } htable.delete(delete); htable.flushCommits(); logger.debug("ACL of " + objectIdentity + " deleted successfully."); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } finally { IOUtils.closeQuietly(htable); } }
From source file:org.apache.kylin.rest.service.LegacyAclService.java
@Override public void deleteAcl(ObjectIdentity objectIdentity, boolean deleteChildren) throws ChildrenExistException { Table htable = null;/*from ww w . j a v a 2s .c om*/ try { htable = aclHBaseStorage.getTable(aclTableName); Delete delete = new Delete(Bytes.toBytes(String.valueOf(objectIdentity.getIdentifier()))); List<ObjectIdentity> children = findChildren(objectIdentity); if (!deleteChildren && children.size() > 0) { throw new ChildrenExistException("Children exists for " + objectIdentity); } for (ObjectIdentity oid : children) { deleteAcl(oid, deleteChildren); } htable.delete(delete); logger.debug("ACL of " + objectIdentity + " deleted successfully."); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } finally { IOUtils.closeQuietly(htable); } }
From source file:org.springframework.security.acls.cassandra.CassandraMutableAclService.java
public void deleteAcl(ObjectIdentity objectIdentity, boolean deleteChildren) throws ChildrenExistException { Assert.notNull(objectIdentity, "Object Identity required"); Assert.notNull(objectIdentity.getIdentifier(), "Object Identity doesn't provide an identifier"); if (LOG.isDebugEnabled()) { LOG.debug("BEGIN deleteAcl: objectIdentity: " + objectIdentity + ", deleteChildren: " + deleteChildren); }//from w ww .jav a 2 s. c om List<AclObjectIdentity> objIdsToDelete = new ArrayList<AclObjectIdentity>(); List<ObjectIdentity> objectsToDelete = new ArrayList<ObjectIdentity>(); objectsToDelete.add(objectIdentity); List<ObjectIdentity> children = findChildren(objectIdentity); if (deleteChildren) { for (ObjectIdentity child : children) { objectsToDelete.addAll(calculateChildrenReccursively(child)); } } else if (children != null && !children.isEmpty()) { throw new ChildrenExistException( "Cannot delete '" + objectIdentity + "' (has " + children.size() + " children)"); } for (ObjectIdentity objId : objectsToDelete) { objIdsToDelete.add(new AclObjectIdentity(objId)); } aclRepository.deleteAcls(objIdsToDelete); // Clear the cache if (aclCache != null) { for (ObjectIdentity obj : objectsToDelete) { aclCache.evictFromCache(obj); } } if (LOG.isDebugEnabled()) { LOG.debug("END deleteAcl"); } }