javax.naming.ldap.SortControl Java Examples
The following examples show how to use
javax.naming.ldap.SortControl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SortControlDirContextProcessorTest.java From spring-ldap with Apache License 2.0 | 5 votes |
@Test public void testCreateRequestControl() throws Exception { SortControl result = (SortControl) tested.createRequestControl(); assertThat(result).isNotNull(); assertThat(result.getID()).isEqualTo("1.2.840.113556.1.4.473"); assertThat(result.getEncodedValue().length).isEqualTo(9); }
Example #2
Source File: LdapIdentityProviderSession.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void applyRequestControls(AbstractQuery<?, ?> query) { try { List<Control> controls = new ArrayList<>(); List<QueryOrderingProperty> orderBy = query.getOrderingProperties(); if(orderBy != null) { for (QueryOrderingProperty orderingProperty : orderBy) { String propertyName = orderingProperty.getQueryProperty().getName(); if(UserQueryProperty.USER_ID.getName().equals(propertyName)) { controls.add(new SortControl(ldapConfiguration.getUserIdAttribute(), Control.CRITICAL)); } else if(UserQueryProperty.EMAIL.getName().equals(propertyName)) { controls.add(new SortControl(ldapConfiguration.getUserEmailAttribute(), Control.CRITICAL)); } else if(UserQueryProperty.FIRST_NAME.getName().equals(propertyName)) { controls.add(new SortControl(ldapConfiguration.getUserFirstnameAttribute(), Control.CRITICAL)); } else if(UserQueryProperty.LAST_NAME.getName().equals(propertyName)) { controls.add(new SortControl(ldapConfiguration.getUserLastnameAttribute(), Control.CRITICAL)); } } } initialContext.setRequestControls(controls.toArray(new Control[0])); } catch (Exception e) { throw new IdentityProviderException("Exception while setting paging settings", e); } }