directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r557283 - in /directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor: model/schemachecker/ view/views/
Date Wed, 18 Jul 2007 14:54:25 GMT
Author: pamarcelot
Date: Wed Jul 18 07:54:22 2007
New Revision: 557283

URL: http://svn.apache.org/viewvc?view=rev&rev=557283
Log:
Added text descriptions for SchemaErrors and SchemaWarnings in the ProblemsView.

Added:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaCheckerElement.java
Removed:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DuplicateMandatoryOptionalAttributeError.java
Modified:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaError.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaWarning.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewLabelProvider.java

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java?view=diff&rev=557283&r1=557282&r2=557283
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java
Wed Jul 18 07:54:22 2007
@@ -304,7 +304,7 @@
                         counter++;
                         o = list.get( counter );
                     }
-                    SchemaError error = new DuplicateAliasError( at, oid, ( SchemaObject
) o );
+                    SchemaError error = new DuplicateAliasError( at, alias, ( SchemaObject
) o );
                     errorsList.add( error );
                     errorsMap.put( at, error );
                 }
@@ -462,13 +462,6 @@
 
             for ( String mandatoryAT : mandatoryATsList )
             {
-                if ( optionalATsList.contains( mandatoryAT ) )
-                {
-                    SchemaError error = new DuplicateMandatoryOptionalAttributeError( oc,
mandatoryAT );
-                    errorsList.add( error );
-                    errorsMap.put( oc, error );
-                }
-
                 if ( schemaHandler.getAttributeType( mandatoryAT ) == null )
                 {
                     SchemaError error = new NonExistingMandatoryATError( oc, mandatoryAT
);

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaCheckerElement.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaCheckerElement.java?view=auto&rev=557283
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaCheckerElement.java
(added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaCheckerElement.java
Wed Jul 18 07:54:22 2007
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
+/**
+ * Common interface for the all the schema errors.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface SchemaCheckerElement
+{
+    /**
+     * Gets the source object.
+     * 
+     * @return
+     *      the source object
+     */
+    public SchemaObject getSource();
+}

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaError.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaError.java?view=diff&rev=557283&r1=557282&r2=557283
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaError.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaError.java
Wed Jul 18 07:54:22 2007
@@ -20,22 +20,12 @@
 package org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker;
 
 
-import org.apache.directory.shared.ldap.schema.SchemaObject;
-
-
 /**
  * Common interface for the all the schema errors.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public interface SchemaError
+public interface SchemaError extends SchemaCheckerElement
 {
-    /**
-     * Gets the source object.
-     * 
-     * @return
-     *      the source object
-     */
-    public SchemaObject getSource();
 }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaWarning.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaWarning.java?view=diff&rev=557283&r1=557282&r2=557283
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaWarning.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaWarning.java
Wed Jul 18 07:54:22 2007
@@ -20,22 +20,12 @@
 package org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker;
 
 
-import org.apache.directory.shared.ldap.schema.SchemaObject;
-
-
 /**
  * Common interface for all the schema warnings.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public interface SchemaWarning
+public interface SchemaWarning extends SchemaCheckerElement
 {
-    /**
-     * Gets the source object.
-     * 
-     * @return
-     *      the source object
-     */
-    public SchemaObject getSource();
 }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewLabelProvider.java?view=diff&rev=557283&r1=557282&r2=557283
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewLabelProvider.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewLabelProvider.java
Wed Jul 18 07:54:22 2007
@@ -20,8 +20,21 @@
 package org.apache.directory.studio.apacheds.schemaeditor.view.views;
 
 
+import org.apache.directory.shared.ldap.schema.SchemaObject;
 import org.apache.directory.studio.apacheds.schemaeditor.Activator;
 import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+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.schemachecker.DuplicateAliasError;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.DuplicateOidError;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.NoAliasWarning;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.NonExistingATSuperiorError;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.NonExistingMandatoryATError;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.NonExistingMatchingRuleError;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.NonExistingOCSuperiorError;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.NonExistingOptionalATError;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.NonExistingSyntaxError;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaCheckerElement;
 import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.Folder;
 import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaErrorWrapper;
 import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaWarningWrapper;
@@ -79,7 +92,7 @@
 
             if ( columnIndex == 0 )
             {
-                return errorWrapper.getSchemaError().toString();
+                return getMessage( errorWrapper.getSchemaError() );
             }
             else if ( columnIndex == 1 )
             {
@@ -102,7 +115,7 @@
 
             if ( columnIndex == 0 )
             {
-                return warningWrapper.getSchemaWarning().toString();
+                return getMessage( warningWrapper.getSchemaWarning() );
             }
             else if ( columnIndex == 1 )
             {
@@ -133,5 +146,100 @@
 
         // Default
         return element.toString();
+    }
+
+
+    private String getMessage( SchemaCheckerElement element )
+    {
+        StringBuffer message = new StringBuffer();
+
+        if ( element instanceof DuplicateAliasError )
+        {
+            DuplicateAliasError duplicateAliasError = ( DuplicateAliasError ) element;
+
+            message.append( "Alias '" + duplicateAliasError.getAlias() + "' is already used
by another item: " );
+            SchemaObject duplicate = duplicateAliasError.getDuplicate();
+            if ( duplicate instanceof AttributeTypeImpl )
+            {
+                message.append( "attribute type" );
+            }
+            else if ( duplicate instanceof ObjectClassImpl )
+            {
+                message.append( "object class" );
+            }
+            message.append( " with OID '" + duplicate.getOid() + "'." );
+        }
+        else if ( element instanceof DuplicateOidError )
+        {
+            DuplicateOidError duplicateOidError = ( DuplicateOidError ) element;
+
+            message.append( "OID '" + duplicateOidError.getOid() + "' is already used by
another item: " );
+            SchemaObject duplicate = duplicateOidError.getDuplicate();
+            if ( duplicate instanceof AttributeTypeImpl )
+            {
+                message.append( "attribute type" );
+            }
+            else if ( duplicate instanceof ObjectClassImpl )
+            {
+                message.append( "object class" );
+            }
+            message.append( " with alias '" + duplicate.getName() + "'." );
+        }
+        else if ( element instanceof NonExistingATSuperiorError )
+        {
+            NonExistingATSuperiorError nonExistingATSuperiorError = ( NonExistingATSuperiorError
) element;
+
+            message.append( "Superior attribute type '" + nonExistingATSuperiorError.getSuperiorAlias()
+                + "' does not exist." );
+        }
+        else if ( element instanceof NonExistingOCSuperiorError )
+        {
+            NonExistingOCSuperiorError nonExistingOCSuperiorError = ( NonExistingOCSuperiorError
) element;
+
+            message.append( "Superior object class '" + nonExistingOCSuperiorError.getSuperiorAlias()
+                + "' does not exist." );
+        }
+        else if ( element instanceof NonExistingMandatoryATError )
+        {
+            NonExistingMandatoryATError nonExistingMandatoryATError = ( NonExistingMandatoryATError
) element;
+
+            message
+                .append( "Mandatory attribute type '" + nonExistingMandatoryATError.getAlias()
+ "' does not exist." );
+        }
+        else if ( element instanceof NonExistingOptionalATError )
+        {
+            NonExistingOptionalATError nonExistingOptionalATError = ( NonExistingOptionalATError
) element;
+
+            message.append( "Optional attribute type '" + nonExistingOptionalATError.getAlias()
+ "' does not exist." );
+        }
+        else if ( element instanceof NonExistingSyntaxError )
+        {
+            NonExistingSyntaxError nonExistingSyntaxError = ( NonExistingSyntaxError ) element;
+
+            message.append( "Syntax with OID '" + nonExistingSyntaxError.getSyntaxOid() +
"' does not exist." );
+        }
+        else if ( element instanceof NonExistingMatchingRuleError )
+        {
+            NonExistingMatchingRuleError nonExistingMatchingRuleError = ( NonExistingMatchingRuleError
) element;
+
+            message.append( "Matching rule '" + nonExistingMatchingRuleError.getMatchingRuleAlias()
+                + "' does not exist." );
+        }
+        else if ( element instanceof NoAliasWarning )
+        {
+            NoAliasWarning noAliasWarning = ( NoAliasWarning ) element;
+            SchemaObject source = noAliasWarning.getSource();
+            if ( source instanceof AttributeTypeImpl )
+            {
+                message.append( "Attribute type" );
+            }
+            else if ( source instanceof ObjectClassImpl )
+            {
+                message.append( "Abject class" );
+            }
+            message.append( " with OID '" + source.getOid() + "' does not have any alias."
);
+        }
+
+        return message.toString();
     }
 }



Mime
View raw message