|
|
Author: pamarcelot
Date: Tue Mar 20 08:59:11 2007
New Revision: 520454
URL: http://svn.apache.org/viewvc?view=rev&rev=520454
Log:
Updated Schema Pool. Aliases of Schema Elements are now stored in a lowercase
form.
Updated some methods to use the lowercase form before looking for elements.
Added a method for looking for a Schema Element (AT and OC) and another one to
verify if a schema element is contained in the pool.
Updated Manage Aliases Dialog to use these new methods.
Modified:
directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/SchemaPool.java
directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ManageAliasesDialog.java
Modified:
directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/SchemaPool.java
URL:
http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/SchemaPool.java?view=diff&rev=520454&r1=520453&r2=520454
==============================================================================
---
directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/SchemaPool.java
(original)
+++
directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/SchemaPool.java
Tue Mar 20 08:59:11 2007
@@ -341,7 +341,7 @@
*/
public boolean containsObjectClass( String name )
{
- return objectClassesMap.containsKey( name );
+ return objectClassesMap.containsKey( name.toLowerCase() );
}
@@ -352,7 +352,18 @@
*/
public boolean containsAttributeType( String name )
{
- return attributeTypesMap.containsKey( name );
+ return attributeTypesMap.containsKey( name.toLowerCase() );
+ }
+
+
+ /**
+ * Tests if the following element is inside the pool
+ * @param name the name of the eleme,t to test
+ * @return true if inside, false if not
+ */
+ public boolean containsSchemaElement( String name )
+ {
+ return getSchemaElements().containsKey( name.toLowerCase() );
}
@@ -364,7 +375,7 @@
*/
public boolean containsObjectClass( ObjectClass objectClass )
{
- return objectClassesMap.containsKey( objectClass.getOid() );
+ return objectClasses.contains( objectClass );
}
@@ -376,7 +387,18 @@
*/
public boolean containsAttributeType( AttributeType attributeType )
{
- return attributeTypesMap.containsKey( attributeType.getOid() );
+ return attributeTypes.contains( attributeType );
+ }
+
+
+ /**
+ * Tests if the given element exists in the pool
+ * @param schemaElement the Schema Element to test
+ * @return if inside the pool, false if not
+ */
+ public boolean containsSchemaElement( SchemaElement schemaElement )
+ {
+ return getSchemaElements().containsKey( schemaElement );
}
@@ -387,7 +409,8 @@
*/
public ObjectClass getObjectClass( String name )
{
- return objectClassesMap.get( name );
+
+ return objectClassesMap.get( name.toLowerCase() );
}
@@ -398,16 +421,28 @@
*/
public AttributeType getAttributeType( String name )
{
- return attributeTypesMap.get( name );
+ return attributeTypesMap.get( name.toLowerCase() );
}
+ /**
+ * Returns the Object Classes as a Map.
+ *
+ * @return
+ * the Object Classes as a Map
+ */
public Map<String, ObjectClass> getObjectClassesAsMap()
{
return objectClassesMap;
}
+ /**
+ * Gets the Attribute Types as a Map.
+ *
+ * @return
+ * the Attribute Types as a Map
+ */
public Map<String, AttributeType> getAttributeTypesAsMap()
{
return attributeTypesMap;
@@ -415,9 +450,10 @@
/**
- * Accessor to all the schema elements (attribute types and object
classes) defined by
- * the schemas stored in the pool
- * @return as an (oid, SchemaElement) hashtable
+ * Get the Schema Elements as a Map
+ *
+ * @return
+ * the Schema Elements as a Map
*/
public Map<String, SchemaElement> getSchemaElements()
{
@@ -792,14 +828,14 @@
String[] names = oldAttributeType.getNames();
for ( int j = 0; j < names.length; j++ )
{
- attributeTypesMap.remove( names[j] );
+ attributeTypesMap.remove( names[j].toLowerCase() );
}
attributeTypesMap.remove( oldAttributeType.getOid() );
names = newAttributeType.getNames();
for ( int j = 0; j < names.length; j++ )
{
- attributeTypesMap.put( names[j], newAttributeType );
+ attributeTypesMap.put( names[j].toLowerCase(), newAttributeType );
}
attributeTypesMap.put( newAttributeType.getOid(), newAttributeType );
}
@@ -819,14 +855,14 @@
String[] names = oldObjectClass.getNames();
for ( int j = 0; j < names.length; j++ )
{
- objectClassesMap.remove( names[j] );
+ objectClassesMap.remove( names[j].toLowerCase() );
}
objectClassesMap.remove( oldObjectClass.getOid() );
names = newObjectClass.getNames();
for ( int j = 0; j < names.length; j++ )
{
- objectClassesMap.put( names[j], newObjectClass );
+ objectClassesMap.put( names[j].toLowerCase(), newObjectClass );
}
objectClassesMap.put( newObjectClass.getOid(), newObjectClass );
}
@@ -864,7 +900,7 @@
String[] names = at.getNames();
for ( int j = 0; j < names.length; j++ )
{
- attributeTypesMap.put( names[j], at );
+ attributeTypesMap.put( names[j].toLowerCase(), at );
}
attributeTypesMap.put( at.getOid(), at );
attributeTypes.add( at );
@@ -882,7 +918,7 @@
String[] names = at.getNames();
for ( int j = 0; j < names.length; j++ )
{
- attributeTypesMap.remove( names[j] );
+ attributeTypesMap.remove( names[j].toLowerCase() );
}
attributeTypesMap.remove( at.getOid() );
attributeTypes.remove( at );
@@ -900,7 +936,7 @@
String[] names = oc.getNames();
for ( int j = 0; j < names.length; j++ )
{
- objectClassesMap.put( names[j], oc );
+ objectClassesMap.put( names[j].toLowerCase(), oc );
}
objectClassesMap.put( oc.getOid(), oc );
objectClasses.add( oc );
@@ -918,7 +954,7 @@
String[] names = oc.getNames();
for ( int j = 0; j < names.length; j++ )
{
- objectClassesMap.remove( names[j] );
+ objectClassesMap.remove( names[j].toLowerCase() );
}
objectClassesMap.remove( oc.getOid() );
objectClasses.remove( oc );
Modified:
directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ManageAliasesDialog.java
URL:
http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ManageAliasesDialog.java?view=diff&rev=520454&r1=520453&r2=520454
==============================================================================
---
directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ManageAliasesDialog.java
(original)
+++
directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ManageAliasesDialog.java
Tue Mar 20 08:59:11 2007
@@ -252,7 +252,7 @@
String text = newAliasText.getText();
if ( ( !"".equals( text ) ) && (
!aliasesLowerCased.contains( text.toLowerCase() ) )
- && (
!SchemaPool.getInstance().getSchemaElements().containsKey( text ) ) )
+ && (
!SchemaPool.getInstance().containsSchemaElement( text ) ) )
{
addANewAlias();
}
@@ -278,7 +278,7 @@
errorLabel.setText( "This alias already exists in the
list." );
newAliasAddButton.setEnabled( false );
}
- else if (
SchemaPool.getInstance().getSchemaElements().containsKey( text ) )
+ else if ( SchemaPool.getInstance().containsSchemaElement(
text ) )
{
errorComposite.setVisible( true );
errorLabel.setText( "An element with same alias
already exists." );
|
|