private Resource toResource(ArtifactEntity entity, Set<String> requestedIds) throws AmbariException {
    Resource resource = new ResourceImpl(Resource.Type.Artifact);
    setResourceProperty(resource, ARTIFACT_NAME_PROPERTY, entity.getArtifactName(), requestedIds);
    setResourceProperty(resource, ARTIFACT_DATA_PROPERTY, entity.getArtifactData(), requestedIds);

    for (Map.Entry<String, String> entry : entity.getForeignKeys().entrySet()) {
      TypeRegistration typeRegistration = typeRegistrationsByShortFK.get(entry.getKey());
      setResourceProperty(resource, typeRegistration.getFKPropertyName(),
          typeRegistration.fromPersistId(entry.getValue()), requestedIds);
    }
    return resource;
  }
Create a resource instance from an artifact entity.
This will convert short fk property names to the full property name as well
as converting the value from the 'persist id' representation which is written
to the database.

@param entity        artifact entity
@param requestedIds  requested id's

@return a new resource instance for the given artifact entity
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ArtifactResourceProvider.java