Formatting Code base with ktlint
[ccsdk/cds.git] / ms / blueprintsprocessor / functions / resource-resolution / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / functions / resource / resolution / db / TemplateResolution.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.functions.resource.resolution.db
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.Date
26 import javax.persistence.Column
27 import javax.persistence.Entity
28 import javax.persistence.EntityListeners
29 import javax.persistence.Id
30 import javax.persistence.Lob
31 import javax.persistence.Table
32 import javax.persistence.Temporal
33 import javax.persistence.TemporalType
34
35 @EntityListeners(AuditingEntityListener::class)
36 @Entity
37 @Table(name = "TEMPLATE_RESOLUTION")
38 @Proxy(lazy = false)
39 class TemplateResolution : Serializable {
40
41     @get:ApiModelProperty(value = "Name of the CBA.", required = true)
42     @Column(name = "blueprint_name", nullable = false)
43     var blueprintName: String? = null
44
45     @get:ApiModelProperty(value = "Version of the CBA.", required = true)
46     @Column(name = "blueprint_version", nullable = false)
47     var blueprintVersion: String? = null
48
49     @get:ApiModelProperty(value = "Artifact name for which to retrieve a resolved resource.", required = true)
50     @Column(name = "artifact_name", nullable = false)
51     var artifactName: String? = null
52
53     @get:ApiModelProperty(value = "Rendered template.", required = true)
54     @Lob
55     @Column(name = "result", nullable = false)
56     var result: String? = null
57
58     @get:ApiModelProperty(
59         value = "Resolution Key uniquely identifying the resolution of a given artifact within a CBA.",
60         required = true
61     )
62     @Column(name = "resolution_key", nullable = false)
63     var resolutionKey: String? = null
64
65     @get:ApiModelProperty(value = "Resolution type.", required = true, example = "ServiceInstance, VfModule, VNF")
66     @Column(name = "resource_type", nullable = false)
67     var resourceType: String? = null
68
69     @get:ApiModelProperty(value = "ID associated with the resolution type in the inventory system.", required = true)
70     @Column(name = "resource_id", nullable = false)
71     var resourceId: String? = null
72
73     @get:ApiModelProperty(
74         value = "If resolution occurred multiple time, this field provides the index.",
75         required = true
76     )
77     @Column(name = "occurrence", nullable = false)
78     var occurrence: Int = 1
79
80     @Id
81     @Column(name = "template_resolution_id")
82     var id: String? = null
83
84     @get:ApiModelProperty(value = "Creation date of the resolution.", required = true)
85     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
86     @LastModifiedDate
87     @Temporal(TemporalType.TIMESTAMP)
88     @Column(name = "creation_date")
89     var createdDate = Date()
90
91     companion object {
92         private const val serialVersionUID = 1L
93     }
94 }