diff options
author | Brinda Santh <bs2796@att.com> | 2019-11-18 12:26:57 -0500 |
---|---|---|
committer | Brinda Santh <bs2796@att.com> | 2019-11-18 12:26:57 -0500 |
commit | 31c2f7de56c5dd90de17ec3026510e5cc660ae67 (patch) | |
tree | 53e4e9a9915dc10fb50b8285533afeabb961332a /ms/blueprintsprocessor | |
parent | 0ff4184e485c31a3a1faa54f6172710bea86c286 (diff) |
Add priority db field and services
Issue-ID: CCSDK-1917
Signed-off-by: Brinda Santh <bs2796@att.com>
Change-Id: I6cf77dfe7882f9528eb65b06e23cb1e89379f5ab
Diffstat (limited to 'ms/blueprintsprocessor')
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() |