private Set getAllSuperTypes( AttributeType id ) throws NamingException { Set allSuperTypes = new HashSet(); AttributeType superType = id; while ( superType != null ) { superType = superType.getSuperior(); if ( superType != null ) { allSuperTypes.add( superType ); } } return allSuperTypes; }
if ( attributeType.getSuperior() != null )
public void registerDescendants( AttributeType attributeType ) throws NamingException { // add/create the descendent set for this attribute oidToDescendantSet.put( attributeType.getOid(), new HashSet( 5 ) ); // add this attribute to descendant list of other attributes in superior chain onRegisterAddToAncestorDescendants( attributeType, attributeType.getSuperior() ); }
/** * Recursive method which checks to see if a descendant is really an ancestor or if the two * are equal. * * @param ancestor the possible ancestor of the descendant * @param descendant the possible descendant of the ancestor * @return true if the ancestor equals the descendant or if the descendant is really * a subtype of the ancestor. otherwise false */ private boolean isAncestorOrEqual( AttributeType ancestor, AttributeType descendant ) { if ( ( ancestor == null ) || ( descendant == null ) ) { return false; } if ( ancestor.equals( descendant ) ) { return true; } return isAncestorOrEqual( ancestor, descendant.getSuperior() ); }
/** * Recursively adds a new attributeType to the descendant's list of all ancestors * until top is reached. Top will not have the new type added. * * @param newType the new attributeType being added * @param ancestor some anscestor from superior up to and including top * @throws NamingException */ protected void onRegisterAddToAncestorDescendants( AttributeType newType, AttributeType ancestor ) throws NamingException { if ( ancestor == null || ancestor.getName().equals( "top" ) ) { return; } Set descendants = ( Set ) oidToDescendantSet.get( ancestor.getOid() ); if ( descendants == null ) { descendants = new HashSet( 5 ); oidToDescendantSet.put( ancestor.getOid(), descendants ); } descendants.add( newType ); onRegisterAddToAncestorDescendants( newType, ancestor.getSuperior() ); }
/** * {@inheritDoc} */ public AttributeType unregister( String numericOid ) throws LdapException { try { AttributeType removed = super.unregister( numericOid ); removeMappingFor( removed ); // Deleting an AT which might be used as a superior means we have // to recursively update the descendant map. We also have to remove // the at.oid -> descendant relation oidToDescendantSet.remove( numericOid ); // Now recurse if needed unregisterDescendants( removed, removed.getSuperior() ); return removed; } catch ( LdapException ne ) { throw new LdapNoSuchAttributeException( ne.getMessage() ); } }
if ( superior.getSuperior() == null ) tmp = tmp.getSuperior();
if ( at.getSuperior() != null ) buf.append( " SUP " ).append( at.getSuperior().getName() );
isSuccess &= resolve( at.getSuperior(), errors );
isSuccess &= resolve( at.getSuperior(), errors );
if ( attributeType.getSuperior() != null ) delReference( attributeType, attributeType.getSuperior() );
if ( attributeType.getSuperior() != null ) AttributeType superior = attributeType.getSuperior();