1 package org.onap.vid.job.command;
3 import com.google.common.collect.ImmutableMap;
4 import org.onap.vid.job.Job;
5 import org.onap.vid.job.JobCommand;
6 import org.onap.vid.job.NextCommand;
7 import org.springframework.beans.factory.config.ConfigurableBeanFactory;
8 import org.springframework.context.annotation.Scope;
9 import org.springframework.stereotype.Component;
11 import javax.ws.rs.client.ClientBuilder;
12 import javax.ws.rs.client.Entity;
13 import javax.ws.rs.core.Response;
15 import java.util.UUID;
19 @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
20 public class HttpCallCommand implements JobCommand {
24 public HttpCallCommand() {
27 public HttpCallCommand(String url, UUID uuid) {
32 public NextCommand call() {
33 final Response response = ClientBuilder.newClient().target(url).request().post(Entity.text(uuid.toString()));
34 return new NextCommand(Job.JobStatus.COMPLETED);
38 public HttpCallCommand init(UUID jobUuid, Map<String, Object> data) {
39 return init((String) data.get("url"), jobUuid);
42 private HttpCallCommand init(String url, UUID jobUuid) {
49 public Map<String, Object> getData() {
50 return ImmutableMap.of("url", url);