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
--- /dev/null
+/*
+ * 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
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.*
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.*
* 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
* 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)
}
}
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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
+ }
+
+
+}
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
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
//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
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
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
}
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
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
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) {
+ ", " + resourceDefinition.updatedBy)
} else {
- resourceDictionary.tags = resourceDefinition.tags
+ resourceDictionary.tags = resourceDefinition.tags!!
}
resourceDictionaryHandler.saveResourceDictionary(resourceDictionary)
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
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
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
--- /dev/null
+/*
+ * 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)
+ }
+}
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.*
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 {
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
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
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
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
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
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 {
modelType.definitionType = ""
modelType.derivedFrom = ""
modelType.description = ""
- val definitionContent: JsonNode? = null
- modelType.definition = definitionContent
+ modelType.definition = JacksonUtils.objectMapper.createObjectNode()
modelType.modelName = ""
modelType.version = ""
modelType.tags = ""
+++ /dev/null
-/*
- * 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);
- }
- });
- }
- }
-}
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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;
- }
-
-
-}
+++ /dev/null
-/*
- * 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;
- }
-
-
-
-}
+++ /dev/null
-/*
- * 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;
- }
-
-
-
-}