2 * Copyright © 2020 IBM, 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.cds.error.catalog.services.domain
19 import java.io.Serializable
21 import javax.persistence.CascadeType
22 import javax.persistence.Column
23 import javax.persistence.Entity
24 import javax.persistence.FetchType
25 import javax.persistence.Id
26 import javax.persistence.JoinColumn
27 import javax.persistence.JoinTable
28 import javax.persistence.Lob
29 import javax.persistence.ManyToMany
30 import javax.persistence.Table
31 import javax.persistence.UniqueConstraint
34 * Provide ErrorCode Entity
41 @Table(name = "ERROR_DOMAINS", uniqueConstraints = [UniqueConstraint(columnNames = ["name", "application_id"])])
42 class Domain : Serializable {
45 var id: String = UUID.randomUUID().toString()
47 @Column(name = "name")
48 lateinit var name: String
50 @Column(name = "application_id")
51 lateinit var applicationId: String
54 @Column(name = "description")
55 var description: String = ""
57 @ManyToMany(fetch = FetchType.EAGER, cascade = [CascadeType.ALL])
59 name = "ERROR_DOMAINS_ERROR_MESSAGES",
60 joinColumns = [JoinColumn(name = "domain_id", referencedColumnName = "id")],
61 inverseJoinColumns = [JoinColumn(name = "message_id", referencedColumnName = "id")]
63 @Column(name = "error_msg")
64 val errorMessages: MutableSet<ErrorMessageModel> = mutableSetOf()
68 constructor(name: String, applicationId: String, description: String) {
70 this.description = description
71 this.applicationId = applicationId
76 private const val serialVersionUID = 1L