Merge "Adding changes for catalog edit and create"
[ccsdk/cds.git] / ms / blueprintsprocessor / functions / message-prioritizaion / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / functions / message / prioritization / db / PrioritizationMessageEntity.kt
1 /*
2  * Copyright © 2018-2019 AT&T Intellectual Property.
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.cds.blueprintsprocessor.functions.message.prioritization.db
18
19 import com.fasterxml.jackson.annotation.JsonFormat
20 import org.hibernate.annotations.Proxy
21 import org.springframework.data.annotation.LastModifiedDate
22 import org.springframework.data.jpa.domain.support.AuditingEntityListener
23 import org.springframework.data.jpa.repository.config.EnableJpaAuditing
24 import java.util.*
25 import javax.persistence.*
26
27 @EnableJpaAuditing
28 @EntityListeners(AuditingEntityListener::class)
29 @Entity
30 @Table(name = "MESSAGE_PRIORITIZATION")
31 @Proxy(lazy = false)
32 open class MessagePrioritization {
33     @Id
34     @Column(name = "message_id", length = 50)
35     lateinit var id: String
36
37     @Column(name = "message_group", length = 50, nullable = false)
38     lateinit var group: String
39
40     @Column(name = "message_type", length = 50, nullable = false)
41     lateinit var type: String
42
43     /** States Defined by MessageState */
44     @Column(name = "message_state", length = 20, nullable = false)
45     lateinit var state: String
46
47     @Column(name = "priority", nullable = false)
48     var priority: Int = 5
49
50     @Lob
51     @Column(name = "message", nullable = false)
52     var message: String? = null
53
54     @Lob
55     @Column(name = "error", nullable = true)
56     var error: String? = null
57
58     @Lob
59     @Column(name = "aggregated_message_ids", nullable = true)
60     var aggregatedMessageIds: String? = null
61
62     @Lob
63     @Column(name = "correlation_id", nullable = true)
64     var correlationId: String? = null
65
66     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
67     @Temporal(TemporalType.TIMESTAMP)
68     @Column(name = "created_date", nullable = false)
69     var createdDate = Date()
70
71     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
72     @LastModifiedDate
73     @Temporal(TemporalType.TIMESTAMP)
74     @Column(name = "updated_date", nullable = false)
75     var updatedDate: Date? = null
76
77     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
78     @Temporal(TemporalType.TIMESTAMP)
79     @Column(name = "expiry_date", nullable = false)
80     var expiryDate: Date? = null
81 }