Add message prioritization module
[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     @Lob
48     @Column(name = "message", nullable = false)
49     var message: String? = null
50
51     @Lob
52     @Column(name = "aggregated_message_ids", nullable = true)
53     var aggregatedMessageIds: String? = null
54
55     @Lob
56     @Column(name = "correlation_id", nullable = true)
57     var correlationId: String? = null
58
59     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
60     @Temporal(TemporalType.TIMESTAMP)
61     @Column(name = "created_date", nullable = false)
62     var createdDate = Date()
63
64     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
65     @LastModifiedDate
66     @Temporal(TemporalType.TIMESTAMP)
67     @Column(name = "updated_date", nullable = false)
68     var updatedDate: Date? = null
69
70     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
71     @Temporal(TemporalType.TIMESTAMP)
72     @Column(name = "expiry_date", nullable = false)
73     var expiryDate: Date? = null
74 }