// non cached ...
LOG.debug("Need one or more remote connections");
for (ExternalResource resource : getTargetResource(virAttr, type)) {
LOG.debug("Seach values into {}", resource.getName());
try {
final ConnectorObject connectorObject;
if (externalResources.containsKey(resource.getName())) {
connectorObject = externalResources.get(resource.getName());
} else {
LOG.debug("Perform connection to {}", resource.getName());
final String accountId = SchemaMappingUtil.getAccountIdValue(
owner, SchemaMappingUtil.getAccountIdMapping(resource.getMappings()));
if (StringUtils.isBlank(accountId)) {
throw new IllegalArgumentException("No AccountId found for " + resource.getName());
}
final Set<String> extAttrNames =
SchemaMappingUtil.getExtAttrNames(resource.getMappings(), type);
LOG.debug("External attribute ({}) names to get '{}'", type, extAttrNames);
final OperationOptionsBuilder oob = new OperationOptionsBuilder();
oob.setAttributesToGet(extAttrNames);
final ConnectorFacadeProxy connector = connInstanceLoader.getConnector(resource);
connectorObject = connector.getObject(ObjectClass.ACCOUNT, new Uid(accountId), oob.build());
externalResources.put(resource.getName(), connectorObject);
}
if (connectorObject != null) {
final Set<SchemaMapping> mappings = resource.getMappings(schemaName, type);
// the same virtual attribute could be mapped with one or more external attribute
for (SchemaMapping mapping : mappings) {
final Attribute attribute =
connectorObject.getAttributeByName(SchemaMappingUtil.getExtAttrName(mapping));
if (attribute != null && attribute.getValue() != null) {
for (Object obj : attribute.getValue()) {
if (obj != null) {
virAttr.addValue(obj.toString());