summaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
Diffstat (limited to 'ms')
-rw-r--r--ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java3
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/pom.xml12
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt86
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt3
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt93
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt101
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt22
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt21
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt7
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties6
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/RestClientServiceTest.kt3
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml2
-rwxr-xr-xms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintCatalogServiceImpl.kt45
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/pom.xml52
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/blueprint/validation/BluePrintTypeValidatorServiceImpl.kt (renamed from ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/BluePrintTypeValidatorServiceImpl.kt)2
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/blueprint/validation/BluePrintValidatorDefaultService.kt (renamed from ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/BluePrintValidatorDefaultService.kt)27
-rw-r--r--ms/controllerblueprints/modules/db-resources/pom.xml47
-rw-r--r--ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt82
-rw-r--r--ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/repository/ModelContentRepository.kt93
-rw-r--r--ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/repository/ModelRepository.kt88
-rw-r--r--ms/controllerblueprints/modules/pom.xml8
-rw-r--r--ms/controllerblueprints/modules/service/pom.xml180
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelService.java32
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ApplicationConstants.java34
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/BlueprintModelContentRepository.java102
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/BlueprintModelRepository.java96
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelSearchRepository.java (renamed from ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/BlueprintModelSearchRepository.java)138
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoServiceImpl.kt11
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/ControllerBluePrintCoreConfiguration.kt (renamed from ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintCoreConfiguration.kt)12
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintDatabaseLoadService.kt1
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintLoadConfiguration.kt34
-rwxr-xr-xms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt (renamed from ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintCatalogServiceImpl.kt)79
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelContentRepository.kt22
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelRepository.kt21
-rw-r--r--ms/controllerblueprints/parent/pom.xml10
35 files changed, 999 insertions, 576 deletions
diff --git a/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java b/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java
index 8a4ebd0a..5777a28f 100644
--- a/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java
+++ b/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java
@@ -21,6 +21,7 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
@@ -35,7 +36,7 @@ import org.springframework.test.context.junit4.SpringRunner;
*/
@RunWith(SpringRunner.class)
-@ContextConfiguration(classes = BlueprintProcessorApplication.class)
+@ContextConfiguration(classes = {BlueprintProcessorApplication.class, BluePrintLoadConfiguration.class})
@SpringBootTest(classes = BlueprintProcessorApplication.class,
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class BlueprintProcessorApplicationTest {
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
index 4b11f83f..cf265fc3 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
@@ -15,7 +15,7 @@
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
@@ -30,6 +30,16 @@
<dependencies>
<dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>db-resources</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>blueprint-validation</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
<artifactId>core</artifactId>
</dependency>
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt
new file mode 100755
index 00000000..7c0eb6b6
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt
@@ -0,0 +1,86 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2019 Bell Canada.
+ *
+ * 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.apps.blueprintsprocessor.db
+
+import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain.BlueprintProcessorModel
+import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain.BlueprintProcessorModelContent
+import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.repository.BlueprintProcessorModelContentRepository
+import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.repository.BlueprintProcessorModelRepository
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.apps.controllerblueprints.core.common.ApplicationConstants
+import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidatorService
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintArchiveUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
+import org.onap.ccsdk.apps.controllerblueprints.db.resources.BlueprintCatalogServiceImpl
+import org.springframework.stereotype.Service
+import java.io.File
+import java.nio.file.Files
+
+/**
+Similar/Duplicate implementation in [org.onap.ccsdk.apps.controllerblueprints.service.load.ControllerBlueprintCatalogServiceImpl]
+ */
+@Service
+class BlueprintProcessorCatalogServiceImpl(bluePrintLoadConfiguration: BluePrintLoadConfiguration,
+ private val bluePrintValidatorService: BluePrintValidatorService,
+ private val blueprintModelContentRepository: BlueprintProcessorModelContentRepository,
+ private val blueprintModelRepository: BlueprintProcessorModelRepository)
+ : BlueprintCatalogServiceImpl(bluePrintLoadConfiguration) {
+
+ override fun saveToDataBase(extractedDirectory: File, id: String, archiveFile: File, checkValidity: Boolean?) {
+ var valid = false
+ val firstItem = BluePrintArchiveUtils.getFirstItemInDirectory(extractedDirectory)
+ val blueprintBaseDirectory = extractedDirectory.absolutePath + "/" + firstItem
+ // Validate Blueprint
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(id, blueprintBaseDirectory)
+
+ // Check Validity of blueprint
+ if (checkValidity!!) {
+ valid = bluePrintValidatorService.validateBluePrints(bluePrintRuntimeService)
+ }
+
+ if ((valid && checkValidity!!) || (!valid && !checkValidity!!)) {
+ val metaData = bluePrintRuntimeService.bluePrintContext().metadata!!
+ // FIXME("Check Duplicate for Artifact Name and Artifact Version")
+ val blueprintModel = BlueprintProcessorModel()
+ blueprintModel.id = id
+ blueprintModel.artifactType = ApplicationConstants.ASDC_ARTIFACT_TYPE_SDNC_MODEL
+ blueprintModel.published = ApplicationConstants.ACTIVE_N
+ blueprintModel.artifactName = metaData[BluePrintConstants.METADATA_TEMPLATE_NAME]
+ blueprintModel.artifactVersion = metaData[BluePrintConstants.METADATA_TEMPLATE_VERSION]
+ blueprintModel.updatedBy = metaData[BluePrintConstants.METADATA_TEMPLATE_AUTHOR]
+ blueprintModel.tags = metaData[BluePrintConstants.METADATA_TEMPLATE_TAGS]
+ blueprintModel.artifactDescription = "Controller Blueprint for ${blueprintModel.artifactName}:${blueprintModel.artifactVersion}"
+
+ val blueprintModelContent = BlueprintProcessorModelContent()
+ blueprintModelContent.id = id // For quick access both id's are same.always have one to one mapping.
+ blueprintModelContent.contentType = "CBA_ZIP"
+ blueprintModelContent.name = "${blueprintModel.artifactName}:${blueprintModel.artifactVersion}"
+ blueprintModelContent.description = "(${blueprintModel.artifactName}:${blueprintModel.artifactVersion} CBA Zip Content"
+ blueprintModelContent.content = Files.readAllBytes(archiveFile.toPath())
+
+ // Set the Blueprint Model into blueprintModelContent
+ blueprintModelContent.blueprintModel = blueprintModel
+
+ // Set the Blueprint Model Content into blueprintModel
+ blueprintModel.blueprintModelContent = blueprintModelContent
+
+ blueprintModelRepository.saveAndFlush(blueprintModel)
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt
index bf76e213..98b6221d 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt
@@ -45,8 +45,7 @@ open class PrimaryDatabaseConfiguration(private val primaryDataSourceProperties:
open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
val em = LocalContainerEntityManagerFactoryBean()
em.dataSource = primaryDataSource()
- em.setPackagesToScan(
- "org.onap.ccsdk.apps.blueprintsprocessor.db.primary")
+ em.setPackagesToScan("org.onap.ccsdk.apps.blueprintsprocessor.db.primary")
val vendorAdapter = HibernateJpaVendorAdapter()
em.jpaVendorAdapter = vendorAdapter
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt
new file mode 100755
index 00000000..00d4830e
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt
@@ -0,0 +1,93 @@
+/*
+ * Copyright © 2019 Bell Canada
+ *
+ * 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.apps.blueprintsprocessor.db.primary.domain
+
+import com.fasterxml.jackson.annotation.JsonFormat
+import io.swagger.annotations.ApiModelProperty
+import javax.persistence.Entity
+import javax.persistence.EntityListeners
+import javax.persistence.Table
+import org.hibernate.annotations.Proxy
+import org.springframework.data.annotation.LastModifiedDate
+import org.springframework.data.jpa.domain.support.AuditingEntityListener
+import java.io.Serializable
+import java.util.*
+import javax.persistence.CascadeType
+import javax.persistence.Column
+import javax.persistence.FetchType
+import javax.persistence.Id
+import javax.persistence.Lob
+import javax.persistence.OneToOne
+import javax.persistence.Temporal
+import javax.persistence.TemporalType
+
+@EntityListeners(AuditingEntityListener::class)
+@Entity
+@Table(name = "BLUEPRINT_RUNTIME")
+@Proxy(lazy = false)
+class BlueprintProcessorModel : Serializable {
+ @Id
+ @Column(name = "config_model_id")
+ var id: String? = null
+
+ @Column(name = "artifact_uuid")
+ var artifactUUId: String? = null
+
+ @Column(name = "artifact_type")
+ var artifactType: String? = null
+
+ @Column(name = "artifact_version", nullable = false)
+ @ApiModelProperty(required = true)
+ var artifactVersion: String? = null
+
+ @Lob
+ @Column(name = "artifact_description")
+ var artifactDescription: String? = null
+
+ @Column(name = "internal_version")
+ var internalVersion: Int? = null
+
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+ @LastModifiedDate
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "creation_date")
+ var createdDate = Date()
+
+ @Column(name = "artifact_name", nullable = false)
+ @ApiModelProperty(required = true)
+ var artifactName: String? = null
+
+ @Column(name = "published", nullable = false)
+ @ApiModelProperty(required = true)
+ var published: String? = null
+
+ @Column(name = "updated_by", nullable = false)
+ @ApiModelProperty(required = true)
+ var updatedBy: String? = null
+
+ @Lob
+ @Column(name = "tags", nullable = false)
+ @ApiModelProperty(required = true)
+ var tags: String? = null
+
+ @OneToOne(mappedBy = "blueprintModel", fetch = FetchType.EAGER, orphanRemoval = true, cascade = [CascadeType.ALL])
+ var blueprintModelContent: BlueprintProcessorModelContent? = null
+
+ companion object {
+ private const val serialVersionUID = 1L
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt
new file mode 100644
index 00000000..d012af58
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt
@@ -0,0 +1,101 @@
+/*
+ * Copyright © 2019 Bell Canada
+ *
+ * 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.apps.blueprintsprocessor.db.primary.domain
+
+import com.fasterxml.jackson.annotation.JsonFormat
+import io.swagger.annotations.ApiModelProperty
+import java.io.Serializable
+import java.util.Date
+import java.util.Objects
+import javax.persistence.Column
+import javax.persistence.Entity
+import javax.persistence.EntityListeners
+import javax.persistence.Id
+import javax.persistence.JoinColumn
+import javax.persistence.Lob
+import javax.persistence.OneToOne
+import javax.persistence.Table
+import javax.persistence.Temporal
+import javax.persistence.TemporalType
+import org.springframework.data.annotation.LastModifiedDate
+import org.springframework.data.jpa.domain.support.AuditingEntityListener
+
+@EntityListeners(AuditingEntityListener::class)
+@Entity
+@Table(name = "BLUEPRINT_CONTENT_RUNTIME")
+class BlueprintProcessorModelContent : Serializable {
+
+ @Id
+ @Column(name = "config_model_content_id")
+ var id: String? = null
+
+ @Column(name = "name", nullable = false)
+ @ApiModelProperty(required = true)
+ var name: String? = null
+
+ @Column(name = "content_type", nullable = false)
+ @ApiModelProperty(required = true)
+ var contentType: String? = null
+
+ @OneToOne
+ @JoinColumn(name = "config_model_id")
+ var blueprintModel: BlueprintProcessorModel? = null
+
+ @Lob
+ @Column(name = "description")
+ var description: String? = null
+
+ @Lob
+ @Column(name = "content", nullable = false)
+ @ApiModelProperty(required = true)
+ var content: ByteArray? = null
+
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+ @LastModifiedDate
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "updated_date")
+ var creationDate = Date()
+
+ override fun toString(): String {
+ return "[" + "id = " + id +
+ ", name = " + name +
+ ", contentType = " + contentType +
+ "]"
+ }
+
+ override fun equals(o: Any?): Boolean {
+
+ if (o === this) {
+ return true
+ }
+ if (o !is BlueprintProcessorModelContent) {
+ return false
+ }
+ val blueprintModelContent = o as BlueprintProcessorModelContent?
+ return (id == blueprintModelContent!!.id && name == blueprintModelContent.name
+ && contentType == blueprintModelContent.contentType)
+ }
+
+ override fun hashCode(): Int {
+ return Objects.hash(id, name, contentType)
+ }
+
+ companion object {
+ private const val serialVersionUID = 1L
+ }
+
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt
new file mode 100644
index 00000000..e614544e
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2019 Bell Canada.
+ *
+ * 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.apps.blueprintsprocessor.db.primary.repository
+
+import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain.BlueprintProcessorModel
+import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain.BlueprintProcessorModelContent
+import org.onap.ccsdk.apps.controllerblueprints.db.resources.repository.ModelContentRepository
+
+interface BlueprintProcessorModelContentRepository : ModelContentRepository<BlueprintProcessorModel, BlueprintProcessorModelContent> \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt
new file mode 100644
index 00000000..25f3dac9
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2019 Bell Canada.
+ *
+ * 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.apps.blueprintsprocessor.db.primary.repository
+
+import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain.BlueprintProcessorModel
+import org.onap.ccsdk.apps.controllerblueprints.db.resources.repository.ModelRepository
+
+interface BlueprintProcessorModelRepository : ModelRepository<BlueprintProcessorModel>
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt
index aa48c8e3..3f737e31 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt
@@ -21,7 +21,10 @@ import org.junit.runner.RunWith
import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintProperties
import org.onap.ccsdk.apps.blueprintsprocessor.core.BlueprintPropertyConfiguration
import org.onap.ccsdk.apps.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration
import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration
+import org.springframework.context.annotation.ComponentScan
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
@@ -30,8 +33,10 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(classes = [BlueprintPropertyConfiguration::class, BluePrintProperties::class,
- BluePrintDBLibConfiguration::class])
+ BluePrintDBLibConfiguration::class, BluePrintLoadConfiguration::class])
@TestPropertySource(locations = ["classpath:application-test.properties"])
+@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"])
+@EnableAutoConfiguration
class PrimaryDatabaseConfigurationTest {
@Autowired
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties
index 672ff80f..6f10626e 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties
@@ -21,4 +21,8 @@ blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
blueprintsprocessor.db.primary.hibernateDDLAuto=update
blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect \ No newline at end of file
+blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
+
+# Controller Blueprints Core Configuration
+blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
+blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/RestClientServiceTest.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/RestClientServiceTest.kt
index 502758a4..1481406e 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/RestClientServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/RestClientServiceTest.kt
@@ -22,6 +22,7 @@ import org.onap.ccsdk.apps.blueprintsprocessor.core.BlueprintPropertyConfigurati
import org.onap.ccsdk.apps.blueprintsprocessor.rest.BluePrintRestLibConfiguration
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
@@ -32,8 +33,8 @@ import org.springframework.web.bind.annotation.RestController
import kotlin.test.Test
import kotlin.test.assertNotNull
-@EnableAutoConfiguration
@RunWith(SpringRunner::class)
+@EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class])
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@ContextConfiguration(classes = [BluePrintRestLibConfiguration::class, BlueprintPropertyConfiguration::class,
SampleController::class, BluePrintProperties::class])
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
index f319ca41..2c6da2e7 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
@@ -15,7 +15,7 @@
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintCatalogServiceImpl.kt
deleted file mode 100755
index 484972a9..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintCatalogServiceImpl.kt
+++ /dev/null
@@ -1,45 +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.apps.blueprintsprocessor.selfservice.api
-
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintCoreConfiguration
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService
-import org.springframework.stereotype.Service
-import java.io.File
-
-@Service
-class BluePrintCatalogServiceImpl(private val bluePrintCoreConfiguration: BluePrintCoreConfiguration) : BluePrintCatalogService {
-
- override fun uploadToDataBase(file: String, validate : Boolean): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun downloadFromDataBase(name: String, version: String, path: String): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun prepareBluePrint(name: String, version: String): String {
- //TODO("Get the Blueprint from the DB")
- return bluePrintCoreConfiguration.deployPath.plus(File.separator)
- .plus(name).plus(File.separator).plus(version)
-
- }
-
- override fun downloadFromDataBase(uuid: String, path: String): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-validation/pom.xml b/ms/controllerblueprints/modules/blueprint-validation/pom.xml
new file mode 100644
index 00000000..0cafc9a6
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-validation/pom.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>modules</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>blueprint-validation</artifactId>
+ <name>Controller Blueprints Validation Service</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>resource-dict</artifactId>
+ </dependency>
+ </dependencies>
+</project>
+
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/BluePrintTypeValidatorServiceImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/blueprint/validation/BluePrintTypeValidatorServiceImpl.kt
index 9d4797ff..76dfa73e 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/BluePrintTypeValidatorServiceImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/blueprint/validation/BluePrintTypeValidatorServiceImpl.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onap.ccsdk.apps.controllerblueprints.service.validator
+package org.onap.ccsdk.apps.controllerblueprints.blueprint.validation
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.*
import org.springframework.beans.factory.annotation.Autowired
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/BluePrintValidatorDefaultService.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/blueprint/validation/BluePrintValidatorDefaultService.kt
index 89f4d9e3..2993b3d3 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/BluePrintValidatorDefaultService.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/blueprint/validation/BluePrintValidatorDefaultService.kt
@@ -14,19 +14,25 @@
* limitations under the License.
*/
-package org.onap.ccsdk.apps.controllerblueprints.service.validator
+package org.onap.ccsdk.apps.controllerblueprints.blueprint.validation
import com.att.eelf.configuration.EELFLogger
import com.att.eelf.configuration.EELFManager
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidatorService
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.validation.*
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceAssignmentValidationServiceImpl
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionValidationServiceImpl
+import org.onap.ccsdk.apps.controllerblueprints.core.validation.BluePrintArtifactTypeValidatorImpl
+import org.onap.ccsdk.apps.controllerblueprints.core.validation.BluePrintAttributeDefinitionValidatorImpl
+import org.onap.ccsdk.apps.controllerblueprints.core.validation.BluePrintDataTypeValidatorImpl
+import org.onap.ccsdk.apps.controllerblueprints.core.validation.BluePrintNodeTemplateValidatorImpl
+import org.onap.ccsdk.apps.controllerblueprints.core.validation.BluePrintNodeTypeValidatorImpl
+import org.onap.ccsdk.apps.controllerblueprints.core.validation.BluePrintPropertyDefinitionValidatorImpl
+import org.onap.ccsdk.apps.controllerblueprints.core.validation.BluePrintServiceTemplateValidatorImpl
+import org.onap.ccsdk.apps.controllerblueprints.core.validation.BluePrintTopologyTemplateValidatorImpl
+import org.onap.ccsdk.apps.controllerblueprints.core.validation.BluePrintValidatorServiceImpl
+import org.onap.ccsdk.apps.controllerblueprints.core.validation.BluePrintWorkflowValidatorImpl
import org.springframework.stereotype.Service
import java.util.*
@@ -91,13 +97,4 @@ class DefaulBluePrintPropertyDefinitionValidator(bluePrintTypeValidatorService:
@Service
class DefaultBluePrintAttributeDefinitionValidator(bluePrintTypeValidatorService: BluePrintTypeValidatorService)
- : BluePrintAttributeDefinitionValidatorImpl(bluePrintTypeValidatorService)
-
-// Resource Dictionary Validation Services
-
-@Service
-class DefaultResourceAssignmentValidationService : ResourceAssignmentValidationServiceImpl()
-
-@Service
-class DefalutResourceDefinitionValidationService(bluePrintRepoService: BluePrintRepoService)
- : ResourceDefinitionValidationServiceImpl(bluePrintRepoService) \ No newline at end of file
+ : BluePrintAttributeDefinitionValidatorImpl(bluePrintTypeValidatorService) \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/db-resources/pom.xml b/ms/controllerblueprints/modules/db-resources/pom.xml
new file mode 100644
index 00000000..69e322e4
--- /dev/null
+++ b/ms/controllerblueprints/modules/db-resources/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>modules</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>db-resources</artifactId>
+ <name>Controller Blueprints DB Resources</name>
+
+ <properties>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
+ </dependency>
+ </dependencies>
+</project>
+
diff --git a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt b/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt
new file mode 100644
index 00000000..881e3bc4
--- /dev/null
+++ b/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt
@@ -0,0 +1,82 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2019 Bell Canada.
+ *
+ * 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.apps.controllerblueprints.db.resources
+
+import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintArchiveUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintFileUtils
+import java.io.File
+import javax.persistence.MappedSuperclass
+
+@MappedSuperclass
+abstract class BlueprintCatalogServiceImpl(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration) : BluePrintCatalogService {
+
+ override fun uploadToDataBase(file: String, validate: Boolean): String {
+ // The file name provided here is unique as we transform to UUID before storing
+ val blueprintFile = File(file)
+ val fileName = blueprintFile.name
+ val id = BluePrintFileUtils.stripFileExtension(fileName)
+ // If the file is directory
+ if (blueprintFile.isDirectory) {
+
+ val zipFile = File("${bluePrintLoadConfiguration.blueprintArchivePath}/$fileName")
+ // zip the directory
+ BluePrintArchiveUtils.compress(blueprintFile, zipFile, true)
+
+ // Upload to the Data Base
+ saveToDataBase(blueprintFile, id, zipFile)
+
+ // After Upload to Database delete the zip file
+ zipFile.delete()
+
+ } else {
+ // If the file is ZIP
+ // unzip the CBA file to validate before store in database
+ val targetDir = "${bluePrintLoadConfiguration.blueprintDeployPath}/$id/"
+ val extractedDirectory = BluePrintArchiveUtils.deCompress(blueprintFile, targetDir)
+
+ // Upload to the Data Base
+ saveToDataBase(extractedDirectory, id, blueprintFile)
+
+ // After Upload to Database delete the zip file
+ blueprintFile.delete()
+ extractedDirectory.delete()
+ }
+
+ return id
+ }
+
+ override fun downloadFromDataBase(name: String, version: String, path: String): String {
+ // If path ends with zip, then compress otherwise download as extracted folder
+
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun downloadFromDataBase(uuid: String, path: String): String {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun prepareBluePrint(name: String, version: String): String {
+ val preparedPath = "${bluePrintLoadConfiguration.blueprintDeployPath}/$name/$version"
+ downloadFromDataBase(name, version, preparedPath)
+ return preparedPath
+ }
+
+ abstract fun saveToDataBase(extractedDirectory: File, id: String, archiveFile: File, checkValidity: Boolean? = false)
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/repository/ModelContentRepository.kt b/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/repository/ModelContentRepository.kt
new file mode 100644
index 00000000..4965677e
--- /dev/null
+++ b/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/repository/ModelContentRepository.kt
@@ -0,0 +1,93 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2019 Bell Canada.
+ *
+ * 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.apps.controllerblueprints.db.resources.repository
+
+import org.jetbrains.annotations.NotNull
+import java.util.Optional
+import org.springframework.data.jpa.repository.JpaRepository
+import org.springframework.data.repository.NoRepositoryBean
+
+/**
+ * @param <T> Model
+ * @param <B> ModelContent
+ */
+@NoRepositoryBean
+interface ModelContentRepository<T, B> : JpaRepository<B, String> {
+
+ /**
+ * This is a findById method
+ *
+ * @param id id
+ * @return Optional<T>
+ */
+ @NotNull
+ override fun findById(@NotNull id: String): Optional<B>
+
+ /**
+ * This is a findTopByBlueprintModelAndContentType method
+ *
+ * @param blueprintModel blueprintModel
+ * @param contentType contentType
+ * @return Optional<B>
+ */
+ fun findTopByBlueprintModelAndContentType(blueprintModel: T,
+ contentType: String): Optional<B>
+
+ /**
+ * This is a findByBlueprintModelAndContentType method
+ *
+ * @param blueprintModel blueprintModel
+ * @param contentType contentType
+ * @return Optional<BlueprintModelContent>
+ */
+ fun findByBlueprintModelAndContentType(blueprintModel: T, contentType: String): List<B>
+
+ /**
+ * This is a findByBlueprintModel method
+ *
+ * @param blueprintModel B
+ * @return Optional<T>
+ */
+ fun findByBlueprintModel(blueprintModel: T): List<B>
+
+ /**
+ * This is a findByBlueprintModelAndContentTypeAndName method
+ *
+ * @param blueprintModel blueprintModel
+ * @param contentType contentType
+ * @param name name
+ * @return Optional<B>
+ */
+ fun findByBlueprintModelAndContentTypeAndName(blueprintModel: T,
+ contentType: String, name: String): Optional<B>
+
+ /**
+ * This is a deleteByMdeleteByBlueprintModelodelName method
+ *
+ * @param blueprintModel B
+ */
+ fun deleteByBlueprintModel(blueprintModel: T)
+
+ /**
+ * This is a deleteById method
+ *
+ * @param id id
+ */
+ override fun deleteById(@NotNull id: String)
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/repository/ModelRepository.kt b/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/repository/ModelRepository.kt
new file mode 100644
index 00000000..c31f009a
--- /dev/null
+++ b/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/db/resources/repository/ModelRepository.kt
@@ -0,0 +1,88 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2019 Bell Canada.
+ *
+ * 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.apps.controllerblueprints.db.resources.repository
+
+import org.jetbrains.annotations.NotNull
+import java.util.Optional
+import org.springframework.data.jpa.repository.JpaRepository
+import org.springframework.data.repository.NoRepositoryBean
+
+/**
+ * @param <T> Model
+ */
+@NoRepositoryBean
+interface ModelRepository<T> : JpaRepository<T, String> {
+
+ /**
+ * This is a findById method
+ *
+ * @param id id
+ * @return Optional<T>
+ */
+ @NotNull
+ override fun findById(@NotNull id: String): Optional<T>
+
+ /**
+ * This is a findByArtifactNameAndArtifactVersion method
+ *
+ * @param artifactName artifactName
+ * @param artifactVersion artifactVersion
+ * @return Optional<T>
+ */
+ fun findByArtifactNameAndArtifactVersion(artifactName: String, artifactVersion: String): Optional<T>
+
+ /**
+ * This is a findTopByArtifactNameOrderByArtifactIdDesc method
+ *
+ * @param artifactName artifactName
+ * @return Optional<T>
+ */
+ fun findTopByArtifactNameOrderByArtifactVersionDesc(artifactName: String): Optional<T>
+
+ /**
+ * This is a findTopByArtifactName method
+ *
+ * @param artifactName artifactName
+ * @return Optional<T>
+ */
+ fun findTopByArtifactName(artifactName: String): List<T>
+
+ /**
+ * This is a findByTagsContainingIgnoreCase method
+ *
+ * @param tags tags
+ * @return Optional<ModelType>
+ */
+ fun findByTagsContainingIgnoreCase(tags: String): List<T>
+
+ /**
+ * This is a deleteByArtifactNameAndArtifactVersion method
+ *
+ * @param artifactName artifactName
+ * @param artifactVersion artifactVersion
+ */
+ fun deleteByArtifactNameAndArtifactVersion(artifactName: String, artifactVersion: String)
+
+ /**
+ * This is a deleteById method
+ *
+ * @param id id
+ */
+ override fun deleteById(@NotNull id: String)
+
+}
diff --git a/ms/controllerblueprints/modules/pom.xml b/ms/controllerblueprints/modules/pom.xml
index eff2429a..9a53eebf 100644
--- a/ms/controllerblueprints/modules/pom.xml
+++ b/ms/controllerblueprints/modules/pom.xml
@@ -16,9 +16,9 @@
-->
<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
@@ -32,6 +32,8 @@
<modules>
<module>service</module>
+ <module>blueprint-validation</module>
+ <module>db-resources</module>
</modules>
<build>
diff --git a/ms/controllerblueprints/modules/service/pom.xml b/ms/controllerblueprints/modules/service/pom.xml
index 017cfde4..91a9eab1 100644
--- a/ms/controllerblueprints/modules/service/pom.xml
+++ b/ms/controllerblueprints/modules/service/pom.xml
@@ -1,84 +1,96 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>modules</artifactId>
- <version>0.4.0-SNAPSHOT</version>
- </parent>
- <artifactId>service</artifactId>
- <name>Controller Blueprints Service</name>
-
- <properties>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-webflux</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.mariadb.jdbc</groupId>
- <artifactId>mariadb-java-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.projectreactor</groupId>
- <artifactId>reactor-test</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>modules</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>service</artifactId>
+ <name>Controller Blueprints Service</name>
+
+ <properties>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>db-resources</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>blueprint-validation</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>resource-dict</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-webflux</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mariadb.jdbc</groupId>
+ <artifactId>mariadb-java-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito2</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-test-junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.projectreactor</groupId>
+ <artifactId>reactor-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
+
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelService.java
index ba27742a..ca0e2439 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelService.java
@@ -21,14 +21,14 @@ import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import org.jetbrains.annotations.NotNull;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration;
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService;
import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintFileUtils;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModel;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelSearch;
-import org.onap.ccsdk.apps.controllerblueprints.service.load.BluePrintLoadConfiguration;
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.BlueprintModelContentRepository;
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.BlueprintModelRepository;
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.BlueprintModelSearchRepository;
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelContentRepository;
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelRepository;
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelSearchRepository;
import org.onap.ccsdk.apps.controllerblueprints.service.utils.BluePrintEnhancerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ByteArrayResource;
@@ -65,17 +65,17 @@ public class BlueprintModelService {
private BluePrintCatalogService bluePrintCatalogService;
@Autowired
- private BlueprintModelSearchRepository blueprintModelSearchRepository;
+ private ControllerBlueprintModelSearchRepository blueprintModelSearchRepository;
@Autowired
- private BlueprintModelRepository blueprintModelRepository;
+ private ControllerBlueprintModelRepository blueprintModelRepository;
@Autowired
- private BlueprintModelContentRepository blueprintModelContentRepository;
+ private ControllerBlueprintModelContentRepository blueprintModelContentRepository;
private static final String BLUEPRINT_MODEL_ID_FAILURE_MSG = "failed to get blueprint model id(%d) from repo";
private static final String BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG = "failed to get blueprint model by name(%d)" +
- " and version(%d) from repo";
+ " and version(%d) from repo";
/**
* This is a saveBlueprintModel method
@@ -86,10 +86,12 @@ public class BlueprintModelService {
*/
public Mono<BlueprintModelSearch> saveBlueprintModel(FilePart filePart) throws BluePrintException {
try {
- Path cbaLocation = BluePrintFileUtils.Companion.getCbaStorageDirectory(bluePrintLoadConfiguration.blueprintArchivePath);
+ Path cbaLocation = BluePrintFileUtils.Companion
+ .getCbaStorageDirectory(bluePrintLoadConfiguration.blueprintArchivePath);
return BluePrintEnhancerUtils.Companion.saveCBAFile(filePart, cbaLocation).map(fileName -> {
- String blueprintId = bluePrintCatalogService.uploadToDataBase(cbaLocation.resolve(fileName).toString(), false);
- return blueprintModelSearchRepository.findById(blueprintId).get();
+ String blueprintId = bluePrintCatalogService
+ .uploadToDataBase(cbaLocation.resolve(fileName).toString(), false);
+ return blueprintModelSearchRepository.findById(blueprintId).get();
});
} catch (IOException | BluePrintException e) {
@@ -122,14 +124,15 @@ public class BlueprintModelService {
/**
* This is a getBlueprintModelByNameAndVersion method
*
- * @param name name
+ * @param name name
* @param version version
* @return BlueprintModelSearch
*/
- public BlueprintModelSearch getBlueprintModelByNameAndVersion(@NotNull String name, @NotNull String version) throws BluePrintException {
+ public BlueprintModelSearch getBlueprintModelByNameAndVersion(@NotNull String name, @NotNull String version)
+ throws BluePrintException {
BlueprintModelSearch blueprintModelSearch;
Optional<BlueprintModelSearch> dbBlueprintModel = blueprintModelSearchRepository
- .findByArtifactNameAndArtifactVersion(name, version);
+ .findByArtifactNameAndArtifactVersion(name, version);
if (dbBlueprintModel.isPresent()) {
blueprintModelSearch = dbBlueprintModel.get();
} else {
@@ -142,7 +145,6 @@ public class BlueprintModelService {
/**
* This is a downloadBlueprintModelFile method to find the target file to download and return a file resource using MONO
*
- * @param (id)
* @return ResponseEntity<Resource>
*/
public ResponseEntity<Resource> downloadBlueprintModelFile(@NotNull String id) throws BluePrintException {
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ApplicationConstants.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ApplicationConstants.java
deleted file mode 100644
index d16f1b13..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ApplicationConstants.java
+++ /dev/null
@@ -1,34 +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.apps.controllerblueprints.service.common;
-
-/**
- * ApplicationConstants.java Purpose: Provide ControllerBluprintsApplication Constant Information
- *
- * @author Brinda Santh
- * @version 1.0
- */
-public final class ApplicationConstants {
- public static final String ACTIVE_Y = "Y";
- public static final String ACTIVE_N = "N";
- public static final String ASDC_ARTIFACT_TYPE_SDNC_MODEL = "SDNC_MODEL";
-
- private ApplicationConstants() {
-
- }
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/BlueprintModelContentRepository.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/BlueprintModelContentRepository.java
deleted file mode 100644
index 7940c944..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/BlueprintModelContentRepository.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * 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.apps.controllerblueprints.service.repository;
-
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModel;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelContent;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-import javax.validation.constraints.NotNull;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * BlueprintModelContentRepository.java Purpose: Provide BlueprintModelContentRepository of Repository
- *
- * @author Brinda Santh
- * @version 1.0
- */
-@Repository
-public interface BlueprintModelContentRepository extends JpaRepository<BlueprintModelContent, String> {
-
- /**
- * This is a findById method
- *
- * @param id id
- * @return Optional<AsdcArtifacts>
- */
- @NotNull
- Optional<BlueprintModelContent> findById(@NotNull String id);
-
- /**
- * This is a findTopByBlueprintModelAndContentType method
- *
- * @param blueprintModel blueprintModel
- * @param contentType contentType
- * @return Optional<BlueprintModelContent>
- */
- @SuppressWarnings("unused")
- Optional<BlueprintModelContent> findTopByBlueprintModelAndContentType(BlueprintModel blueprintModel, String contentType);
-
- /**
- * This is a findByBlueprintModelAndContentType method
- *
- * @param blueprintModel blueprintModel
- * @param contentType contentType
- * @return Optional<BlueprintModelContent>
- */
- @SuppressWarnings("unused")
- List<BlueprintModelContent> findByBlueprintModelAndContentType(BlueprintModel blueprintModel, String contentType);
-
- /**
- * This is a findByBlueprintModel method
- *
- * @param blueprintModel blueprintModel
- * @return Optional<BlueprintModelContent>
- */
- @SuppressWarnings("unused")
- List<BlueprintModelContent> findByBlueprintModel(BlueprintModel blueprintModel);
-
- /**
- * This is a findByBlueprintModelAndContentTypeAndName method
- *
- * @param blueprintModel blueprintModel
- * @param contentType contentType
- * @param name name
- * @return Optional<BlueprintModelContent>
- */
- @SuppressWarnings("unused")
- Optional<BlueprintModelContent> findByBlueprintModelAndContentTypeAndName(BlueprintModel blueprintModel,
- String contentType, String name);
-
- /**
- * This is a deleteByMdeleteByBlueprintModelodelName method
- *
- * @param blueprintModel blueprintModel
- */
- void deleteByBlueprintModel(BlueprintModel blueprintModel);
-
- /**
- * This is a deleteById method
- *
- * @param id id
- */
- void deleteById(@NotNull String id);
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/BlueprintModelRepository.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/BlueprintModelRepository.java
deleted file mode 100644
index 41316049..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/BlueprintModelRepository.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * 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.apps.controllerblueprints.service.repository;
-
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModel;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-import javax.validation.constraints.NotNull;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * AsdcArtifactsRepository.java Purpose: Provide Configuration Generator AsdcArtifactsRepository
- *
- * @author Brinda Santh
- * @version 1.0
- */
-@Repository
-public interface BlueprintModelRepository extends JpaRepository<BlueprintModel, String> {
- /**
- * This is a findById method
- *
- * @param id id
- * @return Optional<AsdcArtifacts>
- */
- @NotNull
- Optional<BlueprintModel> findById(@NotNull String id);
-
- /**
- * This is a findByArtifactNameAndArtifactVersion method
- *
- * @param artifactName artifactName
- * @param artifactVersion artifactVersion
- * @return Optional<AsdcArtifacts>
- */
- Optional<BlueprintModel> findByArtifactNameAndArtifactVersion(String artifactName, String artifactVersion);
-
- /**
- * This is a findTopByArtifactNameOrderByArtifactIdDesc method
- *
- * @param artifactName artifactName
- * @return Optional<AsdcArtifacts>
- */
- Optional<BlueprintModel> findTopByArtifactNameOrderByArtifactVersionDesc(String artifactName);
-
- /**
- * This is a findTopByArtifactName method
- *
- * @param artifactName artifactName
- * @return Optional<AsdcArtifacts>
- */
- @SuppressWarnings("unused")
- List<BlueprintModel> findTopByArtifactName(String artifactName);
-
- /**
- * This is a findByTagsContainingIgnoreCase method
- *
- * @param tags tags
- * @return Optional<ModelType>
- */
- List<BlueprintModel> findByTagsContainingIgnoreCase(String tags);
-
- /**
- * This is a deleteByArtifactNameAndArtifactVersion method
- *
- * @param artifactName artifactName
- * @param artifactVersion artifactVersion
- */
- @SuppressWarnings("unused")
- void deleteByArtifactNameAndArtifactVersion(String artifactName, String artifactVersion);
-
- /**
- * This is a deleteById method
- *
- * @param id id
- */
- @SuppressWarnings("unused")
- void deleteById(@NotNull String id);
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/BlueprintModelSearchRepository.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelSearchRepository.java
index ed863563..343f8c67 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/BlueprintModelSearchRepository.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelSearchRepository.java
@@ -1,69 +1,69 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * 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.apps.controllerblueprints.service.repository;
-
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelSearch;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-import javax.validation.constraints.NotNull;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * BlueprintModelSearchRepository.java Purpose: Provide Configuration Generator AsdcArtifactsRepository
- *
- * @author Brinda Santh
- * @version 1.0
- */
-@Repository
-public interface BlueprintModelSearchRepository extends JpaRepository<BlueprintModelSearch, Long> {
-
- /**
- * This is a findById method
- *
- * @param id id
- * @return Optional<BlueprintModelSearch>
- */
- @NotNull
- Optional<BlueprintModelSearch> findById(@NotNull String id);
-
- /**
- * This is a findAll method
- * @return List<BlueprintModelSearch>
- */
- @Override
- List<BlueprintModelSearch> findAll();
-
- /**
- * This is a findByArtifactNameAndArtifactVersion method
- *
- * @param artifactName artifactName
- * @param artifactVersion artifactVersion
- * @return Optional<AsdcArtifacts>
- */
- Optional<BlueprintModelSearch> findByArtifactNameAndArtifactVersion(String artifactName, String artifactVersion);
-
- /**
- * This is a findByTagsContainingIgnoreCase method
- *
- * @param tags
- * @return Optional<BlueprintModelSearch>
- */
- List<BlueprintModelSearch> findByTagsContainingIgnoreCase(String tags);
-}
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2019 Bell Canada.
+ *
+ * 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.apps.controllerblueprints.service.repository;
+
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelSearch;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * ControllerBlueprintModelSearchRepository.java Purpose: Provide Configuration Generator AsdcArtifactsRepository
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@Repository
+public interface ControllerBlueprintModelSearchRepository extends JpaRepository<BlueprintModelSearch, Long> {
+
+ /**
+ * This is a findById method
+ *
+ * @param id id
+ * @return Optional<BlueprintModelSearch>
+ */
+ @NotNull
+ Optional<BlueprintModelSearch> findById(@NotNull String id);
+
+ /**
+ * This is a findAll method
+ * @return List<BlueprintModelSearch>
+ */
+ @Override
+ List<BlueprintModelSearch> findAll();
+
+ /**
+ * This is a findByArtifactNameAndArtifactVersion method
+ *
+ * @param artifactName artifactName
+ * @param artifactVersion artifactVersion
+ * @return Optional<AsdcArtifacts>
+ */
+ Optional<BlueprintModelSearch> findByArtifactNameAndArtifactVersion(String artifactName, String artifactVersion);
+
+ /**
+ * This is a findByTagsContainingIgnoreCase method
+ *
+ * @param tags
+ * @return Optional<BlueprintModelSearch>
+ */
+ List<BlueprintModelSearch> findByTagsContainingIgnoreCase(String tags);
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoServiceImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoServiceImpl.kt
index c818410f..f856b9ef 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoServiceImpl.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoServiceImpl.kt
@@ -24,10 +24,21 @@ import org.onap.ccsdk.apps.controllerblueprints.core.data.*
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceAssignmentValidationServiceImpl
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionValidationServiceImpl
import org.onap.ccsdk.apps.controllerblueprints.service.repository.ModelTypeRepository
import org.onap.ccsdk.apps.controllerblueprints.service.repository.ResourceDictionaryRepository
import org.springframework.stereotype.Service
+// Resource Dictionary Validation Services
+
+@Service
+class DefaultResourceAssignmentValidationService : ResourceAssignmentValidationServiceImpl()
+
+@Service
+class DefalutResourceDefinitionValidationService(bluePrintRepoService: BluePrintRepoService)
+ : ResourceDefinitionValidationServiceImpl(bluePrintRepoService)
+
interface ResourceDefinitionRepoService : BluePrintRepoService {
@Throws(BluePrintException::class)
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintCoreConfiguration.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/ControllerBluePrintCoreConfiguration.kt
index 2e5fc5ba..2c4ee746 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintCoreConfiguration.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/ControllerBluePrintCoreConfiguration.kt
@@ -16,7 +16,7 @@
package org.onap.ccsdk.apps.controllerblueprints.service
-import org.onap.ccsdk.apps.controllerblueprints.service.load.BluePrintLoadConfiguration
+import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.context.properties.bind.Bindable
import org.springframework.boot.context.properties.bind.Binder
@@ -27,33 +27,33 @@ import org.springframework.core.env.Environment
import org.springframework.stereotype.Service
@Configuration
-open class BluePrintCoreConfiguration(private val bluePrintProperties: BluePrintProperties) {
+open class ControllerBluePrintCoreConfiguration(private val bluePrintProperties: ControllerBlueprintProperties) {
companion object {
const val PREFIX_BLUEPRINT_LOAD_CONFIGURATION = "controllerblueprints"
}
@Bean
- open fun bluePrintLoadConfiguration(): BluePrintLoadConfiguration {
+ open fun controlelrBlueprintLoadConfiguration(): BluePrintLoadConfiguration {
return bluePrintProperties
.propertyBeanType(PREFIX_BLUEPRINT_LOAD_CONFIGURATION, BluePrintLoadConfiguration::class.java)
}
}
@Configuration
-open class BlueprintPropertyConfiguration {
+open class ControllerBlueprintPropertyConfiguration {
@Autowired
lateinit var environment: Environment
@Bean
- open fun bluePrintPropertyBinder(): Binder {
+ open fun controllerBluePrintPropertyBinder(): Binder {
val configurationPropertySource = ConfigurationPropertySources.get(environment)
return Binder(configurationPropertySource)
}
}
@Service
-open class BluePrintProperties(var bluePrintPropertyBinder: Binder) {
+open class ControllerBlueprintProperties(var bluePrintPropertyBinder: Binder) {
fun <T> propertyBeanType(prefix: String, type: Class<T>): T {
return bluePrintPropertyBinder.bind(prefix, Bindable.of(type)).get()
}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintDatabaseLoadService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintDatabaseLoadService.kt
index eeea97c9..8b6e54af 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintDatabaseLoadService.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintDatabaseLoadService.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.apps.controllerblueprints.service.load
import com.att.eelf.configuration.EELFManager
+import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration
import org.springframework.boot.context.event.ApplicationReadyEvent
import org.springframework.context.event.EventListener
import org.springframework.stereotype.Service
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintLoadConfiguration.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintLoadConfiguration.kt
deleted file mode 100644
index cf36a3e5..00000000
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintLoadConfiguration.kt
+++ /dev/null
@@ -1,34 +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.apps.controllerblueprints.service.load
-
-open class BluePrintLoadConfiguration {
-
- lateinit var blueprintDeployPath: String
- lateinit var blueprintArchivePath: String
- lateinit var blueprintEnrichmentPath: String
-
- var loadInitialData: Boolean = false
- var loadBluePrint: Boolean = false
- var loadBluePrintPaths: String? = null
-
- var loadModelType: Boolean = false
- var loadModeTypePaths: String? = null
-
- var loadResourceDictionary: Boolean = false
- var loadResourceDictionaryPaths: String? = null
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintCatalogServiceImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt
index 761dd25a..ac81f8fa 100755
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintCatalogServiceImpl.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt
@@ -18,80 +18,31 @@
package org.onap.ccsdk.apps.controllerblueprints.service.load
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService
+import org.onap.ccsdk.apps.controllerblueprints.core.common.ApplicationConstants
+import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidatorService
import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintArchiveUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintFileUtils
import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.onap.ccsdk.apps.controllerblueprints.service.common.ApplicationConstants
+import org.onap.ccsdk.apps.controllerblueprints.db.resources.BlueprintCatalogServiceImpl
import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModel
import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelContent
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.BlueprintModelContentRepository
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.BlueprintModelRepository
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelContentRepository
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelRepository
import org.springframework.stereotype.Service
import java.io.File
import java.nio.file.Files
+/**
+Similar implementation in [org.onap.ccsdk.apps.blueprintsprocessor.db.BlueprintProcessorCatalogServiceImpl]
+ */
@Service
-class BluePrintCatalogServiceImpl(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
- private val bluePrintValidatorService: BluePrintValidatorService,
- private val blueprintModelContentRepository: BlueprintModelContentRepository,
- private val blueprintModelRepository: BlueprintModelRepository) : BluePrintCatalogService {
-
- override fun uploadToDataBase(file: String, validate: Boolean): String {
- // The file name provided here is unique as we transform to UUID before storing
- val blueprintFile = File(file)
- val fileName = blueprintFile.name
- val id = BluePrintFileUtils.stripFileExtension(fileName)
- // If the file is directory
- if (blueprintFile.isDirectory) {
-
- val zipFile = File("${bluePrintLoadConfiguration.blueprintArchivePath}/$fileName")
- // zip the directory
- BluePrintArchiveUtils.compress(blueprintFile, zipFile, true)
-
- // Upload to the Data Base
- saveToDataBase(blueprintFile, id, zipFile)
-
- // After Upload to Database delete the zip file
- zipFile.delete()
-
- } else {
- // If the file is ZIP
- // unzip the CBA file to validate before store in database
- val targetDir = "${bluePrintLoadConfiguration.blueprintDeployPath}/$id/"
- val extractedDirectory = BluePrintArchiveUtils.deCompress(blueprintFile, targetDir)
-
- // Upload to the Data Base
- saveToDataBase(extractedDirectory, id, blueprintFile)
-
- // After Upload to Database delete the zip file
- blueprintFile.delete()
- extractedDirectory.delete()
- }
-
- return id
- }
-
- override fun downloadFromDataBase(name: String, version: String, path: String): String {
- // If path ends with zip, then compress otherwise download as extracted folder
-
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun downloadFromDataBase(uuid: String, path: String): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun prepareBluePrint(name: String, version: String): String {
- val preparedPath = "${bluePrintLoadConfiguration.blueprintDeployPath}/$name/$version"
- downloadFromDataBase(name, version, preparedPath)
- return preparedPath
- }
+class ControllerBlueprintCatalogServiceImpl(bluePrintLoadConfiguration: BluePrintLoadConfiguration,
+ private val bluePrintValidatorService: BluePrintValidatorService,
+ private val blueprintModelContentRepository: ControllerBlueprintModelContentRepository,
+ private val blueprintModelRepository: ControllerBlueprintModelRepository)
+ : BlueprintCatalogServiceImpl(bluePrintLoadConfiguration) {
- private fun saveToDataBase(extractedDirectory: File, id: String, archiveFile: File, checkValidity: Boolean? = false) {
- // Upload to the Data Base
- //val id = "save-$uuid"
+ override fun saveToDataBase(extractedDirectory: File, id: String, archiveFile: File, checkValidity: Boolean?) {
var valid = false
val firstItem = BluePrintArchiveUtils.getFirstItemInDirectory(extractedDirectory)
val blueprintBaseDirectory = extractedDirectory.absolutePath + "/" + firstItem
@@ -108,7 +59,7 @@ class BluePrintCatalogServiceImpl(private val bluePrintLoadConfiguration: BluePr
// FIXME("Check Duplicate for Artifact Name and Artifact Version")
val blueprintModel = BlueprintModel()
blueprintModel.id = id
- blueprintModel.artifactType = ApplicationConstants.ASDC_ARTIFACT_TYPE_SDNC_MODEL
+ blueprintModel.artifactType = ApplicationConstants.ASDC_ARTIFACT_TYPE_SDNC_MODEL
blueprintModel.published = ApplicationConstants.ACTIVE_N
blueprintModel.artifactName = metaData[BluePrintConstants.METADATA_TEMPLATE_NAME]
blueprintModel.artifactVersion = metaData[BluePrintConstants.METADATA_TEMPLATE_VERSION]
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelContentRepository.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelContentRepository.kt
new file mode 100644
index 00000000..7cda7276
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelContentRepository.kt
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2019 Bell Canada.
+ *
+ * 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.apps.controllerblueprints.service.repository
+
+import org.onap.ccsdk.apps.controllerblueprints.db.resources.repository.ModelContentRepository
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModel
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelContent
+
+interface ControllerBlueprintModelContentRepository : ModelContentRepository<BlueprintModel, BlueprintModelContent>
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelRepository.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelRepository.kt
new file mode 100644
index 00000000..ec117507
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/repository/ControllerBlueprintModelRepository.kt
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2019 Bell Canada.
+ *
+ * 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.apps.controllerblueprints.service.repository
+
+import org.onap.ccsdk.apps.controllerblueprints.db.resources.repository.ModelRepository
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModel
+
+interface ControllerBlueprintModelRepository : ModelRepository<BlueprintModel>
diff --git a/ms/controllerblueprints/parent/pom.xml b/ms/controllerblueprints/parent/pom.xml
index 38a879ab..ec6f2523 100644
--- a/ms/controllerblueprints/parent/pom.xml
+++ b/ms/controllerblueprints/parent/pom.xml
@@ -190,6 +190,16 @@
<artifactId>resource-dict</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>db-resources</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>blueprint-validation</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!-- Testing Dependencies -->
<dependency>