boolean fetchBaseDns = parameter
.getExtendedBoolProperty( IBrowserConnection.CONNECTION_PARAMETER_FETCH_BASE_DNS );
String baseDn = parameter.getExtendedProperty( IBrowserConnection.CONNECTION_PARAMETER_BASE_DN );
if ( !fetchBaseDns && StringUtils.isNotEmpty( baseDn ) )
{
ldapUrl.getExtensions().add( new Extension( false, X_BASE_DN, baseDn ) );
}
int countLimit = parameter.getExtendedIntProperty( IBrowserConnection.CONNECTION_PARAMETER_COUNT_LIMIT );
if ( countLimit != 0 )
{
ldapUrl.getExtensions().add(
new Extension( false, X_COUNT_LIMIT, parameter
.getExtendedProperty( IBrowserConnection.CONNECTION_PARAMETER_COUNT_LIMIT ) ) );
}
int timeLimit = parameter.getExtendedIntProperty( IBrowserConnection.CONNECTION_PARAMETER_TIME_LIMIT );
if ( timeLimit != 0 )
{
ldapUrl.getExtensions().add(
new Extension( false, X_TIME_LIMIT, parameter
.getExtendedProperty( IBrowserConnection.CONNECTION_PARAMETER_TIME_LIMIT ) ) );
}
int aliasesDereferencingMethodOrdinal = parameter
.getExtendedIntProperty( IBrowserConnection.CONNECTION_PARAMETER_ALIASES_DEREFERENCING_METHOD );
Connection.AliasDereferencingMethod aliasesDereferencingMethod = Connection.AliasDereferencingMethod
.getByOrdinal( aliasesDereferencingMethodOrdinal );
switch ( aliasesDereferencingMethod )
{
case ALWAYS:
// default
break;
case FINDING:
ldapUrl.getExtensions().add( new Extension( false, X_ALIAS_HANDLING, X_ALIAS_HANDLING_FINDING ) );
break;
case SEARCH:
ldapUrl.getExtensions().add( new Extension( false, X_ALIAS_HANDLING, X_ALIAS_HANDLING_SEARCHING ) );
break;
case NEVER:
ldapUrl.getExtensions().add( new Extension( false, X_ALIAS_HANDLING, X_ALIAS_HANDLING_NEVER ) );
break;
}
int referralsHandlingMethodOrdinal = parameter
.getExtendedIntProperty( IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD );
Connection.ReferralHandlingMethod referralsHandlingMethod = Connection.ReferralHandlingMethod
.getByOrdinal( referralsHandlingMethodOrdinal );
switch ( referralsHandlingMethod )
{
case FOLLOW_MANUALLY:
// default
break;
case IGNORE:
ldapUrl.getExtensions().add( new Extension( false, X_REFERRAL_HANDLING, X_REFERRAL_HANDLING_IGNORE ) );
break;
case FOLLOW:
ldapUrl.getExtensions().add( new Extension( false, X_REFERRAL_HANDLING, X_REFERRAL_HANDLING_FOLLOW ) );
break;
}
// ManageDsaIT control
boolean manageDsaIt = parameter.getExtendedBoolProperty( IBrowserConnection.CONNECTION_PARAMETER_MANAGE_DSA_IT );
if ( manageDsaIt )
{
ldapUrl.getExtensions().add( new Extension( false, X_MANAGE_DSA_IT, null ) );
}
// fetch subentries
boolean fetchSubentries = parameter
.getExtendedBoolProperty( IBrowserConnection.CONNECTION_PARAMETER_FETCH_SUBENTRIES );
if ( fetchSubentries )
{
ldapUrl.getExtensions().add( new Extension( false, X_FETCH_SUBENTRIES, null ) );
}
// paged search
boolean pagedSearch = parameter.getExtendedBoolProperty( IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH );
if ( pagedSearch )
{
ldapUrl.getExtensions().add( new Extension( false, X_PAGED_SEARCH, null ) );
ldapUrl.getExtensions().add(
new Extension( false, X_PAGED_SEARCH_SIZE, parameter
.getExtendedProperty( IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH_SIZE ) ) );
boolean pagedSearchScrollMode = parameter
.getExtendedBoolProperty( IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH_SCROLL_MODE );
if ( pagedSearchScrollMode )
{
ldapUrl.getExtensions().add( new Extension( false, X_PAGED_SEARCH_SCROLL_MODE, null ) );
}
}
// fetch operational attributes
boolean fetchOperationalAttributes = parameter
.getExtendedBoolProperty( IBrowserConnection.CONNECTION_PARAMETER_FETCH_OPERATIONAL_ATTRIBUTES );
if ( fetchOperationalAttributes )
{
ldapUrl.getExtensions().add( new Extension( false, X_FETCH_OPERATIONAL_ATTRIBUTES, null ) );
}
}