Search in sources :

Example 6 with ConnectorFacade

use of org.identityconnectors.framework.api.ConnectorFacade in project CzechIdMng by bcvsolutions.

the class ConnIdIcConfigurationService method getSchema.

@Override
public IcSchema getSchema(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration) {
    Assert.notNull(connectorInstance.getConnectorKey(), "Connector key is required.");
    Assert.notNull(connectorConfiguration, "Configuration is required.");
    if (connectorInstance.isRemote()) {
        LOG.info(MessageFormat.format("Get Schema of remote connector - ConnId ({0})", connectorInstance.getConnectorServer().getFullServerName()));
    } else {
        LOG.info(MessageFormat.format("Get Schema - ConnId ({0})", connectorInstance.getConnectorKey().toString()));
    }
    ConnectorFacade conn = getConnectorFacade(connectorInstance, connectorConfiguration);
    Schema schema = conn.schema();
    return ConnIdIcConvertUtil.convertConnIdSchema(schema);
}
Also used : Schema(org.identityconnectors.framework.common.objects.Schema) IcSchema(eu.bcvsolutions.idm.ic.api.IcSchema) ConnectorFacade(org.identityconnectors.framework.api.ConnectorFacade)

Example 7 with ConnectorFacade

use of org.identityconnectors.framework.api.ConnectorFacade in project CzechIdMng by bcvsolutions.

the class ConnIdIcConfigurationService method getConnectorFacade.

private ConnectorFacade getConnectorFacade(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration) {
    Assert.notNull(connectorInstance.getConnectorKey(), "Connector key is required.");
    Assert.notNull(connectorConfiguration, "Configuration is required.");
    if (connectorInstance.isRemote()) {
        Assert.notNull(connectorInstance.getConnectorServer(), "Connector server is required.");
    }
    ConnectorInfo connIdInfo = this.getConnIdConnectorInfo(connectorInstance);
    Assert.notNull(connIdInfo, "ConnId connector info not found!");
    APIConfiguration config = connIdInfo.createDefaultAPIConfiguration();
    Assert.notNull(config.getConfigurationProperties(), "ConnId connector configuration properties not found!");
    config = ConnIdIcConvertUtil.convertIcConnectorConfiguration(connectorConfiguration, config);
    // Use the ConnectorFacadeFactory's newInstance() method to get a new
    // connector.
    ConnectorFacade conn = ConnectorFacadeFactory.getManagedInstance().newInstance(config);
    // Make sure we have set up the Configuration properly
    conn.validate();
    return conn;
}
Also used : ConnectorInfo(org.identityconnectors.framework.api.ConnectorInfo) IcConnectorInfo(eu.bcvsolutions.idm.ic.api.IcConnectorInfo) APIConfiguration(org.identityconnectors.framework.api.APIConfiguration) ConnectorFacade(org.identityconnectors.framework.api.ConnectorFacade)

Example 8 with ConnectorFacade

use of org.identityconnectors.framework.api.ConnectorFacade in project CzechIdMng by bcvsolutions.

the class ConnIdIcConnectorService method updateObject.

@Override
public IcUidAttribute updateObject(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration, IcObjectClass objectClass, IcUidAttribute uid, List<IcAttribute> replaceAttributes) {
    Assert.notNull(connectorInstance, "Connector instance is required.");
    Assert.notNull(connectorInstance.getConnectorKey(), "Connector key is required.");
    Assert.notNull(connectorConfiguration, "Configuration is required.");
    Assert.notNull(replaceAttributes, "Replace attributes are required.");
    Assert.notNull(uid, "Uid is required.");
    LOG.debug("Update object - ConnId (Uid= {} {} {})", uid, connectorInstance.getConnectorKey().toString(), replaceAttributes.toString());
    ConnectorFacade conn = facadeFactory.getConnectorFacade(connectorInstance, connectorConfiguration);
    Set<Attribute> connIdAttributes = new HashSet<>(replaceAttributes.size());
    for (IcAttribute icAttribute : replaceAttributes) {
        connIdAttributes.add(ConnIdIcConvertUtil.convertIcAttribute(icAttribute));
    }
    ObjectClass objectClassConnId = ConnIdIcConvertUtil.convertIcObjectClass(objectClass);
    if (objectClassConnId == null) {
        objectClassConnId = ObjectClass.ACCOUNT;
    }
    Uid updatedUid = conn.update(objectClassConnId, ConnIdIcConvertUtil.convertIcUid(uid), connIdAttributes, new OperationOptions(connectorConfiguration.getSystemOperationOptions()));
    LOG.debug("Updated object - ConnId ({} {}) Uid= {})", connectorInstance.getConnectorKey().toString(), replaceAttributes.toString(), updatedUid);
    return ConnIdIcConvertUtil.convertConnIdUid(updatedUid);
}
Also used : OperationOptions(org.identityconnectors.framework.common.objects.OperationOptions) Uid(org.identityconnectors.framework.common.objects.Uid) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) ObjectClass(org.identityconnectors.framework.common.objects.ObjectClass) Attribute(org.identityconnectors.framework.common.objects.Attribute) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcUidAttribute(eu.bcvsolutions.idm.ic.api.IcUidAttribute) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) ConnectorFacade(org.identityconnectors.framework.api.ConnectorFacade) HashSet(java.util.HashSet)

Example 9 with ConnectorFacade

use of org.identityconnectors.framework.api.ConnectorFacade in project CzechIdMng by bcvsolutions.

the class ConnIdIcConnectorService method deleteObject.

@Override
public void deleteObject(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration, IcObjectClass objectClass, IcUidAttribute uid) {
    Assert.notNull(connectorInstance, "Connector instance is required.");
    Assert.notNull(connectorInstance.getConnectorKey(), "Connector key is required.");
    Assert.notNull(connectorConfiguration, "Configuration is required.");
    Assert.notNull(uid, "Uid is required.");
    LOG.debug("Delete object - ConnId (Uid= {} {})", uid, connectorInstance.getConnectorKey().toString());
    ConnectorFacade conn = facadeFactory.getConnectorFacade(connectorInstance, connectorConfiguration);
    ObjectClass objectClassConnId = ConnIdIcConvertUtil.convertIcObjectClass(objectClass);
    if (objectClassConnId == null) {
        objectClassConnId = ObjectClass.ACCOUNT;
    }
    conn.delete(objectClassConnId, ConnIdIcConvertUtil.convertIcUid(uid), new OperationOptions(connectorConfiguration.getSystemOperationOptions()));
    LOG.debug("Deleted object - ConnId ({}) Uid= {}", connectorInstance.getConnectorKey().toString(), uid);
}
Also used : OperationOptions(org.identityconnectors.framework.common.objects.OperationOptions) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) ObjectClass(org.identityconnectors.framework.common.objects.ObjectClass) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) ConnectorFacade(org.identityconnectors.framework.api.ConnectorFacade)

Example 10 with ConnectorFacade

use of org.identityconnectors.framework.api.ConnectorFacade 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, "Connector instance is required.");
    Assert.notNull(connectorInstance.getConnectorKey(), "Connector key is required.");
    Assert.notNull(connectorConfiguration, "Configuration is required.");
    Assert.notNull(objectClass, "Object class is required.");
    Assert.notNull(handler, "Handler is required.");
    LOG.debug("Start search for connector {} and objectClass {} and filter {} - ConnId", connectorInstance.getConnectorKey().toString(), objectClass.getDisplayName(), filter);
    ConnectorFacade conn = facadeFactory.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);
    this.pageSearch(conn, objectClassConnId, filterConnId, handlerConnId, new OperationOptions(connectorConfiguration.getSystemOperationOptions()));
}
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) 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) SearchResultsHandler(org.identityconnectors.framework.spi.SearchResultsHandler)

Aggregations

ConnectorFacade (org.identityconnectors.framework.api.ConnectorFacade)12 IcConnectorFacade (eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade)8 IcObjectClass (eu.bcvsolutions.idm.ic.api.IcObjectClass)7 ObjectClass (org.identityconnectors.framework.common.objects.ObjectClass)7 OperationOptions (org.identityconnectors.framework.common.objects.OperationOptions)7 IcUidAttribute (eu.bcvsolutions.idm.ic.api.IcUidAttribute)3 APIConfiguration (org.identityconnectors.framework.api.APIConfiguration)3 ConnectorInfo (org.identityconnectors.framework.api.ConnectorInfo)3 IcAttribute (eu.bcvsolutions.idm.ic.api.IcAttribute)2 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)2 HashSet (java.util.HashSet)2 Attribute (org.identityconnectors.framework.common.objects.Attribute)2 ConnectorObject (org.identityconnectors.framework.common.objects.ConnectorObject)2 Uid (org.identityconnectors.framework.common.objects.Uid)2 ItemName (com.evolveum.midpoint.prism.path.ItemName)1 AsynchronousOperationResult (com.evolveum.midpoint.schema.result.AsynchronousOperationResult)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)1 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)1 IcConnectorInfo (eu.bcvsolutions.idm.ic.api.IcConnectorInfo)1