本文整理汇总了Java中org.identityconnectors.framework.common.objects.ResultsHandler类的典型用法代码示例。如果您正苦于以下问题:Java ResultsHandler类的具体用法?Java ResultsHandler怎么用?Java ResultsHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResultsHandler类属于org.identityconnectors.framework.common.objects包,在下文中一共展示了ResultsHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: exactSearchTest
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
@Test
public void exactSearchTest() {
logger.info("Running Exact Search Test");
final String principal = "user2";
final ConnectorFacade facade = getFacade(KerberosConnector.class, null);
final OperationOptionsBuilder builder = new OperationOptionsBuilder();
builder.setPageSize(10);
final ResultsHandler handler = new ToListResultsHandler();
SearchResult result = facade.search(ObjectClass.ACCOUNT, FilterBuilder.equalTo(new Name(principal)), handler, builder.build());
Assert.assertEquals(result.getPagedResultsCookie(), "NO_COOKIE");
Assert.assertEquals(((ToListResultsHandler) handler).getObjects().size(), 1);
final ResultsHandler handler2 = new ToListResultsHandler();
result = facade.search(ObjectClass.ACCOUNT, FilterBuilder.equalTo(new Uid(principal)), handler2, builder.build());
Assert.assertEquals(((ToListResultsHandler) handler2).getObjects().size(), 1);
final ResultsHandler handler3 = new ToListResultsHandler();
result = facade.search(ObjectClass.ACCOUNT, FilterBuilder.equalTo(new Uid(principal + "@" + realm)), handler3, builder.build());
Assert.assertEquals(((ToListResultsHandler) handler3).getObjects().size(), 1);
}
示例2: endsWithSearchTest
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
@Test
public void endsWithSearchTest() {
logger.info("Running \"Ends with\" Search Test");
final ConnectorFacade facade = getFacade(KerberosConnector.class, null);
final OperationOptionsBuilder builder = new OperationOptionsBuilder();
ResultsHandler handler;
builder.setPageSize(10);
handler = new ToListResultsHandler();
SearchResult result =
facade.search(ObjectClass.ACCOUNT, FilterBuilder.endsWith(new Name("3")), handler,
builder.build());
Assert.assertEquals(result.getPagedResultsCookie(), "NO_COOKIE");
Assert.assertEquals(((ToListResultsHandler) handler).getObjects().size(), 1);
handler = new ToListResultsHandler();
result =
facade.search(ObjectClass.ACCOUNT, FilterBuilder.endsWith(new Name("[email protected]" + realm)), handler,
builder.build());
Assert.assertEquals(result.getPagedResultsCookie(), "NO_COOKIE");
Assert.assertEquals(((ToListResultsHandler) handler).getObjects().size(), 1);
}
示例3: searchAllTest
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
@Test
/**
* Test search with empty filter.
*/
public void searchAllTest() {
logger.info("Running Search All Test");
final ConnectorFacade facade = getFacade(KerberosConnector.class, null);
final OperationOptionsBuilder builder = new OperationOptionsBuilder();
builder.setPageSize(10);
final ResultsHandler handler = new ToListResultsHandler();
SearchResult result =
facade.search(ObjectClass.ACCOUNT, null, handler,
builder.build());
Assert.assertEquals(result.getPagedResultsCookie(), "NO_COOKIE");
Assert.assertTrue(((ToListResultsHandler) handler).getObjects().size() > 1);
}
示例4: searchByUid
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
/**
* Returns a complete object based on ICF UID.
*
* This is different from resolveDn() method in that it returns a complete object.
* The resolveDn() method is supposed to be optimized to only return DN.
*/
protected SearchStrategy<C> searchByUid(Uid uid, ObjectClass objectClass, org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass,
ResultsHandler handler, OperationOptions options) {
String uidValue = SchemaUtil.getSingleStringNonBlankValue(uid);
if (LdapUtil.isDnAttribute(configuration.getUidAttribute())) {
return searchByDn(schemaTranslator.toDn(uidValue), objectClass, ldapObjectClass, handler, options);
} else {
// We know that this can return at most one object. Therefore always use simple search.
SearchStrategy<C> searchStrategy = getDefaultSearchStrategy(objectClass, ldapObjectClass, handler, options);
String[] attributesToGet = getAttributesToGet(ldapObjectClass, options);
SearchScope scope = getScope(options);
ExprNode filterNode = LdapUtil.createUidSearchFilter(uidValue, ldapObjectClass, getSchemaTranslator());
Dn baseDn = getBaseDn(options);
checkBaseDnPresent(baseDn);
try {
searchStrategy.search(baseDn, filterNode, scope, attributesToGet);
} catch (LdapException e) {
throw processLdapException("Error searching for UID '"+uidValue+"'", e);
}
return searchStrategy;
}
}
示例5: search
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
@Override
public SearchResult search(
final ObjectClass objectClass,
final Filter filter,
final ResultsHandler handler,
final int pageSize,
final String pagedResultsCookie,
final List<OrderByClause> orderBy,
final OperationOptions options) {
OperationOptionsBuilder builder = new OperationOptionsBuilder().setPageSize(pageSize).setPagedResultsOffset(-1);
if (pagedResultsCookie != null) {
builder.setPagedResultsCookie(pagedResultsCookie);
}
builder.setSortKeys(orderBy.stream().map(clause
-> new SortKey(clause.getField(), clause.getDirection() == OrderByClause.Direction.ASC)).
collect(Collectors.toList()));
builder.setAttributesToGet(options.getAttributesToGet());
return search(objectClass, filter, handler, builder.build());
}
示例6: startsWithSearchTest
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
@Test
public void startsWithSearchTest() {
logger.info("Running \"Starts with\" Search Test");
final ConnectorFacade facade = getFacade(KerberosConnector.class, null);
final OperationOptionsBuilder builder = new OperationOptionsBuilder();
builder.setPageSize(10);
final ResultsHandler handler = new ToListResultsHandler();
SearchResult result =
facade.search(ObjectClass.ACCOUNT, FilterBuilder.startsWith(new Name("user")), handler,
builder.build());
Assert.assertEquals(result.getPagedResultsCookie(), "NO_COOKIE");
Assert.assertEquals(((ToListResultsHandler) handler).getObjects().size(), 3);
}
示例7: containsSearchTest
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
@Test
public void containsSearchTest() {
logger.info("Running \"Contains\" Search Test");
final ConnectorFacade facade = getFacade(KerberosConnector.class, null);
final OperationOptionsBuilder builder = new OperationOptionsBuilder();
builder.setPageSize(10);
final ResultsHandler handler = new ToListResultsHandler();
SearchResult result =
facade.search(ObjectClass.ACCOUNT, FilterBuilder.contains(new Name("earch-tes")), handler,
builder.build());
Assert.assertEquals(result.getPagedResultsCookie(), "NO_COOKIE");
Assert.assertEquals(((ToListResultsHandler) handler).getObjects().size(), 1);
}
示例8: searchPageOutOfRangeTest
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
@Test
public void searchPageOutOfRangeTest() {
logger.info("Running \"Page out of range\" Search Test");
final ConnectorFacade facade = getFacade(KerberosConnector.class, null);
final OperationOptionsBuilder builder = new OperationOptionsBuilder();
builder.setPageSize(10);
builder.setPagedResultsOffset(10000);
final ResultsHandler handler = new ToListResultsHandler();
SearchResult result = facade.search(ObjectClass.ACCOUNT, FilterBuilder.startsWith(new Name("user")), handler, builder.build());
Assert.assertEquals(result.getPagedResultsCookie(), "NO_COOKIE");
Assert.assertEquals(((ToListResultsHandler) handler).getObjects().size(), 0);
}
示例9: getAllObjects
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
/**
* Get remote object used by the propagation manager in order to choose for
* a create (object doesn't exist) or an update (object exists).
*
* @param objectClass ConnId's object class.
* @param handler to be used to handle deltas.
* @param options ConnId's OperationOptions.
*/
public void getAllObjects(
final ObjectClass objectClass,
final SyncResultsHandler handler,
final OperationOptions options) {
if (capabitilies.contains(ConnectorCapability.SEARCH)) {
connector.search(objectClass, null,
new ResultsHandler() {
@Override
public boolean handle(final ConnectorObject obj) {
final SyncDeltaBuilder bld = new SyncDeltaBuilder();
bld.setObject(obj);
bld.setUid(obj.getUid());
bld.setDeltaType(SyncDeltaType.CREATE_OR_UPDATE);
bld.setToken(new SyncToken(""));
return handler.handle(bld.build());
}
}, options);
} else {
LOG.info("Search was attempted, although the "
+ "connector only has these capabilities: {}. No action.",
capabitilies);
}
}
示例10: SearchStrategy
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
protected SearchStrategy(ConnectionManager<C> connectionManager, AbstractLdapConfiguration configuration,
AbstractSchemaTranslator<C> schemaTranslator, ObjectClass objectClass,
org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass,
ResultsHandler handler, OperationOptions options) {
super();
this.connectionManager = connectionManager;
this.configuration = configuration;
this.schemaTranslator = schemaTranslator;
this.objectClass = objectClass;
this.ldapObjectClass = ldapObjectClass;
this.handler = handler;
this.options = options;
}
示例11: SimplePagedResultsSearchStrategy
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
public SimplePagedResultsSearchStrategy(ConnectionManager<C> connectionManager,
AbstractLdapConfiguration configuration, AbstractSchemaTranslator<C> schemaTranslator, ObjectClass objectClass,
org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass,
ResultsHandler handler, OperationOptions options) {
super(connectionManager, configuration, schemaTranslator, objectClass, ldapObjectClass, handler, options);
if (options != null && options.getPagedResultsCookie() != null) {
cookie = Base64.decode(options.getPagedResultsCookie());
}
}
示例12: chooseSearchStrategy
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
@Override
protected SearchStrategy<AdLdapConfiguration> chooseSearchStrategy(org.identityconnectors.framework.common.objects.ObjectClass objectClass,
ObjectClass ldapObjectClass, ResultsHandler handler, OperationOptions options) {
SearchStrategy<AdLdapConfiguration> searchStrategy = super.chooseSearchStrategy(objectClass, ldapObjectClass, handler, options);
searchStrategy.setAttributeHandler(new AdAttributeHandler(searchStrategy));
return searchStrategy;
}
示例13: getDefaultSearchStrategy
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
@Override
protected SearchStrategy<AdLdapConfiguration> getDefaultSearchStrategy(org.identityconnectors.framework.common.objects.ObjectClass objectClass,
ObjectClass ldapObjectClass, ResultsHandler handler, OperationOptions options) {
SearchStrategy<AdLdapConfiguration> searchStrategy = super.getDefaultSearchStrategy(objectClass, ldapObjectClass, handler, options);
searchStrategy.setAttributeHandler(new AdAttributeHandler(searchStrategy));
return searchStrategy;
}
示例14: DefaultSearchStrategy
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
public DefaultSearchStrategy(ConnectionManager<C> connectionManager, AbstractLdapConfiguration configuration,
AbstractSchemaTranslator<C> schemaTranslator, ObjectClass objectClass,
org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass, ResultsHandler handler,
OperationOptions options) {
super(connectionManager, configuration, schemaTranslator, objectClass, ldapObjectClass, handler, options);
}
示例15: VlvSearchStrategy
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
public VlvSearchStrategy(ConnectionManager<C> connectionManager, AbstractLdapConfiguration configuration,
AbstractSchemaTranslator<C> schemaTranslator, ObjectClass objectClass,
org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass, ResultsHandler handler,
OperationOptions options) {
super(connectionManager, configuration, schemaTranslator, objectClass, ldapObjectClass, handler, options);
}