"200": {
"description": "OK",
"schema": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/ei_job_request"
- }
+ "type": "string"
}
},
"401": {
"200": {
"description": "OK",
"schema": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/ei_producer"
- }
+ "type": "string"
}
},
"401": {
"deprecated": false
}
}
- },
- "definitions": {
- "ei_job_request": {
- "type": "object",
- "required": [
- "ei_job_identity"
- ],
- "properties": {
- "ei_job_data": {
- "type": "object",
- "description": "Json for the job data"
- },
- "ei_job_identity": {
- "type": "string",
- "description": "Identity of the EI job"
- },
- "ei_type_identity": {
- "type": "string",
- "description": "Type identity for the job"
- },
- "owner": {
- "type": "string",
- "description": "The owner of the job"
- },
- "target_uri": {
- "type": "string",
- "description": "URI for the target of the EI"
- }
- },
- "title": "ei_job_request",
- "description": "The EI job"
- },
- "ei_producer": {
- "type": "object",
- "required": [
- "ei_producer_id",
- "ei_producer_types",
- "status"
- ],
- "properties": {
- "ei_producer_id": {
- "type": "string",
- "description": "Idenitity of the EI producer"
- },
- "ei_producer_types": {
- "type": "array",
- "description": "Types provided by the EI producer",
- "items": {
- "type": "string"
- }
- },
- "status": {
- "type": "string",
- "description": "Status of the EI producer"
- }
- },
- "title": "ei_producer",
- "description": "The EI producer"
- }
}
}
*/
package org.oransc.portal.nonrtric.controlpanel.controller;
+import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
// Populated by the autowired constructor
private final EiProducerApi eiProducerApi;
+ public static com.google.gson.Gson gson = new GsonBuilder().create();
@Autowired
public EnrichmentController(final EiProducerApi eiProducerApi) {
@ApiOperation(value = "Get the EI job definitions for one EI producer")
@GetMapping(EI_JOBS)
- public ResponseEntity<List<JobInfo>> getEiJobs() {
+ public ResponseEntity<String> getEiJobs() {
logger.debug("getEiJobs");
ResponseEntity<String> response = this.eiProducerApi.getAllEiProducerIds();
JsonArray bodyJson = JsonParser.parseString(response.getBody()).getAsJsonArray();
for (JsonElement producerId : bodyJson) {
allJobs.addAll(getJobs(producerId));
}
- return new ResponseEntity<>(allJobs, HttpStatus.OK);
+ return new ResponseEntity<>(gson.toJson(allJobs), HttpStatus.OK);
}
private List<JobInfo> getJobs(JsonElement producerId) {
@ApiOperation(value = "Get EI producers")
@GetMapping(EI_PRODUCERS)
- public ResponseEntity<List<ProducerInfo>> getEiProducers() {
+ public ResponseEntity<String> getEiProducers() {
logger.debug("getEiProducers");
ResponseEntity<String> response = this.eiProducerApi.getAllEiProducerIds();
JsonArray bodyJson = JsonParser.parseString(response.getBody()).getAsJsonArray();
producers.add(producerInfo);
}
- return new ResponseEntity<>(producers, HttpStatus.OK);
+ return new ResponseEntity<>(gson.toJson(producers), HttpStatus.OK);
}
private String[] getSupportedTypes(JsonElement producerId) {
package org.oransc.portal.nonrtric.controlpanel.model;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
import io.swagger.annotations.ApiModel;
@ApiModelProperty(value = "Identity of the EI job", required = true)
@SerializedName("ei_job_identity")
- @JsonProperty("ei_job_identity")
public String id;
@ApiModelProperty(value = "Type identity for the job")
@SerializedName("ei_type_identity")
- @JsonProperty("ei_type_identity")
public String typeId;
@ApiModelProperty(value = "Json for the job data")
@SerializedName("ei_job_data")
- @JsonProperty("ei_job_data")
public Object jobData;
@ApiModelProperty(value = "URI for the target of the EI")
@SerializedName("target_uri")
- @JsonProperty("target_uri")
public String targetUri;
@ApiModelProperty(value = "The owner of the job")
@SerializedName("owner")
- @JsonProperty("owner")
public String owner;
}
*/
package org.oransc.portal.nonrtric.controlpanel.model;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
public class PolicyType {
- @JsonProperty("name")
String name;
- @JsonProperty("schema")
Object schema;
public PolicyType(String name, Object schema) {
package org.oransc.portal.nonrtric.controlpanel.model;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
import io.swagger.annotations.ApiModel;
@ApiModelProperty(value = "Idenitity of the EI producer", required = true)
@SerializedName("ei_producer_id")
- @JsonProperty("ei_producer_id")
public String id;
@ApiModelProperty(value = "Types provided by the EI producer", required = true)
@SerializedName("ei_producer_types")
- @JsonProperty("ei_producer_types")
public String[] types;
@ApiModelProperty(value = "Status of the EI producer", required = true)
@SerializedName("status")
- @JsonProperty("status")
public String status;
}
package org.oransc.portal.nonrtric.controlpanel.model;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
import io.swagger.annotations.ApiModel;
@ApiModelProperty(value = "EI type identity", required = true)
@SerializedName("ei_type_identity")
- @JsonProperty(value = "ei_type_identity", required = true)
public String eiTypeId;
@ApiModelProperty(value = "Json schema for the job data")
@SerializedName("ei_job_data_schema")
- @JsonProperty("ei_job_data_schema")
public Object jobDataSchema;
}
@ApiModelProperty(value = "Supported EI types", required = true)
@SerializedName("supported_ei_types")
- @JsonProperty(value = "supported_ei_types", required = true)
public Collection<ProducerEiTypeRegistrationInfo> types;
@ApiModelProperty(value = "callback for EI job", required = true)
@SerializedName("ei_job_callback_url")
- @JsonProperty(value = "ei_job_callback_url", required = true)
public String jobCallbackUrl;
@ApiModelProperty(value = "callback for producer supervision", required = true)
@SerializedName("ei_producer_supervision_callback_url")
- @JsonProperty(value = "ei_producer_supervision_callback_url", required = true)
public String producerSupervisionCallbackUrl;
@ApiModelProperty(value = "status", required = true)
@SerializedName("status")
- @JsonProperty(value = "status", required = true)
public ProducerStatusInfo status;
}
package org.oransc.portal.nonrtric.controlpanel.model;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
import lombok.Builder;
}
@SerializedName("operational_state")
- @JsonProperty(value = "operational_state", required = true)
public final OperationalState opState;
public ProducerStatusInfo(OperationalState state) {