Package org.apache.directory.studio.schemaeditor.model

Examples of org.apache.directory.studio.schemaeditor.model.ObjectClassImpl


                        AttributeTypeImpl at = ( ( AttributeTypeWrapper ) selectedItem ).getAttributeType();
                        schemaObjectsList.add( at );
                    }
                    else if ( selectedItem instanceof ObjectClassWrapper )
                    {
                        ObjectClassImpl oc = ( ( ObjectClassWrapper ) selectedItem ).getObjectClass();
                        schemaObjectsList.add( oc );
                    }
                }

                SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
View Full Code Here


                label = label.substring( 0, abbreviateMaxLength ) + "..."; //$NON-NLS-1$
            }
        }
        else if ( element instanceof ObjectClassWrapper )
        {
            ObjectClassImpl oc = ( ( ObjectClassWrapper ) element ).getObjectClass();

            // Label
            if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
            {
                String[] names = oc.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
            {
                String[] names = oc.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = ViewUtils.concateAliases( names );
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
            {
                label = oc.getOid();
            }
            else
            // Default
            {
                String[] names = oc.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }

            // Abbreviate
            if ( abbreviate && ( abbreviateMaxLength < label.length() ) )
            {
                label = label.substring( 0, abbreviateMaxLength ) + "..."; //$NON-NLS-1$
            }
        }
        else if ( element instanceof Folder )
        {
            Folder folder = ( Folder ) element;

            if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT )
            {
                return folder.getName() + " (" + folder.getChildren().size() + ")";
            }
            else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL )
            {
                return folder.getName();
            }
        }

        // Secondary Label
        if ( secondaryLabelDisplay )
        {
            String secondaryLabel = ""; //$NON-NLS-1$
            if ( element instanceof AttributeTypeWrapper )
            {
                AttributeTypeImpl at = ( ( AttributeTypeWrapper ) element ).getAttributeType();

                if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
                {
                    String[] names = at.getNames();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = names[0];
                    }
                    else
                    {
                        secondaryLabel = NONE;
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
                {
                    String[] names = at.getNames();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = ViewUtils.concateAliases( names );
                    }
                    else
                    {
                        secondaryLabel = NONE;
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
                {
                    secondaryLabel = at.getOid();
                }
            }
            else if ( element instanceof ObjectClassWrapper )
            {
                ObjectClassImpl oc = ( ( ObjectClassWrapper ) element ).getObjectClass();

                if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
                {
                    String[] names = oc.getNames();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = names[0];
                    }
                    else
                    {
                        secondaryLabel = NONE;
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
                {
                    String[] names = oc.getNames();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = ViewUtils.concateAliases( names );
                    }
                    else
                    {
                        secondaryLabel = NONE;
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
                {
                    secondaryLabel = oc.getOid();
                }
            }

            if ( secondaryLabelAbbreviate && ( secondaryLabelAbbreviateMaxLength < secondaryLabel.length() ) )
            {
View Full Code Here

                label = label.substring( 0, abbreviateMaxLength ) + "..."; //$NON-NLS-1$
            }
        }
        else if ( obj instanceof ObjectClassWrapper )
        {
            ObjectClassImpl oc = ( ( ObjectClassWrapper ) obj ).getObjectClass();

            // Label
            if ( labelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_FIRST_NAME )
            {
                String[] names = oc.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES )
            {
                String[] names = oc.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = ViewUtils.concateAliases( names );
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_OID )
            {
                label = oc.getOid();
            }
            else
            // Default
            {
                String[] names = oc.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }

            // Abbreviate
            if ( abbreviate && ( abbreviateMaxLength < label.length() ) )
            {
                label = label.substring( 0, abbreviateMaxLength ) + "..."; //$NON-NLS-1$
            }
        }

        // Secondary Label
        if ( secondaryLabelDisplay )
        {
            String secondaryLabel = ""; //$NON-NLS-1$
            if ( obj instanceof AttributeTypeWrapper )
            {
                AttributeTypeImpl at = ( ( AttributeTypeWrapper ) obj ).getAttributeType();

                if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_FIRST_NAME )
                {
                    String[] names = at.getNames();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = names[0];
                    }
                    else
                    {
                        secondaryLabel = NONE;
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES )
                {
                    String[] names = at.getNames();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = ViewUtils.concateAliases( names );
                    }
                    else
                    {
                        secondaryLabel = NONE;
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_OID )
                {
                    secondaryLabel = at.getOid();
                }
            }
            else if ( obj instanceof ObjectClassWrapper )
            {
                ObjectClassImpl oc = ( ( ObjectClassWrapper ) obj ).getObjectClass();

                if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_FIRST_NAME )
                {
                    String[] names = oc.getNames();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = names[0];
                    }
                    else
                    {
                        secondaryLabel = NONE;
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES )
                {
                    String[] names = oc.getNames();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = ViewUtils.concateAliases( names );
                    }
                    else
                    {
                        secondaryLabel = NONE;
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_OID )
                {
                    secondaryLabel = oc.getOid();
                }
            }

            if ( secondaryLabelAbbreviate && ( secondaryLabelAbbreviateMaxLength < secondaryLabel.length() ) )
            {
View Full Code Here

                label = label.substring( 0, abbreviateMaxLength ) + "..."; //$NON-NLS-1$
            }
        }
        else if ( element instanceof ObjectClassImpl )
        {
            ObjectClassImpl oc = ( ObjectClassImpl ) element;

            // Label
            if ( labelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_FIRST_NAME )
            {
                String[] names = oc.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_ALL_ALIASES )
            {
                String[] names = oc.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = ViewUtils.concateAliases( names );
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_OID )
            {
                label = oc.getOid();
            }
            else
            // Default
            {
                String[] names = oc.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }

            // Abbreviate
            if ( abbreviate && ( abbreviateMaxLength < label.length() ) )
            {
                label = label.substring( 0, abbreviateMaxLength ) + "..."; //$NON-NLS-1$
            }
        }

        // Secondary Label
        if ( secondaryLabelDisplay )
        {
            String secondaryLabel = ""; //$NON-NLS-1$
            if ( element instanceof AttributeTypeImpl )
            {
                AttributeTypeImpl at = ( AttributeTypeImpl ) element;

                if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_FIRST_NAME )
                {
                    String[] names = at.getNames();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = names[0];
                    }
                    else
                    {
                        secondaryLabel = NONE;
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_ALL_ALIASES )
                {
                    String[] names = at.getNames();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = ViewUtils.concateAliases( names );
                    }
                    else
                    {
                        secondaryLabel = NONE;
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_OID )
                {
                    secondaryLabel = at.getOid();
                }
            }
            else if ( element instanceof ObjectClassImpl )
            {
                ObjectClassImpl oc = ( ObjectClassImpl ) element;

                if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_FIRST_NAME )
                {
                    String[] names = oc.getNames();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = names[0];
                    }
                    else
                    {
                        secondaryLabel = NONE;
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_ALL_ALIASES )
                {
                    String[] names = oc.getNames();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = ViewUtils.concateAliases( names );
                    }
                    else
                    {
                        secondaryLabel = NONE;
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_OID )
                {
                    secondaryLabel = oc.getOid();
                }
            }

            if ( secondaryLabelAbbreviate && ( secondaryLabelAbbreviateMaxLength < secondaryLabel.length() ) )
            {
View Full Code Here

            String[] supNames = oc.getSuperClassesNames();
            if ( supNames != null )
            {
                for ( String supName : oc.getSuperClassesNames() )
                {
                    ObjectClassImpl sup = schemaHandler.getObjectClass( supName );
                    if ( sup != null )
                    {
                        if ( !schema.getName().toLowerCase().equals( sup.getSchema().toLowerCase() ) )
                        {
                            schemaNames.add( sup.getSchema() );
                        }
                    }
                }
            }
View Full Code Here

        if ( ( superClasseNames != null ) && ( superClasseNames.length > 0 ) )
        // The object class has one or more superiors
        {
            for ( String superClassName : superClasseNames )
            {
                ObjectClassImpl superClass = schemaHandler.getObjectClass( superClassName );
                if ( superClass == null )
                {
                    parentsMap.put( oc, superClassName.toLowerCase() );
                    childrenMap.put( superClassName.toLowerCase(), oc );
                    childrenMap.put( root, oc );
                }
                else
                {
                    parentsMap.put( oc, superClass );
                    childrenMap.put( superClass, oc );
                }
            }
        }
        else
        // The object class does not have any declared superior
        // Then, it is a child of the "top (2.5.6.0)" object class
        // (Unless it is the "top (2.5.6.0)" object class itself)
        {
            ObjectClassImpl topOC = schemaHandler.getObjectClass( "2.5.6.0" );
            if ( oc.equals( topOC ) )
            // The given object class is the "top (2.5.6.0)" object class
            {
                parentsMap.put( oc, root );
                childrenMap.put( root, oc );
View Full Code Here

        {
            for ( String superClassName : superClassesNames )
            {
                if ( !"".equals( superClassName ) )
                {
                    ObjectClassImpl superClassOC = schemaHandler.getObjectClass( superClassName );
                    if ( superClassOC == null )
                    {
                        childrenMap.remove( superClassName.toLowerCase(), oc );
                        childrenMap.remove( root, oc );
                    }
                    else
                    {
                        childrenMap.remove( superClassOC, oc );
                    }
                }
            }
        }
        else
        {
            if ( oc.getOid().equals( "2.5.6.0" ) )
            // The given object class is the "top (2.5.6.0)" object class
            {
                childrenMap.remove( root, oc );
            }
            else
            {
                ObjectClassImpl topOC = schemaHandler.getObjectClass( "2.5.6.0" );
                if ( topOC != null )
                // The "top (2.5.6.0)" object class exists
                {
                    childrenMap.remove( topOC, oc );
                }
                else
                // The "top (2.5.6.0)" object class does not exist
                {
                    childrenMap.remove( "2.5.6.0", oc );
                }
            }
        }

        // Attaching each child (if there are children) to the RootObject
        List<Object> children = getChildren( oc );
        if ( children != null )
        {
            for ( Object child : children )
            {
                ObjectClassImpl childOC = ( ObjectClassImpl ) child;

                parentsMap.remove( child, oc );

                parentsMap.put( child, root );
                childrenMap.put( root, child );
                String[] childSuperClassesNames = childOC.getSuperClassesNames();
                if ( ( childSuperClassesNames != null ) && ( childSuperClassesNames.length > 0 ) )
                {
                    String correctSuperClassName = getCorrectSuperClassName( oc, childSuperClassesNames );
                    if ( correctSuperClassName != null )
                    {
View Full Code Here

                        AttributeTypeImpl at = createAttributeType( searchResult );
                        at.setSchema( name );
                        schema.addAttributeType( at );
                        break;
                    case OBJECT_CLASS:
                        ObjectClassImpl oc = createObjectClass( searchResult );
                        oc.setSchema( name );
                        schema.addObjectClass( oc );
                        break;
                    case MATCHING_RULE:
                        MatchingRuleImpl mr = createMatchingRule( searchResult );
                        mr.setSchema( name );
View Full Code Here

     * ObjectClassImpl could be created
     * @throws NamingException
     */
    private static ObjectClassImpl createObjectClass( SearchResult sr ) throws NamingException
    {
        ObjectClassImpl oc = new ObjectClassImpl( getOid( sr ) );
        oc.setNames( getNames( sr ) );
        oc.setDescription( getDescription( sr ) );
        oc.setObsolete( isObsolete( sr ) );
        oc.setSuperClassesNames( getSuperiors( sr ) );
        oc.setType( getType( sr ) );
        oc.setMayNamesList( getMay( sr ) );
        oc.setMustNamesList( getMust( sr ) );
        return oc;
    }
View Full Code Here

        {
            ObjectClassTypeEnum type = oc.getType();

            for ( String superior : superiors )
            {
                ObjectClassImpl superiorOC = schemaHandler.getObjectClass( superior );
                if ( superiorOC == null )
                {
                    SchemaError error = new NonExistingOCSuperiorError( oc, superior );
                    errorsList.add( error );
                    errorsMap.put( oc, error );
                    dependenciesMap.put( superior, oc );
                    dependsOnMap.put( oc, superior );
                }
                else
                {
                    dependenciesMap.put( superiorOC, oc );
                    dependsOnMap.put( oc, superiorOC );

                    // Checking Type of Superior Hierarchy
                    ObjectClassTypeEnum superiorOCType = superiorOC.getType();
                    switch ( type )
                    {
                        case ABSTRACT:
                            if ( ( !superiorOCType.equals( ObjectClassTypeEnum.ABSTRACT ) )
                                && ( !superiorOC.getOid().equals( "2.5.6.0" ) ) )
                            {
                                SchemaError error = new ClassTypeHierarchyError( oc, superiorOC );
                                errorsList.add( error );
                                errorsMap.put( oc, error );
                            }
                            break;
                        case AUXILIARY:
                            if ( ( superiorOCType.equals( ObjectClassTypeEnum.STRUCTURAL ) )
                                && ( !superiorOC.getOid().equals( "2.5.6.0" ) ) )
                            {
                                SchemaError error = new ClassTypeHierarchyError( oc, superiorOC );
                                errorsList.add( error );
                                errorsMap.put( oc, error );
                            }
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.schemaeditor.model.ObjectClassImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.