aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src
diff options
context:
space:
mode:
authorElena Kuleshov <evn@att.com>2019-03-26 19:10:24 -0400
committerElena Kuleshov <evn@att.com>2019-03-26 20:17:46 -0400
commitd08dc21fbfdcd078a6d11e9fa0f50573bae2ce32 (patch)
tree1f30cea1875892cc11b381eadd3767d3c9654a05 /mso-api-handlers/mso-api-handler-infra/src
parent2f2a07e0e5cd5f8ecc5a3fed71f296cb3896809a (diff)
Add WorkflowSpecification Beans for APIH
Add WorkflorSpecification beans and handling mechanism Change-Id: Iaabd5696f9ddc4cca87c6fb77da42042b758932d Issue-ID: SO-1543 Signed-off-by: Kuleshov, Elena <evn@att.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java90
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/ActivitySequence.java86
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/ArtifactInfo.java226
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/Validation.java86
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowInputParameter.java167
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowSpecification.java107
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowSpecificationList.java66
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowSpecifications.java67
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BeanMultiTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java82
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowSpecificationBeansTest.java40
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/WorkflowSpecifications.json116
13 files changed, 1135 insertions, 0 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
index 182e398461..5790f1afe9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
@@ -62,6 +62,7 @@ public class JerseyConfiguration extends ResourceConfig {
register(RuntimeExceptionMapper.class);
register(RequestUriFilter.class);
register(E2EServiceInstances.class);
+ register(WorkflowSpecificationsHandler.class);
// this registration seems to be needed to get predictable
// execution behavior for the above JSON Exception Mappers
register(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.class);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
new file mode 100644
index 0000000000..50af294fdf
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
@@ -0,0 +1,90 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.apihandlerinfra;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import javax.transaction.Transactional;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Response;
+
+import org.apache.http.HttpStatus;
+
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandler.common.ResponseBuilder;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.apihandlerinfra.workflowspecificationbeans.WorkflowSpecifications;
+import org.onap.so.logger.MessageEnum;
+
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+@Path("onap/so/infra/workflowSpecifications")
+@Api(value="onap/so/infra/workflowSpecifications",description="Queries of Workflow Specifications")
+@Component
+public class WorkflowSpecificationsHandler {
+
+ @Autowired
+ private ResponseBuilder builder;
+
+ @Path("/{version:[vV]1}/workflows")
+ @GET
+ @ApiOperation(value="Finds Workflow Specifications",response=Response.class)
+ @Transactional
+ public Response queryFilters (@QueryParam("vnfModelVersionId") String vnfModelVersionId,
+ @PathParam("version") String version) throws Exception {
+
+ String apiVersion = version.substring(1);
+
+ ObjectMapper mapper1 = new ObjectMapper();
+ mapper1.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+
+ //Replace with Catalog DB Query
+ WorkflowSpecifications workflowSpecifications = mapper1.readValue(new String(Files.readAllBytes(Paths.get("src/test/resources/__files/WorkflowSpecifications.json"))), WorkflowSpecifications.class);
+
+ String jsonResponse = null;
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ jsonResponse = mapper.writeValueAsString(workflowSpecifications);
+ }
+ catch (JsonProcessingException e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+
+ return builder.buildResponse(HttpStatus.SC_ACCEPTED, "", jsonResponse, apiVersion);
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/ActivitySequence.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/ActivitySequence.java
new file mode 100644
index 0000000000..594b43e07d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/ActivitySequence.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.apihandlerinfra.workflowspecificationbeans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "name",
+ "description"
+})
+public class ActivitySequence {
+
+ @JsonProperty("name")
+ private String name;
+ @JsonProperty("description")
+ private String description;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public ActivitySequence() {
+ }
+
+ /**
+ *
+ * @param description
+ * @param name
+ */
+ public ActivitySequence(String name, String description) {
+ super();
+ this.name = name;
+ this.description = description;
+ }
+
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ @JsonProperty("name")
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public ActivitySequence withName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ @JsonProperty("description")
+ public String getDescription() {
+ return description;
+ }
+
+ @JsonProperty("description")
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public ActivitySequence withDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/ArtifactInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/ArtifactInfo.java
new file mode 100644
index 0000000000..0861ff2033
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/ArtifactInfo.java
@@ -0,0 +1,226 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.apihandlerinfra.workflowspecificationbeans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "artifactType",
+ "artifactUuid",
+ "artifactName",
+ "artifactVersion",
+ "artifactDescription",
+ "workflowName",
+ "operationName",
+ "workflowSource",
+ "workflowResourceTarget"
+})
+public class ArtifactInfo {
+
+ @JsonProperty("artifactType")
+ private String artifactType;
+ @JsonProperty("artifactUuid")
+ private String artifactUuid;
+ @JsonProperty("artifactName")
+ private String artifactName;
+ @JsonProperty("artifactVersion")
+ private String artifactVersion;
+ @JsonProperty("artifactDescription")
+ private String artifactDescription;
+ @JsonProperty("workflowName")
+ private String workflowName;
+ @JsonProperty("operationName")
+ private String operationName;
+ @JsonProperty("workflowSource")
+ private String workflowSource;
+ @JsonProperty("workflowResourceTarget")
+ private String workflowResourceTarget;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public ArtifactInfo() {
+ }
+
+ /**
+ *
+ * @param artifactName
+ * @param workflowName
+ * @param artifactType
+ * @param operationName
+ * @param artifactVersion
+ * @param workflowResourceTarget
+ * @param workflowSource
+ * @param artifactUuid
+ * @param artifactDescription
+ */
+ public ArtifactInfo(String artifactType, String artifactUuid, String artifactName, String artifactVersion, String artifactDescription, String workflowName, String operationName, String workflowSource, String workflowResourceTarget) {
+ super();
+ this.artifactType = artifactType;
+ this.artifactUuid = artifactUuid;
+ this.artifactName = artifactName;
+ this.artifactVersion = artifactVersion;
+ this.artifactDescription = artifactDescription;
+ this.workflowName = workflowName;
+ this.operationName = operationName;
+ this.workflowSource = workflowSource;
+ this.workflowResourceTarget = workflowResourceTarget;
+ }
+
+ @JsonProperty("artifactType")
+ public String getArtifactType() {
+ return artifactType;
+ }
+
+ @JsonProperty("artifactType")
+ public void setArtifactType(String artifactType) {
+ this.artifactType = artifactType;
+ }
+
+ public ArtifactInfo withArtifactType(String artifactType) {
+ this.artifactType = artifactType;
+ return this;
+ }
+
+ @JsonProperty("artifactUuid")
+ public String getArtifactUuid() {
+ return artifactUuid;
+ }
+
+ @JsonProperty("artifactUuid")
+ public void setArtifactUuid(String artifactUuid) {
+ this.artifactUuid = artifactUuid;
+ }
+
+ public ArtifactInfo withArtifactUuid(String artifactUuid) {
+ this.artifactUuid = artifactUuid;
+ return this;
+ }
+
+ @JsonProperty("artifactName")
+ public String getArtifactName() {
+ return artifactName;
+ }
+
+ @JsonProperty("artifactName")
+ public void setArtifactName(String artifactName) {
+ this.artifactName = artifactName;
+ }
+
+ public ArtifactInfo withArtifactName(String artifactName) {
+ this.artifactName = artifactName;
+ return this;
+ }
+
+ @JsonProperty("artifactVersion")
+ public String getArtifactVersion() {
+ return artifactVersion;
+ }
+
+ @JsonProperty("artifactVersion")
+ public void setArtifactVersion(String artifactVersion) {
+ this.artifactVersion = artifactVersion;
+ }
+
+ public ArtifactInfo withArtifactVersion(String artifactVersion) {
+ this.artifactVersion = artifactVersion;
+ return this;
+ }
+
+ @JsonProperty("artifactDescription")
+ public String getArtifactDescription() {
+ return artifactDescription;
+ }
+
+ @JsonProperty("artifactDescription")
+ public void setArtifactDescription(String artifactDescription) {
+ this.artifactDescription = artifactDescription;
+ }
+
+ public ArtifactInfo withArtifactDescription(String artifactDescription) {
+ this.artifactDescription = artifactDescription;
+ return this;
+ }
+
+ @JsonProperty("workflowName")
+ public String getWorkflowName() {
+ return workflowName;
+ }
+
+ @JsonProperty("workflowName")
+ public void setWorkflowName(String workflowName) {
+ this.workflowName = workflowName;
+ }
+
+ public ArtifactInfo withWorkflowName(String workflowName) {
+ this.workflowName = workflowName;
+ return this;
+ }
+
+ @JsonProperty("operationName")
+ public String getOperationName() {
+ return operationName;
+ }
+
+ @JsonProperty("operationName")
+ public void setOperationName(String operationName) {
+ this.operationName = operationName;
+ }
+
+ public ArtifactInfo withOperationName(String operationName) {
+ this.operationName = operationName;
+ return this;
+ }
+
+ @JsonProperty("workflowSource")
+ public String getWorkflowSource() {
+ return workflowSource;
+ }
+
+ @JsonProperty("workflowSource")
+ public void setWorkflowSource(String workflowSource) {
+ this.workflowSource = workflowSource;
+ }
+
+ public ArtifactInfo withWorkflowSource(String workflowSource) {
+ this.workflowSource = workflowSource;
+ return this;
+ }
+
+ @JsonProperty("workflowResourceTarget")
+ public String getWorkflowResourceTarget() {
+ return workflowResourceTarget;
+ }
+
+ @JsonProperty("workflowResourceTarget")
+ public void setWorkflowResourceTarget(String workflowResourceTarget) {
+ this.workflowResourceTarget = workflowResourceTarget;
+ }
+
+ public ArtifactInfo withWorkflowResourceTarget(String workflowResourceTarget) {
+ this.workflowResourceTarget = workflowResourceTarget;
+ return this;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/Validation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/Validation.java
new file mode 100644
index 0000000000..3a4d5cb5f0
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/Validation.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.apihandlerinfra.workflowspecificationbeans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "maxLength",
+ "allowableChars"
+})
+public class Validation {
+
+ @JsonProperty("maxLength")
+ private String maxLength;
+ @JsonProperty("allowableChars")
+ private String allowableChars;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public Validation() {
+ }
+
+ /**
+ *
+ * @param maxLength
+ * @param allowableChars
+ */
+ public Validation(String maxLength, String allowableChars) {
+ super();
+ this.maxLength = maxLength;
+ this.allowableChars = allowableChars;
+ }
+
+ @JsonProperty("maxLength")
+ public String getMaxLength() {
+ return maxLength;
+ }
+
+ @JsonProperty("maxLength")
+ public void setMaxLength(String maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ public Validation withMaxLength(String maxLength) {
+ this.maxLength = maxLength;
+ return this;
+ }
+
+ @JsonProperty("allowableChars")
+ public String getAllowableChars() {
+ return allowableChars;
+ }
+
+ @JsonProperty("allowableChars")
+ public void setAllowableChars(String allowableChars) {
+ this.allowableChars = allowableChars;
+ }
+
+ public Validation withAllowableChars(String allowableChars) {
+ this.allowableChars = allowableChars;
+ return this;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowInputParameter.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowInputParameter.java
new file mode 100644
index 0000000000..416442c216
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowInputParameter.java
@@ -0,0 +1,167 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.apihandlerinfra.workflowspecificationbeans;
+
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "label",
+ "inputType",
+ "required",
+ "validation",
+ "soFieldName",
+ "soPayloadLocation"
+})
+public class WorkflowInputParameter {
+
+ @JsonProperty("label")
+ private String label;
+ @JsonProperty("inputType")
+ private String inputType;
+ @JsonProperty("required")
+ private Boolean required;
+ @JsonProperty("validation")
+ private List<Validation> validation = null;
+ @JsonProperty("soFieldName")
+ private String soFieldName;
+ @JsonProperty("soPayloadLocation")
+ private String soPayloadLocation;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public WorkflowInputParameter() {
+ }
+
+ /**
+ *
+ * @param validation
+ * @param inputType
+ * @param soPayloadLocation
+ * @param label
+ * @param required
+ * @param soFieldName
+ */
+ public WorkflowInputParameter(String label, String inputType, Boolean required, List<Validation> validation, String soFieldName, String soPayloadLocation) {
+ super();
+ this.label = label;
+ this.inputType = inputType;
+ this.required = required;
+ this.validation = validation;
+ this.soFieldName = soFieldName;
+ this.soPayloadLocation = soPayloadLocation;
+ }
+
+ @JsonProperty("label")
+ public String getLabel() {
+ return label;
+ }
+
+ @JsonProperty("label")
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public WorkflowInputParameter withLabel(String label) {
+ this.label = label;
+ return this;
+ }
+
+ @JsonProperty("inputType")
+ public String getInputType() {
+ return inputType;
+ }
+
+ @JsonProperty("inputType")
+ public void setInputType(String inputType) {
+ this.inputType = inputType;
+ }
+
+ public WorkflowInputParameter withInputType(String inputType) {
+ this.inputType = inputType;
+ return this;
+ }
+
+ @JsonProperty("required")
+ public Boolean getRequired() {
+ return required;
+ }
+
+ @JsonProperty("required")
+ public void setRequired(Boolean required) {
+ this.required = required;
+ }
+
+ public WorkflowInputParameter withRequired(Boolean required) {
+ this.required = required;
+ return this;
+ }
+
+ @JsonProperty("validation")
+ public List<Validation> getValidation() {
+ return validation;
+ }
+
+ @JsonProperty("validation")
+ public void setValidation(List<Validation> validation) {
+ this.validation = validation;
+ }
+
+ public WorkflowInputParameter withValidation(List<Validation> validation) {
+ this.validation = validation;
+ return this;
+ }
+
+ @JsonProperty("soFieldName")
+ public String getSoFieldName() {
+ return soFieldName;
+ }
+
+ @JsonProperty("soFieldName")
+ public void setSoFieldName(String soFieldName) {
+ this.soFieldName = soFieldName;
+ }
+
+ public WorkflowInputParameter withSoFieldName(String soFieldName) {
+ this.soFieldName = soFieldName;
+ return this;
+ }
+
+ @JsonProperty("soPayloadLocation")
+ public String getSoPayloadLocation() {
+ return soPayloadLocation;
+ }
+
+ @JsonProperty("soPayloadLocation")
+ public void setSoPayloadLocation(String soPayloadLocation) {
+ this.soPayloadLocation = soPayloadLocation;
+ }
+
+ public WorkflowInputParameter withSoPayloadLocation(String soPayloadLocation) {
+ this.soPayloadLocation = soPayloadLocation;
+ return this;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowSpecification.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowSpecification.java
new file mode 100644
index 0000000000..86dc44ef39
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowSpecification.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.apihandlerinfra.workflowspecificationbeans;
+
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "artifactInfo",
+ "activitySequence",
+ "workflowInputParameters"
+})
+public class WorkflowSpecification {
+
+ @JsonProperty("artifactInfo")
+ private ArtifactInfo artifactInfo;
+ @JsonProperty("activitySequence")
+ private List<ActivitySequence> activitySequence = null;
+ @JsonProperty("workflowInputParameters")
+ private List<WorkflowInputParameter> workflowInputParameters = null;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public WorkflowSpecification() {
+ }
+
+ /**
+ *
+ * @param activitySequence
+ * @param artifactInfo
+ * @param workflowInputParameters
+ */
+ public WorkflowSpecification(ArtifactInfo artifactInfo, List<ActivitySequence> activitySequence, List<WorkflowInputParameter> workflowInputParameters) {
+ super();
+ this.artifactInfo = artifactInfo;
+ this.activitySequence = activitySequence;
+ this.workflowInputParameters = workflowInputParameters;
+ }
+
+ @JsonProperty("artifactInfo")
+ public ArtifactInfo getArtifactInfo() {
+ return artifactInfo;
+ }
+
+ @JsonProperty("artifactInfo")
+ public void setArtifactInfo(ArtifactInfo artifactInfo) {
+ this.artifactInfo = artifactInfo;
+ }
+
+ public WorkflowSpecification withArtifactInfo(ArtifactInfo artifactInfo) {
+ this.artifactInfo = artifactInfo;
+ return this;
+ }
+
+ @JsonProperty("activitySequence")
+ public List<ActivitySequence> getActivitySequence() {
+ return activitySequence;
+ }
+
+ @JsonProperty("activitySequence")
+ public void setActivitySequence(List<ActivitySequence> activitySequence) {
+ this.activitySequence = activitySequence;
+ }
+
+ public WorkflowSpecification withActivitySequence(List<ActivitySequence> activitySequence) {
+ this.activitySequence = activitySequence;
+ return this;
+ }
+
+ @JsonProperty("workflowInputParameters")
+ public List<WorkflowInputParameter> getWorkflowInputParameters() {
+ return workflowInputParameters;
+ }
+
+ @JsonProperty("workflowInputParameters")
+ public void setWorkflowInputParameters(List<WorkflowInputParameter> workflowInputParameters) {
+ this.workflowInputParameters = workflowInputParameters;
+ }
+
+ public WorkflowSpecification withWorkflowInputParameters(List<WorkflowInputParameter> workflowInputParameters) {
+ this.workflowInputParameters = workflowInputParameters;
+ return this;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowSpecificationList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowSpecificationList.java
new file mode 100644
index 0000000000..c6bf4e3d41
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowSpecificationList.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.apihandlerinfra.workflowspecificationbeans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "workflowSpecification"
+})
+public class WorkflowSpecificationList {
+
+ @JsonProperty("workflowSpecification")
+ private WorkflowSpecification workflowSpecification;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public WorkflowSpecificationList() {
+ }
+
+ /**
+ *
+ * @param workflowSpecification
+ */
+ public WorkflowSpecificationList(WorkflowSpecification workflowSpecification) {
+ super();
+ this.workflowSpecification = workflowSpecification;
+ }
+
+ @JsonProperty("workflowSpecification")
+ public WorkflowSpecification getWorkflowSpecification() {
+ return workflowSpecification;
+ }
+
+ @JsonProperty("workflowSpecification")
+ public void setWorkflowSpecification(WorkflowSpecification workflowSpecification) {
+ this.workflowSpecification = workflowSpecification;
+ }
+
+ public WorkflowSpecificationList withWorkflowSpecification(WorkflowSpecification workflowSpecification) {
+ this.workflowSpecification = workflowSpecification;
+ return this;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowSpecifications.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowSpecifications.java
new file mode 100644
index 0000000000..ffe9980af4
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowSpecifications.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.apihandlerinfra.workflowspecificationbeans;
+
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "workflowSpecificationList"
+})
+public class WorkflowSpecifications {
+
+ @JsonProperty("workflowSpecificationList")
+ private List<WorkflowSpecificationList> workflowSpecificationList = null;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public WorkflowSpecifications() {
+ }
+
+ /**
+ *
+ * @param workflowSpecificationList
+ */
+ public WorkflowSpecifications(List<WorkflowSpecificationList> workflowSpecificationList) {
+ super();
+ this.workflowSpecificationList = workflowSpecificationList;
+ }
+
+ @JsonProperty("workflowSpecificationList")
+ public List<WorkflowSpecificationList> getWorkflowSpecificationList() {
+ return workflowSpecificationList;
+ }
+
+ @JsonProperty("workflowSpecificationList")
+ public void setWorkflowSpecificationList(List<WorkflowSpecificationList> workflowSpecificationList) {
+ this.workflowSpecificationList = workflowSpecificationList;
+ }
+
+ public WorkflowSpecifications withWorkflowSpecificationList(List<WorkflowSpecificationList> workflowSpecificationList) {
+ this.workflowSpecificationList = workflowSpecificationList;
+ return this;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BeanMultiTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BeanMultiTest.java
index 68c5c918ba..e249c2d8ef 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BeanMultiTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BeanMultiTest.java
@@ -53,6 +53,7 @@ public class BeanMultiTest {
test("org.onap.so.apihandlerinfra.tasksbeans");
test("org.onap.so.apihandlerinfra.vnfbeans");
test("org.onap.so.apihandlerinfra.tenantisolationbeans");
+ test("org.onap.so.apihandlerinfra.workflowspecificationbeans");
}
private void test(String packageName) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
new file mode 100644
index 0000000000..1a2eca6300
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra;
+
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.text.ParseException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.json.JSONException;
+import org.junit.Test;
+import org.onap.so.apihandlerinfra.workflowspecificationbeans.WorkflowSpecifications;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.util.UriComponentsBuilder;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class WorkflowSpecificationsHandlerTest extends BaseTest{
+
+ private final String basePath = "onap/so/infra/workflowSpecifications/v1/workflows";
+
+ @Test
+ public void getTasksTestByOriginalRequestId() throws ParseException, JSONException, JsonParseException, JsonMappingException, IOException{
+
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath))
+ .queryParam("vnfModelVersionId", "b5fa707a-f55a-11e7-a796-005056856d52");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+
+ WorkflowSpecifications expectedResponse = mapper.readValue(new String(Files.readAllBytes(Paths.get("src/test/resources/__files/WorkflowSpecifications.json"))), WorkflowSpecifications.class);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ WorkflowSpecifications realResponse = mapper.readValue(response.getBody(), WorkflowSpecifications.class);
+ assertThat(realResponse, sameBeanAs(expectedResponse));
+ assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
+ assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
+ assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
+ assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0));
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowSpecificationBeansTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowSpecificationBeansTest.java
new file mode 100644
index 0000000000..c469a56e48
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/workflowspecificationbeans/WorkflowSpecificationBeansTest.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.apihandlerinfra.workflowspecificationbeans;
+
+import org.junit.Test;
+import org.onap.so.apihandlerinfra.BaseTest;
+
+import com.openpojo.reflection.filters.FilterPackageInfo;
+import com.openpojo.validation.Validator;
+import com.openpojo.validation.ValidatorBuilder;
+import com.openpojo.validation.rule.impl.GetterMustExistRule;
+import com.openpojo.validation.rule.impl.SetterMustExistRule;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
+
+public class WorkflowSpecificationBeansTest extends BaseTest{
+ @Test
+ public void validateGettersAndSetters() {
+ Validator validator = ValidatorBuilder.create().with(new SetterMustExistRule(), new GetterMustExistRule())
+ .with(new SetterTester(), new GetterTester()).build();
+ validator.validate("org.onap.so.apihandlerinfra.tasksbeans", new FilterPackageInfo());
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/WorkflowSpecifications.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/WorkflowSpecifications.json
new file mode 100644
index 0000000000..beca93bd70
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/WorkflowSpecifications.json
@@ -0,0 +1,116 @@
+{
+ "workflowSpecificationList": [
+ {
+ "workflowSpecification": {
+ "artifactInfo": {
+ "artifactType": "workflow",
+ "artifactUuid": "ab6478e4-ea33-3346-ac12-ab121484a333",
+ "artifactName": "inPlaceSoftwareUpdate-1_0.bpmn",
+ "artifactVersion": "1.0",
+ "artifactDescription": "xyz xyz",
+ "workflowName": "inPlaceSoftwareUpdate",
+ "operationName": "inPlaceSoftwareUpdate",
+ "workflowSource": "sdc",
+ "workflowResourceTarget": "vnf"
+ },
+ "activitySequence": [
+ {
+ "name": "VNFQuiesceTrafficActivity",
+ "description": "Activity to QuiesceTraffic on VNF"
+ },
+ {
+ "name": "VNFHealthCheckActivity",
+ "description": "Activity to HealthCheck VNF"
+ },
+ {
+ "name": "FlowCompleteActivity",
+ "description": "Activity to Complete the BPMN Flow"
+ }
+ ],
+ "workflowInputParameters": [
+ {
+ "label": "Cloud Owner",
+ "inputType": "text",
+ "required": true,
+ "validation": [
+ {
+ "maxLength": "7",
+ "allowableChars": "someRegEx"
+ }
+ ],
+ "soFieldName": "cloudOwner",
+ "soPayloadLocation": "cloudConfiguration"
+ },
+ {
+ "label": "Cloud Region ID",
+ "inputType": "text",
+ "required": true,
+ "validation": [
+ {
+ "maxLength": "7",
+ "allowableChars": "someRegEx"
+ }
+ ],
+ "soFieldName": "lcpCloudRegionId",
+ "soPayloadLocation": "cloudConfiguration"
+ },
+ {
+ "label": "Tenant/Project ID",
+ "inputType": "text",
+ "required": true,
+ "validation": [
+ {
+ "maxLength": "36",
+ "allowableChars": "someRegEx"
+ }
+ ],
+ "soFieldName": "tenantId",
+ "soPayloadLocation": "cloudConfiguration"
+ },
+ {
+ "label": "Operations Timeout",
+ "inputType": "text",
+ "required": true,
+ "validation": [
+ {
+ "maxLength": "50",
+ "allowableChars": "someRegEx"
+ }
+ ],
+ "soFieldName": "operations_timeout",
+ "soPayloadLocation": "userParams"
+ },
+ {
+ "label": "Existing Software Version",
+ "inputType": "text",
+ "required": true,
+ "validation": [
+ {
+ "maxLength": "50",
+ "allowableChars": "someRegEx"
+ }
+ ],
+ "soFieldName": "existing_software_version",
+ "soPayloadLocation": "userParams"
+ },
+ {
+ "label": "New Software Version",
+ "inputType": "text",
+ "required": true,
+ "validation": [
+ {
+ "maxLength": "50",
+ "allowableChars": "someRegEx"
+ }
+ ],
+ "soFieldName": "new_software_version",
+ "soPayloadLocation": "userParams"
+ }
+ ]
+ }
+ },
+ {
+ "workflowSpecification": {}
+ }
+ ]
+}