00d4830ea348a8b5a779f33af5a73193d8c48ce7
[ccsdk/cds.git] /
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.apps.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     @Id
44     @Column(name = "config_model_id")
45     var id: String? = null
46
47     @Column(name = "artifact_uuid")
48     var artifactUUId: String? = null
49
50     @Column(name = "artifact_type")
51     var artifactType: String? = null
52
53     @Column(name = "artifact_version", nullable = false)
54     @ApiModelProperty(required = true)
55     var artifactVersion: String? = null
56
57     @Lob
58     @Column(name = "artifact_description")
59     var artifactDescription: String? = null
60
61     @Column(name = "internal_version")
62     var internalVersion: Int? = null
63
64     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
65     @LastModifiedDate
66     @Temporal(TemporalType.TIMESTAMP)
67     @Column(name = "creation_date")
68     var createdDate = Date()
69
70     @Column(name = "artifact_name", nullable = false)
71     @ApiModelProperty(required = true)
72     var artifactName: String? = null
73
74     @Column(name = "published", nullable = false)
75     @ApiModelProperty(required = true)
76     var published: String? = null
77
78     @Column(name = "updated_by", nullable = false)
79     @ApiModelProperty(required = true)
80     var updatedBy: String? = null
81
82     @Lob
83     @Column(name = "tags", nullable = false)
84     @ApiModelProperty(required = true)
85     var tags: String? = null
86
87     @OneToOne(mappedBy = "blueprintModel", fetch = FetchType.EAGER, orphanRemoval = true, cascade = [CascadeType.ALL])
88     var blueprintModelContent: BlueprintProcessorModelContent? = null
89
90     companion object {
91         private const val serialVersionUID = 1L
92     }
93 }