summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/commons
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2019-08-30 11:03:10 -0400
committerBrinda Santh <brindasanth@in.ibm.com>2019-08-30 11:03:10 -0400
commitd39c13bf2aff5f80029a4b8beb949f1f4a9ed189 (patch)
tree9367aca6e578cc88aa0d479b670629e925b2a6a2 /ms/blueprintsprocessor/modules/commons
parentb7ab2e2c1aa96168169bac8e76e9e9b5f71e7839 (diff)
Refactor model entity and repository.
Change-Id: I6f06fc46fcedbe1cbb8a8e6f8c30b131680a5b08 Issue-ID: CCSDK-1663 Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons')
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt117
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt98
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt82
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/ControllerBlueprintModelContentRepository.kt22
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/ControllerBlueprintModelRepository.kt21
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/ControllerBlueprintModelSearchRepository.kt62
6 files changed, 402 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt
new file mode 100755
index 000000000..7bc88d8c2
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt
@@ -0,0 +1,117 @@
+/*
+ * Copyright © 2019 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain
+
+import com.fasterxml.jackson.annotation.JsonFormat
+import io.swagger.annotations.ApiModelProperty
+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.*
+
+/**
+ * Provide Configuration Generator BlueprintModel Entity
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+@EntityListeners(AuditingEntityListener::class)
+@Entity
+@Table(name = "CONFIG_MODEL", uniqueConstraints = [UniqueConstraint(columnNames = ["artifact_name", "artifact_version"])])
+@Proxy(lazy = false)
+class BlueprintModel : Serializable {
+ @Id
+ @Column(name = "config_model_id")
+ var id: String? = null
+
+ @Column(name = "service_uuid")
+ var serviceUUID: String? = null
+
+ @Column(name = "distribution_id")
+ var distributionId: String? = null
+
+ @Column(name = "service_name")
+ var serviceName: String? = null
+
+ @Column(name = "service_description")
+ var serviceDescription: String? = null
+
+ @Column(name = "resource_uuid")
+ var resourceUUID: String? = null
+
+ @Column(name = "resource_instance_name")
+ var resourceInstanceName: String? = null
+
+ @Column(name = "resource_name")
+ var resourceName: String? = null
+
+ @Column(name = "resource_version")
+ var resourceVersion: String? = null
+
+ @Column(name = "resource_type")
+ var resourceType: 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: BlueprintModelContent? = 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/BlueprintModelContent.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt
new file mode 100644
index 000000000..a3a42ff3d
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt
@@ -0,0 +1,98 @@
+/*
+ * Copyright © 2019 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain
+
+import com.fasterxml.jackson.annotation.JsonFormat
+import io.swagger.annotations.ApiModelProperty
+import org.springframework.data.annotation.LastModifiedDate
+import org.springframework.data.jpa.domain.support.AuditingEntityListener
+import java.io.Serializable
+import java.util.*
+import javax.persistence.*
+
+/**
+ * Provide Blueprint Model Content Entity
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@EntityListeners(AuditingEntityListener::class)
+@Entity
+@Table(name = "CONFIG_MODEL_CONTENT")
+class BlueprintModelContent : 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: BlueprintModel? = 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 BlueprintModelContent) {
+ return false
+ }
+ val blueprintModelContent = o as BlueprintModelContent?
+ 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
+ }
+
+}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt
new file mode 100644
index 000000000..f00d5cadf
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt
@@ -0,0 +1,82 @@
+/*
+ * Copyright © 2019 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain
+
+import com.fasterxml.jackson.annotation.JsonFormat
+import com.fasterxml.jackson.annotation.JsonTypeInfo
+import com.fasterxml.jackson.annotation.JsonTypeName
+import org.springframework.data.annotation.LastModifiedDate
+import java.io.Serializable
+import java.util.*
+import javax.persistence.*
+
+/**
+ * Provide Blueprint Model Search Entity
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+@Entity
+@Table(name = "CONFIG_MODEL")
+@JsonTypeName("blueprintModel")
+@JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)
+class BlueprintModelSearch : 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)
+ 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)
+ var artifactName: String? = null
+
+ @Column(name = "published", nullable = false)
+ var published: String? = null
+
+ @Column(name = "updated_by", nullable = false)
+ var updatedBy: String? = null
+
+ @Lob
+ @Column(name = "tags", nullable = false)
+ var tags: String? = null
+
+ companion object {
+ const val serialversionuid = 1L
+ }
+}
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
new file mode 100644
index 000000000..59b82a3da
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/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.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
+import org.onap.ccsdk.cds.controllerblueprints.db.resources.repository.ModelContentRepository
+
+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
new file mode 100644
index 000000000..c26475b1d
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/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.cds.blueprintsprocessor.db.primary.repository
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
+import org.onap.ccsdk.cds.controllerblueprints.db.resources.repository.ModelRepository
+
+interface ControllerBlueprintModelRepository : ModelRepository<BlueprintModel>
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/ControllerBlueprintModelSearchRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/ControllerBlueprintModelSearchRepository.kt
new file mode 100644
index 000000000..0e0c5435b
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/ControllerBlueprintModelSearchRepository.kt
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2019 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSearch
+import org.springframework.data.jpa.repository.JpaRepository
+import org.springframework.stereotype.Repository
+
+/**
+ * Provide Configuration Generator AsdcArtifactsRepository
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@Repository
+interface ControllerBlueprintModelSearchRepository : JpaRepository<BlueprintModelSearch, Long> {
+
+ /**
+ * This is a findById method
+ *
+ * @param id id
+ * @return Optional<BlueprintModelSearch>
+ </BlueprintModelSearch> */
+ fun findById(id: String): BlueprintModelSearch?
+
+ /**
+ * This is a findAll method
+ * @return List<BlueprintModelSearch>
+ </BlueprintModelSearch> */
+ override fun findAll(): List<BlueprintModelSearch>
+
+ /**
+ * This is a findByArtifactNameAndArtifactVersion method
+ *
+ * @param artifactName artifactName
+ * @param artifactVersion artifactVersion
+ * @return Optional<AsdcArtifacts>
+ </AsdcArtifacts> */
+ fun findByArtifactNameAndArtifactVersion(artifactName: String, artifactVersion: String): BlueprintModelSearch?
+
+ /**
+ * This is a findByTagsContainingIgnoreCase method
+ *
+ * @param tags
+ * @return Optional<BlueprintModelSearch>
+ </BlueprintModelSearch> */
+ fun findByTagsContainingIgnoreCase(tags: String): List<BlueprintModelSearch>
+} \ No newline at end of file