Author: seelmann Date: Thu Oct 8 14:25:26 2009 New Revision: 823186 URL: http://svn.apache.org/viewvc?rev=823186&view=rev Log: Fix for DIRSTUDIO-558 (Load special entries (aliases, referrals, subentries) per request, add menu items to browser's context menu) Added: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchAliasesAction.java directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchReferralsAction.java directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchSubentriesAction.java Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchOperationalAttributesAction.java directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages.properties directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_de.properties directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_fr.properties directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenRunnable.java directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IEntry.java directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ISearch.java directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/messages.properties directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/messages_de.properties directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/messages_fr.properties Added: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchAliasesAction.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchAliasesAction.java?rev=823186&view=auto ============================================================================== --- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchAliasesAction.java (added) +++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchAliasesAction.java Thu Oct 8 14:25:26 2009 @@ -0,0 +1,138 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.directory.studio.ldapbrowser.common.actions; + + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod; +import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeChildrenRunnable; +import org.apache.directory.studio.ldapbrowser.core.jobs.StudioBrowserJob; +import org.apache.directory.studio.ldapbrowser.core.model.IEntry; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.resource.ImageDescriptor; + + +/** + * This Action toggles weather to fetch aliases for an entry or not. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ +public class FetchAliasesAction extends BrowserAction +{ + /** + * Creates a new instance of FetchAliasesAction. + */ + public FetchAliasesAction() + { + } + + + @Override + public int getStyle() + { + return Action.AS_CHECK_BOX; + } + + + @Override + public String getText() + { + return Messages.getString( "FetchOperationalAttributesAction.FetchAliases" ); //$NON-NLS-1$ + } + + + @Override + public ImageDescriptor getImageDescriptor() + { + return null; + } + + + @Override + public String getCommandId() + { + return null; + } + + + @Override + public boolean isEnabled() + { + List entries = getEntries(); + return !entries.isEmpty() + && entries.iterator().next().getBrowserConnection().getAliasesDereferencingMethod() != AliasDereferencingMethod.NEVER; + } + + + @Override + public boolean isChecked() + { + boolean checked = true; + List entries = getEntries(); + if ( entries.isEmpty() ) + { + checked = false; + } + else + { + for ( IEntry entry : entries ) + { + if ( !entry.isFetchAliases() ) + { + checked = false; + } + } + } + return checked; + } + + + @Override + public void run() + { + IEntry[] entries = getEntries().toArray( new IEntry[0] ); + boolean init = !isChecked(); + for ( IEntry entry : entries ) + { + entry.setFetchAliases( init ); + } + new StudioBrowserJob( new InitializeChildrenRunnable( true, entries ) ).execute(); + } + + + /** + * Gets the Entries + * + * @return + * the entries + */ + protected List getEntries() + { + List entriesList = new ArrayList(); + entriesList.addAll( Arrays.asList( getSelectedEntries() ) ); + return entriesList; + } + +} Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchOperationalAttributesAction.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchOperationalAttributesAction.java?rev=823186&r1=823185&r2=823186&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchOperationalAttributesAction.java (original) +++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchOperationalAttributesAction.java Thu Oct 8 14:25:26 2009 @@ -35,7 +35,7 @@ /** - * This Action toggles weather to fetch operational attributes for an entry or no. + * This Action toggles weather to fetch operational attributes for an entry or not. * * @author Apache Directory Project * @version $Rev$, $Date$ @@ -43,7 +43,7 @@ public class FetchOperationalAttributesAction extends BrowserAction { /** - * Creates a new instance of ShowRawValuesAction. + * Creates a new instance of FetchOperationalAttributesAction. */ public FetchOperationalAttributesAction() { Added: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchReferralsAction.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchReferralsAction.java?rev=823186&view=auto ============================================================================== --- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchReferralsAction.java (added) +++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchReferralsAction.java Thu Oct 8 14:25:26 2009 @@ -0,0 +1,138 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.directory.studio.ldapbrowser.common.actions; + + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod; +import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeChildrenRunnable; +import org.apache.directory.studio.ldapbrowser.core.jobs.StudioBrowserJob; +import org.apache.directory.studio.ldapbrowser.core.model.IEntry; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.resource.ImageDescriptor; + + +/** + * This Action toggles weather to fetch referrals for an entry or not. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ +public class FetchReferralsAction extends BrowserAction +{ + /** + * Creates a new instance of FetchReferralsAction. + */ + public FetchReferralsAction() + { + } + + + @Override + public int getStyle() + { + return Action.AS_CHECK_BOX; + } + + + @Override + public String getText() + { + return Messages.getString( "FetchOperationalAttributesAction.FetchReferrals" ); //$NON-NLS-1$ + } + + + @Override + public ImageDescriptor getImageDescriptor() + { + return null; + } + + + @Override + public String getCommandId() + { + return null; + } + + + @Override + public boolean isEnabled() + { + List entries = getEntries(); + return !entries.isEmpty() + && entries.iterator().next().getBrowserConnection().getReferralsHandlingMethod() != ReferralHandlingMethod.MANAGE; + } + + + @Override + public boolean isChecked() + { + boolean checked = true; + List entries = getEntries(); + if ( entries.isEmpty() ) + { + checked = false; + } + else + { + for ( IEntry entry : entries ) + { + if ( !entry.isFetchReferrals() ) + { + checked = false; + } + } + } + return checked; + } + + + @Override + public void run() + { + IEntry[] entries = getEntries().toArray( new IEntry[0] ); + boolean init = !isChecked(); + for ( IEntry entry : entries ) + { + entry.setFetchReferrals( init ); + } + new StudioBrowserJob( new InitializeChildrenRunnable( true, entries ) ).execute(); + } + + + /** + * Gets the Entries + * + * @return + * the entries + */ + protected List getEntries() + { + List entriesList = new ArrayList(); + entriesList.addAll( Arrays.asList( getSelectedEntries() ) ); + return entriesList; + } + +} Added: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchSubentriesAction.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchSubentriesAction.java?rev=823186&view=auto ============================================================================== --- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchSubentriesAction.java (added) +++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FetchSubentriesAction.java Thu Oct 8 14:25:26 2009 @@ -0,0 +1,136 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.directory.studio.ldapbrowser.common.actions; + + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeChildrenRunnable; +import org.apache.directory.studio.ldapbrowser.core.jobs.StudioBrowserJob; +import org.apache.directory.studio.ldapbrowser.core.model.IEntry; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.resource.ImageDescriptor; + + +/** + * This Action toggles weather to fetch subentries for an entry or not. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ +public class FetchSubentriesAction extends BrowserAction +{ + /** + * Creates a new instance of FetchSubentriesAction. + */ + public FetchSubentriesAction() + { + } + + + @Override + public int getStyle() + { + return Action.AS_CHECK_BOX; + } + + + @Override + public String getText() + { + return Messages.getString( "FetchOperationalAttributesAction.FetchSubentries" ); //$NON-NLS-1$ + } + + + @Override + public ImageDescriptor getImageDescriptor() + { + return null; + } + + + @Override + public String getCommandId() + { + return null; + } + + + @Override + public boolean isEnabled() + { + List entries = getEntries(); + return !entries.isEmpty() && !entries.iterator().next().getBrowserConnection().isFetchSubentries(); + } + + + @Override + public boolean isChecked() + { + boolean checked = true; + List entries = getEntries(); + if ( entries.isEmpty() ) + { + checked = false; + } + else + { + for ( IEntry entry : entries ) + { + if ( !entry.isFetchSubentries() ) + { + checked = false; + } + } + } + return checked; + } + + + @Override + public void run() + { + IEntry[] entries = getEntries().toArray( new IEntry[0] ); + boolean init = !isChecked(); + for ( IEntry entry : entries ) + { + entry.setFetchSubentries( init ); + } + new StudioBrowserJob( new InitializeChildrenRunnable( true, entries ) ).execute(); + } + + + /** + * Gets the Entries + * + * @return + * the entries + */ + protected List getEntries() + { + List entriesList = new ArrayList(); + entriesList.addAll( Arrays.asList( getSelectedEntries() ) ); + return entriesList; + } + +} Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages.properties?rev=823186&r1=823185&r2=823186&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages.properties (original) +++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages.properties Thu Oct 8 14:25:26 2009 @@ -93,3 +93,6 @@ UpAction.Up=Up ValueEditorPreferencesAction.Preferences=Preferences... FetchOperationalAttributesAction.FetchOperationalAttributes=Fetch Operational Attributes +FetchOperationalAttributesAction.FetchAliases=Fetch Aliases +FetchOperationalAttributesAction.FetchReferrals=Fetch Referrals +FetchOperationalAttributesAction.FetchSubentries=Fetch Subentries Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_de.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_de.properties?rev=823186&r1=823185&r2=823186&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_de.properties (original) +++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_de.properties Thu Oct 8 14:25:26 2009 @@ -93,3 +93,6 @@ UpAction.Up=Hoch ValueEditorPreferencesAction.Preferences=Benutzervorgaben... FetchOperationalAttributesAction.FetchOperationalAttributes=Operationale Attribute abrufen +FetchOperationalAttributesAction.FetchAliases=Aliase abrufen +FetchOperationalAttributesAction.FetchReferrals=Referrals abrufen +FetchOperationalAttributesAction.FetchSubentries=Sub-Eintr\u00E4ge abrufen Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_fr.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_fr.properties?rev=823186&r1=823185&r2=823186&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_fr.properties (original) +++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_fr.properties Thu Oct 8 14:25:26 2009 @@ -93,3 +93,6 @@ UpAction.Up=Remonter ValueEditorPreferencesAction.Preferences=Pr\u00E9f\u00E9rences... FetchOperationalAttributesAction.FetchOperationalAttributes=R\u00E9cup\u00E9rer les attributs op\u00E9rationnels +FetchOperationalAttributesAction.FetchAliases=TODO: Fetch Aliases +FetchOperationalAttributesAction.FetchReferrals=TODO: Fetch Referrals +FetchOperationalAttributesAction.FetchSubentries=TODO: Fetch Subentries \ No newline at end of file Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenRunnable.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenRunnable.java?rev=823186&r1=823185&r2=823186&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenRunnable.java (original) +++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenRunnable.java Thu Oct 8 14:25:26 2009 @@ -195,8 +195,7 @@ * @param monitor the progress monitor * @param pagedSearchControl the paged search control */ - private void initializeChildren( IEntry parent, StudioProgressMonitor monitor, - StudioControl pagedSearchControl ) + private void initializeChildren( IEntry parent, StudioProgressMonitor monitor, StudioControl pagedSearchControl ) { monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__init_entries_progress_sub, new String[] @@ -206,7 +205,7 @@ clearCaches( parent, purgeAllCaches ); // create search - ISearch search = createSearch( parent, pagedSearchControl, false ); + ISearch search = createSearch( parent, pagedSearchControl, false, false, false ); // search ISearchResult[] srs = executeSearch( parent, search, monitor ); @@ -299,30 +298,43 @@ } // get sub-entries - ISearch subSearch = createSearch( parent, null, true ); - if ( parent.getBrowserConnection().isFetchSubentries() ) + ISearch subSearch = createSearch( parent, null, true, false, false ); + if ( parent.getBrowserConnection().isFetchSubentries() || parent.isFetchSubentries() ) { - ISearchResult[] subSrs = executeSearch( parent, subSearch, monitor ); + executeSubSearch( parent, subSearch, monitor ); + } - // fill children in search result - if ( subSrs != null && subSrs.length > 0 ) - { - for ( ISearchResult searchResult : subSrs ) - { - parent.addChild( searchResult.getEntry() ); - } - } + // get aliases and referrals + ISearch aliasOrReferralSearch = createSearch( parent, null, false, parent.isFetchAliases(), parent.isFetchReferrals() ); + if ( parent.isFetchAliases() || parent.isFetchReferrals() ) + { + executeSubSearch( parent, aliasOrReferralSearch, monitor ); } // check exceeded limits / canceled parent.setHasMoreChildren( search.isCountLimitExceeded() || subSearch.isCountLimitExceeded() - || monitor.isCanceled() ); + || aliasOrReferralSearch.isCountLimitExceeded() || monitor.isCanceled() ); // set initialized state parent.setChildrenInitialized( true ); } + private void executeSubSearch( IEntry parent, ISearch subSearch, StudioProgressMonitor monitor ) + { + ISearchResult[] subSrs = executeSearch( parent, subSearch, monitor ); + + // fill children in search result + if ( subSrs != null && subSrs.length > 0 ) + { + for ( ISearchResult searchResult : subSrs ) + { + parent.addChild( searchResult.getEntry() ); + } + } + } + + private static ISearchResult[] executeSearch( IEntry parent, ISearch search, StudioProgressMonitor monitor ) { SearchRunnable.searchAndUpdateModel( parent.getBrowserConnection(), search, monitor ); @@ -334,45 +346,60 @@ } - private static ISearch createSearch( IEntry parent, StudioControl pagedSearchControl, boolean isSubSearch ) + private static ISearch createSearch( IEntry parent, StudioControl pagedSearchControl, boolean isSubSearch, + boolean isAliasSearch, boolean isReferralsSearch ) { // determine alias and referral handling SearchScope scope = SearchScope.ONELEVEL; AliasDereferencingMethod aliasesDereferencingMethod = parent.getBrowserConnection() .getAliasesDereferencingMethod(); - if ( parent.isAlias() ) + if ( parent.isAlias() || isAliasSearch ) { aliasesDereferencingMethod = AliasDereferencingMethod.NEVER; } ReferralHandlingMethod referralsHandlingMethod = parent.getBrowserConnection().getReferralsHandlingMethod(); - if ( parent.isReferral() ) + if ( parent.isReferral() || isReferralsSearch ) { referralsHandlingMethod = ReferralHandlingMethod.MANAGE; } - if ( !isSubSearch ) + if ( isSubSearch ) { - ISearch search = new Search( null, parent.getBrowserConnection(), parent.getDn(), parent - .getChildrenFilter(), ISearch.NO_ATTRIBUTES, scope, parent.getBrowserConnection().getCountLimit(), - parent.getBrowserConnection().getTimeLimit(), aliasesDereferencingMethod, referralsHandlingMethod, + ISearch subSearch = new Search( null, parent.getBrowserConnection(), parent.getDn(), parent + .getChildrenFilter() != null ? parent.getChildrenFilter() : ISearch.FILTER_SUBENTRY, + ISearch.NO_ATTRIBUTES, scope, parent.getBrowserConnection().getCountLimit(), parent + .getBrowserConnection().getTimeLimit(), aliasesDereferencingMethod, referralsHandlingMethod, BrowserCorePlugin.getDefault().getPluginPreferences().getBoolean( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN ), null ); - if ( pagedSearchControl != null ) - { - search.getSearchParameter().getControls().add( pagedSearchControl ); - } - return search; + subSearch.getSearchParameter().getControls().add( StudioControl.SUBENTRIES_CONTROL ); + return subSearch; } else { - ISearch subSearch = new Search( null, parent.getBrowserConnection(), parent.getDn(), parent - .getChildrenFilter() != null ? parent.getChildrenFilter() : ISearch.FILTER_SUBENTRY, + String filter = parent.getChildrenFilter(); + if ( isAliasSearch && isReferralsSearch ) + { + filter = ISearch.FILTER_ALIAS_OR_REFERRAL; + } + else if ( isAliasSearch ) + { + filter = ISearch.FILTER_ALIAS; + } + else if ( isReferralsSearch ) + { + filter = ISearch.FILTER_REFERRAL; + } + + ISearch search = new Search( null, parent.getBrowserConnection(), parent.getDn(), filter, ISearch.NO_ATTRIBUTES, scope, parent.getBrowserConnection().getCountLimit(), parent .getBrowserConnection().getTimeLimit(), aliasesDereferencingMethod, referralsHandlingMethod, BrowserCorePlugin.getDefault().getPluginPreferences().getBoolean( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN ), null ); - subSearch.getSearchParameter().getControls().add( StudioControl.SUBENTRIES_CONTROL ); - return subSearch; + if ( pagedSearchControl != null ) + { + search.getSearchParameter().getControls().add( pagedSearchControl ); + } + return search; } } Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IEntry.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IEntry.java?rev=823186&r1=823185&r2=823186&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IEntry.java (original) +++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IEntry.java Thu Oct 8 14:25:26 2009 @@ -222,6 +222,54 @@ /** + * Indicates whether this entry's alias children should be fetched. + * + * @return true if this entry's alias children should be fetched + */ + public abstract boolean isFetchAliases(); + + + /** + * Sets a flag whether this entry's alias children should be fetched. + * + * @param b the fetch aliases flag + */ + public abstract void setFetchAliases( boolean b ); + + + /** + * Indicates whether this entry's referral children should be fetched. + * + * @return true if this entry's referral children should be fetched + */ + public abstract boolean isFetchReferrals(); + + + /** + * Sets a flag whether this entry's referral children should be fetched. + * + * @param b the fetch referral flag + */ + public abstract void setFetchReferrals( boolean b ); + + + /** + * Indicates whether this entry's sub-entries should be fetched. + * + * @return true if this entry's sub-entries should be fetched + */ + public abstract boolean isFetchSubentries(); + + + /** + * Sets a flag whether this entry's sub-entries should be fetched. + * + * @param b the fetch sub-entries flag + */ + public abstract void setFetchSubentries( boolean b ); + + + /** * Gets the attributes of the entry. * * If isAttributesInitialized() returns false the returned attributes Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ISearch.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ISearch.java?rev=823186&r1=823185&r2=823186&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ISearch.java (original) +++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ISearch.java Thu Oct 8 14:25:26 2009 @@ -58,6 +58,15 @@ /** Filter for fetching subentries (|(objectClass=subentry)(objectClass=ldapSubentry)) */ public static final String FILTER_SUBENTRY = "(|(objectClass=subentry)(objectClass=ldapSubentry))"; //$NON-NLS-1$ + /** Filter for fetching aliases (objectClass=alias) */ + public static final String FILTER_ALIAS = "(objectClass=alias)"; //$NON-NLS-1$ + + /** Filter for fetching referrals (objectClass=referral) */ + public static final String FILTER_REFERRAL = "(objectClass=referral)"; //$NON-NLS-1$ + + /** Filter for fetching aliases and referrals (|(objectClass=alias)(objectClass=referral)) */ + public static final String FILTER_ALIAS_OR_REFERRAL = "(|(objectClass=alias)(objectClass=referral))"; //$NON-NLS-1$ + /** * Enum for the used search scope. * Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java?rev=823186&r1=823185&r2=823186&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java (original) +++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java Thu Oct 8 14:25:26 2009 @@ -69,17 +69,23 @@ private static final long serialVersionUID = -2431637532526418774L; - private static final int HAS_CHILDREN_HINT_FLAG = 1; + private static final int HAS_CHILDREN_HINT_FLAG = 1 << 0; - private static final int IS_DIRECTORY_ENTRY_FLAG = 2; + private static final int IS_DIRECTORY_ENTRY_FLAG = 1 << 1; - private static final int IS_ALIAS_FLAG = 4; + private static final int IS_ALIAS_FLAG = 1 << 2; - private static final int IS_REFERRAL_FLAG = 8; + private static final int IS_REFERRAL_FLAG = 1 << 3; - private static final int IS_SUBENTRY_FLAG = 16; - - private static final int IS_INIT_OPERATIONAL_ATTRIBUTES_FLAG = 32; + private static final int IS_SUBENTRY_FLAG = 1 << 4; + + private static final int IS_INIT_OPERATIONAL_ATTRIBUTES_FLAG = 1 << 5; + + private static final int IS_FETCH_ALIASES_FLAG = 1 << 6; + + private static final int IS_FETCH_REFERRALS_FLAG = 1 << 7; + + private static final int IS_FETCH_SUBENTRIES_FLAG = 1 << 8; private volatile int flags; @@ -449,6 +455,81 @@ /** * {@inheritDoc} */ + public boolean isFetchAliases() + { + return ( flags & IS_FETCH_ALIASES_FLAG ) != 0; + } + + + /** + * {@inheritDoc} + */ + public void setFetchAliases( boolean b ) + { + if ( b ) + { + flags = flags | IS_FETCH_ALIASES_FLAG; + } + else + { + flags = flags & ~IS_FETCH_ALIASES_FLAG; + } + } + + + /** + * {@inheritDoc} + */ + public boolean isFetchReferrals() + { + return ( flags & IS_FETCH_REFERRALS_FLAG ) != 0; + } + + + /** + * {@inheritDoc} + */ + public void setFetchReferrals( boolean b ) + { + if ( b ) + { + flags = flags | IS_FETCH_REFERRALS_FLAG; + } + else + { + flags = flags & ~IS_FETCH_REFERRALS_FLAG; + } + } + + + /** + * {@inheritDoc} + */ + public boolean isFetchSubentries() + { + return ( flags & IS_FETCH_SUBENTRIES_FLAG ) != 0; + } + + + /** + * {@inheritDoc} + */ + public void setFetchSubentries( boolean b ) + { + if ( b ) + { + flags = flags | IS_FETCH_SUBENTRIES_FLAG; + } + else + { + flags = flags & ~IS_FETCH_SUBENTRIES_FLAG; + } + } + + + /** + * {@inheritDoc} + */ public IAttribute[] getAttributes() { Collection attributes = new HashSet(); Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java?rev=823186&r1=823185&r2=823186&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java (original) +++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java Thu Oct 8 14:25:26 2009 @@ -221,6 +221,66 @@ /** * {@inheritDoc} */ + public boolean isFetchAliases() + { + if ( getDelegate() != null ) + { + return getDelegate().isFetchAliases(); + } + else if ( entryDoesNotExist ) + { + return true; + } + else + { + return false; + } + } + + + /** + * {@inheritDoc} + */ + public boolean isFetchReferrals() + { + if ( getDelegate() != null ) + { + return getDelegate().isFetchReferrals(); + } + else if ( entryDoesNotExist ) + { + return true; + } + else + { + return false; + } + } + + + /** + * {@inheritDoc} + */ + public boolean isFetchSubentries() + { + if ( getDelegate() != null ) + { + return getDelegate().isFetchSubentries(); + } + else if ( entryDoesNotExist ) + { + return true; + } + else + { + return false; + } + } + + + /** + * {@inheritDoc} + */ public boolean isChildrenInitialized() { if ( getDelegate() != null ) @@ -564,6 +624,105 @@ /** * {@inheritDoc} */ + public void setFetchAliases( boolean b ) + { + if ( !b ) + { + if ( getDelegate() != null ) + { + getDelegate().setFetchAliases( b ); + } + setDelegate( null ); + entryDoesNotExist = false; + } + else + { + if ( getDelegate() == null ) + { + setDelegate( getBrowserConnection().getEntryFromCache( dn ) ); + if ( getDelegate() == null ) + { + // entry doesn't exist! + entryDoesNotExist = true; + } + } + if ( getDelegate() != null ) + { + getDelegate().setFetchAliases( b ); + } + } + } + + + /** + * {@inheritDoc} + */ + public void setFetchReferrals( boolean b ) + { + if ( !b ) + { + if ( getDelegate() != null ) + { + getDelegate().setFetchReferrals( b ); + } + setDelegate( null ); + entryDoesNotExist = false; + } + else + { + if ( getDelegate() == null ) + { + setDelegate( getBrowserConnection().getEntryFromCache( dn ) ); + if ( getDelegate() == null ) + { + // entry doesn't exist! + entryDoesNotExist = true; + } + } + if ( getDelegate() != null ) + { + getDelegate().setFetchReferrals( b ); + } + } + } + + + /** + * {@inheritDoc} + */ + public void setFetchSubentries( boolean b ) + { + if ( !b ) + { + if ( getDelegate() != null ) + { + getDelegate().setFetchSubentries( b ); + } + setDelegate( null ); + entryDoesNotExist = false; + } + else + { + if ( getDelegate() == null ) + { + setDelegate( getBrowserConnection().getEntryFromCache( dn ) ); + if ( getDelegate() == null ) + { + // entry doesn't exist! + entryDoesNotExist = true; + } + } + if ( getDelegate() != null ) + { + getDelegate().setFetchSubentries( b ); + } + } + } + + + /** + * {@inheritDoc} + */ public void setDirectoryEntry( boolean b ) { if ( getDelegate() != null ) Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java?rev=823186&r1=823185&r2=823186&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java (original) +++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java Thu Oct 8 14:25:26 2009 @@ -68,7 +68,7 @@ /** The browser connection. */ private IBrowserConnection browserConnection; - + /** The attribute map. */ private Map attributeMap; @@ -343,6 +343,33 @@ /** + * This implementation always returns false. + */ + public boolean isFetchAliases() + { + return false; + } + + + /** + * This implementation always returns false. + */ + public boolean isFetchReferrals() + { + return false; + } + + + /** + * This implementation always returns false. + */ + public boolean isFetchSubentries() + { + return false; + } + + + /** * {@inheritDoc} */ public boolean isReferral() @@ -398,6 +425,30 @@ /** * This implementation does nothing. */ + public void setFetchAliases( boolean b ) + { + } + + + /** + * This implementation does nothing. + */ + public void setFetchReferrals( boolean b ) + { + } + + + /** + * This implementation does nothing. + */ + public void setFetchSubentries( boolean b ) + { + } + + + /** + * This implementation does nothing. + */ public void setDirectoryEntry( boolean isDirectoryEntry ) { } @@ -490,7 +541,7 @@ ObjectClassDescription ocd = schema.getObjectClassDescription( ocName ); ocds.add( ocd ); } - } + } return ocds; } Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java?rev=823186&r1=823185&r2=823186&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java (original) +++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java Thu Oct 8 14:25:26 2009 @@ -23,7 +23,10 @@ import org.apache.directory.studio.ldapbrowser.common.actions.CopyAction; import org.apache.directory.studio.ldapbrowser.common.actions.DeleteAction; +import org.apache.directory.studio.ldapbrowser.common.actions.FetchAliasesAction; import org.apache.directory.studio.ldapbrowser.common.actions.FetchOperationalAttributesAction; +import org.apache.directory.studio.ldapbrowser.common.actions.FetchReferralsAction; +import org.apache.directory.studio.ldapbrowser.common.actions.FetchSubentriesAction; import org.apache.directory.studio.ldapbrowser.common.actions.PasteAction; import org.apache.directory.studio.ldapbrowser.common.actions.RenameAction; import org.apache.directory.studio.ldapbrowser.common.actions.proxy.BrowserActionProxy; @@ -172,6 +175,15 @@ /** The Constant fetchOperationalAttributesAction. */ private static final String fetchOperationalAttributesAction = "fetchOperationalAttributesAction"; //$NON-NLS-1$ + /** The Constant fetchAliasesAction. */ + private static final String fetchAliasesAction = "fetchAliasesAction"; //$NON-NLS-1$ + + /** The Constant fetchReferralsAction. */ + private static final String fetchReferralsAction = "fetchReferralsAction"; //$NON-NLS-1$ + + /** The Constant fetchSubentriesAction. */ + private static final String fetchSubentriesAction = "fetchSubentriesAction"; //$NON-NLS-1$ + /** The Constant openEntryEditorAction. */ private static final String openEntryEditorAction = "openEntryEditor"; //$NON-NLS-1$ @@ -251,6 +263,9 @@ browserActionMap.put( fetchOperationalAttributesAction, new BrowserViewActionProxy( viewer, new FetchOperationalAttributesAction() ) ); + browserActionMap.put( fetchAliasesAction, new BrowserViewActionProxy( viewer, new FetchAliasesAction() ) ); + browserActionMap.put( fetchReferralsAction, new BrowserViewActionProxy( viewer, new FetchReferralsAction() ) ); + browserActionMap.put( fetchSubentriesAction, new BrowserViewActionProxy( viewer, new FetchSubentriesAction() ) ); browserActionMap.put( openEntryEditorAction, new BrowserViewActionProxy( viewer, new OpenEntryEditorAction() ) ); } @@ -389,10 +404,24 @@ // refresh menuManager.add( browserActionMap.get( refreshAction ) ); + MenuManager fetchMenuManager = new MenuManager( Messages.getString( "BrowserViewActionGroup.Fetch" ) ); //$NON-NLS-1$ if ( browserActionMap.get( fetchOperationalAttributesAction ).isEnabled() ) { - menuManager.add( browserActionMap.get( fetchOperationalAttributesAction ) ); + fetchMenuManager.add( browserActionMap.get( fetchOperationalAttributesAction ) ); + } + if ( browserActionMap.get( fetchAliasesAction ).isEnabled() ) + { + fetchMenuManager.add( browserActionMap.get( fetchAliasesAction ) ); + } + if ( browserActionMap.get( fetchReferralsAction ).isEnabled() ) + { + fetchMenuManager.add( browserActionMap.get( fetchReferralsAction ) ); + } + if ( browserActionMap.get( fetchSubentriesAction ).isEnabled() ) + { + fetchMenuManager.add( browserActionMap.get( fetchSubentriesAction ) ); } + menuManager.add( fetchMenuManager ); menuManager.add( new Separator() ); // additions Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/messages.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/messages.properties?rev=823186&r1=823185&r2=823186&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/messages.properties (original) +++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/messages.properties Thu Oct 8 14:25:26 2009 @@ -19,6 +19,7 @@ BrowserViewActionGroup.Advanced=Advanced BrowserViewActionGroup.Export=Export BrowserViewActionGroup.Import=Import +BrowserViewActionGroup.Fetch=Fetch LinkWithEditorAction.LinkWithEditor=Link with editor OpenBrowserPreferencePageAction.Preferences=Preferences... OpenBrowserPreferencePageAction.PreferencesToolTip=Preferences... Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/messages_de.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/messages_de.properties?rev=823186&r1=823185&r2=823186&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/messages_de.properties (original) +++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/messages_de.properties Thu Oct 8 14:25:26 2009 @@ -19,6 +19,7 @@ BrowserViewActionGroup.Advanced=Erweitert BrowserViewActionGroup.Export=Exportieren BrowserViewActionGroup.Import=Importieren +BrowserViewActionGroup.Fetch=Abrufen LinkWithEditorAction.LinkWithEditor=Verkn\u00FCpfne mit Editor OpenBrowserPreferencePageAction.Preferences=Benutzervorgaben... OpenBrowserPreferencePageAction.PreferencesToolTip=Benutzervorgaben... Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/messages_fr.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/messages_fr.properties?rev=823186&r1=823185&r2=823186&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/messages_fr.properties (original) +++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/messages_fr.properties Thu Oct 8 14:25:26 2009 @@ -19,6 +19,7 @@ BrowserViewActionGroup.Advanced=Avanc\u00E9 BrowserViewActionGroup.Export=Export BrowserViewActionGroup.Import=Import +BrowserViewActionGroup.Fetch=TODO:Fetch LinkWithEditorAction.LinkWithEditor=Lien avec l'\u00E9diteur OpenBrowserPreferencePageAction.Preferences=Pr\u00E9f\u00E9rences... OpenBrowserPreferencePageAction.PreferencesToolTip=Pr\u00E9f\u00E9rences...