2  * Copyright © 2019 Bell Canada
 
   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.apps.blueprintsprocessor.db.primary.domain
 
  19 import com.fasterxml.jackson.annotation.JsonFormat
 
  20 import io.swagger.annotations.ApiModelProperty
 
  21 import java.io.Serializable
 
  23 import java.util.Objects
 
  24 import javax.persistence.Column
 
  25 import javax.persistence.Entity
 
  26 import javax.persistence.EntityListeners
 
  27 import javax.persistence.Id
 
  28 import javax.persistence.JoinColumn
 
  29 import javax.persistence.Lob
 
  30 import javax.persistence.OneToOne
 
  31 import javax.persistence.Table
 
  32 import javax.persistence.Temporal
 
  33 import javax.persistence.TemporalType
 
  34 import org.springframework.data.annotation.LastModifiedDate
 
  35 import org.springframework.data.jpa.domain.support.AuditingEntityListener
 
  37 @EntityListeners(AuditingEntityListener::class)
 
  39 @Table(name = "BLUEPRINT_CONTENT_RUNTIME")
 
  40 class BlueprintProcessorModelContent : Serializable {
 
  43     @Column(name = "config_model_content_id")
 
  44     var id: String? = null
 
  46     @Column(name = "name", nullable = false)
 
  47     @ApiModelProperty(required = true)
 
  48     var name: String? = null
 
  50     @Column(name = "content_type", nullable = false)
 
  51     @ApiModelProperty(required = true)
 
  52     var contentType: String? = null
 
  55     @JoinColumn(name = "config_model_id")
 
  56     var blueprintModel: BlueprintProcessorModel? = null
 
  59     @Column(name = "description")
 
  60     var description: String? = null
 
  63     @Column(name = "content", nullable = false)
 
  64     @ApiModelProperty(required = true)
 
  65     var content: ByteArray? = null
 
  67     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
 
  69     @Temporal(TemporalType.TIMESTAMP)
 
  70     @Column(name = "updated_date")
 
  71     var creationDate = Date()
 
  73     override fun toString(): String {
 
  74         return "[" + "id = " + id +
 
  76                 ", contentType = " + contentType +
 
  80     override fun equals(o: Any?): Boolean {
 
  85         if (o !is BlueprintProcessorModelContent) {
 
  88         val blueprintModelContent = o as BlueprintProcessorModelContent?
 
  89         return (id == blueprintModelContent!!.id && name == blueprintModelContent.name
 
  90                 && contentType == blueprintModelContent.contentType)
 
  93     override fun hashCode(): Int {
 
  94         return Objects.hash(id, name, contentType)
 
  98         private const val serialVersionUID = 1L