directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r590761 - /directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java
Date Wed, 31 Oct 2007 17:29:50 GMT
Author: pamarcelot
Date: Wed Oct 31 10:29:49 2007
New Revision: 590761

URL: http://svn.apache.org/viewvc?rev=590761&view=rev
Log:
Fixed a bug that caused the error to not be removed even if the AT or OC fixing this error
was added.

Modified:
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java?rev=590761&r1=590760&r2=590761&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java
Wed Oct 31 10:29:49 2007
@@ -86,8 +86,12 @@
     {
         public void attributeTypeAdded( AttributeTypeImpl at )
         {
+            List<?> deps = getAndDeleteDependencies( at );
+
             checkAttributeType( at );
 
+            checkDependencies( deps );
+
             notifyListeners();
         }
 
@@ -120,8 +124,12 @@
 
         public void objectClassAdded( ObjectClassImpl oc )
         {
+            List<?> deps = getAndDeleteDependencies( oc );
+
             checkObjectClass( oc );
 
+            checkDependencies( deps );
+
             notifyListeners();
         }
 
@@ -864,5 +872,59 @@
                 }
             }
         }
+    }
+
+
+    /**
+     * Gets the dependencies for the given schema object
+     * and deletes them from the tables.
+     *
+     * @param sc
+     *      the schema object
+     * @return
+     *      the dependencies for the given schema object
+     * and deletes them from the tables.
+     */
+    @SuppressWarnings("unchecked")
+    private List<Object> getAndDeleteDependencies( SchemaObject sc )
+    {
+        List<Object> deps = new ArrayList<Object>();
+
+        // Checking OID
+        String oid = sc.getOid();
+        if ( ( oid != null ) && ( !"".equals( oid ) ) )
+        {
+            List<Object> oidDependencies = ( List<Object> ) dependenciesMap.get(
oid );
+            if ( oidDependencies != null )
+            {
+                deps.addAll( oidDependencies );
+                dependenciesMap.remove( oid );
+                for ( Object oidDependency : oidDependencies )
+                {
+                    dependsOnMap.remove( oidDependency, oid );
+                }
+            }
+        }
+
+        // Checking aliases
+        String[] aliases = sc.getNames();
+        if ( ( aliases != null ) && ( aliases.length > 0 ) )
+        {
+            for ( String alias : aliases )
+            {
+                List<Object> aliasDependencies = ( List<Object> ) dependenciesMap.get(
alias );
+                if ( aliasDependencies != null )
+                {
+                    deps.addAll( aliasDependencies );
+                    dependenciesMap.remove( alias );
+                    for ( Object aliasDependency : aliasDependencies )
+                    {
+                        dependsOnMap.remove( aliasDependency, alias );
+                    }
+                }
+            }
+        }
+
+        return deps;
     }
 }



Mime
View raw message