Combine Blueprint entities and repositories. 10/94710/1
authorBrinda Santh <brindasanth@in.ibm.com>
Fri, 30 Aug 2019 20:51:49 +0000 (16:51 -0400)
committerBrinda Santh <brindasanth@in.ibm.com>
Fri, 30 Aug 2019 20:51:49 +0000 (16:51 -0400)
Change-Id: I9e8672d6d0252dcf125e27060322ddd2b455aa39
Issue-ID: CCSDK-1663
Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
17 files changed:
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt [deleted file]
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt [deleted file]
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt [moved from ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/ModelContentRepository.kt with 68% similarity]
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelRepository.kt [moved from ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/ModelRepository.kt with 81% similarity]
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt [moved from ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/ControllerBlueprintModelSearchRepository.kt with 95% similarity]
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt [deleted file]
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt [deleted file]
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/ControllerBlueprintModelContentRepository.kt [deleted file]
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/ControllerBlueprintModelRepository.kt [deleted file]
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/BlueprintCatalogServiceImpl.kt [moved from ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintCatalogServiceImpl.kt with 98% similarity]
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/BlueprintProcessorCatalogServiceImpl.kt [moved from ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt with 92% similarity]
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/service/ControllerBlueprintCatalogServiceImpl.kt [moved from ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ControllerBlueprintCatalogServiceImpl.kt with 95% similarity]
ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt

index 7bc88d8..17ffd5b 100755 (executable)
@@ -26,7 +26,7 @@ import java.util.*
 import javax.persistence.*
 
 /**
- *  Provide Configuration Generator BlueprintModel Entity
+ *  Provide BlueprintModel Entity
  *
  * @author Brinda Santh
  * @version 1.0
@@ -76,7 +76,7 @@ class BlueprintModel : Serializable {
 
     @Column(name = "artifact_version", nullable = false)
     @ApiModelProperty(required = true)
-    var artifactVersion: String? = null
+    lateinit var artifactVersion: String
 
     @Lob
     @Column(name = "artifact_description")
@@ -93,20 +93,20 @@ class BlueprintModel : Serializable {
 
     @Column(name = "artifact_name", nullable = false)
     @ApiModelProperty(required = true)
-    var artifactName: String? = null
+    lateinit var artifactName: String
 
     @Column(name = "published", nullable = false)
     @ApiModelProperty(required = true)
-    var published: String? = null
+    lateinit var published: String
 
     @Column(name = "updated_by", nullable = false)
     @ApiModelProperty(required = true)
-    var updatedBy: String? = null
+    lateinit var updatedBy: String
 
     @Lob
     @Column(name = "tags", nullable = false)
     @ApiModelProperty(required = true)
-    var tags: String? = null
+    lateinit var tags: String
 
     @OneToOne(mappedBy = "blueprintModel", fetch = FetchType.EAGER, orphanRemoval = true, cascade = [CascadeType.ALL])
     var blueprintModelContent: BlueprintModelContent? = null
index a3a42ff..e0d26a7 100644 (file)
@@ -41,11 +41,11 @@ class BlueprintModelContent : Serializable {
 
     @Column(name = "name", nullable = false)
     @ApiModelProperty(required = true)
-    var name: String? = null
+    lateinit var name: String
 
     @Column(name = "content_type", nullable = false)
     @ApiModelProperty(required = true)
-    var contentType: String? = null
+    lateinit var contentType: String
 
     @OneToOne
     @JoinColumn(name = "config_model_id")
@@ -58,7 +58,7 @@ class BlueprintModelContent : Serializable {
     @Lob
     @Column(name = "content", nullable = false)
     @ApiModelProperty(required = true)
-    var content: ByteArray? = null
+    lateinit var content: ByteArray
 
     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
     @LastModifiedDate
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt
deleted file mode 100755 (executable)
index c565262..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.cds.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 = "blueprint_runtime_id")
-    var id: 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
-
-    @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 = "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
-    }
-}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt
deleted file mode 100644 (file)
index dc02d2f..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.cds.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 = "blueprint_content_runtime_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 = "blueprint_runtime_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
-    }
-
-}
 package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository
 
 import org.jetbrains.annotations.NotNull
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelContent
 import org.springframework.data.jpa.repository.JpaRepository
-import org.springframework.data.repository.NoRepositoryBean
+import org.springframework.stereotype.Repository
 import java.util.*
 
 /**
  * @param <T> Model
  * @param <B> ModelContent
  */
-@NoRepositoryBean
-interface ModelContentRepository<T, B> : JpaRepository<B, String> {
+@Repository
+interface BlueprintModelContentRepository : JpaRepository<BlueprintModelContent, String> {
 
     /**
      * This is a findById method
@@ -36,7 +38,7 @@ interface ModelContentRepository<T, B> : JpaRepository<B, String> {
      * @return Optional<T>
      */
     @NotNull
-    override fun findById(@NotNull id: String): Optional<B>
+    override fun findById(@NotNull id: String): Optional<BlueprintModelContent>
 
     /**
      * This is a findTopByBlueprintModelAndContentType method
@@ -45,7 +47,8 @@ interface ModelContentRepository<T, B> : JpaRepository<B, String> {
      * @param contentType contentType
      * @return B?
      */
-    fun findTopByBlueprintModelAndContentType(blueprintModel: T, contentType: String): B?
+    fun findTopByBlueprintModelAndContentType(blueprintModel: BlueprintModel, contentType: String)
+            : BlueprintModelContent?
 
     /**
      * This is a findByBlueprintModelAndContentType method
@@ -54,7 +57,8 @@ interface ModelContentRepository<T, B> : JpaRepository<B, String> {
      * @param contentType contentType
      * @return List<B>
      */
-    fun findByBlueprintModelAndContentType(blueprintModel: T, contentType: String): List<B>
+    fun findByBlueprintModelAndContentType(blueprintModel: BlueprintModel, contentType: String)
+            : List<BlueprintModelContent>
 
     /**
      * This is a findByBlueprintModel method
@@ -62,7 +66,7 @@ interface ModelContentRepository<T, B> : JpaRepository<B, String> {
      * @param blueprintModel T
      * @return List<B>
      */
-    fun findByBlueprintModel(blueprintModel: T): List<B>
+    fun findByBlueprintModel(blueprintModel: BlueprintModel): List<BlueprintModelContent>
 
     /**
      * This is a findByBlueprintModelAndContentTypeAndName method
@@ -72,14 +76,15 @@ interface ModelContentRepository<T, B> : JpaRepository<B, String> {
      * @param name name
      * @return B?
      */
-    fun findByBlueprintModelAndContentTypeAndName(blueprintModel: T, contentType: String, name: String): B?
+    fun findByBlueprintModelAndContentTypeAndName(blueprintModel: BlueprintModel,
+                                                  contentType: String, name: String): BlueprintModelContent?
 
     /**
      * This is a deleteByMdeleteByBlueprintModelodelName method
      *
      * @param blueprintModel T
      */
-    fun deleteByBlueprintModel(blueprintModel: T)
+    fun deleteByBlueprintModel(blueprintModel: BlueprintModel)
 
     /**
      * This is a deleteById method
 package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository
 
 import org.jetbrains.annotations.NotNull
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
 import org.springframework.data.jpa.repository.JpaRepository
-import org.springframework.data.repository.NoRepositoryBean
+import org.springframework.stereotype.Repository
 import java.util.*
 import javax.transaction.Transactional
 
 /**
  * @param <T> Model
  */
-@NoRepositoryBean
-interface ModelRepository<T> : JpaRepository<T, String> {
+@Repository
+interface BlueprintModelRepository : JpaRepository<BlueprintModel, String> {
 
     /**
      * This is a findById method
@@ -35,8 +36,7 @@ interface ModelRepository<T> : JpaRepository<T, String> {
      * @param id id
      * @return Optional<T>
      */
-    @NotNull
-    override fun findById(@NotNull id: String): Optional<T>
+    override fun findById(id: String): Optional<BlueprintModel>
 
     /**
      * This is a findByArtifactNameAndArtifactVersion method
@@ -45,7 +45,7 @@ interface ModelRepository<T> : JpaRepository<T, String> {
      * @param artifactVersion artifactVersion
      * @return T?
      */
-    fun findByArtifactNameAndArtifactVersion(artifactName: String, artifactVersion: String): T?
+    fun findByArtifactNameAndArtifactVersion(artifactName: String, artifactVersion: String): BlueprintModel?
 
     /**
      * This is a findTopByArtifactNameOrderByArtifactIdDesc method
@@ -53,7 +53,7 @@ interface ModelRepository<T> : JpaRepository<T, String> {
      * @param artifactName artifactName
      * @return T?
      */
-    fun findTopByArtifactNameOrderByArtifactVersionDesc(artifactName: String): T?
+    fun findTopByArtifactNameOrderByArtifactVersionDesc(artifactName: String): BlueprintModel?
 
     /**
      * This is a findTopByArtifactName method
@@ -61,7 +61,7 @@ interface ModelRepository<T> : JpaRepository<T, String> {
      * @param artifactName artifactName
      * @return List<T>
      */
-    fun findTopByArtifactName(artifactName: String): List<T>
+    fun findTopByArtifactName(artifactName: String): List<BlueprintModel>
 
     /**
      * This is a findByTagsContainingIgnoreCase method
@@ -69,7 +69,7 @@ interface ModelRepository<T> : JpaRepository<T, String> {
      * @param tags tags
      * @return List<T>
      */
-    fun findByTagsContainingIgnoreCase(tags: String): List<T>
+    fun findByTagsContainingIgnoreCase(tags: String): List<BlueprintModel>
 
     /**
      * This is a deleteByArtifactNameAndArtifactVersion method
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt
deleted file mode 100644 (file)
index e8cdee3..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.cds.blueprintsprocessor.db.primary.repository
-
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintProcessorModel
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintProcessorModelContent
-
-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/cds/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt
deleted file mode 100644 (file)
index e200184..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.cds.blueprintsprocessor.db.primary.repository
-
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintProcessorModel
-
-interface BlueprintProcessorModelRepository : ModelRepository<BlueprintProcessorModel>
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/ControllerBlueprintModelContentRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/ControllerBlueprintModelContentRepository.kt
deleted file mode 100644 (file)
index 3dbaf7b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.cds.blueprintsprocessor.db.primary.repository
-
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelContent
-
-interface ControllerBlueprintModelContentRepository : ModelContentRepository<BlueprintModel, BlueprintModelContent>
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/ControllerBlueprintModelRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/ControllerBlueprintModelRepository.kt
deleted file mode 100644 (file)
index 4e765cd..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.cds.blueprintsprocessor.db.primary.repository
-
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
-
-interface ControllerBlueprintModelRepository : ModelRepository<BlueprintModel>
  * limitations under the License.
  */
 
-package org.onap.ccsdk.cds.blueprintsprocessor.db
+package org.onap.ccsdk.cds.blueprintsprocessor.db.service
 
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintProcessorModel
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintProcessorModelContent
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintProcessorModelRepository
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelContent
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelRepository
 import org.onap.ccsdk.cds.controllerblueprints.core.*
 import org.onap.ccsdk.cds.controllerblueprints.core.common.ApplicationConstants
 import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
@@ -34,14 +34,14 @@ import org.springframework.stereotype.Service
 import java.io.File
 import java.nio.file.Path
 import java.util.*
-
+// TODO("Duplicate : Merge BlueprintProcessorCatalogServiceImpl and ControllerBlueprintCatalogServiceImpl")
 /**
  * Similar/Duplicate implementation in [org.onap.ccsdk.cds.controllerblueprints.service.load.ControllerBlueprintCatalogServiceImpl]
  */
 @Service("blueprintsProcessorCatalogService")
 class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: BluePrintValidatorService,
                                            private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
-                                           private val blueprintModelRepository: BlueprintProcessorModelRepository)
+                                           private val blueprintModelRepository: BlueprintModelRepository)
     : BlueprintCatalogServiceImpl(bluePrintLoadConfiguration, bluePrintRuntimeValidatorService) {
 
     private val log = LoggerFactory.getLogger(BlueprintProcessorCatalogServiceImpl::class.toString())
@@ -123,16 +123,18 @@ class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: Blu
             }
         }
 
-        val blueprintModel = BlueprintProcessorModel()
+        val blueprintModel = BlueprintModel()
         blueprintModel.id = metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID]
         blueprintModel.artifactType = ApplicationConstants.ASDC_ARTIFACT_TYPE_SDNC_MODEL
+        blueprintModel.published = metadata[BluePrintConstants.PROPERTY_BLUEPRINT_VALID]
+                ?: BluePrintConstants.FLAG_Y
         blueprintModel.artifactName = artifactName
         blueprintModel.artifactVersion = artifactVersion
-        blueprintModel.updatedBy = metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR]
-        blueprintModel.tags = metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS]
+        blueprintModel.updatedBy = metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR]!!
+        blueprintModel.tags = metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS]!!
         blueprintModel.artifactDescription = "Controller Blueprint for $artifactName:$artifactVersion"
 
-        val blueprintModelContent = BlueprintProcessorModelContent()
+        val blueprintModelContent = BlueprintModelContent()
         blueprintModelContent.id = metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID]
         blueprintModelContent.contentType = "CBA_ZIP"
         blueprintModelContent.name = "$artifactName:$artifactVersion"
  * limitations under the License.
  */
 
-package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load
+package org.onap.ccsdk.cds.blueprintsprocessor.db.service
 
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelContent
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelRepository
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
 import org.onap.ccsdk.cds.controllerblueprints.core.common.ApplicationConstants
@@ -26,10 +29,6 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode
 import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
 import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService
 import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPath
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BlueprintCatalogServiceImpl
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelContent
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.ControllerBlueprintModelRepository
 import org.slf4j.LoggerFactory
 import org.springframework.dao.DataIntegrityViolationException
 import org.springframework.stereotype.Service
@@ -37,14 +36,14 @@ import java.io.File
 import java.nio.file.Files
 import java.nio.file.Path
 import java.util.*
-
+//TODO("Duplicate : Merge BlueprintProcessorCatalogServiceImpl and ControllerBlueprintCatalogServiceImpl")
 /**
  * Similar implementation in [org.onap.ccsdk.cds.blueprintsprocessor.db.BlueprintProcessorCatalogServiceImpl]
  */
 @Service("controllerBlueprintsCatalogService")
 class ControllerBlueprintCatalogServiceImpl(bluePrintDesignTimeValidatorService: BluePrintValidatorService,
                                             private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
-                                            private val blueprintModelRepository: ControllerBlueprintModelRepository)
+                                            private val blueprintModelRepository: BlueprintModelRepository)
     : BlueprintCatalogServiceImpl(bluePrintLoadConfiguration, bluePrintDesignTimeValidatorService) {
 
 
@@ -98,8 +97,8 @@ class ControllerBlueprintCatalogServiceImpl(bluePrintDesignTimeValidatorService:
                 ?: BluePrintConstants.FLAG_N
         blueprintModel.artifactName = artifactName
         blueprintModel.artifactVersion = artifactVersion
-        blueprintModel.updatedBy = metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR]
-        blueprintModel.tags = metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS]
+        blueprintModel.updatedBy = metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR]!!
+        blueprintModel.tags = metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS]!!
         blueprintModel.artifactDescription = "Controller Blueprint for $artifactName:$artifactVersion"
 
         val blueprintModelContent = BlueprintModelContent()
index 11cd90e..8058dc2 100644 (file)
@@ -22,6 +22,8 @@ import org.junit.Test
 import org.junit.runner.RunWith
 import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.db.mock.MockBlueprintProcessorCatalogServiceImpl
+import org.onap.ccsdk.cds.blueprintsprocessor.db.service.BlueprintCatalogServiceImpl
+import org.onap.ccsdk.cds.blueprintsprocessor.db.service.BlueprintProcessorCatalogServiceImpl
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
 import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
 import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
index 44b0c4b..c074573 100644 (file)
@@ -20,9 +20,9 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler
 
 import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
 import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSearch
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.ControllerBlueprintModelContentRepository
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.ControllerBlueprintModelRepository
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.ControllerBlueprintModelSearchRepository
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelContentRepository
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelRepository
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelSearchRepository
 import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils
 import org.onap.ccsdk.cds.controllerblueprints.core.*
 import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
@@ -52,9 +52,9 @@ import java.util.*
 @Service
 open class BluePrintModelHandler(private val controllerBlueprintsCatalogService: BluePrintCatalogService,
                                  private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
-                                 private val blueprintModelSearchRepository: ControllerBlueprintModelSearchRepository,
-                                 private val blueprintModelRepository: ControllerBlueprintModelRepository,
-                                 private val blueprintModelContentRepository: ControllerBlueprintModelContentRepository,
+                                 private val blueprintModelSearchRepository: BlueprintModelSearchRepository,
+                                 private val blueprintModelRepository: BlueprintModelRepository,
+                                 private val blueprintModelContentRepository: BlueprintModelContentRepository,
                                  private val bluePrintEnhancerService: BluePrintEnhancerService) {
 
     private val log = LoggerFactory.getLogger(BluePrintModelHandler::class.java)!!
index 65b4126..d9e352b 100644 (file)
@@ -56,7 +56,7 @@ import kotlin.test.assertTrue
 class ExecutionServiceHandlerTest {
 
     @Autowired
-    lateinit var blueprintCatalog: BluePrintCatalogService
+    lateinit var blueprintsProcessorCatalogService: BluePrintCatalogService
     @Autowired
     lateinit var webTestClient: WebTestClient
 
@@ -98,7 +98,7 @@ class ExecutionServiceHandlerTest {
     @Test
     fun `test rest process`() {
         runBlocking {
-            blueprintCatalog.saveToDatabase(UUID.randomUUID().toString(), loadTestCbaFile())
+            blueprintsProcessorCatalogService.saveToDatabase(UUID.randomUUID().toString(), loadTestCbaFile())
 
             val executionServiceInput = JacksonUtils
                     .readValueFromClassPathFile("execution-input/default-input.json",
@@ -116,7 +116,7 @@ class ExecutionServiceHandlerTest {
     @Test
     fun `rest resource process should return status code 500 in case of server-side exception`() {
         runBlocking {
-            blueprintCatalog.saveToDatabase(UUID.randomUUID().toString(), loadTestCbaFile())
+            blueprintsProcessorCatalogService.saveToDatabase(UUID.randomUUID().toString(), loadTestCbaFile())
 
             val executionServiceInput = JacksonUtils
                     .readValueFromClassPathFile("execution-input/faulty-input.json",