Search in sources :

Example 1 with SearchResultsHandler

use of org.identityconnectors.framework.spi.SearchResultsHandler in project CzechIdMng by bcvsolutions.

the class ConnIdIcConnectorService method search.

@Override
public void search(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration, IcObjectClass objectClass, IcFilter filter, IcResultsHandler handler) {
    Assert.notNull(connectorInstance);
    Assert.notNull(connectorInstance.getConnectorKey());
    Assert.notNull(connectorConfiguration);
    Assert.notNull(objectClass);
    Assert.notNull(handler);
    LOG.debug("Start search for connector {} and objectClass {} and filter {} - ConnId", connectorInstance.getConnectorKey().toString(), objectClass.getDisplayName(), filter);
    ConnectorFacade conn = getConnectorFacade(connectorInstance, connectorConfiguration);
    ObjectClass objectClassConnId = ConnIdIcConvertUtil.convertIcObjectClass(objectClass);
    if (objectClassConnId == null) {
        objectClassConnId = ObjectClass.ACCOUNT;
    }
    final SearchResultsHandler handlerConnId = new SearchResultsHandler() {

        @Override
        public boolean handle(ConnectorObject connectorObject) {
            return handler.handle(ConnIdIcConvertUtil.convertConnIdConnectorObject(connectorObject));
        }

        @Override
        public void handleResult(SearchResult result) {
            // VS TODO: For all my tests was search result Null and this method (handle result) was not called!
            LOG.debug("SearchResul was returned (pagination): cookie: {}  --- remaining paged results: {}", result.getPagedResultsCookie(), result.getRemainingPagedResults());
        }
    };
    Filter filterConnId = ConnIdIcConvertUtil.convertIcFilter(filter);
    // For pagination - TODO
    Map<String, Object> searchOpt = new HashMap<String, Object>();
    searchOpt.put(OperationOptions.OP_PAGE_SIZE, 100);
    searchOpt.put(OperationOptions.OP_PAGED_RESULTS_OFFSET, 1);
    OperationOptions searchOptions = new OperationOptions(searchOpt);
    this.pageSearch(conn, objectClassConnId, filterConnId, handlerConnId, searchOptions);
}
Also used : OperationOptions(org.identityconnectors.framework.common.objects.OperationOptions) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) ObjectClass(org.identityconnectors.framework.common.objects.ObjectClass) Filter(org.identityconnectors.framework.common.objects.filter.Filter) IcFilter(eu.bcvsolutions.idm.ic.filter.api.IcFilter) HashMap(java.util.HashMap) ConnectorObject(org.identityconnectors.framework.common.objects.ConnectorObject) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) ConnectorFacade(org.identityconnectors.framework.api.ConnectorFacade) SearchResult(org.identityconnectors.framework.common.objects.SearchResult) ConnectorObject(org.identityconnectors.framework.common.objects.ConnectorObject) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) SearchResultsHandler(org.identityconnectors.framework.spi.SearchResultsHandler)

Aggregations

GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)1 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)1 IcObjectClass (eu.bcvsolutions.idm.ic.api.IcObjectClass)1 IcFilter (eu.bcvsolutions.idm.ic.filter.api.IcFilter)1 IcConnectorFacade (eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade)1 HashMap (java.util.HashMap)1 ConnectorFacade (org.identityconnectors.framework.api.ConnectorFacade)1 ConnectorObject (org.identityconnectors.framework.common.objects.ConnectorObject)1 ObjectClass (org.identityconnectors.framework.common.objects.ObjectClass)1 OperationOptions (org.identityconnectors.framework.common.objects.OperationOptions)1 SearchResult (org.identityconnectors.framework.common.objects.SearchResult)1 Filter (org.identityconnectors.framework.common.objects.filter.Filter)1 SearchResultsHandler (org.identityconnectors.framework.spi.SearchResultsHandler)1