You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2007/07/06 16:40:21 UTC

svn commit: r553900 - in /directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model: AttributeTypeImpl.java ObjectClassImpl.java

Author: pamarcelot
Date: Fri Jul  6 07:40:20 2007
New Revision: 553900

URL: http://svn.apache.org/viewvc?view=rev&rev=553900
Log:
Added Equals() methods.

Modified:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeImpl.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassImpl.java

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeImpl.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeImpl.java?view=diff&rev=553900&r1=553899&r2=553900
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeImpl.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeImpl.java Fri Jul  6 07:40:20 2007
@@ -42,7 +42,7 @@
 
     /** The object OID */
     private String objectOid;
-    
+
     /** The name of the superior */
     private String superiorName;
 
@@ -79,7 +79,8 @@
     {
         super.setNames( names );
     }
-    
+
+
     /* (non-Javadoc)
      * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#getOid()
      */
@@ -326,5 +327,207 @@
     public MatchingRule getSubstr() throws NamingException
     {
         return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#equals(java.lang.Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof AttributeTypeImpl )
+        {
+            AttributeTypeImpl at = ( AttributeTypeImpl ) obj;
+
+            // OID
+            if ( ( getOid() == null ) && ( at.getOid() != null ) )
+            {
+                return false;
+            }
+            else if ( ( getOid() != null ) && ( at.getOid() == null ) )
+            {
+                return false;
+            }
+            else if ( ( getOid() != null ) && ( at.getOid() != null ) )
+            {
+                if ( !getOid().equals( at.getOid() ) )
+                {
+                    return false;
+                }
+            }
+
+            // Aliases
+            if ( ( getNames() == null ) && ( at.getNames() != null ) )
+            {
+                return false;
+            }
+            else if ( ( getNames() != null ) && ( at.getNames() == null ) )
+            {
+                return false;
+            }
+            else if ( ( getNames() != null ) && ( at.getNames() != null ) )
+            {
+                if ( !getNames().equals( at.getNames() ) )
+                {
+                    return false;
+                }
+            }
+
+            // Description
+            if ( ( getDescription() == null ) && ( at.getDescription() != null ) )
+            {
+                return false;
+            }
+            else if ( ( getDescription() != null ) && ( at.getDescription() == null ) )
+            {
+                return false;
+            }
+            else if ( ( getDescription() != null ) && ( at.getDescription() != null ) )
+            {
+                if ( !getDescription().equals( at.getDescription() ) )
+                {
+                    return false;
+                }
+            }
+
+            // Superior
+            if ( ( getSuperiorName() == null ) && ( at.getSuperiorName() != null ) )
+            {
+                return false;
+            }
+            else if ( ( getSuperiorName() != null ) && ( at.getSuperiorName() == null ) )
+            {
+                return false;
+            }
+            else if ( ( getSuperiorName() != null ) && ( at.getSuperiorName() != null ) )
+            {
+                if ( !getSuperiorName().equals( at.getSuperiorName() ) )
+                {
+                    return false;
+                }
+            }
+
+            // Usage
+            if ( ( getUsage() == null ) && ( at.getUsage() != null ) )
+            {
+                return false;
+            }
+            else if ( ( getUsage() != null ) && ( at.getUsage() == null ) )
+            {
+                return false;
+            }
+            else if ( ( getUsage() != null ) && ( at.getUsage() != null ) )
+            {
+                if ( !getUsage().equals( at.getUsage() ) )
+                {
+                    return false;
+                }
+            }
+
+            // Syntax
+            if ( ( getSyntaxOid() == null ) && ( at.getSyntaxOid() != null ) )
+            {
+                return false;
+            }
+            else if ( ( getSyntaxOid() != null ) && ( at.getSyntaxOid() == null ) )
+            {
+                return false;
+            }
+            else if ( ( getSyntaxOid() != null ) && ( at.getSyntaxOid() != null ) )
+            {
+                if ( !getSyntaxOid().equals( at.getSyntaxOid() ) )
+                {
+                    return false;
+                }
+            }
+
+            // Syntax length
+            if ( getLength() != at.getLength() )
+            {
+                return false;
+            }
+
+            // Obsolete
+            if ( isObsolete() != at.isObsolete() )
+            {
+                return false;
+            }
+
+            // Single value
+            if ( isSingleValue() != at.isSingleValue() )
+            {
+                return false;
+            }
+
+            // Collective
+            if ( isCollective() != at.isCollective() )
+            {
+                return false;
+            }
+
+            // No User Modification
+            if ( isCanUserModify() != at.isCanUserModify() )
+            {
+                return false;
+            }
+
+            // Equality matching rule
+            if ( ( getEqualityName() == null ) && ( at.getEqualityName() != null ) )
+            {
+                return false;
+            }
+            else if ( ( getEqualityName() != null ) && ( at.getEqualityName() == null ) )
+            {
+                return false;
+            }
+            else if ( ( getEqualityName() != null ) && ( at.getEqualityName() != null ) )
+            {
+                if ( !getEqualityName().equals( at.getEqualityName() ) )
+                {
+                    return false;
+                }
+            }
+
+            // Ordering matching rule
+            if ( ( getOrderingName() == null ) && ( at.getOrderingName() != null ) )
+            {
+                return false;
+            }
+            else if ( ( getOrderingName() != null ) && ( at.getOrderingName() == null ) )
+            {
+                return false;
+            }
+            else if ( ( getOrderingName() != null ) && ( at.getOrderingName() != null ) )
+            {
+                if ( !getOrderingName().equals( at.getOrderingName() ) )
+                {
+                    return false;
+                }
+            }
+
+            // Substring matching rule
+            if ( ( getSubstrName() == null ) && ( at.getSubstrName() != null ) )
+            {
+                return false;
+            }
+            else if ( ( getSubstrName() != null ) && ( at.getSubstrName() == null ) )
+            {
+                return false;
+            }
+            else if ( ( getSubstrName() != null ) && ( at.getSubstrName() != null ) )
+            {
+                if ( !getSubstrName().equals( at.getSubstrName() ) )
+                {
+                    return false;
+                }
+            }
+
+            // If we've reached here, the two objects are equal.
+            return true;
+        }
+        else
+        {
+            return false;
+        }
     }
 }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassImpl.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassImpl.java?view=diff&rev=553900&r1=553899&r2=553900
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassImpl.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassImpl.java Fri Jul  6 07:40:20 2007
@@ -234,4 +234,137 @@
     {
         return null;
     }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#equals(java.lang.Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof ObjectClassImpl )
+        {
+            ObjectClassImpl oc = ( ObjectClassImpl ) obj;
+
+            // OID
+            if ( ( getOid() == null ) && ( oc.getOid() != null ) )
+            {
+                return false;
+            }
+            else if ( ( getOid() != null ) && ( oc.getOid() == null ) )
+            {
+                return false;
+            }
+            else if ( ( getOid() != null ) && ( oc.getOid() != null ) )
+            {
+                if ( !getOid().equals( oc.getOid() ) )
+                {
+                    return false;
+                }
+            }
+
+            // Aliases
+            if ( ( getNames() == null ) && ( oc.getNames() != null ) )
+            {
+                return false;
+            }
+            else if ( ( getNames() != null ) && ( oc.getNames() == null ) )
+            {
+                return false;
+            }
+            else if ( ( getNames() != null ) && ( oc.getNames() != null ) )
+            {
+                if ( !getNames().equals( oc.getNames() ) )
+                {
+                    return false;
+                }
+            }
+
+            // Description
+            if ( ( getDescription() == null ) && ( oc.getDescription() != null ) )
+            {
+                return false;
+            }
+            else if ( ( getDescription() != null ) && ( oc.getDescription() == null ) )
+            {
+                return false;
+            }
+            else if ( ( getDescription() != null ) && ( oc.getDescription() != null ) )
+            {
+                if ( !getDescription().equals( oc.getDescription() ) )
+                {
+                    return false;
+                }
+            }
+
+            // Superiors
+            if ( ( getSuperClassesNames() == null ) && ( oc.getSuperClassesNames() != null ) )
+            {
+                return false;
+            }
+            else if ( ( getSuperClassesNames() != null ) && ( oc.getSuperClassesNames() == null ) )
+            {
+                return false;
+            }
+            else if ( ( getSuperClassesNames() != null ) && ( oc.getSuperClassesNames() != null ) )
+            {
+                if ( !getSuperClassesNames().equals( oc.getSuperClassesNames() ) )
+                {
+                    return false;
+                }
+            }
+
+            // Type
+            if ( getType() != oc.getType() )
+            {
+                return false;
+            }
+
+            // Obsolete
+            if ( isObsolete() != oc.isObsolete() )
+            {
+                return false;
+            }
+
+            // Mandatory attributes
+            if ( ( getMustNamesList() == null ) && ( oc.getMustNamesList() != null ) )
+            {
+                return false;
+            }
+            else if ( ( getMustNamesList() != null ) && ( oc.getMustNamesList() == null ) )
+            {
+                return false;
+            }
+            else if ( ( getMustNamesList() != null ) && ( oc.getMustNamesList() != null ) )
+            {
+                if ( !getMustNamesList().equals( oc.getMustNamesList() ) )
+                {
+                    return false;
+                }
+            }
+
+            // Optional attributes
+            if ( ( getMayNamesList() == null ) && ( oc.getMayNamesList() != null ) )
+            {
+                return false;
+            }
+            else if ( ( getMayNamesList() != null ) && ( oc.getMayNamesList() == null ) )
+            {
+                return false;
+            }
+            else if ( ( getMayNamesList() != null ) && ( oc.getMayNamesList() != null ) )
+            {
+                if ( !getMayNamesList().equals( oc.getMayNamesList() ) )
+                {
+                    return false;
+                }
+            }
+
+            // If we've reached here, the two objects are equal.
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
 }