Package org.apache.directory.api.ldap.model.schema

Examples of org.apache.directory.api.ldap.model.schema.ObjectClass


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

            // Label
            if ( labelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_FIRST_NAME )
            {
                List<String> names = oc.getNames();
                if ( ( names != null ) && ( names.size() > 0 ) )
                {
                    label = names.get( 0 );
                }
                else
                {
                    label = Messages.getString( "HierarchyViewLabelProvider.None" ); //$NON-NLS-1$
                }
            }
            else if ( labelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES )
            {
                List<String> names = oc.getNames();
                if ( ( names != null ) && ( names.size() > 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
            {
                List<String> names = oc.getNames();
                if ( ( names != null ) && ( names.size() > 0 ) )
                {
                    label = names.get( 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 )
            {
                AttributeType at = ( ( AttributeTypeWrapper ) obj ).getAttributeType();

                if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_FIRST_NAME )
                {
                    List<String> names = at.getNames();
                    if ( ( names != null ) && ( names.size() > 0 ) )
                    {
                        secondaryLabel = names.get( 0 );
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "HierarchyViewLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES )
                {
                    List<String> names = at.getNames();
                    if ( ( names != null ) && ( names.size() > 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 )
            {
                ObjectClass oc = ( ( ObjectClassWrapper ) obj ).getObjectClass();

                if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_FIRST_NAME )
                {
                    List<String> names = oc.getNames();
                    if ( ( names != null ) && ( names.size() > 0 ) )
                    {
                        secondaryLabel = names.get( 0 );
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "HierarchyViewLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES )
                {
                    List<String> names = oc.getNames();
                    if ( ( names != null ) && ( names.size() > 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 displayValue = value.getStringValue();

        if ( !showRawValues() && !"".equals( displayValue ) ) //$NON-NLS-1$
        {
            Schema schema = value.getAttribute().getEntry().getBrowserConnection().getSchema();
            ObjectClass ocd = schema.getObjectClassDescription( displayValue );
            switch ( ocd.getType() )
            {
                case STRUCTURAL:
                    displayValue = displayValue + Messages.getString( "ObjectClassValueEditor.Structural" ); //$NON-NLS-1$
                    break;
                case ABSTRACT:
                    displayValue = displayValue + Messages.getString( "ObjectClassValueEditor.Abstract" ); //$NON-NLS-1$
                    break;
                case AUXILIARY:
                    displayValue = displayValue + Messages.getString( "ObjectClassValueEditor.Auxiliary" ); //$NON-NLS-1$
                    break;
            }
            if ( ocd.isObsolete() )
            {
                displayValue = displayValue + Messages.getString( "ObjectClassValueEditor.Obsolete" ); //$NON-NLS-1$
            }
        }
View Full Code Here

            public String getText( Object element )
            {
                if ( element instanceof ObjectClass )
                {
                    ObjectClass oc = ( ObjectClass ) element;

                    List<String> names = oc.getNames();
                    if ( ( names != null ) && ( names.size() > 0 ) )
                    {
                        return NLS
                            .bind(
                                Messages.getString( "NewObjectClassContentWizardPage.AliasOID" ), new String[] { ViewUtils.concateAliases( names ), oc.getOid() } ); //$NON-NLS-1$
                    }
                    else
                    {
                        return NLS
                            .bind(
                                Messages.getString( "NewObjectClassContentWizardPage.NoneOID" ), new String[] { oc.getOid() } ); //$NON-NLS-1$
                    }
                }
                // Default
                return super.getText( element );
            }
View Full Code Here

                    && SchemaConstants.OBJECT_CLASS_AT.equalsIgnoreCase( fc.getAttributeToken().getValue() )
                    && fc.getValueToken() != null && fc.getValueToken().getOffset() <= hoverRegion.getOffset()
                    && hoverRegion.getOffset() <= fc.getValueToken().getOffset() + fc.getValueToken().getLength() )
                {
                    String objectClass = fc.getValueToken().getValue();
                    ObjectClass objectClassDescription = schema.getObjectClassDescription( objectClass );
                    String ldifLine = SchemaUtils.getLdifLine( objectClassDescription );
                    return ldifLine;
                }
            }
            if ( filter.getFilterComponent() instanceof LdapFilterExtensibleComponent )
View Full Code Here

            List<String> supNames = oc.getSuperiorOids();
            if ( supNames != null )
            {
                for ( String supName : oc.getSuperiorOids() )
                {
                    ObjectClass sup = schemaHandler.getObjectClass( supName );
                    if ( sup != null )
                    {
                        if ( !Strings.toLowerCase( schema.getSchemaName() ).equals(
                            Strings.toLowerCase( sup.getSchemaName() ) ) )
                        {
                            schemaNames.add( sup.getSchemaName() );
                        }
                    }
                }
            }
View Full Code Here

     *
     * @throws Exception
     */
    public void testAddMandatoryATDifference() throws Exception
    {
        ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$
        MutableObjectClass o2 = new MutableObjectClass( "1.2.3.4" ); //$NON-NLS-1$
        o2.setMustAttributeTypeOids( Arrays.asList( new String[]
            { "must" } ) ); //$NON-NLS-1$

        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1, o2 );
View Full Code Here

     *
     * @throws Exception
     */
    public void testAddOptionalATDifference() throws Exception
    {
        ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$
        MutableObjectClass o2 = new MutableObjectClass( "1.2.3.4" ); //$NON-NLS-1$
        o2.setMayAttributeTypeOids( Arrays.asList( new String[]
            { "may" } ) ); //$NON-NLS-1$

        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1, o2 );
View Full Code Here

     *
     * @throws Exception
     */
    public void testAddSuperiorOCDifference() throws Exception
    {
        ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$
        MutableObjectClass o2 = new MutableObjectClass( "1.2.3.4" ); //$NON-NLS-1$
        o2.setSuperiorOids( Arrays.asList( new String[]
            { "superiorOC" } ) ); //$NON-NLS-1$

        List<PropertyDifference> differences = DifferenceEngine.getDifferences( o1, o2 );
View Full Code Here

                    o1Names = at1.getNames();
                    o2Names = at2.getNames();
                }
                else if ( ( o1 instanceof ObjectClass ) && ( o2 instanceof ObjectClass ) )
                {
                    ObjectClass oc1 = ( ObjectClass ) o1;
                    ObjectClass oc2 = ( ObjectClass ) o2;

                    o1Names = oc1.getNames();
                    o2Names = oc2.getNames();
                }
                else if ( ( o1 instanceof AttributeType ) && ( o2 instanceof ObjectClass ) )
                {
                    AttributeType at = ( AttributeType ) o1;
                    ObjectClass oc = ( ObjectClass ) o2;

                    o1Names = at.getNames();
                    o2Names = oc.getNames();
                }
                else if ( ( o1 instanceof ObjectClass ) && ( o2 instanceof AttributeType ) )
                {
                    ObjectClass oc = ( ObjectClass ) o1;
                    AttributeType at = ( AttributeType ) o2;

                    o1Names = oc.getNames();
                    o2Names = at.getNames();
                }

                // Comparing the First Name
                if ( ( o1Names != null ) && ( o2Names != null ) )
                {
                    if ( ( o1Names.size() > 0 ) && ( o2Names.size() > 0 ) )
                    {
                        return o1Names.get( 0 ).compareToIgnoreCase( o2Names.get( 0 ) );
                    }
                    else if ( ( o1Names.size() == 0 ) && ( o2Names.size() > 0 ) )
                    {
                        return "".compareToIgnoreCase( o2Names.get( 0 ) ); //$NON-NLS-1$
                    }
                    else if ( ( o1Names.size() > 0 ) && ( o2Names.size() == 0 ) )
                    {
                        return o1Names.get( 0 ).compareToIgnoreCase( "" ); //$NON-NLS-1$
                    }
                }

                // Default
                return o1.toString().compareToIgnoreCase( o2.toString() );
            }
        };

        oidSorter = new Comparator<SchemaObject>()
        {
            public int compare( SchemaObject o1, SchemaObject o2 )
            {
                if ( ( o1 instanceof AttributeType ) && ( o2 instanceof AttributeType ) )
                {
                    AttributeType at1 = ( AttributeType ) o1;
                    AttributeType at2 = ( AttributeType ) o2;

                    return at1.getOid().compareToIgnoreCase( at2.getOid() );
                }
                else if ( ( o1 instanceof ObjectClass ) && ( o2 instanceof ObjectClass ) )
                {
                    ObjectClass oc1 = ( ObjectClass ) o1;
                    ObjectClass oc2 = ( ObjectClass ) o2;

                    return oc1.getOid().compareToIgnoreCase( oc2.getOid() );
                }
                else if ( ( o1 instanceof AttributeType ) && ( o2 instanceof ObjectClass ) )
                {
                    AttributeType at = ( AttributeType ) o1;
                    ObjectClass oc = ( ObjectClass ) o2;

                    return at.getOid().compareToIgnoreCase( oc.getOid() );
                }
                else if ( ( o1 instanceof ObjectClass ) && ( o2 instanceof AttributeType ) )
                {
                    ObjectClass oc = ( ObjectClass ) o1;
                    AttributeType at = ( AttributeType ) o2;

                    return oc.getOid().compareToIgnoreCase( at.getOid() );
                }

                // Default
                return o1.toString().compareToIgnoreCase( o2.toString() );
            }
View Full Code Here

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

            // Label
            if ( labelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_FIRST_NAME )
            {
                List<String> names = oc.getNames();
                if ( ( names != null ) && ( names.size() > 0 ) )
                {
                    label = names.get( 0 );
                }
                else
                {
                    label = Messages.getString( "SearchViewLabelProvider.None" ); //$NON-NLS-1$
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_ALL_ALIASES )
            {
                List<String> names = oc.getNames();
                if ( ( names != null ) && ( names.size() > 0 ) )
                {
                    label = ViewUtils.concateAliases( names );
                }
                else
                {
                    label = Messages.getString( "SearchViewLabelProvider.None" ); //$NON-NLS-1$
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_OID )
            {
                label = oc.getOid();
            }
            else
            // Default
            {
                List<String> names = oc.getNames();
                if ( ( names != null ) && ( names.size() > 0 ) )
                {
                    label = names.get( 0 );
                }
                else
                {
                    label = Messages.getString( "SearchViewLabelProvider.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 ( element instanceof AttributeType )
            {
                AttributeType at = ( AttributeType ) element;

                if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_FIRST_NAME )
                {
                    List<String> names = at.getNames();
                    if ( ( names != null ) && ( names.size() > 0 ) )
                    {
                        secondaryLabel = names.get( 0 );
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "SearchViewLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_ALL_ALIASES )
                {
                    List<String> names = at.getNames();
                    if ( ( names != null ) && ( names.size() > 0 ) )
                    {
                        secondaryLabel = ViewUtils.concateAliases( names );
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "SearchViewLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_OID )
                {
                    secondaryLabel = at.getOid();
                }
            }
            else if ( element instanceof ObjectClass )
            {
                ObjectClass oc = ( ObjectClass ) element;

                if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_FIRST_NAME )
                {
                    List<String> names = oc.getNames();
                    if ( ( names != null ) && ( names.size() > 0 ) )
                    {
                        secondaryLabel = names.get( 0 );
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "SearchViewLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_ALL_ALIASES )
                {
                    List<String> names = oc.getNames();
                    if ( ( names != null ) && ( names.size() > 0 ) )
                    {
                        secondaryLabel = ViewUtils.concateAliases( names );
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "SearchViewLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_OID )
                {
                    secondaryLabel = oc.getOid();
                }
            }

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

TOP

Related Classes of org.apache.directory.api.ldap.model.schema.ObjectClass

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.