for ( int i = 0; i < getSelectedAttributes().length; i++ )
{
// check if a non-modifyable, must or objectClass attribute is
// selected
IAttribute att = getSelectedAttributes()[i];
if ( !SchemaUtils.isModifyable( att.getAttributeTypeDescription() ) || att.isMustAttribute()
|| att.isObjectClassAttribute() )
{
throw new Exception();
}
}
for ( int i = 0; i < getSelectedAttributeHierarchies().length; i++ )
{
// check if a non-modifyable, must or objectClass attribute is
// selected
AttributeHierarchy ah = getSelectedAttributeHierarchies()[i];
for ( Iterator it = ah.iterator(); it.hasNext(); )
{
IAttribute attribute = ( IAttribute ) it.next();
if ( !SchemaUtils.isModifyable( attribute.getAttributeTypeDescription() )
|| attribute.isMustAttribute() || attribute.isObjectClassAttribute() )
{
throw new Exception();
}
}
}
List attributeList = new ArrayList();
// add selected attributes
for ( int i = 0; i < getSelectedAttributes().length; i++ )
{
IAttribute attribute = getSelectedAttributes()[i];
if ( attribute != null && attribute.getValueSize() > 0 )
{
attributeList.add( attribute );
}
}
// add selected hierarchies
for ( int i = 0; i < getSelectedAttributeHierarchies().length; i++ )
{
// check if a operational, must or objectClass attribute is
// selected
AttributeHierarchy ah = getSelectedAttributeHierarchies()[i];
for ( Iterator it = ah.iterator(); it.hasNext(); )
{
IAttribute attribute = ( IAttribute ) it.next();
if ( attribute != null && attribute.getValueSize() > 0 )
{
attributeList.add( attribute );
}
}
}
// check if ALL values of an attribute are selected -> delete whole
// attribute
Map attributeNameToSelectedValuesCountMap = new HashMap();
for ( int i = 0; i < getSelectedValues().length; i++ )
{
if ( !attributeNameToSelectedValuesCountMap.containsKey( getSelectedValues()[i].getAttribute()
.getDescription() ) )
{
attributeNameToSelectedValuesCountMap.put( getSelectedValues()[i].getAttribute().getDescription(),
new Integer( 0 ) );
}
int count = ( ( Integer ) attributeNameToSelectedValuesCountMap.get( getSelectedValues()[i].getAttribute()
.getDescription() ) ).intValue() + 1;
attributeNameToSelectedValuesCountMap.put( getSelectedValues()[i].getAttribute().getDescription(),
new Integer( count ) );
if ( count >= getSelectedValues()[i].getAttribute().getValueSize() )
{
IAttribute attribute = getSelectedValues()[i].getAttribute();
if ( attribute != null && !attributeList.contains( attribute ) )
{
attributeList.add( attribute );
}
}