@Override
      public Set<Resource> invoke() throws AmbariException {
        String name = (String) properties.get(ARTIFACT_NAME_PROPERTY);
        validateParent(properties);

        Set<Resource> matchingResources = new HashSet<>();
        TreeMap<String, String> foreignKeys = createForeignKeyMap(properties);
        Set<String> requestPropertyIds = getRequestPropertyIds(request, predicate);
        if (name != null) {
          // find instance using name and foreign keys
          ArtifactEntity entity = artifactDAO.findByNameAndForeignKeys(name, foreignKeys);
          if (entity != null) {
            Resource instance = (toResource(entity, requestPropertyIds));
            if (predicate.evaluate(instance)) {
              matchingResources.add(instance);
            }
          }
        } else {
          // find collection using foreign keys only
          List<ArtifactEntity> results = artifactDAO.findByForeignKeys(foreignKeys);
          for (ArtifactEntity entity : results) {
            Resource resource = toResource(entity, requestPropertyIds);
            if (predicate.evaluate(resource)) {
              matchingResources.add(resource);
            }
          }
        }
        return matchingResources;
      }
Create a command to get the requested resources.

@param properties  request properties

@return a new get command
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ArtifactResourceProvider.java