Account tAccount = (Account) expectedTarget;
expectedObjectMetadata.put("targetFuid", tAccount.getFuid());
expectedObjectMetadata.put("targetName", tAccount.getName());
} else if (expectedTarget instanceof InventoryItem) {
InventoryItem tInventoryItem = (InventoryItem) expectedTarget;
Connection tConnection = tInventoryItem.getConnection();
ConnectionProvider tConnectionProvider =
applicationManager.getConnectionProviderFactory()
.connectionProviderFromId(tConnection.getProviderId());
Map<String, Object> expectedInventoryItemMetadata = new HashMap<>();
InventoryService inventoryService = applicationManager.getInventoryService();
expectedObjectMetadata.put("targetExternalId", tInventoryItem.getExternalId());
expectedInventoryItemMetadata.put("targetConnectionId", tConnection.getId());
expectedInventoryItemMetadata.put("targetConnectionAlias", tConnection.getAlias());
expectedInventoryItemMetadata.put("targetConnectionHashtags", tConnection.getHashtags());
expectedInventoryItemMetadata.put("targetConnectionVersion", tConnection.getVersion());
expectedInventoryItemMetadata.put("targetProviderId", tConnectionProvider.getId());
expectedInventoryItemMetadata.put("targetProviderDisplayName", tConnectionProvider.getDisplayName());
expectedInventoryItemMetadata.put("targetProviderType", tConnectionProvider.getType());
if (tInventoryItem.getConnection().getProviderId().equals(ProviderIdConstants.AWS_PROVIDER_ID)) {
Location zone = inventoryService.getLocationByScope(tInventoryItem, LocationScope.ZONE);
Location region = inventoryService.getLocationByScope(tInventoryItem, LocationScope.REGION);
Set<String> iso3166Codes = zone != null ? zone.getIso3166Codes() : null;
String iso3166Code = iso3166Codes != null && iso3166Codes.size() >= 1 ?
iso3166Codes.iterator().next() :
null;
if (tInventoryItem.getType().equals(Constants.COMPUTE_INSTANCE_TYPE)) {
expectedObjectMetadata.put("targetIP",
inventoryService.getComputeInstanceIPAddress(tInventoryItem));
expectedObjectMetadata.put("targetOS",
inventoryService.getComputeInstanceOSName(tInventoryItem));
}