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.db.primary.domain
19 import com.fasterxml.jackson.annotation.JsonFormat
20 import io.swagger.annotations.ApiModelProperty
21 import org.springframework.data.annotation.LastModifiedDate
22 import org.springframework.data.jpa.domain.support.AuditingEntityListener
23 import java.io.Serializable
25 import javax.persistence.*
28 * Provide Blueprint Model Content Entity
30 * @author Brinda Santh
33 @EntityListeners(AuditingEntityListener::class)
35 @Table(name = "CONFIG_MODEL_CONTENT")
36 class BlueprintModelContent : Serializable {
39 @Column(name = "config_model_content_id")
40 var id: String? = null
42 @Column(name = "name", nullable = false)
43 @ApiModelProperty(required = true)
44 lateinit var name: String
46 @Column(name = "content_type", nullable = false)
47 @ApiModelProperty(required = true)
48 lateinit var contentType: String
51 @JoinColumn(name = "config_model_id")
52 var blueprintModel: BlueprintModel? = null
55 @Column(name = "description")
56 var description: String? = null
59 @Column(name = "content", nullable = false)
60 @ApiModelProperty(required = true)
61 lateinit var content: ByteArray
63 @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
65 @Temporal(TemporalType.TIMESTAMP)
66 @Column(name = "updated_date")
67 var creationDate = Date()
69 override fun toString(): String {
70 return "[" + "id = " + id +
72 ", contentType = " + contentType +
76 override fun equals(o: Any?): Boolean {
81 if (o !is BlueprintModelContent) {
84 val blueprintModelContent = o as BlueprintModelContent?
85 return (id == blueprintModelContent!!.id && name == blueprintModelContent.name
86 && contentType == blueprintModelContent.contentType)
89 override fun hashCode(): Int {
90 return Objects.hash(id, name, contentType)
95 private const val serialVersionUID = 1L