From commits-return-17062-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Sat Feb 02 17:44:06 2008 Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 41646 invoked from network); 2 Feb 2008 17:44:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Feb 2008 17:44:06 -0000 Received: (qmail 65099 invoked by uid 500); 2 Feb 2008 17:43:58 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 65054 invoked by uid 500); 2 Feb 2008 17:43:57 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 65043 invoked by uid 99); 2 Feb 2008 17:43:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Feb 2008 09:43:57 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Feb 2008 17:43:50 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 4BE991A9832; Sat, 2 Feb 2008 09:43:42 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r617842 - /directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java Date: Sat, 02 Feb 2008 17:43:42 -0000 To: commits@directory.apache.org From: seelmann@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080202174342.4BE991A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: seelmann Date: Sat Feb 2 09:43:35 2008 New Revision: 617842 URL: http://svn.apache.org/viewvc?rev=617842&view=rev Log: Fix for DIRSTUDIO-152 Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java?rev=617842&r1=617841&r2=617842&view=diff ============================================================================== --- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java (original) +++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java Sat Feb 2 09:43:35 2008 @@ -23,7 +23,6 @@ import java.util.ArrayList; import java.util.Arrays; -import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -118,7 +117,8 @@ */ public void addAttribute( IAttribute attributeToAdd ) { - attributeMap.put( attributeToAdd.getDescription().toLowerCase(), attributeToAdd ); + String oidString = attributeToAdd.getAttributeDescription().toOidString( getBrowserConnection().getSchema() ); + attributeMap.put( oidString.toLowerCase(), attributeToAdd ); EventRegistry.fireEntryUpdated( new AttributeAddedEvent( attributeToAdd.getEntry().getBrowserConnection(), this, attributeToAdd ), this ); } @@ -137,7 +137,8 @@ */ public void deleteAttribute( IAttribute attributeToDelete ) { - attributeMap.remove( attributeToDelete.getDescription().toLowerCase() ); + String oidString = attributeToDelete.getAttributeDescription().toOidString( getBrowserConnection().getSchema() ); + attributeMap.remove( oidString.toLowerCase() ); EventRegistry.fireEntryUpdated( new AttributeDeletedEvent( attributeToDelete.getEntry().getBrowserConnection(), this, attributeToDelete ), this ); } @@ -153,7 +154,9 @@ */ public IAttribute getAttribute( String attributeDescription ) { - return attributeMap.get( attributeDescription.toLowerCase() ); + AttributeDescription ad = new AttributeDescription( attributeDescription ); + String oidString = ad.toOidString( getBrowserConnection().getSchema() ); + return attributeMap.get( oidString ); } @@ -165,9 +168,9 @@ AttributeDescription ad = new AttributeDescription( attributeDescription ); List attributeList = new ArrayList(); - for ( IAttribute attribute : attributeList ) + for ( IAttribute attribute : attributeMap.values() ) { - AttributeDescription other = new AttributeDescription( attributeDescription ); + AttributeDescription other = attribute.getAttributeDescription(); if ( other.isSubtypeOf( ad, getBrowserConnection().getSchema() ) ) { attributeList.add( attribute ); @@ -331,34 +334,33 @@ { return true; } - - + + /** * {@inheritDoc} */ public boolean isConsistent() { // check empty attributes and empty values - Iterator attributeIterator = attributeMap.values().iterator(); - while ( attributeIterator.hasNext() ) + for ( IAttribute attribute : attributeMap.values() ) { - IAttribute attribute = attributeIterator.next(); if ( !attribute.isConsistent() ) + { return false; + } } // check objectClass attribute - if ( !attributeMap.containsKey( IAttribute.OBJECTCLASS_ATTRIBUTE.toLowerCase() ) ) + if ( !attributeMap.containsKey( IAttribute.OBJECTCLASS_ATTRIBUTE_OID.toLowerCase() ) ) { return false; } - IAttribute ocAttribute = attributeMap.get( IAttribute.OBJECTCLASS_ATTRIBUTE.toLowerCase() ); + IAttribute ocAttribute = attributeMap.get( IAttribute.OBJECTCLASS_ATTRIBUTE_OID.toLowerCase() ); String[] ocValues = ocAttribute.getStringValues(); boolean structuralObjectClassAvailable = false; - for ( int i = 0; i < ocValues.length; i++ ) + for ( String ocValue : ocValues ) { - ObjectClassDescription ocd = this.getBrowserConnection().getSchema() - .getObjectClassDescription( ocValues[i] ); + ObjectClassDescription ocd = this.getBrowserConnection().getSchema().getObjectClassDescription( ocValue ); if ( ocd.isStructural() ) { structuralObjectClassAvailable = true; @@ -372,9 +374,11 @@ // check must-attributes String[] mustAttributeNames = getSubschema().getMustAttributeNames(); - for ( int i = 0; i < mustAttributeNames.length; i++ ) + for ( String mustAttributeName : mustAttributeNames ) { - if ( !attributeMap.containsKey( mustAttributeNames[i].toLowerCase() ) ) + AttributeDescription ad = new AttributeDescription( mustAttributeName ); + String oidString = ad.toOidString( getBrowserConnection().getSchema() ); + if ( !attributeMap.containsKey( oidString.toLowerCase() ) ) { return false; } @@ -442,8 +446,8 @@ public void setOperationalAttributesInitialized( boolean b ) { } - - + + /** * This implementation does nothing. */