Fix: Run both sonar and clm scans in parallel
[ccsdk/cds.git] / ms / blueprintsprocessor / functions / resource-resolution / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / functions / resource / resolution / db / ResourceResolution.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.Index
31 import javax.persistence.Lob
32 import javax.persistence.Table
33 import javax.persistence.Temporal
34 import javax.persistence.TemporalType
35
36 @EntityListeners(AuditingEntityListener::class)
37 @Entity
38 @Table(
39     name = "RESOURCE_RESOLUTION",
40     indexes = [
41         Index(name = "idx_rr_bpnameversion", columnList = "blueprint_name, blueprint_version"),
42         Index(name = "idx_rr_resolution_key", columnList = "resolution_key"),
43         Index(name = "idx_rr_name", columnList = "name"),
44         Index(name = "idx_rr_artifact_name", columnList = "artifact_name"),
45         Index(name = "idx_rr_resource_idtype", columnList = "resource_id, resource_type")
46     ]
47 )
48 @Proxy(lazy = false)
49 class ResourceResolution : Serializable {
50
51     @get:ApiModelProperty(value = "Name of the CBA.", required = true)
52     @Column(name = "blueprint_name", nullable = false)
53     var blueprintName: String? = null
54
55     @get:ApiModelProperty(value = "Version of the CBA.", required = true)
56     @Column(name = "blueprint_version", nullable = false)
57     var blueprintVersion: String? = null
58
59     @get:ApiModelProperty(value = "Artifact name for which to retrieve a resolved resource.", required = true)
60     @Column(name = "artifact_name", nullable = false)
61     var artifactName: String? = null
62
63     @get:ApiModelProperty(value = "Name of the resource.", required = true)
64     @Column(name = "name", nullable = false)
65     var name: String? = null
66
67     @get:ApiModelProperty(value = "Value of the resolution.", required = true)
68     @Lob
69     @Column(name = "value", nullable = false)
70     var value: String? = null
71
72     @get:ApiModelProperty(value = "Whether success of failure.", required = true)
73     @Column(name = "status", nullable = false)
74     var status: String? = null
75
76     @get:ApiModelProperty(
77         value = "Resolution Key uniquely identifying the resolution of a given artifact within a CBA.",
78         required = true
79     )
80     @Column(name = "resolution_key", nullable = false)
81     var resolutionKey: String? = null
82
83     @get:ApiModelProperty(value = "Resolution type.", required = true, example = "\"ServiceInstance\"")
84     @Column(name = "resource_type", nullable = false)
85     var resourceType: String? = null
86
87     @get:ApiModelProperty(value = "ID associated with the resolution type in the inventory system.", required = true)
88     @Column(name = "resource_id", nullable = false)
89     var resourceId: String? = null
90
91     @get:ApiModelProperty(
92         value = "If resolution occurred multiple time, this field provides the index.",
93         required = true
94     )
95     @Column(name = "occurrence", nullable = false)
96     var occurrence: Int = 0
97
98     @get:ApiModelProperty(value = "Name of the data dictionary used for the resolution.", required = true)
99     @Column(name = "dictionary_name", nullable = false)
100     var dictionaryName: String? = null
101
102     @get:ApiModelProperty(
103         value = "Source associated with the data dictionary used for the resolution.",
104         required = true
105     )
106     @Column(name = "dictionary_status", nullable = false)
107     var dictionarySource: String? = null
108
109     @get:ApiModelProperty(value = "Version of the data dictionary used for the resolution.", required = true)
110     @Column(name = "dictionary_version", nullable = false)
111     var dictionaryVersion: Int = 0
112
113     @Id
114     @Column(name = "resource_resolution_id")
115     var id: String? = null
116
117     @get:ApiModelProperty(value = "Creation date of the resolution.", required = true)
118     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
119     @LastModifiedDate
120     @Temporal(TemporalType.TIMESTAMP)
121     @Column(name = "creation_date")
122     var createdDate = Date()
123
124     companion object {
125
126         private const val serialVersionUID = 1L
127     }
128 }