Examples of AttributeTypeImpl


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

     */
    public String getText( Object obj )
    {
        if ( obj instanceof AttributeTypeImpl )
        {
            AttributeTypeImpl at = ( AttributeTypeImpl ) obj;

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

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

        {
            // Superior
            String supName = at.getSuperiorName();
            if ( supName != null )
            {
                AttributeTypeImpl sup = schemaHandler.getAttributeType( supName );
                if ( sup != null )
                {
                    if ( !schema.getName().toLowerCase().equals( sup.getSchema().toLowerCase() ) )
                    {
                        schemaNames.add( sup.getSchema() );
                    }
                }
            }
        }

        // Looping on Object Classes
        for ( ObjectClassImpl oc : schema.getObjectClasses() )
        {
            // Superiors
            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() );
                        }
                    }
                }
            }

            // Mays
            String[] mayNames = oc.getMayNamesList();
            if ( mayNames != null )
            {
                for ( String mayName : mayNames )
                {
                    AttributeTypeImpl may = schemaHandler.getAttributeType( mayName );
                    if ( may != null )
                    {
                        if ( !schema.getName().toLowerCase().equals( may.getSchema().toLowerCase() ) )
                        {
                            schemaNames.add( may.getSchema() );
                        }
                    }
                }

            }

            // Musts
            String[] mustNames = oc.getMustNamesList();
            if ( mustNames != null )
            {
                for ( String mustName : oc.getMustNamesList() )
                {
                    AttributeTypeImpl must = schemaHandler.getAttributeType( mustName );
                    if ( must != null )
                    {
                        if ( !schema.getName().toLowerCase().equals( must.getSchema().toLowerCase() ) )
                        {
                            schemaNames.add( must.getSchema() );
                        }
                    }
                }
            }
        }
View Full Code Here

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

        SchemaChecker schemaChecker = Activator.getDefault().getSchemaChecker();
        ElementState state = ElementState.NONE;

        if ( element instanceof AttributeTypeWrapper )
        {
            AttributeTypeImpl at = ( ( AttributeTypeWrapper ) element ).getAttributeType();

            if ( schemaChecker.hasErrors( at ) )
            {
                decorateState( ElementState.ERROR, decoration );
                return;
View Full Code Here

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

        {
            for ( TreeNode child : children )
            {
                if ( child instanceof AttributeTypeWrapper )
                {
                    AttributeTypeImpl at = ( ( AttributeTypeWrapper ) child ).getAttributeType();

                    if ( schemaChecker.hasWarnings( at ) )
                    {
                        return true;
                    }
View Full Code Here

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

        {
            for ( TreeNode child : children )
            {
                if ( child instanceof AttributeTypeWrapper )
                {
                    AttributeTypeImpl at = ( ( AttributeTypeWrapper ) child ).getAttributeType();

                    if ( schemaChecker.hasErrors( at ) )
                    {
                        return true;
                    }
View Full Code Here

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

                String[] o1Names = null;
                String[] o2Names = null;

                if ( ( o1 instanceof AttributeTypeImpl ) && ( o2 instanceof AttributeTypeImpl ) )
                {
                    AttributeTypeImpl at1 = ( AttributeTypeImpl ) o1;
                    AttributeTypeImpl at2 = ( AttributeTypeImpl ) o2;

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

                    o1Names = oc1.getNamesRef();
                    o2Names = oc2.getNamesRef();
                }
                else if ( ( o1 instanceof AttributeTypeImpl ) && ( o2 instanceof ObjectClassImpl ) )
                {
                    AttributeTypeImpl at = ( AttributeTypeImpl ) o1;
                    ObjectClassImpl oc = ( ObjectClassImpl ) o2;

                    o1Names = at.getNamesRef();
                    o2Names = oc.getNamesRef();
                }
                else if ( ( o1 instanceof ObjectClassImpl ) && ( o2 instanceof AttributeTypeImpl ) )
                {
                    ObjectClassImpl oc = ( ObjectClassImpl ) o1;
                    AttributeTypeImpl at = ( AttributeTypeImpl ) o2;

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

                // Comparing the First Name
                if ( ( o1Names != null ) && ( o2Names != null ) )
                {
                    if ( ( o1Names.length > 0 ) && ( o2Names.length > 0 ) )
                    {
                        return o1Names[0].compareToIgnoreCase( o2Names[0] );
                    }
                    else if ( ( o1Names.length == 0 ) && ( o2Names.length > 0 ) )
                    {
                        return "".compareToIgnoreCase( o2Names[0] ); //$NON-NLS-1$
                    }
                    else if ( ( o1Names.length > 0 ) && ( o2Names.length == 0 ) )
                    {
                        return o1Names[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 AttributeTypeImpl ) && ( o2 instanceof AttributeTypeImpl ) )
                {
                    AttributeTypeImpl at1 = ( AttributeTypeImpl ) o1;
                    AttributeTypeImpl at2 = ( AttributeTypeImpl ) o2;

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

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

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

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

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

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

        Schema schema = new SchemaImpl( schemaName );

        List<?> ats = parser.getAttributeTypes();
        for ( int i = 0; i < ats.size(); i++ )
        {
            AttributeTypeImpl at = convertAttributeType( ( AttributeTypeLiteral ) ats.get( i ) );
            at.setSchema( schemaName );
            at.setSchemaObject( schema );
            schema.addAttributeType( at );
        }

        List<?> ocs = parser.getObjectClassTypes();
        for ( int i = 0; i < ocs.size(); i++ )
View Full Code Here

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

     * @return
     *      the corresponding AttributeTypeImpl
     */
    private static final AttributeTypeImpl convertAttributeType( AttributeTypeLiteral at )
    {
        AttributeTypeImpl newAT = new AttributeTypeImpl( at.getOid() );
        newAT.setNames( at.getNames() );
        newAT.setDescription( at.getDescription() );
        newAT.setSuperiorName( at.getSuperior() );
        newAT.setUsage( at.getUsage() );
        newAT.setSyntaxOid( at.getSyntax() );
        newAT.setLength( at.getLength() );
        newAT.setObsolete( at.isObsolete() );
        newAT.setSingleValue( at.isSingleValue() );
        newAT.setCollective( at.isCollective() );
        newAT.setCanUserModify( !at.isNoUserModification() );
        newAT.setEqualityName( at.getEquality() );
        newAT.setOrderingName( at.getOrdering() );
        newAT.setSubstrName( at.getSubstr() );

        return newAT;
    }
View Full Code Here

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

            .getInt( PluginConstants.PREFS_SEARCH_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH );
        boolean schemaLabelDisplay = store.getBoolean( PluginConstants.PREFS_SEARCH_VIEW_SCHEMA_LABEL_DISPLAY );

        if ( element instanceof AttributeTypeImpl )
        {
            AttributeTypeImpl at = ( AttributeTypeImpl ) element;

            // Label
            if ( labelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_FIRST_NAME )
            {
                String[] names = at.getNamesRef();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = Messages.getString( "SearchViewLabelProvider.None" ); //$NON-NLS-1$
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_ALL_ALIASES )
            {
                String[] names = at.getNamesRef();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = ViewUtils.concateAliases( names );
                }
                else
                {
                    label = Messages.getString( "SearchViewLabelProvider.None" ); //$NON-NLS-1$
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_OID )
            {
                label = at.getOid();
            }
            else
            // Default
            {
                String[] names = at.getNamesRef();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = Messages.getString( "SearchViewLabelProvider.None" ); //$NON-NLS-1$
                }
            }

            // Abbreviate
            if ( abbreviate && ( abbreviateMaxLength < label.length() ) )
            {
                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.getNamesRef();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = Messages.getString( "SearchViewLabelProvider.None" ); //$NON-NLS-1$
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_ALL_ALIASES )
            {
                String[] names = oc.getNamesRef();
                if ( ( names != null ) && ( names.length > 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
            {
                String[] names = oc.getNamesRef();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[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 AttributeTypeImpl )
            {
                AttributeTypeImpl at = ( AttributeTypeImpl ) element;

                if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_FIRST_NAME )
                {
                    String[] names = at.getNamesRef();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = names[0];
                    }
                    else
                    {
                        secondaryLabel = Messages.getString( "SearchViewLabelProvider.None" ); //$NON-NLS-1$
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_ALL_ALIASES )
                {
                    String[] names = at.getNamesRef();
                    if ( ( names != null ) && ( names.length > 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 ObjectClassImpl )
            {
                ObjectClassImpl oc = ( ObjectClassImpl ) element;
View Full Code Here

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

        String superiorName = at.getSuperiorName();
        if ( superiorName != null )
        // The attribute type has a superior
        {
            AttributeTypeImpl superior = schemaHandler.getAttributeType( superiorName );
            if ( superior != null )
            // The superior attribute type object exists
            {
                parentsMap.put( at, superior );
                childrenMap.put( superior, at );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.