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);
}
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;
}
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);
}
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);
}
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()));
}
Aggregations