diff options
author | Brinda Santh <brindasanth@in.ibm.com> | 2019-08-30 15:01:12 -0400 |
---|---|---|
committer | Brinda Santh <brindasanth@in.ibm.com> | 2019-08-30 15:01:12 -0400 |
commit | c65d8743072d10e7ec426d145adebcd8557212ee (patch) | |
tree | 84fd49f2907a4bf3c31c10ddb8be3777f918c8da /ms | |
parent | 9039b516eaa55a08d2f97ef290c17de781e13ae2 (diff) |
Refactor resource dictionary entity and repositories.
Change-Id: I156d63df70d04e129e4a753cdc11e119ee97d37a
Issue-ID: CCSDK-1663
Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms')
28 files changed, 339 insertions, 567 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ControllerBlueprintExceptionHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ControllerBlueprintExceptionHandler.kt index f4dabcded..0d2a7b7dc 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ControllerBlueprintExceptionHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ControllerBlueprintExceptionHandler.kt @@ -18,7 +18,6 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode -import org.onap.ccsdk.cds.controllerblueprints.service.common.ErrorMessage import org.slf4j.LoggerFactory import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt new file mode 100644 index 000000000..5259ee1c9 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt @@ -0,0 +1,46 @@ +/* + * Copyright © 2019 IBM. + * + * 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. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api + +import com.fasterxml.jackson.annotation.JsonFormat +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonTypeInfo +import com.fasterxml.jackson.annotation.JsonTypeName +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment +import java.io.Serializable +import java.util.* + +/** + * ArtifactRequest.java Purpose: Provide Configuration Generator ArtifactRequest Model + * + * @author Brinda Santh + * @version 1.0 + */ +class AutoMapResponse { + var resourceAssignments: List<ResourceAssignment>? = null + var dataDictionaries: List<ResourceDictionary>? = null +} + + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonTypeName("errorMessage") +@JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME) +class ErrorMessage(var message: String?, var code: Int?, var debugMessage: String?) : Serializable { + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") + var timestamp = Date() +}
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeController.kt index 4c2ec6aa9..bac281356 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeController.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeController.kt @@ -20,7 +20,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api import kotlinx.coroutines.runBlocking import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.ModelTypeHandler import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType import org.springframework.http.MediaType import org.springframework.web.bind.annotation.* diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt index 89744dd2f..bae890a87 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt @@ -17,10 +17,10 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api import kotlinx.coroutines.runBlocking +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.ResourceDictionaryHandler import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceSourceMapping -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary import org.springframework.http.MediaType import org.springframework.web.bind.annotation.* diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/JpaJsonNodeConverter.java b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaJsonNodeConverter.kt index f45c30fc6..97c7ab6a6 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/JpaJsonNodeConverter.java +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaJsonNodeConverter.kt @@ -14,27 +14,25 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.domain; +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain -import com.fasterxml.jackson.databind.JsonNode; -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils; +import com.fasterxml.jackson.databind.JsonNode +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils + +import javax.persistence.AttributeConverter +import javax.persistence.Converter -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; /** * @author Brinda Santh */ @Converter -public class JpaJsonNodeConverter implements - AttributeConverter<JsonNode, String> { +class JpaJsonNodeConverter : AttributeConverter<JsonNode, String> { - @Override - public String convertToDatabaseColumn(JsonNode node) { - return JacksonUtils.Companion.getJson(node, true); + override fun convertToDatabaseColumn(node: JsonNode): String { + return JacksonUtils.getJson(node, true) } - @Override - public JsonNode convertToEntityAttribute(String dbData) { - return JacksonUtils.Companion.jsonNode(dbData); + override fun convertToEntityAttribute(dbData: String): JsonNode { + return JacksonUtils.jsonNode(dbData) } }
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/JpaResourceDefinitionConverter.java b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaResourceDefinitionConverter.kt index 60c069428..75cfede50 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/JpaResourceDefinitionConverter.java +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaResourceDefinitionConverter.kt @@ -14,26 +14,24 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.controllerblueprints.service.domain; +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils; -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition; +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition + +import javax.persistence.AttributeConverter +import javax.persistence.Converter -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; /** * @author Brinda Santh */ @Converter -public class JpaResourceDefinitionConverter implements - AttributeConverter<ResourceDefinition, String> { - @Override - public String convertToDatabaseColumn(ResourceDefinition resourceDefinition) { - return JacksonUtils.Companion.getJson(resourceDefinition); +class JpaResourceDefinitionConverter : AttributeConverter<ResourceDefinition, String> { + override fun convertToDatabaseColumn(resourceDefinition: ResourceDefinition): String { + return JacksonUtils.getJson(resourceDefinition) } - @Override - public ResourceDefinition convertToEntityAttribute(String content) { - return JacksonUtils.Companion.readValue(content, ResourceDefinition.class); + override fun convertToEntityAttribute(content: String): ResourceDefinition? { + return JacksonUtils.readValue(content, ResourceDefinition::class.java) } } diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt new file mode 100644 index 000000000..a964e0416 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt @@ -0,0 +1,97 @@ +/* + * Copyright © 2019 IBM. + * + * 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. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain + +import com.fasterxml.jackson.annotation.JsonFormat +import com.fasterxml.jackson.databind.JsonNode +import io.swagger.annotations.ApiModelProperty +import org.springframework.data.annotation.LastModifiedDate +import org.springframework.data.jpa.domain.support.AuditingEntityListener +import java.io.Serializable +import java.util.* +import javax.persistence.* + +/** + * Provide ModelType Entity + * + * @author Brinda Santh + * @version 1.0 + */ +@EntityListeners(AuditingEntityListener::class) +@Entity +@Table(name = "MODEL_TYPE") +class ModelType : Serializable { + + @Id + @Column(name = "model_name", nullable = false) + @ApiModelProperty(required = true) + lateinit var modelName: String + + @Column(name = "derived_from", nullable = false) + @ApiModelProperty(required = true) + lateinit var derivedFrom: String + + @Column(name = "definition_type", nullable = false) + @ApiModelProperty(required = true) + lateinit var definitionType: String + + @Lob + @Convert(converter = JpaJsonNodeConverter::class) + @Column(name = "definition", nullable = false) + @ApiModelProperty(required = true) + lateinit var definition: JsonNode + + @Lob + @Column(name = "description", nullable = false) + @ApiModelProperty(required = true) + lateinit var description: String + + @Column(name = "version", nullable = false) + @ApiModelProperty(required = true) + lateinit var version: String + + @Lob + @Column(name = "tags", nullable = false) + @ApiModelProperty(required = true) + lateinit var tags: String + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") + @LastModifiedDate + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "creation_date") + var creationDate: Date? = null + + @Column(name = "updated_by", nullable = false) + @ApiModelProperty(required = true) + lateinit var updatedBy: String + + override fun toString(): String { + return "[" + "modelName = " + modelName + + ", derivedFrom = " + derivedFrom + + ", definitionType = " + definitionType + + ", description = " + description + + ", creationDate = " + creationDate + + ", version = " + version + + ", updatedBy = " + updatedBy + + ", tags = " + tags + + "]" + } + + companion object { + private const val serialVersionUID = 1L + } +}
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt new file mode 100644 index 000000000..ac5ea2070 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt @@ -0,0 +1,94 @@ +/* + * Copyright © 2019 IBM. + * + * 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. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain + +import com.fasterxml.jackson.annotation.JsonFormat +import io.swagger.annotations.ApiModelProperty +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition +import org.springframework.data.annotation.LastModifiedDate +import org.springframework.data.jpa.domain.support.AuditingEntityListener +import java.io.Serializable +import java.util.* +import javax.persistence.* + +/** + * Provide ResourceDictionary Entity + * + * @author Brinda Santh + * @version 1.0 + */ +@EntityListeners(AuditingEntityListener::class) +@Entity +@Table(name = "RESOURCE_DICTIONARY") +class ResourceDictionary : Serializable { + + @Id + @Column(name = "name", nullable = false) + @ApiModelProperty(required = true) + lateinit var name: String + + @Column(name = "data_type", nullable = false) + @ApiModelProperty(required = true) + lateinit var dataType: String + + @Column(name = "entry_schema") + var entrySchema: String? = null + + @Lob + @Convert(converter = JpaResourceDefinitionConverter::class) + @Column(name = "definition", nullable = false) + @ApiModelProperty(required = true) + lateinit var definition: ResourceDefinition + + @Lob + @Column(name = "description", nullable = false) + @ApiModelProperty(required = true) + lateinit var description: String + + @Lob + @Column(name = "tags", nullable = false) + @ApiModelProperty(required = true) + lateinit var tags: String + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") + @LastModifiedDate + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "creation_date") + var creationDate: Date? = null + + @Column(name = "updated_by", nullable = false) + @ApiModelProperty(required = true) + lateinit var updatedBy: String + + override fun toString(): String { + return "[" + ", name = " + name + + ", dataType = " + dataType + + ", entrySchema = " + entrySchema + + ", definition =" + definition + + ", description = " + description + + ", updatedBy = " + updatedBy + + ", tags = " + tags + + ", creationDate = " + creationDate + + "]" + } + + companion object { + private const val serialVersionUID = 1L + } + + +} diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt index 034c40774..5c7ba275d 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt @@ -20,7 +20,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ModelTypeRepository import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.ModelTypeValidator import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType import org.slf4j.LoggerFactory import org.springframework.stereotype.Service diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt index a7e8f2011..8ba4c7b38 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt @@ -20,12 +20,12 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler import com.google.common.base.Preconditions import org.apache.commons.collections.CollectionUtils import org.apache.commons.lang3.StringUtils +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ResourceDictionaryRepository import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceSourceMapping import org.onap.ccsdk.cds.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary import org.springframework.stereotype.Service @Service @@ -88,11 +88,11 @@ class ResourceDictionaryHandler(private val resourceDictionaryRepository: Resour //TODO( Save Validator) //validate(resourceDefinition) - resourceDictionary.tags = resourceDefinition.tags + resourceDictionary.tags = resourceDefinition.tags!! resourceDefinition.updatedBy = resourceDictionary.updatedBy // Set the Property Definitions val propertyDefinition = resourceDefinition.property - resourceDictionary.description = propertyDefinition.description + resourceDictionary.description = propertyDefinition.description!! resourceDictionary.dataType = propertyDefinition.type if (propertyDefinition.entrySchema != null) { resourceDictionary.entrySchema = propertyDefinition.entrySchema!!.type diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ModelTypeLoadService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ModelTypeLoadService.kt index 1434bccb4..9f43740aa 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ModelTypeLoadService.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ModelTypeLoadService.kt @@ -22,6 +22,7 @@ import kotlinx.coroutines.awaitAll import kotlinx.coroutines.coroutineScope import org.apache.commons.io.FilenameUtils import org.apache.commons.lang3.text.StrBuilder +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.ModelTypeHandler import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException @@ -29,7 +30,6 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.* import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile import org.onap.ccsdk.cds.controllerblueprints.core.readNBText import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType import org.slf4j.LoggerFactory import org.springframework.stereotype.Service import java.io.File @@ -131,7 +131,7 @@ open class ModelTypeLoadService(private val modelTypeHandler: ModelTypeHandler) } modelType.definitionType = definitionType modelType.derivedFrom = definition.derivedFrom - modelType.description = definition.description + modelType.description = definition.description!! modelType.definition = JacksonUtils.jsonNode(definitionContent) modelType.modelName = dataKey modelType.version = definition.version diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ResourceDictionaryLoadService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ResourceDictionaryLoadService.kt index 14dc4473a..95073e99d 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ResourceDictionaryLoadService.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ResourceDictionaryLoadService.kt @@ -22,13 +22,13 @@ import kotlinx.coroutines.awaitAll import kotlinx.coroutines.coroutineScope import org.apache.commons.lang3.StringUtils import org.apache.commons.lang3.text.StrBuilder +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.ResourceDictionaryHandler import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile import org.onap.ccsdk.cds.controllerblueprints.core.readNBText import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary import org.slf4j.LoggerFactory import org.springframework.stereotype.Service import java.io.File @@ -82,7 +82,7 @@ open class ResourceDictionaryLoadService(private val resourceDictionaryHandler: resourceDictionary.definition = resourceDefinition checkNotNull(resourceDefinition.property) { "Property field is missing" } - resourceDictionary.description = resourceDefinition.property.description + resourceDictionary.description = resourceDefinition.property.description!! resourceDictionary.dataType = resourceDefinition.property.type if (resourceDefinition.property.entrySchema != null) { @@ -95,7 +95,7 @@ open class ResourceDictionaryLoadService(private val resourceDictionaryHandler: + ", " + resourceDefinition.updatedBy) } else { - resourceDictionary.tags = resourceDefinition.tags + resourceDictionary.tags = resourceDefinition.tags!! } resourceDictionaryHandler.saveResourceDictionary(resourceDictionary) diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/BluePrintsReactRepository.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/BluePrintsReactRepository.kt index 78175724f..1d69cd7cc 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/BluePrintsReactRepository.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/BluePrintsReactRepository.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType import org.springframework.stereotype.Service import reactor.core.publisher.Flux import reactor.core.publisher.Mono diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeRepository.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeRepository.kt index 82dc89c3e..3e36947a4 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeRepository.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeRepository.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType import org.springframework.data.jpa.repository.JpaRepository import org.springframework.stereotype.Repository import javax.transaction.Transactional diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt index ccd91b84d..68db371c6 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary import org.springframework.data.jpa.repository.JpaRepository import org.springframework.stereotype.Repository diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/ApplicationRegistrationService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/ApplicationRegistrationService.kt new file mode 100644 index 000000000..edf4c8cf6 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/ApplicationRegistrationService.kt @@ -0,0 +1,54 @@ +/* + * Copyright © 2019 IBM. + * + * 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. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.service + +import org.apache.commons.collections.CollectionUtils +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory +import org.slf4j.LoggerFactory +import org.springframework.beans.factory.annotation.Value +import org.springframework.stereotype.Component +import javax.annotation.PostConstruct + +@Component +class ApplicationRegistrationService { + + @Value("#{'\${resourceSourceMappings}'.split(',')}") + private val resourceSourceMappings: List<String>? = null + + @PostConstruct + fun register() { + registerDictionarySources() + } + + fun registerDictionarySources() { + log.info("Registering Dictionary Sources : {}", resourceSourceMappings) + if (CollectionUtils.isNotEmpty(resourceSourceMappings)) { + resourceSourceMappings!!.forEach { resourceSourceMapping -> + val mappingKeyValue = resourceSourceMapping.split("=".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() + if (mappingKeyValue != null && mappingKeyValue.size == 2) { + ResourceSourceMappingFactory.registerSourceMapping(mappingKeyValue[0].trim { it <= ' ' }, mappingKeyValue[1].trim { it <= ' ' }) + } else { + log.warn("failed to get resource source mapping {}", resourceSourceMapping) + } + } + } + } + + companion object { + private val log = LoggerFactory.getLogger(ApplicationRegistrationService::class.java) + } +} diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/AutoResourceMappingService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/AutoResourceMappingService.kt index 56bd01e11..be562642f 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/AutoResourceMappingService.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/AutoResourceMappingService.kt @@ -20,13 +20,13 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.service import com.google.common.base.Preconditions import org.apache.commons.collections.CollectionUtils import org.apache.commons.lang3.StringUtils +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.AutoMapResponse +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ResourceDictionaryRepository import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils.ResourceDictionaryUtils -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary -import org.onap.ccsdk.cds.controllerblueprints.service.model.AutoMapResponse import org.slf4j.LoggerFactory import org.springframework.stereotype.Service import java.util.* diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt index 7d6644219..8ec0b9bab 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt @@ -17,12 +17,12 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils import com.fasterxml.jackson.databind.JsonNode +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.cds.controllerblueprints.core.data.* import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType class ModelTypeValidator { companion object { diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt index 6d3b3da4a..6fe7097e5 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt @@ -26,7 +26,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguratio import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.annotation.Commit diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt index 31ae54036..00e78d247 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt @@ -28,7 +28,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.annotation.Commit diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt index 7adc1c963..55bc1e4af 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt @@ -28,7 +28,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfig import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.annotation.Commit import org.springframework.test.context.ContextConfiguration diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepositoryTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepositoryTest.kt index bbf1751c6..70e1b8ed2 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepositoryTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepositoryTest.kt @@ -25,9 +25,9 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.annotation.Commit import org.springframework.test.context.ContextConfiguration @@ -90,8 +90,8 @@ class ResourceDictionaryReactRepositoryTest { val resourceDictionary = ResourceDictionary() resourceDictionary.name = resourceDefinition.name resourceDictionary.dataType = resourceDefinition.property.type - resourceDictionary.description = resourceDefinition.property.description - resourceDictionary.tags = resourceDefinition.tags + resourceDictionary.description = resourceDefinition.property.description!! + resourceDictionary.tags = resourceDefinition.tags!! resourceDictionary.updatedBy = resourceDefinition.updatedBy resourceDictionary.definition = resourceDefinition return resourceDictionary diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidatorTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidatorTest.kt index 1869acec3..3c263b349 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidatorTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidatorTest.kt @@ -16,9 +16,9 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils -import com.fasterxml.jackson.databind.JsonNode import org.junit.Test -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils class ModelTypeValidatorTest { @@ -29,8 +29,7 @@ class ModelTypeValidatorTest { modelType.definitionType = "" modelType.derivedFrom = "" modelType.description = "" - val definitionContent: JsonNode? = null - modelType.definition = definitionContent + modelType.definition = JacksonUtils.objectMapper.createObjectNode() modelType.modelName = "" modelType.version = "" modelType.tags = "" diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/ApplicationRegistrationService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/ApplicationRegistrationService.java deleted file mode 100644 index 51484ff6c..000000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/ApplicationRegistrationService.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2018 IBM. - * - * 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. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service; - -import org.apache.commons.collections.CollectionUtils; -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.util.List; - -@Component -@SuppressWarnings("unused") -public class ApplicationRegistrationService { - private static Logger log = LoggerFactory.getLogger(ApplicationRegistrationService.class); - - @Value("#{'${resourceSourceMappings}'.split(',')}") - private List<String> resourceSourceMappings; - - @PostConstruct - public void register() { - registerDictionarySources(); - } - - public void registerDictionarySources() { - log.info("Registering Dictionary Sources : {}", resourceSourceMappings); - if (CollectionUtils.isNotEmpty(resourceSourceMappings)) { - resourceSourceMappings.forEach(resourceSourceMapping -> { - String[] mappingKeyValue = resourceSourceMapping.split("="); - if (mappingKeyValue != null && mappingKeyValue.length == 2) { - ResourceSourceMappingFactory.INSTANCE.registerSourceMapping(mappingKeyValue[0].trim(), mappingKeyValue[1].trim()); - } else { - log.warn("failed to get resource source mapping {}", resourceSourceMapping); - } - }); - } - } -} diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/ErrorMessage.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/ErrorMessage.java deleted file mode 100644 index 155a162b6..000000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/ErrorMessage.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * 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. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service.common; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; - -import java.io.Serializable; -import java.util.Date; - -@JsonInclude(Include.NON_NULL) -@JsonTypeName("errorMessage") -@JsonTypeInfo(include= JsonTypeInfo.As.WRAPPER_OBJECT, use=JsonTypeInfo.Id.NAME) -public class ErrorMessage implements Serializable { - private String message; - private Integer code; - private String debugMessage; - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - private Date timestamp = new Date(); - - public ErrorMessage(String message, Integer code, String debugMessage){ - this.message = message; - this.code = code; - this.debugMessage = debugMessage; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public Integer getCode() { - return code; - } - - public void setCode(Integer code) { - this.code = code; - } - - public String getDebugMessage() { - return debugMessage; - } - - public void setDebugMessage(String developerMessage) { - this.debugMessage = developerMessage; - } - - public Date getTimestamp() { - return timestamp; - } - - public void setTimestamp(Date timestamp) { - this.timestamp = timestamp; - } -}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/ModelType.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/ModelType.java deleted file mode 100644 index 31b792407..000000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/ModelType.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * 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. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service.domain; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.databind.JsonNode; -import io.swagger.annotations.ApiModelProperty; -import org.springframework.data.annotation.LastModifiedDate; -import org.springframework.data.jpa.domain.support.AuditingEntityListener; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - - -/** - * AsdcReference.java Purpose: Provide Configuration Generator AsdcReference Entity - * - * @author Brinda Santh - * @version 1.0 - */ -@EntityListeners({AuditingEntityListener.class}) -@Entity -@Table(name = "MODEL_TYPE") -public class ModelType implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @Column(name = "model_name", nullable = false) - @ApiModelProperty(required=true) - private String modelName; - - @Column(name = "derived_from", nullable = false) - @ApiModelProperty(required=true) - private String derivedFrom; - - @Column(name = "definition_type", nullable = false) - @ApiModelProperty(required=true) - private String definitionType; - - @Lob - @Convert(converter = JpaJsonNodeConverter.class) - @Column(name = "definition", nullable = false) - @ApiModelProperty(required=true) - private JsonNode definition; - - @Lob - @Column(name = "description", nullable = false) - @ApiModelProperty(required=true) - private String description; - - @Column(name = "version", nullable = false) - @ApiModelProperty(required=true) - private String version; - - @Lob - @Column(name = "tags", nullable = false) - @ApiModelProperty(required=true) - private String tags; - - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - @LastModifiedDate - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "creation_date") - private Date creationDate; - - @Column(name = "updated_by", nullable = false) - @ApiModelProperty(required=true) - private String updatedBy; - - @Override - public String toString() { - return "[" + "modelName = " + modelName + - ", derivedFrom = " + derivedFrom + - ", definitionType = " + definitionType + - ", description = " + description + - ", creationDate = " + creationDate + - ", version = " + version + - ", updatedBy = " + updatedBy + - ", tags = " + tags + - "]"; - } - - public String getModelName() { - return modelName; - } - - public void setModelName(String modelName) { - this.modelName = modelName; - } - - public String getDerivedFrom() { - return derivedFrom; - } - - public void setDerivedFrom(String derivedFrom) { - this.derivedFrom = derivedFrom; - } - - public String getDefinitionType() { - return definitionType; - } - - public void setDefinitionType(String definitionType) { - this.definitionType = definitionType; - } - - public JsonNode getDefinition() { - return definition; - } - - public void setDefinition(JsonNode definition) { - this.definition = definition; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getTags() { - return tags; - } - - public void setTags(String tags) { - this.tags = tags; - } - - public Date getCreationDate() { - return creationDate; - } - - public void setCreationDate(Date creationDate) { - this.creationDate = creationDate; - } - - public String getUpdatedBy() { - return updatedBy; - } - - public void setUpdatedBy(String updatedBy) { - this.updatedBy = updatedBy; - } - - -} diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/ResourceDictionary.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/ResourceDictionary.java deleted file mode 100644 index 2a6ab459b..000000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/domain/ResourceDictionary.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * 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. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service.domain; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModelProperty; -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition; -import org.springframework.data.annotation.LastModifiedDate; -import org.springframework.data.jpa.domain.support.AuditingEntityListener; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * DataDictionary.java Purpose: Provide Configuration Generator DataDictionary Entity - * - * @author Brinda Santh - * @version 1.0 - */ -@EntityListeners({AuditingEntityListener.class}) -@Entity -@Table(name = "RESOURCE_DICTIONARY") -public class ResourceDictionary implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @Column(name = "name", nullable = false) - @ApiModelProperty(required=true) - private String name; - - @Column(name = "data_type", nullable = false) - @ApiModelProperty(required=true) - private String dataType; - - @Column(name = "entry_schema") - private String entrySchema; - - @Lob - @Convert(converter = JpaResourceDefinitionConverter.class) - @Column(name = "definition", nullable = false) - @ApiModelProperty(required=true) - private ResourceDefinition definition; - - @Lob - @Column(name = "description", nullable = false) - @ApiModelProperty(required=true) - private String description; - - @Lob - @Column(name = "tags", nullable = false) - @ApiModelProperty(required=true) - private String tags; - - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - @LastModifiedDate - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "creation_date") - private Date creationDate; - - @Column(name = "updated_by", nullable = false) - @ApiModelProperty(required=true) - private String updatedBy; - - @Override - public String toString() { - return "[" + ", name = " + name + - ", dataType = " + dataType + - ", entrySchema = " + entrySchema + - ", definition =" + definition + - ", description = " + description + - ", updatedBy = " + updatedBy + - ", tags = " + tags + - ", creationDate = " + creationDate + - "]"; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDataType() { - return dataType; - } - - public void setDataType(String dataType) { - this.dataType = dataType; - } - - public String getEntrySchema() { - return entrySchema; - } - - public void setEntrySchema(String entrySchema) { - this.entrySchema = entrySchema; - } - - public ResourceDefinition getDefinition() { - return definition; - } - - public void setDefinition(ResourceDefinition definition) { - this.definition = definition; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getTags() { - return tags; - } - - public void setTags(String tags) { - this.tags = tags; - } - - public Date getCreationDate() { - return creationDate; - } - - public void setCreationDate(Date creationDate) { - this.creationDate = creationDate; - } - - public String getUpdatedBy() { - return updatedBy; - } - - public void setUpdatedBy(String updatedBy) { - this.updatedBy = updatedBy; - } - - - -} diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/model/AutoMapResponse.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/model/AutoMapResponse.java deleted file mode 100644 index 0fa337762..000000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/model/AutoMapResponse.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * 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. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service.model; - -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment; -import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary; - -import java.util.List; - -/** - * ArtifactRequest.java Purpose: Provide Configuration Generator ArtifactRequest Model - * - * @author Brinda Santh - * @version 1.0 - */ -public class AutoMapResponse { - - private List<ResourceAssignment> resourceAssignments; - private List<ResourceDictionary> dataDictionaries; - - public List<ResourceAssignment> getResourceAssignments() { - return resourceAssignments; - } - - public void setResourceAssignments(List<ResourceAssignment> resourceAssignments) { - this.resourceAssignments = resourceAssignments; - } - - public List<ResourceDictionary> getDataDictionaries() { - return dataDictionaries; - } - - public void setDataDictionaries(List<ResourceDictionary> dataDictionaries) { - this.dataDictionaries = dataDictionaries; - } - - - -} |