本文整理汇总了Java中org.identityconnectors.framework.common.objects.ResultsHandler类的典型用法代码示例。如果您正苦于以下问题:Java ResultsHandler类的具体用法?Java ResultsHandler怎么用?Java ResultsHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResultsHandler类属于org.identityconnectors.framework.common.objects包,在下文中一共展示了ResultsHandler类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:23,代码来源:KerberosConnectorTests.java
示例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);
}
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:23,代码来源:KerberosConnectorTests.java
示例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);
}
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:19,代码来源:KerberosConnectorTests.java
示例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;
}
}
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:29,代码来源:AbstractLdapConnector.java
示例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());
}
开发者ID:apache,项目名称:syncope,代码行数:23,代码来源:ConnectorFacadeProxy.java
示例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);
}
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:15,代码来源:KerberosConnectorTests.java
示例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);
}
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:15,代码来源:KerberosConnectorTests.java
示例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);
}
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:14,代码来源:KerberosConnectorTests.java
示例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);
}
}
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:36,代码来源:ConnectorFacadeProxy.java
示例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;
}
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:14,代码来源:SearchStrategy.java
示例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());
}
}
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:10,代码来源:SimplePagedResultsSearchStrategy.java
示例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;
}
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:8,代码来源:AdLdapConnector.java
示例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;
}
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:9,代码来源:AdLdapConnector.java
示例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);
}
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:7,代码来源:DefaultSearchStrategy.java
示例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);
}
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:7,代码来源:VlvSearchStrategy.java
示例16: chooseSearchStrategy
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
protected SearchStrategy<C> chooseSearchStrategy(ObjectClass objectClass,
org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass,
ResultsHandler handler, OperationOptions options) {
AbstractSchemaTranslator<C> schemaTranslator = getSchemaTranslator();
String pagingStrategy = configuration.getPagingStrategy();
if (pagingStrategy == null) {
pagingStrategy = LdapConfiguration.PAGING_STRATEGY_AUTO;
}
if (options != null && options.getAllowPartialResults() != null && options.getAllowPartialResults() &&
options.getPagedResultsOffset() == null && options.getPagedResultsCookie() == null &&
options.getPageSize() == null) {
// Search that allow partial results, no need for paging. Regardless of the configured strategy.
return getDefaultSearchStrategy(objectClass, ldapObjectClass, handler, options);
}
if (LdapConfiguration.PAGING_STRATEGY_NONE.equals(pagingStrategy)) {
// This may fail on a sizeLimit. But this is what has been configured so we are going to do it anyway.
LOG.ok("Selecting default search strategy because strategy setting is set to {0}", pagingStrategy);
return getDefaultSearchStrategy(objectClass, ldapObjectClass, handler, options);
} else if (LdapConfiguration.PAGING_STRATEGY_SPR.equals(pagingStrategy)) {
if (supportsControl(PagedResults.OID)) {
LOG.ok("Selecting SimplePaged search strategy because strategy setting is set to {0}", pagingStrategy);
return new SimplePagedResultsSearchStrategy<>(connectionManager, configuration, schemaTranslator, objectClass, ldapObjectClass, handler, options);
} else {
throw new ConfigurationException("Configured paging strategy "+pagingStrategy+", but the server does not support PagedResultsControl.");
}
} else if (LdapConfiguration.PAGING_STRATEGY_VLV.equals(pagingStrategy)) {
if (supportsControl(VirtualListViewRequest.OID)) {
LOG.ok("Selecting VLV search strategy because strategy setting is set to {0}", pagingStrategy);
return new VlvSearchStrategy<>(connectionManager, configuration, getSchemaTranslator(), objectClass, ldapObjectClass, handler, options);
} else {
throw new ConfigurationException("Configured paging strategy "+pagingStrategy+", but the server does not support VLV.");
}
} else if (LdapConfiguration.PAGING_STRATEGY_AUTO.equals(pagingStrategy)) {
if (options.getPagedResultsOffset() != null) {
// Always prefer VLV even if the offset is 1. We expect that the client will use paging and subsequent
// queries will come with offset other than 1. The server may use a slightly different sorting for VLV and other
// paging mechanisms. Bu we want consisten results. Therefore in this case prefer VLV even if it might be less efficient.
if (supportsControl(VirtualListViewRequest.OID)) {
LOG.ok("Selecting VLV search strategy because strategy setting is set to {0} and the request specifies an offset", pagingStrategy);
return new VlvSearchStrategy<>(connectionManager, configuration, getSchemaTranslator(), objectClass, ldapObjectClass, handler, options);
} else {
throw new UnsupportedOperationException("Requested search from offset ("+options.getPagedResultsOffset()+"), but the server does not support VLV. Unable to execute the search.");
}
} else {
if (supportsControl(PagedResults.OID)) {
// SPR is usually a better choice if no offset is specified. Less overhead on the server.
LOG.ok("Selecting SimplePaged search strategy because strategy setting is set to {0} and the request does not specify an offset", pagingStrategy);
return new SimplePagedResultsSearchStrategy<>(connectionManager, configuration, schemaTranslator, objectClass, ldapObjectClass, handler, options);
} else if (supportsControl(VirtualListViewRequest.OID)) {
return new VlvSearchStrategy<>(connectionManager, configuration, getSchemaTranslator(), objectClass, ldapObjectClass, handler, options);
} else {
throw new UnsupportedOperationException("Requested paged search, but the server does not support VLV or PagedResultsControl. Unable to execute the search.");
}
}
}
return getDefaultSearchStrategy(objectClass, ldapObjectClass, handler, options);
}
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:64,代码来源:AbstractLdapConnector.java
示例17: getDefaultSearchStrategy
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
protected SearchStrategy<C> getDefaultSearchStrategy(ObjectClass objectClass,
org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass,
ResultsHandler handler, OperationOptions options) {
return new DefaultSearchStrategy<>(connectionManager, configuration, getSchemaTranslator(), objectClass, ldapObjectClass, handler, options);
}
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:6,代码来源:AbstractLdapConnector.java
示例18: listConnObjects
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
@PreAuthorize("hasRole('" + StandardEntitlement.RESOURCE_LIST_CONNOBJECT + "')")
@Transactional(readOnly = true)
public Pair<SearchResult, List<ConnObjectTO>> listConnObjects(final String key, final String anyTypeKey,
final int size, final String pagedResultsCookie, final List<OrderByClause> orderBy) {
ExternalResource resource;
ObjectClass objectClass;
OperationOptions options;
if (SyncopeConstants.REALM_ANYTYPE.equals(anyTypeKey)) {
resource = resourceDAO.authFind(key);
if (resource == null) {
throw new NotFoundException("Resource '" + key + "'");
}
if (resource.getOrgUnit() == null) {
throw new NotFoundException("Realm provisioning for resource '" + key + "'");
}
objectClass = resource.getOrgUnit().getObjectClass();
options = MappingUtils.buildOperationOptions(
MappingUtils.getPropagationItems(resource.getOrgUnit().getItems()).iterator());
} else {
Triple<ExternalResource, AnyType, Provision> init = connObjectInit(key, anyTypeKey);
resource = init.getLeft();
objectClass = init.getRight().getObjectClass();
init.getRight().getMapping().getItems();
Set<MappingItem> linkinMappingItems = virSchemaDAO.findByProvision(init.getRight()).stream().
map(virSchema -> virSchema.asLinkingMappingItem()).collect(Collectors.toSet());
Iterator<MappingItem> mapItems = new IteratorChain<>(
init.getRight().getMapping().getItems().iterator(),
linkinMappingItems.iterator());
options = MappingUtils.buildOperationOptions(mapItems);
}
final List<ConnObjectTO> connObjects = new ArrayList<>();
SearchResult searchResult = connFactory.getConnector(resource).search(objectClass, null, new ResultsHandler() {
private int count;
@Override
public boolean handle(final ConnectorObject connectorObject) {
connObjects.add(ConnObjectUtils.getConnObjectTO(connectorObject));
// safety protection against uncontrolled result size
count++;
return count < size;
}
}, size, pagedResultsCookie, orderBy, options);
return ImmutablePair.of(searchResult, connObjects);
}
开发者ID:apache,项目名称:syncope,代码行数:52,代码来源:ResourceLogic.java
示例19: search
import org.identityconnectors.framework.common.objects.ResultsHandler; //导入依赖的package包/类
/**
* Search for remote objects.
*
* @param objectClass ConnId's object class
* @param filter search filter
* @param handler class responsible for working with the objects returned from the search; may be null.
* @param pageSize requested page results page size
* @param pagedResultsCookie an opaque cookie which is used by the connector to track its position in the set of
* query results
* @param orderBy the sort keys which should be used for ordering the {@link ConnectorObject} returned by
* search request
* @param options ConnId's OperationOptions
* @return search result
*/
SearchResult search(
ObjectClass objectClass,
Filter filter,
ResultsHandler handler,
int pageSize,
String pagedResultsCookie,
List<OrderByClause> orderBy,
OperationOptions options);
开发者ID:apache,项目名称:syncope,代码行数:23,代码来源:Connector.java
注:本文中的org.identityconnectors.framework.common.objects.ResultsHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论