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

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


                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.getNamesRef();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = Messages.getString( "SchemaViewLabelProvider.None" ); //$NON-NLS-1$
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
            {
                String[] names = oc.getNamesRef();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = ViewUtils.concateAliases( names );
                }
                else
                {
                    label = Messages.getString( "SchemaViewLabelProvider.None" ); //$NON-NLS-1$
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
            {
                label = oc.getOid();
            }
            else
            // Default
            {
                String[] names = oc.getNamesRef();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = Messages.getString( "SchemaViewLabelProvider.None" ); //$NON-NLS-1$
                }
            }

            // 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() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
            }
            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.getNamesRef();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = names[0];
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "SchemaViewLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
                {
                    String[] names = at.getNamesRef();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = ViewUtils.concateAliases( names );
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "SchemaViewLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                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.getNamesRef();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = names[0];
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "SchemaViewLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
                {
                    String[] names = oc.getNamesRef();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = ViewUtils.concateAliases( names );
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "SchemaViewLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
                {
                    secondaryLabel = oc.getOid();
                }
            }

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


                    String value = ( String ) ne.nextElement();
                    ObjectClassDescriptionSchemaParser parser = new ObjectClassDescriptionSchemaParser();
                    parser.setQuirksMode( true );
                    ObjectClassDescription ocd = parser.parseObjectClassDescription( value );

                    ObjectClassImpl impl = new ObjectClassImpl( ocd.getNumericOid() );
                    impl.setOid( ocd.getNumericOid() );
                    impl.setNames( ocd.getNames().toArray( new String[0] ) );
                    impl.setDescription( ocd.getDescription() );
                    impl.setSuperClassesNames( ocd.getSuperiorObjectClasses().toArray( new String[0] ) );
                    impl.setType( ocd.getKind() );
                    impl.setObsolete( ocd.isObsolete() );
                    impl.setMustNamesList( ocd.getMustAttributeTypes().toArray( new String[0] ) );
                    impl.setMayNamesList( ocd.getMayAttributeTypes().toArray( new String[0] ) );
                    impl.setSchema( schema.getName() );
                    impl.setSchemaObject( schema );

                    schema.addObjectClass( impl );
                }
            }
        }

        Attribute ldapSyntaxesAttribute = searchResult.getAttributes().get( "ldapSyntaxes" );
        if ( ldapSyntaxesAttribute != null )
        {
            NamingEnumeration<?> ne = ldapSyntaxesAttribute.getAll();
            if ( ne != null )
            {
                while ( ne.hasMoreElements() )
                {
                    String value = ( String ) ne.nextElement();
                    LdapSyntaxDescriptionSchemaParser parser = new LdapSyntaxDescriptionSchemaParser();
                    parser.setQuirksMode( true );
                    LdapSyntaxDescription lsd = parser.parseLdapSyntaxDescription( value );

                    SyntaxImpl impl = new SyntaxImpl( lsd.getNumericOid() );
                    impl.setDescription( lsd.getDescription() );
                    impl.setNames( new String[]
                        { lsd.getDescription() } );
                    //impl.setObsolete( lsd.isObsolete() );
                    impl.setHumanReadable( true );
                    impl.setSchema( schema.getName() );
                    impl.setSchemaObject( schema );

                    schema.addSyntax( impl );
                }
            }
        }
        // if online: assume all received syntaxes in attributes are valid -> create dummy syntaxes if missing
        for ( AttributeTypeImpl at : schema.getAttributeTypes() )
        {
            String syntaxOid = at.getSyntaxOid();
            if ( syntaxOid != null && schema.getSyntax( syntaxOid ) == null )
            {
                SyntaxImpl impl = new SyntaxImpl( syntaxOid );
                impl.setSchema( schema.getName() );
                impl.setSchemaObject( schema );
                String oidDescription = Utils.getOidDescription( syntaxOid );
                impl.setDescription( oidDescription != null ? oidDescription : "Dummy" ); //$NON-NLS-1$
                impl.setNames( new String[]
                    { impl.getDescription() } );
                schema.addSyntax( impl );
            }
        }

        Attribute matchingRulesAttribute = searchResult.getAttributes().get( "matchingRules" );
        if ( matchingRulesAttribute != null )
        {
            NamingEnumeration<?> ne = matchingRulesAttribute.getAll();
            if ( ne != null )
            {
                while ( ne.hasMoreElements() )
                {
                    String value = ( String ) ne.nextElement();
                    MatchingRuleDescriptionSchemaParser parser = new MatchingRuleDescriptionSchemaParser();
                    parser.setQuirksMode( true );
                    MatchingRuleDescription mrd = parser.parseMatchingRuleDescription( value );

                    MatchingRuleImpl impl = new MatchingRuleImpl( mrd.getNumericOid() );
                    impl.setDescription( mrd.getDescription() );
                    impl.setNames( mrd.getNames().toArray( new String[0] ) );
                    impl.setObsolete( mrd.isObsolete() );
                    impl.setSyntaxOid( mrd.getSyntax() );
                    impl.setSchema( schema.getName() );
                    impl.setSchemaObject( schema );

                    schema.addMatchingRule( impl );
                }
            }
        }
View Full Code Here

     */
    public String getColumnText( Object element, int columnIndex )
    {
        if ( element instanceof ObjectClassImpl )
        {
            ObjectClassImpl oc = ( ObjectClassImpl ) element;

            String[] names = oc.getNamesRef();
            if ( ( names != null ) && ( names.length > 0 ) )
            {
                return ViewUtils.concateAliases( names ) + "  -  (" + oc.getOid() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
            }
            else
            {
                return NLS
                    .bind(
                        Messages.getString( "ObjectClassEditorSuperiorsTableLabelProvider.None" ), new String[] { oc.getOid() } ); //$NON-NLS-1$
            }
        }
        else if ( element instanceof NonExistingObjectClass )
        {
            return ( ( NonExistingObjectClass ) element ).getDisplayName();
View Full Code Here

     */
    public String getText( Object element )
    {
        if ( element instanceof ObjectClassImpl )
        {
            ObjectClassImpl oc = ( ObjectClassImpl ) element;

            String[] names = oc.getNamesRef();
            if ( ( names != null ) && ( names.length > 0 ) )
            {
                return ViewUtils.concateAliases( names ) + "  -  (" + oc.getOid() + ")"; //$NON-NLS-2$
            }
            else
            {
                return NLS.bind(
                    Messages.getString( "ObjectClassSelectionDialogLabelProvider.None" ), new String[] { oc.getOid() } ); //$NON-NLS-1$
            }
        }

        // Default
        return null;
View Full Code Here

        }
        else if ( element instanceof ObjectClassDifference )
        {
            ObjectClassDifference ocd = ( ObjectClassDifference ) element;

            ObjectClassImpl oc = null;

            switch ( ocd.getType() )
            {
                case ADDED:
                    oc = ( ( ObjectClassImpl ) ocd.getDestination() );
                    break;
                case MODIFIED:
                    oc = ( ( ObjectClassImpl ) ocd.getDestination() );
                    break;
                case REMOVED:
                    oc = ( ( ObjectClassImpl ) ocd.getSource() );
                    break;
                case IDENTICAL:
                    oc = ( ( ObjectClassImpl ) ocd.getDestination() );
                    break;
            }

            // Label
            if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
            {
                String[] names = oc.getNamesRef();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = Messages.getString( "DifferencesWidgetSchemaLabelProvider.None" ); //$NON-NLS-1$
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
            {
                String[] names = oc.getNamesRef();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = ViewUtils.concateAliases( names );
                }
                else
                {
                    label = Messages.getString( "DifferencesWidgetSchemaLabelProvider.None" ); //$NON-NLS-1$
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
            {
                label = oc.getOid();
            }
            else
            // Default
            {
                String[] names = oc.getNamesRef();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = Messages.getString( "DifferencesWidgetSchemaLabelProvider.None" ); //$NON-NLS-1$
                }
            }

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

            return folder.getName() + " (" + folder.getChildren().size() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
        }

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

                AttributeTypeImpl at = null;

                switch ( atd.getType() )
                {
                    case ADDED:
                        at = ( ( AttributeTypeImpl ) atd.getDestination() );
                        break;
                    case MODIFIED:
                        at = ( ( AttributeTypeImpl ) atd.getDestination() );
                        break;
                    case REMOVED:
                        at = ( ( AttributeTypeImpl ) atd.getSource() );
                        break;
                    case IDENTICAL:
                        at = ( ( AttributeTypeImpl ) atd.getDestination() );
                        break;
                }

                if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
                {
                    String[] names = at.getNamesRef();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = names[0];
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "DifferencesWidgetSchemaLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
                {
                    String[] names = at.getNamesRef();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = ViewUtils.concateAliases( names );
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "DifferencesWidgetSchemaLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
                {
                    secondaryLabel = at.getOid();
                }
            }
            else if ( element instanceof ObjectClassDifference )
            {
                ObjectClassDifference ocd = ( ObjectClassDifference ) element;

                ObjectClassImpl oc = null;

                switch ( ocd.getType() )
                {
                    case ADDED:
                        oc = ( ( ObjectClassImpl ) ocd.getDestination() );
                        break;
                    case MODIFIED:
                        oc = ( ( ObjectClassImpl ) ocd.getDestination() );
                        break;
                    case REMOVED:
                        oc = ( ( ObjectClassImpl ) ocd.getSource() );
                        break;
                    case IDENTICAL:
                        oc = ( ( ObjectClassImpl ) ocd.getDestination() );
                        break;
                }

                if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
                {
                    String[] names = oc.getNamesRef();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = names[0];
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "DifferencesWidgetSchemaLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
                {
                    String[] names = oc.getNamesRef();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = ViewUtils.concateAliases( names );
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "DifferencesWidgetSchemaLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
                {
                    secondaryLabel = oc.getOid();
                }
            }

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

                mergeAttributeType( at, targetProject, targetSchema, processedObjects, errorMessages,
                    replaceUnknownSyntax, mergeDependencies, pullUpAttributes );
            }
            if ( sourceObject instanceof ObjectClassImpl )
            {
                ObjectClassImpl oc = ( ObjectClassImpl ) sourceObject;
                Schema targetSchema = getTargetSchema( oc.getSchemaObject().getProject(), targetProject, targetSchemas );
                mergeObjectClass( oc, targetProject, targetSchema, processedObjects, errorMessages,
                    replaceUnknownSyntax, mergeDependencies, pullUpAttributes );
            }
        }
View Full Code Here

            return;
        }
        processedObjects.add( sourceObjectClass );

        // check if object class (identified by OID or alias name) already exists in the target project
        ObjectClassImpl targetObjectClass = targetProject.getSchemaHandler()
            .getObjectClass( sourceObjectClass.getOid() );
        if ( targetObjectClass == null )
        {
            for ( String name : sourceObjectClass.getNamesRef() )
            {
                targetObjectClass = targetProject.getSchemaHandler().getObjectClass( name );
                if ( targetObjectClass != null )
                {
                    break;
                }
            }
        }

        // check if OID or alias name already exist in target project
        boolean oidOrAliasAlreadyTaken = targetProject.getSchemaHandler().isAliasOrOidAlreadyTaken(
            sourceObjectClass.getOid() );
        if ( !oidOrAliasAlreadyTaken )
        {
            for ( String name : sourceObjectClass.getNamesRef() )
            {
                oidOrAliasAlreadyTaken = targetProject.getSchemaHandler().isAliasOrOidAlreadyTaken( name );
                if ( oidOrAliasAlreadyTaken )
                {
                    break;
                }
            }
        }

        if ( targetObjectClass != null )
        {
            errorMessages.add( NLS.bind( Messages.getString( "MergeSchemasWizard.ObjectClassExistsInTargetProject" ), //$NON-NLS-1$
                getIdString( sourceObjectClass ) ) );
        }
        else
        {
            if ( oidOrAliasAlreadyTaken )
            {
                errorMessages.add( NLS.bind( Messages.getString( "MergeSchemasWizard.OidOrAliasAlreadyTaken" ), //$NON-NLS-1$
                    getIdString( sourceObjectClass ) ) );
            }
            else
            {
                // remove object class if already there from previous merge
                ObjectClassImpl oc = targetSchema.getObjectClass( sourceObjectClass.getOid() );
                if ( oc != null )
                {
                    targetSchema.removeObjectClass( oc );
                }

                // create object class
                ObjectClassImpl clonedObjectClass = new ObjectClassImpl( sourceObjectClass.getOid() );
                clonedObjectClass.setOid( sourceObjectClass.getOid() );
                clonedObjectClass.setNames( sourceObjectClass.getNamesRef() );
                clonedObjectClass.setDescription( sourceObjectClass.getDescription() );
                clonedObjectClass.setSuperClassesNames( sourceObjectClass.getSuperClassesNames() );
                clonedObjectClass.setType( sourceObjectClass.getType() );
                clonedObjectClass.setObsolete( sourceObjectClass.isObsolete() );
                clonedObjectClass.setMustNamesList( sourceObjectClass.getMustNamesList() );
                clonedObjectClass.setMayNamesList( sourceObjectClass.getMayNamesList() );
                clonedObjectClass.setSchema( targetSchema.getName() );
                clonedObjectClass.setSchemaObject( targetSchema );

                // merge dependencies: super object classes and must/may attributes
                if ( mergeDependencies )
                {
                    String[] superClassesNames = clonedObjectClass.getSuperClassesNames();
                    if ( superClassesNames != null )
                    {
                        for ( String superClassName : superClassesNames )
                        {
                            if ( superClassName != null )
                            {
                                ObjectClassImpl superSourceObjectClass = sourceObjectClass.getSchemaObject()
                                    .getProject().getSchemaHandler().getObjectClass( superClassName );
                                ObjectClassImpl superTargetObjectClass = targetProject.getSchemaHandler()
                                    .getObjectClass( superClassName );
                                if ( superSourceObjectClass != null )
                                {
                                    if ( superTargetObjectClass == null )
                                    {
View Full Code Here

        {
            ObjectClassTypeEnum type = oc.getType();

            for ( String superior : superiors )
            {
                ObjectClassImpl superiorOC = Activator.getDefault().getSchemaHandler().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

                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.getNamesRef();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = Messages.getString( "HierarchyViewLabelProvider.None" ); //$NON-NLS-1$
                }
            }
            else if ( labelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES )
            {
                String[] names = oc.getNamesRef();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = ViewUtils.concateAliases( names );
                }
                else
                {
                    label = Messages.getString( "HierarchyViewLabelProvider.None" ); //$NON-NLS-1$
                }
            }
            else if ( labelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_OID )
            {
                label = oc.getOid();
            }
            else
            // Default
            {
                String[] names = oc.getNamesRef();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = Messages.getString( "HierarchyViewLabelProvider.None" ); //$NON-NLS-1$
                }
            }

            // 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.getNamesRef();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = names[0];
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "HierarchyViewLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES )
                {
                    String[] names = at.getNamesRef();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = ViewUtils.concateAliases( names );
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "HierarchyViewLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                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.getNamesRef();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = names[0];
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "HierarchyViewLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES )
                {
                    String[] names = oc.getNamesRef();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = ViewUtils.concateAliases( names );
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "HierarchyViewLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_OID )
                {
                    secondaryLabel = oc.getOid();
                }
            }

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

        String[] attributeNames = must ? oc.getMustNamesList() : oc.getMayNamesList();
        attributeNameList.addAll( Arrays.asList( attributeNames ) );

        for ( String superClassName : oc.getSuperClassesNames() )
        {
            ObjectClassImpl superObjectClass = oc.getSchemaObject().getProject().getSchemaHandler().getObjectClass(
                superClassName );
            fetchAttributes( attributeNameList, superObjectClass, must );
        }
    }
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.