aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/MessagePrioritizationRepositories.kt12
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/PrioritizationMessageEntity.kt3
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateService.kt7
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessagePrioritizationSample.kt1
4 files changed, 23 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/MessagePrioritizationRepositories.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/MessagePrioritizationRepositories.kt
index 69c81079d..5c2495fd7 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/MessagePrioritizationRepositories.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/MessagePrioritizationRepositories.kt
@@ -77,12 +77,24 @@ interface PrioritizationMessageRepository : JpaRepository<MessagePrioritization,
@Modifying
@Transactional
+ @Query("UPDATE MessagePrioritization SET priority = :priority, updatedDate = :currentDate " +
+ "WHERE id = :id")
+ fun setPriorityForMessageId(id: String, priority: String, currentDate: Date): Int
+
+ @Modifying
+ @Transactional
@Query("UPDATE MessagePrioritization SET state = :state, updatedDate = :currentDate " +
"WHERE id IN :ids")
fun setStateForMessageIds(ids: List<String>, state: String, currentDate: Date): Int
@Modifying
@Transactional
+ @Query("UPDATE MessagePrioritization SET priority = :priority, updatedDate = :currentDate " +
+ "WHERE id IN :ids")
+ fun setPriorityForMessageIds(ids: List<String>, priority: String, currentDate: Date): Int
+
+ @Modifying
+ @Transactional
@Query("UPDATE MessagePrioritization SET state = :state, error = :error, updatedDate = :currentDate " +
"WHERE id = :id")
fun setStateAndErrorForMessageId(id: String, state: String, error: String, currentDate: Date): Int
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/PrioritizationMessageEntity.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/PrioritizationMessageEntity.kt
index 1825f91c2..15e85b0e7 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/PrioritizationMessageEntity.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/PrioritizationMessageEntity.kt
@@ -44,6 +44,9 @@ open class MessagePrioritization {
@Column(name = "message_state", length = 20, nullable = false)
lateinit var state: String
+ @Column(name = "priority", nullable = false)
+ var priority: Int = 5
+
@Lob
@Column(name = "message", nullable = false)
var message: String? = null
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateService.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateService.kt
index 8424226c2..6138fa9d3 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateService.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateService.kt
@@ -54,6 +54,8 @@ interface MessagePrioritizationStateService {
suspend fun setMessageState(id: String, state: String)
+ suspend fun setMessagesPriority(ids: List<String>, priority: String)
+
suspend fun setMessagesState(ids: List<String>, state: String)
suspend fun setMessageStateANdError(id: String, state: String, error: String)
@@ -141,6 +143,11 @@ open class MessagePrioritizationStateServiceImpl(
}
@Transactional
+ override suspend fun setMessagesPriority(ids: List<String>, priority: String) {
+ prioritizationMessageRepository.setPriorityForMessageIds(ids, priority, Date())
+ }
+
+ @Transactional
override suspend fun setMessagesState(ids: List<String>, state: String) {
prioritizationMessageRepository.setStateForMessageIds(ids, state, Date())
}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessagePrioritizationSample.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessagePrioritizationSample.kt
index 3281a97f9..185022973 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessagePrioritizationSample.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessagePrioritizationSample.kt
@@ -93,6 +93,7 @@ object MessagePrioritizationSample {
group = groupName
type = messageType
state = messageState
+ priority = 5
correlationId = messageCorrelationId
message = "I am the Message"
createdDate = Date()