当前位置: 首页>>代码示例>>Java>>正文


Java SortKey类代码示例

本文整理汇总了Java中javax.naming.ldap.SortKey的典型用法代码示例。如果您正苦于以下问题:Java SortKey类的具体用法?Java SortKey怎么用?Java SortKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SortKey类属于javax.naming.ldap包,在下文中一共展示了SortKey类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setRequestControls

import javax.naming.ldap.SortKey; //导入依赖的package包/类
/** 
 * Set the standard request controls
 */
private void setRequestControls(byte[] cookie) throws TranslatorException {
	List<Control> ctrl = new ArrayList<Control>();
	SortKey[] keys = searchDetails.getSortKeys();
	try {			
		if (keys != null) {
			ctrl.add(new SortControl(keys, Control.NONCRITICAL));
		}
		if (this.executionFactory.usePagination()) {
			ctrl.add(new PagedResultsControl(this.executionContext.getBatchSize(), cookie, Control.CRITICAL));
		}
		if (!ctrl.isEmpty()) {
			this.ldapCtx.setRequestControls(ctrl.toArray(new Control[ctrl.size()]));
			LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Sort/pagination controls were created successfully."); //$NON-NLS-1$
		}
	} catch (NamingException ne) {
           final String msg = LDAPPlugin.Util.getString("LDAPSyncQueryExecution.setControlsError") +  //$NON-NLS-1$
           " : "+ne.getExplanation(); //$NON-NLS-1$
		throw new TranslatorException(ne, msg);
	} catch(IOException e) {
		throw new TranslatorException(e);
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:26,代码来源:LDAPQueryExecution.java

示例2: testSelectFrom1

import javax.naming.ldap.SortKey; //导入依赖的package包/类
/**
 * Test a Query without criteria
 */
@Test public void testSelectFrom1() throws Exception {
    LDAPSearchDetails searchDetails = helpGetSearchDetails("SELECT UserID, Name FROM LdapModel.People"); //$NON-NLS-1$
    
    //-----------------------------------
    // Set Expected SearchDetails Values
    //-----------------------------------
    String expectedContextName = "ou=people,dc=metamatrix,dc=com"; //$NON-NLS-1$
    String expectedContextFilter = "(objectClass=*)"; //$NON-NLS-1$
    
    List<String> expectedAttrNameList = new ArrayList<String>();
    expectedAttrNameList.add("uid"); //$NON-NLS-1$
    expectedAttrNameList.add("cn"); //$NON-NLS-1$
    
    long expectedCountLimit = -1;
    int expectedSearchScope = SearchControls.ONELEVEL_SCOPE;
    SortKey[] expectedSortKeys = null;
    
    helpTestSearchDetails(searchDetails, expectedContextName, expectedContextFilter, expectedAttrNameList,
    		expectedCountLimit, expectedSearchScope, expectedSortKeys);
    
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:25,代码来源:TestIQueryToLdapSearchParser.java

示例3: testSelectFromWhere1

import javax.naming.ldap.SortKey; //导入依赖的package包/类
/**
 * Test a Query with a criteria
 */
@Test public void testSelectFromWhere1() throws Exception {
	LDAPSearchDetails searchDetails = helpGetSearchDetails("SELECT UserID, Name FROM LdapModel.People WHERE Name = 'R%'"); //$NON-NLS-1$
    
    //-----------------------------------
    // Set Expected SearchDetails Values
    //-----------------------------------
    String expectedContextName = "ou=people,dc=metamatrix,dc=com"; //$NON-NLS-1$
    String expectedContextFilter = "(cn=R%)"; //$NON-NLS-1$
    
    List<String> expectedAttrNameList = new ArrayList<String>();
    expectedAttrNameList.add("uid"); //$NON-NLS-1$
    expectedAttrNameList.add("cn"); //$NON-NLS-1$
    
    long expectedCountLimit = -1;
    int expectedSearchScope = SearchControls.ONELEVEL_SCOPE;
    SortKey[] expectedSortKeys = null;
    
    helpTestSearchDetails(searchDetails, expectedContextName, expectedContextFilter, expectedAttrNameList,
    		expectedCountLimit, expectedSearchScope, expectedSortKeys);
    
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:25,代码来源:TestIQueryToLdapSearchParser.java

示例4: testEscaping

import javax.naming.ldap.SortKey; //导入依赖的package包/类
/**
 * Test a Query with a criteria
 */
@Test public void testEscaping() throws Exception {
	LDAPSearchDetails searchDetails = helpGetSearchDetails("SELECT UserID, Name FROM LdapModel.People WHERE Name = 'R*'"); //$NON-NLS-1$
    
    //-----------------------------------
    // Set Expected SearchDetails Values
    //-----------------------------------
    String expectedContextName = "ou=people,dc=metamatrix,dc=com"; //$NON-NLS-1$
    String expectedContextFilter = "(cn=R\\2a)"; //$NON-NLS-1$
    
    List<String> expectedAttrNameList = new ArrayList<String>();
    expectedAttrNameList.add("uid"); //$NON-NLS-1$
    expectedAttrNameList.add("cn"); //$NON-NLS-1$
    
    long expectedCountLimit = -1;
    int expectedSearchScope = SearchControls.ONELEVEL_SCOPE;
    SortKey[] expectedSortKeys = null;
    
    helpTestSearchDetails(searchDetails, expectedContextName, expectedContextFilter, expectedAttrNameList,
    		expectedCountLimit, expectedSearchScope, expectedSortKeys);
    
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:25,代码来源:TestIQueryToLdapSearchParser.java

示例5: testNot

import javax.naming.ldap.SortKey; //导入依赖的package包/类
@Test public void testNot() throws Exception {
	LDAPSearchDetails searchDetails = helpGetSearchDetails("SELECT UserID, Name FROM LdapModel.People WHERE not (Name like 'R%' or Name like 'S%')"); //$NON-NLS-1$
    
    //-----------------------------------
    // Set Expected SearchDetails Values
    //-----------------------------------
    String expectedContextName = "ou=people,dc=metamatrix,dc=com"; //$NON-NLS-1$
    String expectedContextFilter = "(&(!(cn=R*))(!(cn=S*)))"; //$NON-NLS-1$
    
    List<String> expectedAttrNameList = new ArrayList<String>();
    expectedAttrNameList.add("uid"); //$NON-NLS-1$
    expectedAttrNameList.add("cn"); //$NON-NLS-1$
    
    long expectedCountLimit = -1;
    int expectedSearchScope = SearchControls.ONELEVEL_SCOPE;
    SortKey[] expectedSortKeys = null;
    
    helpTestSearchDetails(searchDetails, expectedContextName, expectedContextFilter, expectedAttrNameList,
    		expectedCountLimit, expectedSearchScope, expectedSortKeys);
    
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:22,代码来源:TestIQueryToLdapSearchParser.java

示例6: testGT

import javax.naming.ldap.SortKey; //导入依赖的package包/类
@Test public void testGT() throws Exception {
	LDAPSearchDetails searchDetails = helpGetSearchDetails("SELECT UserID, Name FROM LdapModel.People WHERE Name > 'R'"); //$NON-NLS-1$
    
    //-----------------------------------
    // Set Expected SearchDetails Values
    //-----------------------------------
    String expectedContextName = "ou=people,dc=metamatrix,dc=com"; //$NON-NLS-1$
    String expectedContextFilter = "(!(cn<=R))"; //$NON-NLS-1$
    
    List<String> expectedAttrNameList = new ArrayList<String>();
    expectedAttrNameList.add("uid"); //$NON-NLS-1$
    expectedAttrNameList.add("cn"); //$NON-NLS-1$
    
    long expectedCountLimit = -1;
    int expectedSearchScope = SearchControls.ONELEVEL_SCOPE;
    SortKey[] expectedSortKeys = null;
    
    helpTestSearchDetails(searchDetails, expectedContextName, expectedContextFilter, expectedAttrNameList,
    		expectedCountLimit, expectedSearchScope, expectedSortKeys);
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:21,代码来源:TestIQueryToLdapSearchParser.java

示例7: testLT

import javax.naming.ldap.SortKey; //导入依赖的package包/类
@Test public void testLT() throws Exception {
	LDAPSearchDetails searchDetails = helpGetSearchDetails("SELECT UserID, Name FROM LdapModel.People WHERE Name < 'R'"); //$NON-NLS-1$
    
    //-----------------------------------
    // Set Expected SearchDetails Values
    //-----------------------------------
    String expectedContextName = "ou=people,dc=metamatrix,dc=com"; //$NON-NLS-1$
    String expectedContextFilter = "(!(cn>=R))"; //$NON-NLS-1$
    
    List<String> expectedAttrNameList = new ArrayList<String>();
    expectedAttrNameList.add("uid"); //$NON-NLS-1$
    expectedAttrNameList.add("cn"); //$NON-NLS-1$
    
    long expectedCountLimit = -1;
    int expectedSearchScope = SearchControls.ONELEVEL_SCOPE;
    SortKey[] expectedSortKeys = null;
    
    helpTestSearchDetails(searchDetails, expectedContextName, expectedContextFilter, expectedAttrNameList,
    		expectedCountLimit, expectedSearchScope, expectedSortKeys);
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:21,代码来源:TestIQueryToLdapSearchParser.java

示例8: helpTestLike

import javax.naming.ldap.SortKey; //导入依赖的package包/类
private void helpTestLike(String query, String expectedContextFilter)
		throws TranslatorException {
	LDAPSearchDetails searchDetails = helpGetSearchDetails("SELECT UserID FROM LdapModel.People WHERE " + query); //$NON-NLS-1$
       
       // Set Expected SearchDetails Values
       //-----------------------------------
       String expectedContextName = "ou=people,dc=metamatrix,dc=com"; //$NON-NLS-1$
       
       
       List<String> expectedAttrNameList = new ArrayList<String>();
       expectedAttrNameList.add("uid"); //$NON-NLS-1$
       
       long expectedCountLimit = -1;
       int expectedSearchScope = SearchControls.ONELEVEL_SCOPE;
       SortKey[] expectedSortKeys = null;
       
       helpTestSearchDetails(searchDetails, expectedContextName, expectedContextFilter, expectedAttrNameList,
       		expectedCountLimit, expectedSearchScope, expectedSortKeys);
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:20,代码来源:TestIQueryToLdapSearchParser.java

示例9: LDAPSearchDetails

import javax.naming.ldap.SortKey; //导入依赖的package包/类
/**
 * Constructor
 * @param name the context name
 * @param searchScope the search scope
 * @param filter the context filter
 * @param attributeList the list of attributes
 * @param keys
 * @param limit
 * @param elementList
 */
public LDAPSearchDetails(String name, int searchScope, String filter, SortKey[] keys, long limit, ArrayList elementList, int timeLimit) {

	this.contextName = name;
	this.searchScope = searchScope;
	this.contextFilter = filter;
	this.keys = keys;
	this.limit = limit;
	this.elementList = elementList;
	this.timeLimit = timeLimit;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:21,代码来源:LDAPSearchDetails.java

示例10: helpTestSearchDetails

import javax.naming.ldap.SortKey; //导入依赖的package包/类
/**
  * Helper method for testing the provided LDAPSearchDetails against expected values
  * @param searchDetails the LDAPSearchDetails object
  * @param expectedContextName the expected context name
  * @param expectedContextFilter the expected context filter string
  * @param expectedAttrNameList list of expected attribute names
  * @param expectedCountLimit the expected count limit
  * @param expectedSearchScope the expected search scope
  * @param expectedSortKeys the expected sortKeys list.
  */
 public void helpTestSearchDetails(final LDAPSearchDetails searchDetails, final String expectedContextName,
 		final String expectedContextFilter, final List<String> expectedAttrNameList, final long expectedCountLimit, 
 		final int expectedSearchScope, final SortKey[] expectedSortKeys) {
 	
 	// Get all of the actual values
     String contextName = searchDetails.getContextName();
     String contextFilter = searchDetails.getContextFilter();
     List<Column> attrList = searchDetails.getElementList();
     long countLimit = searchDetails.getCountLimit();
 	int searchScope = searchDetails.getSearchScope();
 	SortKey[] sortKeys = searchDetails.getSortKeys();
 	
 	// Compare actual with Expected
 	assertEquals(expectedContextName, contextName);
 	assertEquals(expectedContextFilter, contextFilter);
 	
 	assertEquals(attrList.size(),expectedAttrNameList.size());
 	Iterator<Column> iter = attrList.iterator();
 	Iterator<String> eIter = expectedAttrNameList.iterator();
 	while(iter.hasNext()&&eIter.hasNext()) {
String actualName = iter.next().getSourceName();
String expectedName = eIter.next();
assertEquals(actualName, expectedName);
 	}

 	assertEquals(expectedCountLimit, countLimit);
 	assertEquals(expectedSearchScope, searchScope);
 	assertArrayEquals(expectedSortKeys, sortKeys);
 }
 
开发者ID:kenweezy,项目名称:teiid,代码行数:40,代码来源:TestIQueryToLdapSearchParser.java

示例11: testSortControlStringArrayBoolean002

import javax.naming.ldap.SortKey; //导入依赖的package包/类
/**
 * @tests isCritical()
 */
public void testSortControlStringArrayBoolean002() throws Exception {
    assertTrue(new SortControl("", true).isCritical());
    assertFalse(new SortControl("", false).isCritical());

    assertTrue(new SortControl(new String[0], true).isCritical());
    assertFalse(new SortControl(new String[0], false).isCritical());

    assertTrue(new SortControl(new SortKey[0], true).isCritical());
    assertFalse(new SortControl(new SortKey[0], false).isCritical());

}
 
开发者ID:shannah,项目名称:cn1,代码行数:15,代码来源:SortControlTest.java

示例12: testEncodedValueOfSortControl001

import javax.naming.ldap.SortKey; //导入依赖的package包/类
/**
 * <p>
 * Test method for 'javax.naming.ldap.SortControl.getEncodedValue()'
 * </p>
 * <p>
 * Here we are testing if this method retrieves the control's ASN.1 BER
 * encoded value. In this case we create a sort control using an array of
 * sortkey.
 * </p>
 * <p>
 * The expecting result is the control's ASN.1 BER encoded value.
 * </p>
 */
public void testEncodedValueOfSortControl001() throws Exception {
    SortKey[] sk = { new SortKey("pepe", false, "leo") };

    SortControl sc = new SortControl(sk, true);
    assertEquals("30 10 30 0e 04 04 70 65 70 65 80 03 6c 65 6f 81 01 ff",
            toHexString(sc.getEncodedValue()));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:SortControlTest.java

示例13: getSortKeys

import javax.naming.ldap.SortKey; //导入依赖的package包/类
/**
 * get the sort keys
 * @return the sort keys
 */
public SortKey[] getSortKeys() {
	return keys;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:8,代码来源:LDAPSearchDetails.java


注:本文中的javax.naming.ldap.SortKey类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。