Examples of IEntry


Examples of org.apache.directory.studio.ldapbrowser.core.model.IEntry

        for ( int i = 0; i < oldEntries.length; i++ )
        {
            dummyMonitor.reset();

            IEntry oldEntry = oldEntries[i];
            LdapDN oldDn = oldEntry.getDn();
            LdapDN newDn = DnUtils.composeDn( oldDn.getRdn(), parentDn );

            // try to move entry
            RenameEntryJob.renameEntry( browserConnection, oldEntry, newDn, dummyMonitor );

            // do a simulated rename, if renaming of a non-leaf entry is not supported.
            if ( dummyMonitor.errorsReported() )
            {
                if ( dialog != null && dummyMonitor.getException() instanceof ContextNotEmptyException )
                {
                    // open dialog
                    if ( numAdd == 0 )
                    {
                        dialog.setEntryInfo( browserConnection, oldDn, newDn );
                        dialog.open();
                        isSimulatedRename = dialog.isSimulateRename();
                    }

                    if ( isSimulatedRename )
                    {
                        // do simulated rename operation
                        dummyMonitor.reset();

                        numAdd = CopyEntriesJob.copyEntry( oldEntry, newParent, null, SearchControls.SUBTREE_SCOPE,
                            numAdd, null, dummyMonitor, monitor );

                        if ( !dummyMonitor.errorsReported() )
                        {
                            dummyMonitor.reset();
                            numDel = DeleteEntriesJob.optimisticDeleteEntryRecursive( browserConnection, oldDn,
                                oldEntry.isReferral(), false, numDel, dummyMonitor, monitor );
                        }
                    }
                    else
                    {
                        // no simulated rename operation
                        // report the exception to the real monitor
                        Exception exception = dummyMonitor.getException();
                        monitor.reportError( exception );
                    }
                }
                else
                {
                    // we have another exception
                    // report it to the real monitor
                    Exception exception = dummyMonitor.getException();
                    monitor.reportError( exception );
                }
            }

            // update model
            if ( !dummyMonitor.errorsReported() )
            {
                // uncache old entry
                browserConnection.uncacheEntryRecursive( oldEntry );

                // remove old entry from old parent
                oldEntry.getParententry().deleteChild( oldEntry );

                // add new entry to new parent
                boolean hasMoreChildren = newParent.hasMoreChildren() || !newParent.isChildrenInitialized();
                List<StudioControl> controls = new ArrayList<StudioControl>();
                if ( oldEntry.isReferral() )
                {
                    controls.add( StudioControl.MANAGEDSAIT_CONTROL );
                }
                IEntry newEntry = ReadEntryRunnable.getEntry( browserConnection, newDn, controls, monitor );
                newEntries[i] = newEntry;
                newParent.addChild( newEntry );
                newParent.setHasMoreChildren( hasMoreChildren );

                // reset searches, if the moved entry is a result of a search
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IEntry

                            importedCount++;
                            logModification( browserConnection, logWriter, record, monitor );

                            // update cache and adjust attribute/children initialization flags
                            LdapDN dn = new LdapDN( record.getDnLine().getValueAsString() );
                            IEntry entry = browserConnection.getEntryFromCache( dn );
                            LdapDN parentDn = DnUtils.getParent( dn );
                            IEntry parentEntry = null;
                            while ( parentEntry == null && parentDn != null )
                            {
                                parentEntry = browserConnection.getEntryFromCache( parentDn );
                                parentDn = DnUtils.getParent( parentDn );
                            }

                            if ( record instanceof LdifChangeDeleteRecord )
                            {
                                if ( entry != null )
                                {
                                    entry.setAttributesInitialized( false );
                                    browserConnection.uncacheEntryRecursive( entry );
                                }
                                if ( parentEntry != null )
                                {
                                    parentEntry.setChildrenInitialized( false );
                                }
                            }
                            else if ( record instanceof LdifChangeModDnRecord )
                            {
                                if ( entry != null )
                                {
                                    entry.setAttributesInitialized( false );
                                    browserConnection.uncacheEntryRecursive( entry );
                                }
                                if ( parentEntry != null )
                                {
                                    parentEntry.setChildrenInitialized( false );
                                }
                                LdifChangeModDnRecord modDnRecord = ( LdifChangeModDnRecord ) record;
                                if ( modDnRecord.getNewsuperiorLine() != null )
                                {
                                    LdapDN newSuperiorDn = new LdapDN( modDnRecord.getNewsuperiorLine()
                                        .getValueAsString() );
                                    IEntry newSuperiorEntry = browserConnection.getEntryFromCache( newSuperiorDn );
                                    if ( newSuperiorEntry != null )
                                    {
                                        newSuperiorEntry.setChildrenInitialized( false );
                                    }
                                }
                            }
                            else if ( record instanceof LdifChangeAddRecord || record instanceof LdifContentRecord )
                            {
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IEntry

        String dn = record.getDnLine().getValueAsString();

        if ( record instanceof LdifContentRecord || record instanceof LdifChangeAddRecord )
        {
            LdifAttrValLine[] attrVals;
            IEntry dummyEntry;
            if ( record instanceof LdifContentRecord )
            {
                LdifContentRecord attrValRecord = ( LdifContentRecord ) record;
                attrVals = attrValRecord.getAttrVals();
                try
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IEntry

            String dn = ""; //$NON-NLS-1$
            boolean enabled = true;

            if ( newInput != null && newInput instanceof IEntry )
            {
                IEntry entry = ( IEntry ) newInput;
                dn = Messages.getString( "EntryEditorWidgetContentProvider.DNLabel" ) + entry.getDn().getUpName(); //$NON-NLS-1$
            }
            else if ( newInput != null && newInput instanceof AttributeHierarchy )
            {
                AttributeHierarchy ah = ( AttributeHierarchy ) newInput;
                dn = Messages.getString( "EntryEditorWidgetContentProvider.DNLabel" ) + ah.getAttribute().getEntry().getDn().getUpName(); //$NON-NLS-1$
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IEntry

        boolean showOperationalAttributes = BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES );

        if ( inputElement != null && inputElement instanceof IEntry )
        {
            IEntry entry = ( IEntry ) inputElement;

            if ( !entry.isAttributesInitialized() )
            {
                InitializeAttributesRunnable runnable = new InitializeAttributesRunnable( entry );
                StudioBrowserJob job = new StudioBrowserJob( runnable );
                job.execute();
                return new Object[0];
            }
            else
            {
                IAttribute[] attributes = entry.getAttributes();
                Object[] values = getValues( attributes, showOperationalAttributes );
                return values;
            }
        }
        else if ( inputElement != null && inputElement instanceof AttributeHierarchy )
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IEntry

        {
            // uncache old entry
            browserConnection.uncacheEntryRecursive( oldEntry );

            // remove old entry and add new entry to parent
            IEntry parent = oldEntry.getParententry();
            boolean hasMoreChildren = parent.hasMoreChildren();
            parent.deleteChild( oldEntry );

            List<StudioControl> controls = new ArrayList<StudioControl>();
            if ( oldEntry.isReferral() )
            {
                controls.add( StudioControl.MANAGEDSAIT_CONTROL );
            }

            // Here we try to read the renamed entry to be able to send the right event notification.
            // In some cases this don't work:
            // - if there was a referral and the entry was created on another (master) server and not yet sync'ed to the current server
            // So we use a dummy monitor to no bother the user with an error message.
            dummyMonitor.reset();
            newEntry = ReadEntryRunnable.getEntry( browserConnection, newDn, controls, dummyMonitor );
            dummyMonitor.done();
            if ( newEntry != null )
            {
                parent.addChild( newEntry );
            }
            parent.setHasMoreChildren( hasMoreChildren );

            // reset searches, if the renamed entry is a result of a search
            List<ISearch> searches = browserConnection.getSearchManager().getSearches();
            for ( ISearch search : searches )
            {
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IEntry

     */
    public int category( Object element )
    {
        if ( element instanceof IEntry )
        {
            IEntry entry = ( IEntry ) element;
            if ( ( entry instanceof DirectoryMetadataEntry || entry instanceof RootDSE || entry.isAlias() || entry
                .isReferral() )
                && preferences.isMetaEntriesLast() )
            {
                return 3;
            }
            else if ( entry.isSubentry() )
            {
                return 0;
            }
            else if ( !entry.hasChildren() && preferences.isLeafEntriesFirst() )
            {
                return 1;
            }
            else if ( entry.hasChildren() && preferences.isContainerEntriesFirst() )
            {
                return 1;
            }
            else
            {
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IEntry

                        return greaterThan();
                    }
                }
                else if ( lockedObject instanceof IEntry )
                {
                    IEntry entry = ( IEntry ) lockedObject;
                    if ( o1 == entry.getTopPageChildrenRunnable() )
                    {
                        return lessThan();
                    }
                    else if ( o1 == entry.getNextPageChildrenRunnable() )
                    {
                        return greaterThan();
                    }
                }
            }
            return lessThan();
        }
        if ( o2 instanceof StudioRunnableWithProgress )
        {
            StudioRunnableWithProgress runnable = ( StudioRunnableWithProgress ) o2;
            for ( Object lockedObject : runnable.getLockedObjects() )
            {
                if ( lockedObject instanceof ISearch )
                {
                    ISearch search = ( ISearch ) lockedObject;
                    if ( o2 == search.getTopSearchRunnable() )
                    {
                        return greaterThan();
                    }
                    else if ( o2 == search.getNextSearchRunnable() )
                    {
                        return lessThan();
                    }
                }
                else if ( lockedObject instanceof IEntry )
                {
                    IEntry entry = ( IEntry ) lockedObject;
                    if ( o2 == entry.getTopPageChildrenRunnable() )
                    {
                        return greaterThan();
                    }
                    else if ( o2 == entry.getNextPageChildrenRunnable() )
                    {
                        return lessThan();
                    }
                }
            }
            return greaterThan();
        }

        if ( o1 == null && o2 == null )
        {
            return equal();
        }
        else if ( o1 == null && o2 != null )
        {
            return lessThan();
        }
        else if ( o1 != null && o2 == null )
        {
            return greaterThan();
        }
        else if ( o1 instanceof IEntry || o2 instanceof IEntry )
        {
            if ( !( o1 instanceof IEntry ) && !( o2 instanceof IEntry ) )
            {
                return equal();
            }
            else if ( !( o1 instanceof IEntry ) && ( o2 instanceof IEntry ) )
            {
                return lessThan();
            }
            else if ( ( o1 instanceof IEntry ) && !( o2 instanceof IEntry ) )
            {
                return greaterThan();
            }
            else
            {
                IEntry entry1 = ( IEntry ) o1;
                IEntry entry2 = ( IEntry ) o2;

                int cat1 = category( entry1 );
                int cat2 = category( entry2 );
                if ( cat1 != cat2 )
                {
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IEntry

                        LdapURL searchContinuationUrl = sr.getSearchContinuationUrl();

                        if ( searchContinuationUrl == null )
                        {
                            LdapDN dn = JNDIUtils.getDn( sr );
                            IEntry entry = null;

                            Connection resultConnection = sr.getConnection();
                            IBrowserConnection resultBrowserConnection = BrowserCorePlugin.getDefault()
                                .getConnectionManager().getBrowserConnection( resultConnection );
                            if ( resultBrowserConnection == null )
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.IEntry

     */
    private static IEntry createAndCacheEntry( IBrowserConnection browserConnection, LdapDN dn,
        StudioProgressMonitor monitor )
    {
        StudioProgressMonitor dummyMonitor = new StudioProgressMonitor( monitor );
        IEntry entry = null;

        // build tree to parent
        LinkedList<LdapDN> parentDnList = new LinkedList<LdapDN>();
        LdapDN parentDN = dn;
        while ( parentDN != null && browserConnection.getEntryFromCache( parentDN ) == null )
        {
            parentDnList.addFirst( parentDN );
            parentDN = DnUtils.getParent( parentDN );
        }

        for ( LdapDN aDN : parentDnList )
        {
            parentDN = DnUtils.getParent( aDN );
            if ( parentDN == null )
            {
                // only the root DSE has a null parent
                entry = browserConnection.getRootDSE();
            }
            else if ( !parentDN.isEmpty() && browserConnection.getEntryFromCache( parentDN ) != null )
            {
                // a normal entry has a parent but the parent isn't the rootDSE
                IEntry parentEntry = browserConnection.getEntryFromCache( parentDN );
                entry = new Entry( parentEntry, aDN.getRdn() );
                entry.setDirectoryEntry( true );
                parentEntry.addChild( entry );
                parentEntry.setChildrenInitialized( true );
                parentEntry.setHasMoreChildren( true );
                parentEntry.setHasChildrenHint( true );
                browserConnection.cacheEntry( entry );
            }
            else
            {
                // we have a base DN, check if the entry really exists in LDAP
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.