groupsByName.modify2E(new PrincipalDbModify2E<Group, PermissionDeniedException, EXistException>(){
@Override
public void execute(Map<String, Group> principalDb) throws PermissionDeniedException, EXistException {
final AbstractPrincipal remove_group = (AbstractPrincipal)principalDb.get(group.getName());
if(remove_group == null)
{throw new IllegalArgumentException("Group does '"+group.getName()+"' not exist!");}
final DBBroker broker = getDatabase().getActiveBroker();
final Subject subject = broker.getSubject();
((Group)remove_group).assertCanModifyGroup(subject);
remove_group.setRemoved(true);
remove_group.setCollection(broker, collectionRemovedGroups, XmldbURI.create(UUIDGenerator.getUUID() + ".xml"));
final TransactionManager transaction = getDatabase().getTransactionManager();
Txn txn = null;
try {
txn = transaction.beginTransaction();
collectionGroups.removeXMLResource(txn, broker, XmldbURI.create(remove_group.getName() + ".xml" ));
transaction.commit(txn);
} catch (final Exception e) {
transaction.abort(txn);
LOG.debug(e);
} finally {
transaction.close(txn);
}
getSecurityManager().addGroup(remove_group.getId(), (Group)remove_group);
principalDb.remove(remove_group.getName());
}
});
return true;
}