7bc88d8c2596dca4e44cc2c1b3b78db407e0e008
[ccsdk/cds.git] /
1 /*
2  *  Copyright © 2019 IBM.
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 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
25 import java.util.*
26 import javax.persistence.*
27
28 /**
29  *  Provide Configuration Generator BlueprintModel Entity
30  *
31  * @author Brinda Santh
32  * @version 1.0
33  */
34
35 @EntityListeners(AuditingEntityListener::class)
36 @Entity
37 @Table(name = "CONFIG_MODEL", uniqueConstraints = [UniqueConstraint(columnNames = ["artifact_name", "artifact_version"])])
38 @Proxy(lazy = false)
39 class BlueprintModel : Serializable {
40     @Id
41     @Column(name = "config_model_id")
42     var id: String? = null
43
44     @Column(name = "service_uuid")
45     var serviceUUID: String? = null
46
47     @Column(name = "distribution_id")
48     var distributionId: String? = null
49
50     @Column(name = "service_name")
51     var serviceName: String? = null
52
53     @Column(name = "service_description")
54     var serviceDescription: String? = null
55
56     @Column(name = "resource_uuid")
57     var resourceUUID: String? = null
58
59     @Column(name = "resource_instance_name")
60     var resourceInstanceName: String? = null
61
62     @Column(name = "resource_name")
63     var resourceName: String? = null
64
65     @Column(name = "resource_version")
66     var resourceVersion: String? = null
67
68     @Column(name = "resource_type")
69     var resourceType: String? = null
70
71     @Column(name = "artifact_uuid")
72     var artifactUUId: String? = null
73
74     @Column(name = "artifact_type")
75     var artifactType: String? = null
76
77     @Column(name = "artifact_version", nullable = false)
78     @ApiModelProperty(required = true)
79     var artifactVersion: String? = null
80
81     @Lob
82     @Column(name = "artifact_description")
83     var artifactDescription: String? = null
84
85     @Column(name = "internal_version")
86     var internalVersion: Int? = null
87
88     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
89     @LastModifiedDate
90     @Temporal(TemporalType.TIMESTAMP)
91     @Column(name = "creation_date")
92     var createdDate = Date()
93
94     @Column(name = "artifact_name", nullable = false)
95     @ApiModelProperty(required = true)
96     var artifactName: String? = null
97
98     @Column(name = "published", nullable = false)
99     @ApiModelProperty(required = true)
100     var published: String? = null
101
102     @Column(name = "updated_by", nullable = false)
103     @ApiModelProperty(required = true)
104     var updatedBy: String? = null
105
106     @Lob
107     @Column(name = "tags", nullable = false)
108     @ApiModelProperty(required = true)
109     var tags: String? = null
110
111     @OneToOne(mappedBy = "blueprintModel", fetch = FetchType.EAGER, orphanRemoval = true, cascade = [CascadeType.ALL])
112     var blueprintModelContent: BlueprintModelContent? = null
113
114     companion object {
115         private const val serialVersionUID = 1L
116     }
117 }