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 java.util.Objects
26 import javax.persistence.Column
27 import javax.persistence.Entity
28 import javax.persistence.EntityListeners
29 import javax.persistence.Id
30 import javax.persistence.JoinColumn
31 import javax.persistence.Lob
32 import javax.persistence.OneToOne
33 import javax.persistence.Table
34 import javax.persistence.Temporal
35 import javax.persistence.TemporalType
38 * Provide Blueprint Model Content Entity
40 * @author Brinda Santh
43 @EntityListeners(AuditingEntityListener::class)
45 @Table(name = "BLUEPRINT_MODEL_CONTENT")
46 class BlueprintModelContent : Serializable {
49 @Column(name = "blueprint_model_content_id")
50 var id: String? = null
52 @Column(name = "name", nullable = false)
53 @ApiModelProperty(required = true)
54 lateinit var name: String
56 @Column(name = "content_type", nullable = false)
57 @ApiModelProperty(required = true)
58 lateinit var contentType: String
61 @JoinColumn(name = "blueprint_model_id")
62 var blueprintModel: BlueprintModel? = null
65 @Column(name = "description")
66 var description: String? = null
69 @Column(name = "content", nullable = false)
70 @ApiModelProperty(required = true)
71 lateinit var content: ByteArray
73 @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
75 @Temporal(TemporalType.TIMESTAMP)
76 @Column(name = "updated_date")
77 var creationDate = Date()
79 override fun toString(): String {
80 return "[" + "id = " + id +
82 ", contentType = " + contentType +
86 override fun equals(o: Any?): Boolean {
91 if (o !is BlueprintModelContent) {
94 val blueprintModelContent = o as BlueprintModelContent?
95 return (id == blueprintModelContent!!.id && name == blueprintModelContent.name &&
96 contentType == blueprintModelContent.contentType)
99 override fun hashCode(): Int {
100 return Objects.hash(id, name, contentType)
105 private const val serialVersionUID = 1L