Migrate ccsdk/apps to ccsdk/cds
[ccsdk/cds.git] / ms / blueprintsprocessor / modules / commons / db-lib / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / db / primary / domain / BlueprintProcessorModel.kt
1 /*
2  * Copyright © 2019 Bell Canada
3  *
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain
18
19 import com.fasterxml.jackson.annotation.JsonFormat
20 import io.swagger.annotations.ApiModelProperty
21 import javax.persistence.Entity
22 import javax.persistence.EntityListeners
23 import javax.persistence.Table
24 import org.hibernate.annotations.Proxy
25 import org.springframework.data.annotation.LastModifiedDate
26 import org.springframework.data.jpa.domain.support.AuditingEntityListener
27 import java.io.Serializable
28 import java.util.*
29 import javax.persistence.CascadeType
30 import javax.persistence.Column
31 import javax.persistence.FetchType
32 import javax.persistence.Id
33 import javax.persistence.Lob
34 import javax.persistence.OneToOne
35 import javax.persistence.Temporal
36 import javax.persistence.TemporalType
37
38 @EntityListeners(AuditingEntityListener::class)
39 @Entity
40 @Table(name = "BLUEPRINT_RUNTIME")
41 @Proxy(lazy = false)
42 class BlueprintProcessorModel : Serializable {
43
44     @Id
45     @Column(name = "blueprint_runtime_id")
46     var id: String? = null
47
48     @Column(name = "artifact_type")
49     var artifactType: String? = null
50
51     @Column(name = "artifact_version", nullable = false)
52     @ApiModelProperty(required = true)
53     var artifactVersion: String? = null
54
55     @Lob
56     @Column(name = "artifact_description")
57     var artifactDescription: String? = null
58
59     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
60     @LastModifiedDate
61     @Temporal(TemporalType.TIMESTAMP)
62     @Column(name = "creation_date")
63     var createdDate = Date()
64
65     @Column(name = "artifact_name", nullable = false)
66     @ApiModelProperty(required = true)
67     var artifactName: String? = null
68
69     @Column(name = "updated_by", nullable = false)
70     @ApiModelProperty(required = true)
71     var updatedBy: String? = null
72
73     @Lob
74     @Column(name = "tags", nullable = false)
75     @ApiModelProperty(required = true)
76     var tags: String? = null
77
78     @OneToOne(mappedBy = "blueprintModel", fetch = FetchType.EAGER, orphanRemoval = true, cascade = [CascadeType.ALL])
79     var blueprintModelContent: BlueprintProcessorModelContent? = null
80
81     companion object {
82         private const val serialVersionUID = 1L
83     }
84 }