Examples of ObjectClassImpl


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

                        }
                    }
                }
                else if ( child instanceof ObjectClassWrapper )
                {
                    ObjectClassImpl oc = ( ( ObjectClassWrapper ) child ).getObjectClass();

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

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

     * @see org.eclipse.jface.wizard.Wizard#performFinish()
     */
    public boolean performFinish()
    {
        // Creating the new object class
        ObjectClassImpl newOC = new ObjectClassImpl( generalPage.getOidValue() );
        newOC.setSchema( generalPage.getSchemaValue() );
        newOC.setSchemaObject( Activator.getDefault().getSchemaHandler().getSchema( generalPage.getSchemaValue() ) );
        newOC.setNames( generalPage.getAliasesValue() );
        newOC.setDescription( generalPage.getDescriptionValue() );
        newOC.setSuperClassesNames( contentPage.getSuperiorsNameValue() );
        newOC.setType( contentPage.getClassTypeValue() );
        newOC.setObsolete( contentPage.getObsoleteValue() );
        newOC.setMustNamesList( mandatoryAttributesPage.getMandatoryAttributeTypesNames() );
        newOC.setMayNamesList( optionalAttributesPage.getOptionalAttributeTypesNames() );

        // Adding the new object class
        Activator.getDefault().getSchemaHandler().addObjectClass( newOC );

        // Saving the Dialog Settings OID History
        PluginUtils.saveDialogSettingsHistory( PluginConstants.DIALOG_SETTINGS_OID_HISTORY, newOC.getOid() );

        return true;
    }
View Full Code Here

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

                        }
                    }
                }
                else if ( child instanceof ObjectClassWrapper )
                {
                    ObjectClassImpl oc = ( ( ObjectClassWrapper ) child ).getObjectClass();

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

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

                    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.ObjectClassImpl

        }

        List<?> ocs = parser.getObjectClassTypes();
        for ( int i = 0; i < ocs.size(); i++ )
        {
            ObjectClassImpl oc = convertObjectClass( ( ObjectClassLiteral ) ocs.get( i ) );
            oc.setSchema( schemaName );
            oc.setSchemaObject( schema );
            schema.addObjectClass( oc );
        }

        return schema;
    }
View Full Code Here

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

     * @return
     *      the corresponding ObjectClassImpl
     */
    private static final ObjectClassImpl convertObjectClass( ObjectClassLiteral oc )
    {
        ObjectClassImpl newOC = new ObjectClassImpl( oc.getOid() );
        newOC.setNames( oc.getNames() );
        newOC.setDescription( oc.getDescription() );
        newOC.setSuperClassesNames( oc.getSuperiors() );
        newOC.setType( oc.getClassType() );
        newOC.setObsolete( oc.isObsolete() );
        newOC.setMustNamesList( oc.getMust() );
        newOC.setMayNamesList( oc.getMay() );

        return newOC;
    }
View Full Code Here

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

                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;

                if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_FIRST_NAME )
                {
                    String[] names = oc.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 = oc.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 = oc.getOid();
                }
            }

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

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

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

                    String[] names = oc.getNamesRef();
                    if ( ( names != null ) && ( names.length > 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

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

        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

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

        {
            for ( String superClassName : superClassesNames )
            {
                if ( !"".equals( superClassName ) ) //$NON-NLS-1$
                {
                    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
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.