private Cluster getCluster(ArtifactEntity artifactEntity) {
    if (artifactEntity != null) {
      Map<String, String> keys = artifactEntity.getForeignKeys();
      if (keys != null) {
        String clusterId = keys.get("cluster");
        if (StringUtils.isNumeric(clusterId)) {
          Clusters clusters = injector.getInstance(Clusters.class);
          try {
            return clusters.getCluster(Long.valueOf(clusterId));
          } catch (AmbariException e) {
            LOG.error(String.format("Failed to obtain cluster using cluster id %s -  %s", clusterId, e.getMessage()), e);
          }
        } else {
          LOG.error(String.format("Failed to obtain cluster id from artifact entity with foreign keys: %s", keys));
        }
      }
    }

    return null;
  }
Retrieves the relevant {@link Cluster} given information from the suppliied {@link ArtifactEntity}.
<p>
The cluster id value is taken from the entity's foreign key value and then used to obtain the cluster object.

@param artifactEntity an {@link ArtifactEntity}
@return a {@link Cluster}
ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java