Prioritization expiry and clean scheduler service
[ccsdk/cds.git] / ms / blueprintsprocessor / functions / message-prioritizaion / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / functions / message / prioritization / MessagePrioritizationStateService.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
18
19 import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.db.MessagePrioritization
20 import java.util.Date
21
22 interface MessagePrioritizationStateService {
23
24     suspend fun saveMessage(message: MessagePrioritization): MessagePrioritization
25
26     suspend fun getMessage(id: String): MessagePrioritization
27
28     suspend fun getMessages(ids: List<String>): List<MessagePrioritization>?
29
30     suspend fun getExpiryEligibleMessages(count: Int): List<MessagePrioritization>?
31
32     suspend fun getMessageForStatesNotExpiredIn(group: String, states: List<String>, count: Int):
33         List<MessagePrioritization>?
34
35     suspend fun getMessageForStatesExpired(group: String, states: List<String>, count: Int):
36         List<MessagePrioritization>?
37
38     suspend fun getExpiredMessages(expiryDate: Date, count: Int): List<MessagePrioritization>?
39
40     suspend fun getExpiredMessages(group: String, expiryDate: Date, count: Int): List<MessagePrioritization>?
41
42     suspend fun getCorrelatedMessages(
43         group: String,
44         states: List<String>,
45         types: List<String>?,
46         correlationIds: String
47     ): List<MessagePrioritization>?
48
49     suspend fun updateMessagesState(ids: List<String>, state: String)
50
51     suspend fun updateMessageState(id: String, state: String): MessagePrioritization
52
53     suspend fun setMessageState(id: String, state: String)
54
55     suspend fun setMessagesPriority(ids: List<String>, priority: String)
56
57     suspend fun setMessagesState(ids: List<String>, state: String)
58
59     suspend fun setMessageStateANdError(id: String, state: String, error: String)
60
61     suspend fun setMessageStateAndAggregatedIds(id: String, state: String, aggregatedIds: List<String>)
62
63     suspend fun deleteMessage(id: String)
64
65     suspend fun deleteMessages(id: List<String>)
66
67     suspend fun deleteExpiredMessage(retentionDays: Int)
68
69     suspend fun deleteMessageByGroup(group: String)
70
71     suspend fun deleteMessageStates(group: String, states: List<String>)
72 }