From b337097739ba195b5d7a8cbb71c2f0e7f0e74d30 Mon Sep 17 00:00:00 2001 From: renrak15 Date: Wed, 26 Aug 2020 18:49:14 +0530 Subject: Transformation of request/response payloads for SDC Integration for POST /serviceSpecification Swagger changes and model classes Issue-ID: EXTAPI-487 Change-Id: I1ae29c643fe9c84856e3e0ec08e0776e724924d0 Signed-off-by: renrak15 --- .../PostServiceResponseSpecJsonTransformer.java | 53 ++++ .../jolt/PostServiceSpecJsonTransformer.java | 48 ++++ .../nbi/apis/servicecatalog/model/Attachment.java | 220 ++++++++++++++ .../servicecatalog/model/DistributionStatus.java | 45 +++ .../model/LifecycleStatusValues.java | 49 ++++ .../apis/servicecatalog/model/RelatedPartyRef.java | 80 ++++++ .../model/ResourceSpecificationRef.java | 172 +++++++++++ .../model/ServiceSpecCharacteristicRequest.java | 144 ++++++++++ .../ServiceSpecCharacteristicValueRequest.java | 78 +++++ .../model/ServiceSpecificationRequest.java | 320 +++++++++++++++++++++ .../model/TargetServiceSchemaRef.java | 60 ++++ 11 files changed, 1269 insertions(+) create mode 100644 src/main/java/org/onap/nbi/apis/servicecatalog/jolt/PostServiceResponseSpecJsonTransformer.java create mode 100644 src/main/java/org/onap/nbi/apis/servicecatalog/jolt/PostServiceSpecJsonTransformer.java create mode 100644 src/main/java/org/onap/nbi/apis/servicecatalog/model/Attachment.java create mode 100644 src/main/java/org/onap/nbi/apis/servicecatalog/model/DistributionStatus.java create mode 100644 src/main/java/org/onap/nbi/apis/servicecatalog/model/LifecycleStatusValues.java create mode 100644 src/main/java/org/onap/nbi/apis/servicecatalog/model/RelatedPartyRef.java create mode 100644 src/main/java/org/onap/nbi/apis/servicecatalog/model/ResourceSpecificationRef.java create mode 100644 src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecCharacteristicRequest.java create mode 100644 src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecCharacteristicValueRequest.java create mode 100644 src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecificationRequest.java create mode 100644 src/main/java/org/onap/nbi/apis/servicecatalog/model/TargetServiceSchemaRef.java (limited to 'src/main/java/org') diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/PostServiceResponseSpecJsonTransformer.java b/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/PostServiceResponseSpecJsonTransformer.java new file mode 100644 index 0000000..d9b10b3 --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/PostServiceResponseSpecJsonTransformer.java @@ -0,0 +1,53 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 + * =================================================================== + * 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.nbi.apis.servicecatalog.jolt; + +import java.util.List; + +import org.onap.nbi.exceptions.TechnicalException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import com.bazaarvoice.jolt.Chainr; +import com.bazaarvoice.jolt.JsonUtils; +import com.bazaarvoice.jolt.exception.JoltException; + +/** + * @author rakeshgirijaramesannair + * + */ +@Service +public class PostServiceResponseSpecJsonTransformer { + private Chainr chainr; + + private static final Logger LOGGER = LoggerFactory.getLogger(PostServiceSpecJsonTransformer.class); + + public PostServiceResponseSpecJsonTransformer() { + List specs = JsonUtils.classpathToList("/jolt/postServiceCatalogResponse.json"); + this.chainr = Chainr.fromSpec(specs); + } + + public Object transform(Object serviceSpec) { + Object output = null; + try { + output = chainr.transform(serviceSpec); + } catch (JoltException joE) { + LOGGER.error("Unable to transform SDC response to TMF format with JOLT Transformer -Ext API Post", joE); + throw new TechnicalException("Error while parsing ONAP SDC response"); + } + return output; + } + +} diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/PostServiceSpecJsonTransformer.java b/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/PostServiceSpecJsonTransformer.java new file mode 100644 index 0000000..80b82d8 --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/PostServiceSpecJsonTransformer.java @@ -0,0 +1,48 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 NikhilMohan + * =================================================================== + * 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.nbi.apis.servicecatalog.jolt; + +import com.bazaarvoice.jolt.Chainr; +import com.bazaarvoice.jolt.JsonUtils; +import com.bazaarvoice.jolt.exception.JoltException; +import org.onap.nbi.exceptions.TechnicalException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class PostServiceSpecJsonTransformer { + private Chainr chainr; + + private static final Logger LOGGER = LoggerFactory.getLogger(PostServiceSpecJsonTransformer.class); + + public PostServiceSpecJsonTransformer() { + List specs = JsonUtils.classpathToList("/jolt/postServiceCatalog.json"); + this.chainr = Chainr.fromSpec(specs); + } + + public Object transform(Object serviceSpec) { + Object output = null; + try { + output = chainr.transform(serviceSpec); + } catch (JoltException joE) { + LOGGER.error("Unable to transform SDC response with JOLT Transformer", joE); + throw new TechnicalException("Error while parsing ONAP response"); + } + return output; + } + +} diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/Attachment.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/Attachment.java new file mode 100644 index 0000000..e9565ce --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/Attachment.java @@ -0,0 +1,220 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + +/** + * An attachment is a file uses to describe the service. In nbi we use attachment to retrieve ONAP artifacts. + */ +@ApiModel(description = "An attachment is a file uses to describe the service. In nbi we use attachment to retrieve ONAP artifacts.") + + +public class Attachment { + + private String id = null; + + + private String name = null; + + private String description = null; + + private String type = "ONAPartifact"; + + private String artifactLabel = null; + + private String artifactGroupType = null; + + private String artifactTimeout = null; + + private String artifactChecksum = null; + + private String artifactVersion = null; + + private String generatedFromUUID = null; + + private String url = null; + + private String mimeType = null; + + /** + * Unique identifier of the attachment - filled with artifactUUID. + * @return id + **/ + @ApiModelProperty(value = "Unique identifier of the attachment - filled with artifactUUID.") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * Name of the attachment - filled with artifactName + * @return name + **/ + @ApiModelProperty(value = "Name of the attachment - filled with artifactName") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * Description of the attachment - filled with artifactDescription + * @return description + **/ + @ApiModelProperty(value = "Description of the attachment - filled with artifactDescription") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + /** + * This attribute allows to dynamically extends TMF class. Valued with 'ONAPartifact'. We used this features to add following attributes: artifactLabel artifactGroupType artifactTimeout artifactChecksum artifactVersion generatedFromUUID + * @return type + **/ + @ApiModelProperty(value = "This attribute allows to dynamically extends TMF class. Valued with 'ONAPartifact'. We used this features to add following attributes: artifactLabel artifactGroupType artifactTimeout artifactChecksum artifactVersion generatedFromUUID") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + + /** + * Additional attribute (not in the TMF API) - extended through @type - artifactLabel + * @return artifactLabel + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - artifactLabel") + public String getArtifactLabel() { + return artifactLabel; + } + + public void setArtifactLabel(String artifactLabel) { + this.artifactLabel = artifactLabel; + } + + /** + * Additional attribute (not in the TMF API) - extended through @type - artifactGroupType + * @return artifactGroupType + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - artifactGroupType") + public String getArtifactGroupType() { + return artifactGroupType; + } + + public void setArtifactGroupType(String artifactGroupType) { + this.artifactGroupType = artifactGroupType; + } + + + /** + * Additional attribute (not in the TMF API) - extended through @type - artifactTimeout + * @return artifactTimeout + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - artifactTimeout") + public String getArtifactTimeout() { + return artifactTimeout; + } + + public void setArtifactTimeout(String artifactTimeout) { + this.artifactTimeout = artifactTimeout; + } + + + /** + * Additional attribute (not in the TMF API) - extended through @type - artifactChecksum + * @return artifactChecksum + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - artifactChecksum") + public String getArtifactChecksum() { + return artifactChecksum; + } + + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + + /** + * Additional attribute (not in the TMF API) - extended through @type - artifactVersion + * @return artifactVersion + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - artifactVersion") + public String getArtifactVersion() { + return artifactVersion; + } + + public void setArtifactVersion(String artifactVersion) { + this.artifactVersion = artifactVersion; + } + + + /** + * Additional attribute (not in the TMF API) - extended through @type - generatedFromUUID + * @return generatedFromUUID + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - generatedFromUUID") + public String getGeneratedFromUUID() { + return generatedFromUUID; + } + + public void setGeneratedFromUUID(String generatedFromUUID) { + this.generatedFromUUID = generatedFromUUID; + } + + /** + * Uniform Resource Locator, is a web page address - filled with artifactURL + * @return url + **/ + @ApiModelProperty(value = "Uniform Resource Locator, is a web page address - filled with artifactURL") + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + /** + * Filled with artifactType + * @return mimeType + **/ + @ApiModelProperty(value = "Filled with artifactType") + public String getMimeType() { + return mimeType; + } + + public void setMimeType(String mimeType) { + this.mimeType = mimeType; + } + + + + +} + diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/DistributionStatus.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/DistributionStatus.java new file mode 100644 index 0000000..7d0bf3b --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/DistributionStatus.java @@ -0,0 +1,45 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + + +/** + * Service distribution status from ONAP. + * + */ + +public enum DistributionStatus { + + DISTRIBUTION_NOT_APPROVED("DISTRIBUTION_NOT_APPROVED"), + + DISTRIBUTION_APPROVED("DISTRIBUTION_APPROVED"), + + DISTRIBUTED("DISTRIBUTED"), + + DISTRIBUTION_REJECTED("DISTRIBUTION_REJECTED"); + + private String value; + + DistributionStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + +} + diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/LifecycleStatusValues.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/LifecycleStatusValues.java new file mode 100644 index 0000000..d960325 --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/LifecycleStatusValues.java @@ -0,0 +1,49 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 NikhilMohan + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + + +/** + * Service lifecycle value from ONAP SDC + * + */ +public enum LifecycleStatusValues { + + NOT_CERTIFIED_CHECKOUT("NOT_CERTIFIED_CHECKOUT"), + + NOT_CERTIFIED_CHECKIN("NOT_CERTIFIED_CHECKIN"), + + READY_FOR_CERTIFICATION("READY_FOR_CERTIFICATION"), + + CERTIFICATION_IN_PROGRESS("CERTIFICATION_IN_PROGRESS"), + + CERTIFIED("CERTIFIED"); + + private String value; + + LifecycleStatusValues(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + + + +} + diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/RelatedPartyRef.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/RelatedPartyRef.java new file mode 100644 index 0000000..b4b52e5 --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/RelatedPartyRef.java @@ -0,0 +1,80 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotEmpty; +import java.util.Objects; + +/** + * Party linked to the service catalog. in nbi we retrieve information about last updater of the service in SDC + */ +@ApiModel(description = "Party linked to the service catalog. in nbi we retrieve information about last updater of the service in SDC") + +public class RelatedPartyRef { + + @NotEmpty(message = "is missing in the request!") + private String id = null; + + private String role = null; + + private String name = null; + + /** + * Unique identifier of the related party. Filled with lastUpdaterUserId + * @return id + **/ + @ApiModelProperty(value = "Unique identifier of the related party. Filled with lastUpdaterUserId") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * Role payed by the related party Only role 'lastUpdater' is retrieved in Beijing release + * @return role + **/ + @ApiModelProperty(value = "Role payed by the related party Only role 'lastUpdater' is retrieved in Beijing release") + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + /** + * Name of the related party - Filled with lastUpdatedFullName + * @return name + **/ + @ApiModelProperty(value = "Name of the related party - Filled with lastUpdatedFullName") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + +} + diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/ResourceSpecificationRef.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ResourceSpecificationRef.java new file mode 100644 index 0000000..06399ce --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ResourceSpecificationRef.java @@ -0,0 +1,172 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 NikhilMohan + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + +/** + * A list of resourceSpec identified to deliver the service. for nbi we retrieve resource information available in service description (through SDC api) bu as well information retrieved in the TOSCA file. + */ +@ApiModel(description = "A list of resourceSpec identified to deliver the service. for nbi we retrieve resource information available in service description (through SDC api) bu as well information retrieved in the TOSCA file.") + +public class ResourceSpecificationRef { + private String id = null; + + private String version = null; + + private String name = null; + + private String type = "ONAPresource"; + + private String resourceInstanceName = null; + + private String resourceInvariantUUID = null; + + private String resourceType = null; + + private String modelCustomizationName = null; + + private String modelCustomizationId = null; + + + /** + * Unique identifier of the resource specification - filled with resourceUUID + * @return id + **/ + @ApiModelProperty(value = "Unique identifier of the resource specification - filled with resourceUUID") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * Version for this resource specification - filled with resourceVersion + * @return version + **/ + @ApiModelProperty(value = "Version for this resource specification - filled with resourceVersion") + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + + /** + * Name of the resource specification - filled with resourceName + * @return name + **/ + @ApiModelProperty(value = "Name of the resource specification - filled with resourceName") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + /** + * This attribute allows to dynamically extends TMF class. Valued with: 'ONAPresource'. We used this features to add following attributes: resourceInstanceName resourceInvariantUUID resourceType modelCustomizationName modelCustomizationId + * @return type + **/ + @ApiModelProperty(value = "This attribute allows to dynamically extends TMF class. Valued with: 'ONAPresource'. We used this features to add following attributes: resourceInstanceName resourceInvariantUUID resourceType modelCustomizationName modelCustomizationId") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + + /** + * Additional attribute (not in the TMF API) - extended through @type - resourceInstanceName + * @return resourceInstanceName + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - resourceInstanceName") + public String getResourceInstanceName() { + return resourceInstanceName; + } + + public void setResourceInstanceName(String resourceInstanceName) { + this.resourceInstanceName = resourceInstanceName; + } + + + /** + * Additional attribute (not in the TMF API) - extended through @type - resourceInvariantUUID + * @return resourceInvariantUUID + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - resourceInvariantUUID") + public String getResourceInvariantUUID() { + return resourceInvariantUUID; + } + + public void setResourceInvariantUUID(String resourceInvariantUUID) { + this.resourceInvariantUUID = resourceInvariantUUID; + } + + + /** + * Additional attribute (not in the TMF API) - extended through @type - resoucreType + * @return resourceType + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - resoucreType") + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + /** + * Additional attribute (not in the TMF API) - extended through @type - Retrieved in the TOSCA file : attribute name in topology_template/node_template for the resource + * @return modelCustomizationName + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - Retrieved in the TOSCA file : attribute name in topology_template/node_template for the resource") + public String getModelCustomizationName() { + return modelCustomizationName; + } + + public void setModelCustomizationName(String modelCustomizationName) { + this.modelCustomizationName = modelCustomizationName; + } + + + /** + * Additional attribute (not in the TMF API) - extended through @type - Retrieved in the TOSCA file : attribute customizationUUID in topology_template/node_template for the resource + * @return modelCustomizationId + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - Retrieved in the TOSCA file : attribute customizationUUID in topology_template/node_template for the resource") + public String getModelCustomizationId() { + return modelCustomizationId; + } + + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + +} + diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecCharacteristicRequest.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecCharacteristicRequest.java new file mode 100644 index 0000000..c1c80a5 --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecCharacteristicRequest.java @@ -0,0 +1,144 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * A characteristic quality or distinctive feature of a ServiceSpecification. + */ +@ApiModel(description = "A characteristic quality or distinctive feature of a ServiceSpecification.") + +public class ServiceSpecCharacteristicRequest { + private String name = null; + + private String description = null; + + private String valueType = null; + + private String type = null; + + private String schemaLocation = null; + + private Boolean required = true; + + private List serviceSpecCharacteristicValue = null; + + /** + * Name of the characteristic + * @return name + **/ + @ApiModelProperty(value = "Name of the characteristic") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * A narrative that explains in detail what the characteristic is + * @return description + **/ + @ApiModelProperty(value = "A narrative that explains in detail what the characteristic is") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + /** + * A kind of value that the characteristic can take on, from Dublin from Dublin we use the object type to describe service characteristic values + * @return valueType + **/ + @ApiModelProperty(value = "A kind of value that the characteristic can take on, from Dublin from Dublin we use the object type to describe service characteristic values") + public String getValueType() { + return valueType; + } + + public void setValueType(String valueType) { + this.valueType = valueType; + } + + /** + * This attribute allows to dynamically extends TMF class. Valued with: 'ONAPserviceCharacteristic'. We do not used this feature in nbi + * @return type + **/ + @ApiModelProperty(value = "This attribute allows to dynamically extends TMF class. Valued with: 'ONAPserviceCharacteristic'. We do not used this feature in nbi") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * An url pointing to type description - we do not use it + * @return schemaLocation + **/ + @ApiModelProperty(value = "An url pointing to type description - we do not use it") + public String getSchemaLocation() { + return schemaLocation; + } + + public void setSchemaLocation(String schemaLocation) { + this.schemaLocation = schemaLocation; + } + + /** + * A parameter to define if the characteristic is mandatory + * @return required + **/ + @ApiModelProperty(value = "A parameter to define if the characteristic is mandatory") + public Boolean isRequired() { + return required; + } + + public void setRequired(Boolean required) { + this.required = required; + } + + public ServiceSpecCharacteristicRequest addServiceSpecCharacteristicValueItem(ServiceSpecCharacteristicValueRequest serviceSpecCharacteristicValueItem) { + if (this.serviceSpecCharacteristicValue == null) { + this.serviceSpecCharacteristicValue = new ArrayList(); + } + this.serviceSpecCharacteristicValue.add(serviceSpecCharacteristicValueItem); + return this; + } + + /** + * Get serviceSpecCharacteristicValue + * @return serviceSpecCharacteristicValue + **/ + @ApiModelProperty(value = "") + public List getServiceSpecCharacteristicValue() { + return serviceSpecCharacteristicValue; + } + + public void setServiceSpecCharacteristicValue(List serviceSpecCharacteristicValue) { + this.serviceSpecCharacteristicValue = serviceSpecCharacteristicValue; + } +} + diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecCharacteristicValueRequest.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecCharacteristicValueRequest.java new file mode 100644 index 0000000..568e8cf --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecCharacteristicValueRequest.java @@ -0,0 +1,78 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 NikhilMohan + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + +/** + * A json schema of the service specification input characteristic values + */ +@ApiModel(description = "A json schema of the service specification input characteristic values") + +public class ServiceSpecCharacteristicValueRequest { + private String valueType = null; + + private Boolean isDefault = null; + + private String value = null; + + /** + * This attribute describes the type of value + * @return valueType + **/ + @ApiModelProperty(value = "This attribute describes the type of value") + public String getValueType() { + return valueType; + } + + public void setValueType(String valueType) { + this.valueType = valueType; + } + + /** + * To describe whether the attribute is to be included by default or not + * @return isDefault + **/ + @ApiModelProperty(value = "To describe whether the attribute is to be included by default or not") + public Boolean isIsDefault() { + return isDefault; + } + + public void setIsDefault(Boolean isDefault) { + this.isDefault = isDefault; + } + + + /** + * Value of the attribute + * @return value + **/ + @ApiModelProperty(value = "Value of the attribute") + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + + +} + diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecificationRequest.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecificationRequest.java new file mode 100644 index 0000000..8b7022c --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecificationRequest.java @@ -0,0 +1,320 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 NikhilMohan + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.Valid; +import javax.validation.constraints.NotEmpty; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * ServiceSpecification is a class that offers characteristics to describe a type of service. Functionally, it acts as a template by which Services may be instantiated. By sharing the same specification, these services would therefore share the same set of characteristics. + */ +@ApiModel(description = "ServiceSpecification is a class that offers characteristics to describe a type of service. Functionally, it acts as a template by which Services may be instantiated. By sharing the same specification, these services would therefore share the same set of characteristics.") +public class ServiceSpecificationRequest { + + @NotEmpty(message = "is missing in the request!") + private String name = null; + + @NotEmpty(message = "is missing in the request!") + private String description = null; + + private String type = "ONAPservice"; + + private String schemaLocation = null; + + private String baseType = null; + + private String toscaModelURL = null; + + private String toscaResourceName = null; + + @NotEmpty(message = "is missing in the request!") + private String category = null; + + private String subcategory = null; + + private String version = null; + + private LifecycleStatusValues lifecycleStatus = null; + + private TargetServiceSchemaRef targetServiceSchema = null; + + private List attachment = null; + + @NotEmpty(message = "is missing in the request!") + @Valid + private List relatedParty = null; + + private List resourceSpecification = null; + + private List serviceSpecCharacteristic = null; + + /** + * Name of the service specification + * @return name + **/ + @ApiModelProperty(value = "Name of the service specification") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + + /** + * A narrative that explains in detail what the service specification + * @return description + **/ + @ApiModelProperty(value = "A narrative that explains in detail what the service specification") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + /** + * This attribute allows to dynamically extends TMF class. Valued with 'ONAPservice'. We use this feature to add following attributes: toscaModelURL toscaResourceName category (1) subcategory (1) distributionStatus + * @return type + **/ + @ApiModelProperty(value = "This attribute allows to dynamically extends TMF class. Valued with 'ONAPservice'. We use this feature to add following attributes: toscaModelURL toscaResourceName category (1) subcategory (1) distributionStatus") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * Not used + * @return schemaLocation + **/ + @ApiModelProperty(value = "Not used") + public String getSchemaLocation() { + return schemaLocation; + } + + public void setSchemaLocation(String schemaLocation) { + this.schemaLocation = schemaLocation; + } + + + + /** + * Not used + * @return baseType + **/ + @ApiModelProperty(value = "Not used") + public String getBaseType() { + return baseType; + } + + public void setBaseType(String baseType) { + this.baseType = baseType; + } + + + + /** + * Additional attribute (not in the TMF API) - extended through @type - toscaModelURL + * @return toscaModelURL + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - toscaModelURL") + public String getToscaModelURL() { + return toscaModelURL; + } + + public void setToscaModelURL(String toscaModelURL) { + this.toscaModelURL = toscaModelURL; + } + + /** + * Additional attribute (not in the TMF API) - extended through @type - toscaResourceName + * @return toscaResourceName + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - toscaResourceName") + public String getToscaResourceName() { + return toscaResourceName; + } + + public void setToscaResourceName(String toscaResourceName) { + this.toscaResourceName = toscaResourceName; + } + + /** + * Additional attribute - extended through @type - category Please note that this attribute is managed in TMF - in future release we'll introduce category resource + * @return category + **/ + @ApiModelProperty(value = "Additional attribute - extended through @type - category Please note that this attribute is managed in TMF - in future release we'll introduce category resource") + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + /** + * Additional attribute - extended through @type - category Please note that this attribute is managed in TMF - in future release we'll introduce category resource + * @return subcategory + **/ + @ApiModelProperty(value = "Additional attribute - extended through @type - category Please note that this attribute is managed in TMF - in future release we'll introduce category resource") + public String getSubcategory() { + return subcategory; + } + + public void setSubcategory(String subcategory) { + this.subcategory = subcategory; + } + + /** + * Service specification version + * @return version + **/ + @ApiModelProperty(value = "Service specification version") + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + /** + * Get lifecycleStatus + * @return lifecycleStatus + **/ + @ApiModelProperty(value = "") + public LifecycleStatusValues getLifecycleStatus() { + return lifecycleStatus; + } + + public void setLifecycleStatus(LifecycleStatusValues lifecycleStatus) { + this.lifecycleStatus = lifecycleStatus; + } + + /** + * Get targetServiceSchema + * @return targetServiceSchema + **/ + @ApiModelProperty(value = "") + public TargetServiceSchemaRef getTargetServiceSchema() { + return targetServiceSchema; + } + + public void setTargetServiceSchema(TargetServiceSchemaRef targetServiceSchema) { + this.targetServiceSchema = targetServiceSchema; + } + + public ServiceSpecificationRequest addAttachmentItem(Attachment attachmentItem) { + if (this.attachment == null) { + this.attachment = new ArrayList(); + } + this.attachment.add(attachmentItem); + return this; + } + + /** + * Get attachment + * @return attachment + **/ + @ApiModelProperty(value = "") + public List getAttachment() { + return attachment; + } + + public void setAttachment(List attachment) { + this.attachment = attachment; + } + + public ServiceSpecificationRequest addRelatedPartyItem(RelatedPartyRef relatedPartyItem) { + if (this.relatedParty == null) { + this.relatedParty = new ArrayList(); + } + this.relatedParty.add(relatedPartyItem); + return this; + } + + /** + * Get relatedParty + * @return relatedParty + **/ + @ApiModelProperty(value = "") + public List getRelatedParty() { + return relatedParty; + } + + public void setRelatedParty(List relatedParty) { + this.relatedParty = relatedParty; + } + + public ServiceSpecificationRequest addResourceSpecificationItem(ResourceSpecificationRef resourceSpecificationItem) { + if (this.resourceSpecification == null) { + this.resourceSpecification = new ArrayList(); + } + this.resourceSpecification.add(resourceSpecificationItem); + return this; + } + + /** + * Get resourceSpecification + * @return resourceSpecification + **/ + @ApiModelProperty(value = "") + public List getResourceSpecification() { + return resourceSpecification; + } + + public void setResourceSpecification(List resourceSpecification) { + this.resourceSpecification = resourceSpecification; + } + + public ServiceSpecificationRequest addServiceSpecCharacteristicItem(ServiceSpecCharacteristicRequest serviceSpecCharacteristicItem) { + if (this.serviceSpecCharacteristic == null) { + this.serviceSpecCharacteristic = new ArrayList(); + } + this.serviceSpecCharacteristic.add(serviceSpecCharacteristicItem); + return this; + } + + /** + * Get serviceSpecCharacteristic + * @return serviceSpecCharacteristic + **/ + @ApiModelProperty(value = "") + public List getServiceSpecCharacteristic() { + return serviceSpecCharacteristic; + } + + public void setServiceSpecCharacteristic(List serviceSpecCharacteristic) { + this.serviceSpecCharacteristic = serviceSpecCharacteristic; + } + + + + +} + diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/TargetServiceSchemaRef.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/TargetServiceSchemaRef.java new file mode 100644 index 0000000..1b36ad0 --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/TargetServiceSchemaRef.java @@ -0,0 +1,60 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 NikhilMohan + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + +/** + * Target Service Schema + */ +@ApiModel(description = "Target Service Schema") + +public class TargetServiceSchemaRef { + private String type = null; + + private String schemaLocation = null; + + /** + * + * @return type + **/ + @ApiModelProperty(required = true, value = "") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * + * @return schemaLocation + **/ + @ApiModelProperty(required = true, value = "") + public String getSchemaLocation() { + return schemaLocation; + } + + public void setSchemaLocation(String schemaLocation) { + this.schemaLocation = schemaLocation; + } + +} + -- cgit 1.2.3-korg