// monitor progress of resolution into proper definitions.
int cnt = aggregates.size();
// look for those definitions whose declared aggregates have all been processed.
for (Iterator<PrivilegeDefinition> itr = aggregates.iterator(); itr.hasNext();) {
PrivilegeDefinition stub = itr.next();
PrivilegeBits bts = getAggregateBits(stub.getDeclaredAggregateNames(), definitions);
if (!bts.isEmpty()) {
// make sure the same aggregation is not yet covered by an
// already registered privilege
if (bitsToNames.containsKey(bts) && bitsToNames.get(bts).size() == 1) {
Name existingName = bitsToNames.get(bts).iterator().next();
throw new RepositoryException("Custom aggregate privilege '" + stub.getName() + "' is already covered by '" + existingName.toString() + "'");
}
// ... nor is present within the set of definitions that have
// been created before for registration.
for (Definition d : definitions.values()) {
if (bts.equals(d.bits)) {
throw new RepositoryException("Custom aggregate privilege '" + stub.getName() + "' is already defined by '"+ d.getName()+"'");
}
}
// now its save to create the new definition
Definition def = new Definition(stub, bts);