2 * Copyright © 2019 IBM.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain
19 import com.fasterxml.jackson.annotation.JsonFormat
20 import io.swagger.annotations.ApiModelProperty
21 import org.hibernate.annotations.Proxy
22 import org.springframework.data.annotation.LastModifiedDate
23 import org.springframework.data.jpa.domain.support.AuditingEntityListener
24 import java.io.Serializable
26 import javax.persistence.CascadeType
27 import javax.persistence.Column
28 import javax.persistence.Entity
29 import javax.persistence.EntityListeners
30 import javax.persistence.FetchType
31 import javax.persistence.Id
32 import javax.persistence.Lob
33 import javax.persistence.OneToOne
34 import javax.persistence.Table
35 import javax.persistence.Temporal
36 import javax.persistence.TemporalType
37 import javax.persistence.UniqueConstraint
40 * Provide BlueprintModel Entity
42 * @author Brinda Santh
46 @EntityListeners(AuditingEntityListener::class)
48 @Table(name = "BLUEPRINT_MODEL", uniqueConstraints = [UniqueConstraint(columnNames = ["artifact_name", "artifact_version"])])
50 class BlueprintModel : Serializable {
53 @Column(name = "blueprint_model_id")
54 var id: String? = null
56 @Column(name = "service_uuid")
57 var serviceUUID: String? = null
59 @Column(name = "distribution_id")
60 var distributionId: String? = null
62 @Column(name = "service_name")
63 var serviceName: String? = null
65 @Column(name = "service_description")
66 var serviceDescription: String? = null
68 @Column(name = "resource_uuid")
69 var resourceUUID: String? = null
71 @Column(name = "resource_instance_name")
72 var resourceInstanceName: String? = null
74 @Column(name = "resource_name")
75 var resourceName: String? = null
77 @Column(name = "resource_version")
78 var resourceVersion: String? = null
80 @Column(name = "resource_type")
81 var resourceType: String? = null
83 @Column(name = "artifact_uuid")
84 var artifactUUId: String? = null
86 @Column(name = "artifact_type")
87 var artifactType: String? = null
89 @Column(name = "artifact_version", nullable = false)
90 @ApiModelProperty(required = true)
91 lateinit var artifactVersion: String
94 @Column(name = "artifact_description")
95 var artifactDescription: String? = null
97 @Column(name = "internal_version")
98 var internalVersion: Int? = null
100 @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
102 @Temporal(TemporalType.TIMESTAMP)
103 @Column(name = "creation_date")
104 var createdDate = Date()
106 @Column(name = "artifact_name", nullable = false)
107 @ApiModelProperty(required = true)
108 lateinit var artifactName: String
110 @Column(name = "published", nullable = false)
111 @ApiModelProperty(required = true)
112 lateinit var published: String
114 @Column(name = "updated_by", nullable = false)
115 @ApiModelProperty(required = true)
116 lateinit var updatedBy: String
119 @Column(name = "tags", nullable = false)
120 @ApiModelProperty(required = true)
121 lateinit var tags: String
123 @OneToOne(mappedBy = "blueprintModel", fetch = FetchType.EAGER, orphanRemoval = true, cascade = [CascadeType.ALL])
124 var blueprintModelContent: BlueprintModelContent? = null
127 private const val serialVersionUID = 1L