ac5ea2070575df160d8fb6653a1374cf1ac2eeff
[ccsdk/cds.git] / ms / blueprintsprocessor / modules / inbounds / designer-api / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / designer / api / domain / ResourceDictionary.kt
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.designer.api.domain
18
19 import com.fasterxml.jackson.annotation.JsonFormat
20 import io.swagger.annotations.ApiModelProperty
21 import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
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 ResourceDictionary Entity
30  *
31  * @author Brinda Santh
32  * @version 1.0
33  */
34 @EntityListeners(AuditingEntityListener::class)
35 @Entity
36 @Table(name = "RESOURCE_DICTIONARY")
37 class ResourceDictionary : Serializable {
38
39     @Id
40     @Column(name = "name", nullable = false)
41     @ApiModelProperty(required = true)
42     lateinit var name: String
43
44     @Column(name = "data_type", nullable = false)
45     @ApiModelProperty(required = true)
46     lateinit var dataType: String
47
48     @Column(name = "entry_schema")
49     var entrySchema: String? = null
50
51     @Lob
52     @Convert(converter = JpaResourceDefinitionConverter::class)
53     @Column(name = "definition", nullable = false)
54     @ApiModelProperty(required = true)
55     lateinit var definition: ResourceDefinition
56
57     @Lob
58     @Column(name = "description", nullable = false)
59     @ApiModelProperty(required = true)
60     lateinit var description: String
61
62     @Lob
63     @Column(name = "tags", nullable = false)
64     @ApiModelProperty(required = true)
65     lateinit var tags: String
66
67     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
68     @LastModifiedDate
69     @Temporal(TemporalType.TIMESTAMP)
70     @Column(name = "creation_date")
71     var creationDate: Date? = null
72
73     @Column(name = "updated_by", nullable = false)
74     @ApiModelProperty(required = true)
75     lateinit var updatedBy: String
76
77     override fun toString(): String {
78         return "[" + ", name = " + name +
79                 ", dataType = " + dataType +
80                 ", entrySchema = " + entrySchema +
81                 ", definition =" + definition +
82                 ", description = " + description +
83                 ", updatedBy = " + updatedBy +
84                 ", tags = " + tags +
85                 ", creationDate = " + creationDate +
86                 "]"
87     }
88
89     companion object {
90         private const val serialVersionUID = 1L
91     }
92
93
94 }