Fix groupId for error-catalog
[ccsdk/cds.git] / ms / error-catalog / services / src / main / kotlin / org / onap / ccsdk / error / catalog / services / domain / ErrorMessageModel.kt
1 /*
2  *  Copyright © 2020 IBM, Bell Canada.
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.onap.ccsdk.error.catalog.services.domain
18
19 import java.io.Serializable
20 import java.util.UUID
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.Lob
27 import javax.persistence.ManyToMany
28 import javax.persistence.Table
29 import javax.persistence.UniqueConstraint
30
31 /**
32  * Provide Error Message Model Entity
33  *
34  * @author Steve Siani
35  * @version 1.0
36  */
37 @Entity
38 @Table(name = "ERROR_MESSAGES", uniqueConstraints = [UniqueConstraint(columnNames = ["message_id"])])
39 class ErrorMessageModel : Serializable {
40
41     @Id
42     var id: String = UUID.randomUUID().toString()
43
44     @Column(name = "message_id", nullable = false)
45     lateinit var messageID: String
46
47     @Lob
48     @Column(name = "cause")
49     var cause: String = ""
50
51     @Lob
52     @Column(name = "action")
53     lateinit var action: String
54
55     @ManyToMany(mappedBy = "errorMessages", fetch = FetchType.EAGER, cascade = [CascadeType.PERSIST])
56     val domains: MutableSet<Domain> = mutableSetOf()
57
58     companion object {
59         private const val serialVersionUID = 1L
60     }
61
62     constructor()
63
64     constructor(messageId: String, cause: String, action: String) {
65         this.messageID = messageId
66         this.cause = cause
67         this.action = action
68     }
69 }