directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r557943 - in /directory/studio/trunk/studio-apacheds-schemaeditor/src: main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/ test/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/
Date Fri, 20 Jul 2007 09:44:06 GMT
Author: pamarcelot
Date: Fri Jul 20 02:44:05 2007
New Revision: 557943

URL: http://svn.apache.org/viewvc?view=rev&rev=557943
Log:
Added getDifferences method for two lists of schemas.
Refactored the DifferenceEngine methods.
Updated tests.

Modified:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/AttributeTypeDifference.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/DifferenceEngine.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/ObjectClassDifference.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/test/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/DifferenceEngineTest.java

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/AttributeTypeDifference.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/AttributeTypeDifference.java?view=diff&rev=557943&r1=557942&r2=557943
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/AttributeTypeDifference.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/AttributeTypeDifference.java
Fri Jul 20 02:44:05 2007
@@ -91,6 +91,18 @@
 
 
     /**
+     * Adds differences.
+     *
+     * @param differences
+     *      the differences
+     */
+    public void addDifferences( List<PropertyDifference> differences )
+    {
+        differences.addAll( differences );
+    }
+
+
+    /**
      * Removes a difference.
      *
      * @param difference

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/DifferenceEngine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/DifferenceEngine.java?view=diff&rev=557943&r1=557942&r2=557943
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/DifferenceEngine.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/DifferenceEngine.java
Fri Jul 20 02:44:05 2007
@@ -21,13 +21,16 @@
 
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
 import org.apache.directory.shared.ldap.schema.SchemaObject;
 import org.apache.directory.shared.ldap.schema.UsageEnum;
 import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
 import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
 
 
 /**
@@ -40,6 +43,169 @@
 public class DifferenceEngine
 {
     /**
+     * Gets the differences between two Lists of Schemas.
+     *
+     * @param l1
+     *      the first list
+     * @param l2
+     *      the second list
+     * @return
+     *      the differences between the two schema Lists
+     */
+    public static List<Difference> getDifferences( List<Schema> l1, List<Schema>
l2 )
+    {
+        List<Difference> differences = new ArrayList<Difference>();
+
+        // Building Maps for schemas
+        Map<String, Schema> mapL1 = new HashMap<String, Schema>();
+        for ( Schema schema : l1 )
+        {
+            mapL1.put( schema.getName().toLowerCase(), schema );
+        }
+        Map<String, Schema> mapL2 = new HashMap<String, Schema>();
+        for ( Schema schema : l2 )
+        {
+            mapL2.put( schema.getName().toLowerCase(), schema );
+        }
+
+        // Looping on schemas from the first list
+        for ( Schema schemaFromL1 : l1 )
+        {
+            Schema schemaFromL2 = mapL2.get( schemaFromL1.getName().toLowerCase() );
+            if ( schemaFromL2 == null )
+            {
+                SchemaDifference schemaDifference = new SchemaDifference( schemaFromL1, null,
DifferenceType.REMOVED );
+                differences.add( schemaDifference );
+            }
+            else
+            {
+                SchemaDifference schemaDifference = new SchemaDifference( schemaFromL1, schemaFromL2,
+                    DifferenceType.IDENTICAL );
+
+                // Building Maps for attribute types
+                Map<String, AttributeTypeImpl> atMapL1 = new HashMap<String, AttributeTypeImpl>();
+                for ( AttributeTypeImpl at : schemaFromL1.getAttributeTypes() )
+                {
+                    atMapL1.put( at.getOid(), at );
+                }
+                Map<String, AttributeTypeImpl> atMapL2 = new HashMap<String, AttributeTypeImpl>();
+                for ( AttributeTypeImpl at : schemaFromL2.getAttributeTypes() )
+                {
+                    atMapL2.put( at.getOid(), at );
+                }
+
+                // Looping on the attribute types from the Schema from the first list
+                for ( AttributeTypeImpl atFromL1 : schemaFromL1.getAttributeTypes() )
+                {
+                    AttributeTypeImpl atFromL2 = atMapL2.get( atFromL1.getOid() );
+                    if ( atFromL2 == null )
+                    {
+                        AttributeTypeDifference attributeTypeDifference = new AttributeTypeDifference(
atFromL1, null,
+                            DifferenceType.REMOVED );
+                        schemaDifference.addAttributeTypeDifference( attributeTypeDifference
);
+                        schemaDifference.setType( DifferenceType.MODIFIED );
+                    }
+                    else
+                    {
+                        AttributeTypeDifference attributeTypeDifference = new AttributeTypeDifference(
atFromL1,
+                            atFromL2, DifferenceType.IDENTICAL );
+                        schemaDifference.addAttributeTypeDifference( attributeTypeDifference
);
+
+                        List<PropertyDifference> atDifferences = getDifferences( atFromL1,
atFromL2 );
+                        if ( atDifferences.size() > 0 )
+                        {
+                            attributeTypeDifference.setType( DifferenceType.MODIFIED );
+                            attributeTypeDifference.addDifferences( atDifferences );
+                            schemaDifference.setType( DifferenceType.MODIFIED );
+                        }
+                    }
+                }
+
+                // Looping on the attribute types from the Schema from the second list
+                for ( AttributeTypeImpl atFromL2 : schemaFromL2.getAttributeTypes() )
+                {
+                    AttributeTypeImpl atFromL1 = atMapL2.get( atFromL2.getOid() );
+                    if ( atFromL1 == null )
+                    {
+                        AttributeTypeDifference attributeTypeDifference = new AttributeTypeDifference(
null, atFromL2,
+                            DifferenceType.ADDED );
+                        schemaDifference.addAttributeTypeDifference( attributeTypeDifference
);
+                        schemaDifference.setType( DifferenceType.MODIFIED );
+                    }
+                    // If atFromL1 exists, then it has already been processed when looping
on the first list. 
+                }
+
+                // Building Maps for object classes
+                Map<String, ObjectClassImpl> ocMapL1 = new HashMap<String, ObjectClassImpl>();
+                for ( ObjectClassImpl oc : schemaFromL1.getObjectClasses() )
+                {
+                    ocMapL1.put( oc.getOid(), oc );
+                }
+                Map<String, ObjectClassImpl> ocMapL2 = new HashMap<String, ObjectClassImpl>();
+                for ( ObjectClassImpl oc : schemaFromL2.getObjectClasses() )
+                {
+                    ocMapL2.put( oc.getOid(), oc );
+                }
+
+                // Looping on the object classes from the Schema from the first list
+                for ( ObjectClassImpl ocFromL1 : schemaFromL1.getObjectClasses() )
+                {
+                    ObjectClassImpl ocFromL2 = ocMapL2.get( ocFromL1.getOid() );
+                    if ( ocFromL2 == null )
+                    {
+                        ObjectClassDifference objectClassDifference = new ObjectClassDifference(
ocFromL1, null,
+                            DifferenceType.REMOVED );
+                        schemaDifference.addObjectClassDifference( objectClassDifference
);
+                        schemaDifference.setType( DifferenceType.MODIFIED );
+                    }
+                    else
+                    {
+                        ObjectClassDifference objectClassDifference = new ObjectClassDifference(
ocFromL1, ocFromL2,
+                            DifferenceType.IDENTICAL );
+                        schemaDifference.addObjectClassDifference( objectClassDifference
);
+
+                        List<PropertyDifference> ocDifferences = getDifferences( ocFromL1,
ocFromL2 );
+                        if ( ocDifferences.size() > 0 )
+                        {
+                            objectClassDifference.setType( DifferenceType.MODIFIED );
+                            objectClassDifference.addDifferences( ocDifferences );
+                            schemaDifference.setType( DifferenceType.MODIFIED );
+                        }
+                    }
+                }
+
+                // Looping on the object classes from the Schema from the second list
+                for ( ObjectClassImpl ocFromL2 : schemaFromL2.getObjectClasses() )
+                {
+                    ObjectClassImpl ocFromL1 = ocMapL2.get( ocFromL2.getOid() );
+                    if ( ocFromL1 == null )
+                    {
+                        ObjectClassDifference objectClassDifference = new ObjectClassDifference(
null, ocFromL2,
+                            DifferenceType.ADDED );
+                        schemaDifference.addObjectClassDifference( objectClassDifference
);
+                        schemaDifference.setType( DifferenceType.MODIFIED );
+                    }
+                    // If ocFromL1 exists, then it has already been processed when looping
on the first list. 
+                }
+            }
+        }
+
+        // Looping on schemas from the second list
+        for ( Schema schemaFromL2 : l2 )
+        {
+            Schema schemaFromL1 = mapL1.get( schemaFromL2.getName().toLowerCase() );
+            if ( schemaFromL1 == null )
+            {
+                SchemaDifference schemaDifference = new SchemaDifference( null, schemaFromL2,
DifferenceType.ADDED );
+                differences.add( schemaDifference );
+            }
+        }
+
+        return differences;
+    }
+
+
+    /**
      * Gets the differences between two ObjectClassImpl Objects.
      *
      * @param oc1
@@ -49,29 +215,29 @@
      * @return
      *      the differences between two ObjectClassImpl Objects.
      */
-    public static List<Difference> getDifferences( ObjectClassImpl oc1, ObjectClassImpl
oc2 )
+    public static List<PropertyDifference> getDifferences( ObjectClassImpl oc1, ObjectClassImpl
oc2 )
     {
-        List<Difference> differences = new ArrayList<Difference>();
+        List<PropertyDifference> differences = new ArrayList<PropertyDifference>();
 
         // Aliases
         differences.addAll( getAliasesDifferences( oc1, oc2 ) );
 
         // Description
-        Difference descriptionDifference = getDescriptionDifference( oc1, oc2 );
+        PropertyDifference descriptionDifference = getDescriptionDifference( oc1, oc2 );
         if ( descriptionDifference != null )
         {
             differences.add( descriptionDifference );
         }
 
         // Obsolete
-        Difference obsoleteDifference = getObsoleteDifference( oc1, oc2 );
+        PropertyDifference obsoleteDifference = getObsoleteDifference( oc1, oc2 );
         if ( obsoleteDifference != null )
         {
             differences.add( obsoleteDifference );
         }
 
         // Class type
-        Difference classTypeDifference = getClassTypeDifference( oc1, oc2 );
+        PropertyDifference classTypeDifference = getClassTypeDifference( oc1, oc2 );
         if ( classTypeDifference != null )
         {
             differences.add( classTypeDifference );
@@ -100,92 +266,92 @@
      * @return
      *      the differences between two AttributeTypeImpl Objects.
      */
-    public static List<Difference> getDifferences( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
+    public static List<PropertyDifference> getDifferences( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
     {
-        List<Difference> differences = new ArrayList<Difference>();
+        List<PropertyDifference> differences = new ArrayList<PropertyDifference>();
 
         // Aliases
         differences.addAll( getAliasesDifferences( at1, at2 ) );
 
         // Description
-        Difference descriptionDifference = getDescriptionDifference( at1, at2 );
+        PropertyDifference descriptionDifference = getDescriptionDifference( at1, at2 );
         if ( descriptionDifference != null )
         {
             differences.add( descriptionDifference );
         }
 
         // Obsolete
-        Difference obsoleteDifference = getObsoleteDifference( at1, at2 );
+        PropertyDifference obsoleteDifference = getObsoleteDifference( at1, at2 );
         if ( obsoleteDifference != null )
         {
             differences.add( obsoleteDifference );
         }
 
         // Usage
-        Difference usageDifference = getUsageDifference( at1, at2 );
+        PropertyDifference usageDifference = getUsageDifference( at1, at2 );
         if ( usageDifference != null )
         {
             differences.add( usageDifference );
         }
 
         // Superior
-        Difference superiorDifference = getSuperiorDifference( at1, at2 );
+        PropertyDifference superiorDifference = getSuperiorDifference( at1, at2 );
         if ( superiorDifference != null )
         {
             differences.add( superiorDifference );
         }
 
         // Syntax
-        Difference syntaxDifference = getSyntaxDifference( at1, at2 );
+        PropertyDifference syntaxDifference = getSyntaxDifference( at1, at2 );
         if ( syntaxDifference != null )
         {
             differences.add( syntaxDifference );
         }
 
         // Syntax length
-        Difference syntaxLengthDifference = getSyntaxLengthDifference( at1, at2 );
+        PropertyDifference syntaxLengthDifference = getSyntaxLengthDifference( at1, at2 );
         if ( syntaxLengthDifference != null )
         {
             differences.add( syntaxLengthDifference );
         }
 
         // Single value
-        Difference singleValueDifference = getSingleValueDifference( at1, at2 );
+        PropertyDifference singleValueDifference = getSingleValueDifference( at1, at2 );
         if ( singleValueDifference != null )
         {
             differences.add( singleValueDifference );
         }
 
         // Collective
-        Difference collectiveDifference = getCollectiveDifference( at1, at2 );
+        PropertyDifference collectiveDifference = getCollectiveDifference( at1, at2 );
         if ( collectiveDifference != null )
         {
             differences.add( collectiveDifference );
         }
 
         // No user modification
-        Difference noUserModificationDifference = getNoUserModificationDifference( at1, at2
);
+        PropertyDifference noUserModificationDifference = getNoUserModificationDifference(
at1, at2 );
         if ( noUserModificationDifference != null )
         {
             differences.add( noUserModificationDifference );
         }
 
         // Equality
-        Difference equalityDifference = getEqualityDifference( at1, at2 );
+        PropertyDifference equalityDifference = getEqualityDifference( at1, at2 );
         if ( equalityDifference != null )
         {
             differences.add( equalityDifference );
         }
 
         // Ordering
-        Difference orderingDifference = getOrderingDifference( at1, at2 );
+        PropertyDifference orderingDifference = getOrderingDifference( at1, at2 );
         if ( orderingDifference != null )
         {
             differences.add( orderingDifference );
         }
 
         // Substring
-        Difference substringDifference = getSubstringDifference( at1, at2 );
+        PropertyDifference substringDifference = getSubstringDifference( at1, at2 );
         if ( substringDifference != null )
         {
             differences.add( substringDifference );
@@ -205,9 +371,9 @@
      * @return
      *      the 'Aliases' differences between the two SchemaObject Objects
      */
-    private static List<Difference> getAliasesDifferences( SchemaObject so1, SchemaObject
so2 )
+    private static List<PropertyDifference> getAliasesDifferences( SchemaObject so1,
SchemaObject so2 )
     {
-        List<Difference> differences = new ArrayList<Difference>();
+        List<PropertyDifference> differences = new ArrayList<PropertyDifference>();
 
         String[] so1Names = so1.getNames();
         List<String> so1NamesList = new ArrayList<String>();
@@ -263,7 +429,7 @@
      * @return
      *      the 'Description' difference between the two SchemaObject Objects
      */
-    private static Difference getDescriptionDifference( SchemaObject so1, SchemaObject so2
)
+    private static PropertyDifference getDescriptionDifference( SchemaObject so1, SchemaObject
so2 )
     {
         String so1Description = so1.getDescription();
         String so2Description = so2.getDescription();
@@ -305,7 +471,7 @@
      * @return
      *      the 'Obsolete' difference between the two SchemaObject Objects
      */
-    private static Difference getObsoleteDifference( SchemaObject so1, SchemaObject so2 )
+    private static PropertyDifference getObsoleteDifference( SchemaObject so1, SchemaObject
so2 )
     {
         boolean so1Obsolete = so1.isObsolete();
         boolean so2Obsolete = so2.isObsolete();
@@ -332,7 +498,7 @@
      * @return
      *      the 'Class type' difference between the two ObjectClassImpl Objects
      */
-    private static Difference getClassTypeDifference( ObjectClassImpl oc1, ObjectClassImpl
oc2 )
+    private static PropertyDifference getClassTypeDifference( ObjectClassImpl oc1, ObjectClassImpl
oc2 )
     {
         ObjectClassTypeEnum oc1ClassType = oc1.getType();
         ObjectClassTypeEnum oc2ClassType = oc2.getType();
@@ -359,9 +525,9 @@
      * @return
      *      the 'Superior Classes' differences between the two ObjectClassImpl Objects
      */
-    private static List<Difference> getSuperiorClassesDifferences( ObjectClassImpl
oc1, ObjectClassImpl oc2 )
+    private static List<PropertyDifference> getSuperiorClassesDifferences( ObjectClassImpl
oc1, ObjectClassImpl oc2 )
     {
-        List<Difference> differences = new ArrayList<Difference>();
+        List<PropertyDifference> differences = new ArrayList<PropertyDifference>();
 
         String[] oc1Sups = oc1.getSuperClassesNames();
         List<String> oc1SupsList = new ArrayList<String>();
@@ -417,9 +583,10 @@
      * @return
      *      the 'Mandatory attribute types' differences between the two ObjectClassImpl Objects
      */
-    private static List<Difference> getMandatoryAttributeTypesDifferences( ObjectClassImpl
oc1, ObjectClassImpl oc2 )
+    private static List<PropertyDifference> getMandatoryAttributeTypesDifferences(
ObjectClassImpl oc1,
+        ObjectClassImpl oc2 )
     {
-        List<Difference> differences = new ArrayList<Difference>();
+        List<PropertyDifference> differences = new ArrayList<PropertyDifference>();
 
         String[] oc1Musts = oc1.getMustNamesList();
         List<String> oc1MustsList = new ArrayList<String>();
@@ -475,9 +642,10 @@
      * @return
      *      the 'Optional attribute types' differences between the two ObjectClassImpl Objects
      */
-    private static List<Difference> getOptionalAttributeTypesDifferences( ObjectClassImpl
oc1, ObjectClassImpl oc2 )
+    private static List<PropertyDifference> getOptionalAttributeTypesDifferences( ObjectClassImpl
oc1,
+        ObjectClassImpl oc2 )
     {
-        List<Difference> differences = new ArrayList<Difference>();
+        List<PropertyDifference> differences = new ArrayList<PropertyDifference>();
 
         String[] oc1Mays = oc1.getMayNamesList();
         List<String> oc1MaysList = new ArrayList<String>();
@@ -533,7 +701,7 @@
      * @return
      *      the 'Usage' difference between the two AttributeTypeImpl Objects
      */
-    private static Difference getUsageDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
+    private static PropertyDifference getUsageDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
     {
         UsageEnum at1Usage = at1.getUsage();
         UsageEnum at2Usage = at2.getUsage();
@@ -560,7 +728,7 @@
      * @return
      *      the 'Superior' difference between the two AttributeTypeImpl Objects
      */
-    private static Difference getSuperiorDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
+    private static PropertyDifference getSuperiorDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
     {
         String at1Superior = at1.getSuperiorName();
         String at2Superior = at2.getSuperiorName();
@@ -602,7 +770,7 @@
      * @return
      *      the 'Syntax' difference between the two AttributeTypeImpl Objects
      */
-    private static Difference getSyntaxDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
+    private static PropertyDifference getSyntaxDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
     {
         String at1Syntax = at1.getSyntaxOid();
         String at2Syntax = at2.getSyntaxOid();
@@ -644,7 +812,7 @@
      * @return
      *      the 'Syntax length' difference between the two AttributeTypeImpl Objects
      */
-    private static Difference getSyntaxLengthDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
+    private static PropertyDifference getSyntaxLengthDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
     {
         int at1SyntaxLength = at1.getLength();
         int at2SyntaxLength = at2.getLength();
@@ -686,7 +854,7 @@
      * @return
      *      the 'Single value' difference between the two AttributeTypeImpl Objects
      */
-    private static Difference getSingleValueDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
+    private static PropertyDifference getSingleValueDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
     {
         boolean at1SingleValue = at1.isSingleValue();
         boolean at2SingleValue = at2.isSingleValue();
@@ -713,7 +881,7 @@
      * @return
      *      the 'Collective' difference between the two AttributeTypeImpl Objects
      */
-    private static Difference getCollectiveDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
+    private static PropertyDifference getCollectiveDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
     {
         boolean at1Collective = at1.isCollective();
         boolean at2Collective = at2.isCollective();
@@ -740,7 +908,7 @@
      * @return
      *      the 'No user modification' difference between the two AttributeTypeImpl Objects
      */
-    private static Difference getNoUserModificationDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
+    private static PropertyDifference getNoUserModificationDifference( AttributeTypeImpl
at1, AttributeTypeImpl at2 )
     {
         boolean at1CanUserModify = at1.isCanUserModify();
         boolean at2CanUserModify = at2.isCanUserModify();
@@ -767,7 +935,7 @@
      * @return
      *      the 'Equality' difference between the two AttributeTypeImpl Objects
      */
-    private static Difference getEqualityDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
+    private static PropertyDifference getEqualityDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
     {
         String at1Equality = at1.getEqualityName();
         String at2Equality = at2.getEqualityName();
@@ -809,7 +977,7 @@
      * @return
      *      the 'Ordering' difference between the two AttributeTypeImpl Objects
      */
-    private static Difference getOrderingDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
+    private static PropertyDifference getOrderingDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
     {
         String at1Ordering = at1.getOrderingName();
         String at2Ordering = at2.getOrderingName();
@@ -851,7 +1019,7 @@
      * @return
      *      the 'Substring' difference between the two AttributeTypeImpl Objects
      */
-    private static Difference getSubstringDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
+    private static PropertyDifference getSubstringDifference( AttributeTypeImpl at1, AttributeTypeImpl
at2 )
     {
         String at1Substring = at1.getSubstrName();
         String at2Substring = at2.getSubstrName();

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/ObjectClassDifference.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/ObjectClassDifference.java?view=diff&rev=557943&r1=557942&r2=557943
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/ObjectClassDifference.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/ObjectClassDifference.java
Fri Jul 20 02:44:05 2007
@@ -88,6 +88,17 @@
     {
         differences.add( difference );
     }
+    
+    /**
+     * Adds differences.
+     *
+     * @param differences
+     *      the differences
+     */
+    public void addDifferences( List<PropertyDifference> differences )
+    {
+        differences.addAll( differences );
+    }
 
 
     /**

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/test/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/DifferenceEngineTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/test/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/DifferenceEngineTest.java?view=diff&rev=557943&r1=557942&r2=557943
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/test/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/DifferenceEngineTest.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/test/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/DifferenceEngineTest.java
Fri Jul 20 02:44:05 2007
@@ -50,7 +50,7 @@
         o2.setNames( new String[]
             { "alias" } );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -76,7 +76,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setDescription( "Description" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -103,7 +103,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setEqualityName( "Equality" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -130,7 +130,7 @@
         o2.setMustNamesList( new String[]
             { "must" } );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -158,7 +158,7 @@
         o2.setMayNamesList( new String[]
             { "may" } );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -184,7 +184,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setOrderingName( "Ordering" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -210,7 +210,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setSubstrName( "Substring" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -236,7 +236,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setSuperiorName( "superiorAT" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -263,7 +263,7 @@
         o2.setSuperClassesNames( new String[]
             { "superiorOC" } );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -289,7 +289,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setSyntaxOid( "1.2.3.4.5" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -315,7 +315,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setLength( 1234 );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -343,7 +343,7 @@
         ObjectClassImpl o2 = new ObjectClassImpl( "1.2.3.4" );
         o2.setType( ObjectClassTypeEnum.ABSTRACT );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -372,7 +372,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setCollective( false );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -401,7 +401,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setDescription( "New Description" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -430,7 +430,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setEqualityName( "newEqualityName" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -459,7 +459,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setCanUserModify( false );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -488,7 +488,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setObsolete( false );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -517,7 +517,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setOrderingName( "newOrderingName" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -546,7 +546,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setSingleValue( false );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -575,7 +575,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setSubstrName( "newSubstrName" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -604,7 +604,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setSuperiorName( "newSuperiorName" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -633,7 +633,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setSyntaxOid( "1.2.3.4.6" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -661,7 +661,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setLength( 12345 );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -690,7 +690,7 @@
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
         o2.setUsage( UsageEnum.DIRECTORY_OPERATION );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -720,7 +720,7 @@
         o2.setNames( new String[]
             { "name2" } );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -747,7 +747,7 @@
         o1.setDescription( "Description" );
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -775,7 +775,7 @@
         o1.setEqualityName( "equalityName" );
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -805,7 +805,7 @@
         o2.setMustNamesList( new String[]
             { "must2" } );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -836,7 +836,7 @@
         o2.setMayNamesList( new String[]
             { "may2" } );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -864,7 +864,7 @@
         o1.setOrderingName( "orderingName" );
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -891,7 +891,7 @@
         o1.setSubstrName( "substrName" );
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -919,7 +919,7 @@
         o1.setSuperiorName( "superiorName" );
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -950,7 +950,7 @@
         o2.setSuperClassesNames( new String[]
             { "sup2" } );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -978,7 +978,7 @@
         o1.setSyntaxOid( "1.2.3.4.5" );
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 
@@ -1005,7 +1005,7 @@
         o1.setLength( 1234 );
         AttributeTypeImpl o2 = new AttributeTypeImpl( "1.2.3.4" );
 
-        List<Difference> differences = DifferenceEngine.getDifferences( o1, o2 );
+        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1,
o2 );
 
         assertEquals( 1, differences.size() );
 



Mime
View raw message