private Command<Void> getCreateCommand(final Map<String, Object> properties,
                                         final Map<String, String> requestInfoProps) {
    return new Command<Void>() {
      @Override
      public Void invoke() throws AmbariException {
        // ensure that parent exists
        validateParent(properties);

        String artifactName = String.valueOf(properties.get(ARTIFACT_NAME_PROPERTY));
        TreeMap<String, String> foreignKeyMap = createForeignKeyMap(properties);

        if (artifactDAO.findByNameAndForeignKeys(artifactName, foreignKeyMap) != null) {
          throw new DuplicateResourceException(String.format(
              "Attempted to create an artifact which already exists, artifact_name='%s', foreign_keys='%s'",
              artifactName, getRequestForeignKeys(properties)));
        }

        LOG.debug("Creating Artifact Resource with name '{}'. Parent information: {}",
            artifactName, getRequestForeignKeys(properties));

        artifactDAO.create(toEntity(properties, requestInfoProps.get(Request.REQUEST_INFO_BODY_PROPERTY)));

        return null;
      }
    };
  }
Create a command to create a resource.

@param properties        request properties
@param requestInfoProps  request info properties

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