Change-Id: I0bf1a50843ab15a442a6edd20f86e44bced7d3df
Issue-ID: NONRTRIC-173
Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
public void notifyProducersJobDeleted(EiJob eiJob) {
AsyncRestClient restClient = restClient(false);
public void notifyProducersJobDeleted(EiJob eiJob) {
AsyncRestClient restClient = restClient(false);
- ProducerJobInfo request = new ProducerJobInfo(eiJob.jobData(), eiJob, eiJob.type());
+ ProducerJobInfo request = new ProducerJobInfo(eiJob);
String body = gson.toJson(request);
for (EiProducer producer : eiJob.type().getProducers()) {
restClient.post(producer.jobDeletionCallbackUrl(), body) //
String body = gson.toJson(request);
for (EiProducer producer : eiJob.type().getProducers()) {
restClient.post(producer.jobDeletionCallbackUrl(), body) //
public void notifyProducerJobStarted(EiProducer producer, EiJob eiJob) {
AsyncRestClient restClient = restClient(false);
public void notifyProducerJobStarted(EiProducer producer, EiJob eiJob) {
AsyncRestClient restClient = restClient(false);
- ProducerJobInfo request = new ProducerJobInfo(eiJob.jobData(), eiJob, eiJob.type());
+ ProducerJobInfo request = new ProducerJobInfo(eiJob);
String body = gson.toJson(request);
restClient.post(producer.jobCreationCallbackUrl(), body) //
String body = gson.toJson(request);
restClient.post(producer.jobCreationCallbackUrl(), body) //
import org.immutables.gson.Gson;
import org.oransc.enrichment.repository.EiJob;
import org.immutables.gson.Gson;
import org.oransc.enrichment.repository.EiJob;
-import org.oransc.enrichment.repository.EiType;
@Gson.TypeAdapters
@ApiModel(
@Gson.TypeAdapters
@ApiModel(
@JsonProperty("ei_job_data")
public Object jobData;
@JsonProperty("ei_job_data")
public Object jobData;
- public ProducerJobInfo(Object jobData, String id, String typeId) {
+ @ApiModelProperty(value = "URI for the target of the EI")
+ @SerializedName("target_uri")
+ @JsonProperty("target_uri")
+ public String targetUri;
+
+ public ProducerJobInfo(Object jobData, String id, String typeId, String targetUri) {
this.id = id;
this.jobData = jobData;
this.typeId = typeId;
this.id = id;
this.jobData = jobData;
this.typeId = typeId;
+ this.targetUri = targetUri;
- public ProducerJobInfo(Object jobData, EiJob job, EiType type) {
- this(jobData, job.id(), type.getId());
+ public ProducerJobInfo(EiJob job) {
+ this(job.jobData(), job.id(), job.type().getId(), job.targetUri());
}
public ProducerJobInfo() {
}
public ProducerJobInfo() {
.type(type) //
.owner(info.owner) //
.jobData(info.jobData) //
.type(type) //
.owner(info.owner) //
.jobData(info.jobData) //
+ .targetUri(info.targetUri) //
}
private ConsumerEiJobInfo toEiJobInfo(EiJob s) {
}
private ConsumerEiJobInfo toEiJobInfo(EiJob s) {
- return new ConsumerEiJobInfo(s.jobData(), s.owner());
+ return new ConsumerEiJobInfo(s.jobData(), s.owner(), s.targetUri());
@JsonProperty(value = "job_data", required = true)
public Object jobData;
@JsonProperty(value = "job_data", required = true)
public Object jobData;
+ @ApiModelProperty(value = "The target of the EI data", required = true)
+ @SerializedName("target_uri")
+ @JsonProperty(value = "target_uri", required = true)
+ public String targetUri;
+
public ConsumerEiJobInfo() {
}
public ConsumerEiJobInfo() {
}
- public ConsumerEiJobInfo(Object jobData, String owner) {
+ public ConsumerEiJobInfo(Object jobData, String owner, String targetUri) {
this.jobData = jobData;
this.owner = owner;
this.jobData = jobData;
this.owner = owner;
+ this.targetUri = targetUri;
Collection<ProducerJobInfo> producerJobs = new ArrayList<>();
for (EiType type : producer.eiTypes()) {
for (EiJob eiJob : this.eiJobs.getJobsForType(type)) {
Collection<ProducerJobInfo> producerJobs = new ArrayList<>();
for (EiType type : producer.eiTypes()) {
for (EiJob eiJob : this.eiJobs.getJobsForType(type)) {
- ProducerJobInfo request = new ProducerJobInfo(eiJob.jobData(), eiJob, eiJob.type());
+ ProducerJobInfo request = new ProducerJobInfo(eiJob);
producerJobs.add(request);
}
}
producerJobs.add(request);
}
}
String owner();
Object jobData();
String owner();
Object jobData();
String url = ConsumerConsts.API_ROOT + "/eitypes/typeId/eijobs/jobId";
// The element with name "property1" is mandatory in the schema
String url = ConsumerConsts.API_ROOT + "/eitypes/typeId/eijobs/jobId";
// The element with name "property1" is mandatory in the schema
- ConsumerEiJobInfo jobInfo = new ConsumerEiJobInfo(jsonObject("{ \"XXstring\" : \"value\" }"), "owner");
+ ConsumerEiJobInfo jobInfo =
+ new ConsumerEiJobInfo(jsonObject("{ \"XXstring\" : \"value\" }"), "owner", "targetUri");
String body = gson.toJson(jobInfo);
testErrorCode(restClient().put(url, body), HttpStatus.NOT_FOUND, "Json validation failure");
String body = gson.toJson(jobInfo);
testErrorCode(restClient().put(url, body), HttpStatus.NOT_FOUND, "Json validation failure");
}
ConsumerEiJobInfo eiJobInfo() throws JsonMappingException, JsonProcessingException {
}
ConsumerEiJobInfo eiJobInfo() throws JsonMappingException, JsonProcessingException {
- return new ConsumerEiJobInfo(jsonObject(), "owner");
+ return new ConsumerEiJobInfo(jsonObject(), "owner", "targetUri");
}
Object jsonObject(String json) {
}
Object jsonObject(String json) {