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