2 * Copyright © 2019 IBM.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain
19 import com.fasterxml.jackson.annotation.JsonFormat
20 import io.swagger.annotations.ApiModel
21 import io.swagger.annotations.ApiModelProperty
22 import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
23 import org.springframework.data.annotation.LastModifiedDate
24 import org.springframework.data.jpa.domain.support.AuditingEntityListener
25 import java.io.Serializable
27 import javax.persistence.Column
28 import javax.persistence.Convert
29 import javax.persistence.Entity
30 import javax.persistence.EntityListeners
31 import javax.persistence.Id
32 import javax.persistence.Lob
33 import javax.persistence.Table
34 import javax.persistence.Temporal
35 import javax.persistence.TemporalType
38 * Provide ResourceDictionary Entity
40 * @author Brinda Santh
43 @EntityListeners(AuditingEntityListener::class)
46 @Table(name = "RESOURCE_DICTIONARY")
47 class ResourceDictionary : Serializable {
50 @Column(name = "name", nullable = false)
51 @ApiModelProperty(value = "Name", required = true, example = "\"sample-db-source\"")
52 lateinit var name: String
54 @Column(name = "data_type", nullable = false)
55 @ApiModelProperty(value = "Data type", required = true, example = "\"string\"")
56 lateinit var dataType: String
58 @Column(name = "entry_schema")
59 @ApiModelProperty(value = "Entry schema", required = true, example = "\"dt-license-key\"")
60 var entrySchema: String? = null
62 @Column(name = "resource_dictionary_group")
63 @ApiModelProperty(value = "Resource dictionary group", required = true, example = "\"default\"")
64 var resourceDictionaryGroup: String? = null
67 @Convert(converter = JpaResourceDefinitionConverter::class)
68 @Column(name = "definition", nullable = false)
69 @ApiModelProperty(value = "Definition", required = true)
70 lateinit var definition: ResourceDefinition
73 @Column(name = "description", nullable = false)
74 @ApiModelProperty(value = "Description", required = true, example = "\"demo_artifacts_version\"")
75 lateinit var description: String
78 @Column(name = "tags", nullable = false)
79 @ApiModelProperty(value = "Tags", required = true, example = "\"hostname\"")
80 lateinit var tags: String
82 @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
84 @Temporal(TemporalType.TIMESTAMP)
85 @Column(name = "creation_date")
86 var creationDate: Date? = null
88 @Column(name = "updated_by", nullable = false)
89 @ApiModelProperty(value = "Updated by", required = true, example = "\"username\"")
90 lateinit var updatedBy: String
92 override fun toString(): String {
93 return "[" + ", name = " + name +
94 ", dataType = " + dataType +
95 ", entrySchema = " + entrySchema +
96 ", resourceDictionaryGroup = " + resourceDictionaryGroup +
97 ", definition =" + definition +
98 ", description = " + description +
99 ", updatedBy = " + updatedBy +
101 ", creationDate = " + creationDate +
107 private const val serialVersionUID = 1L