summaryrefslogtreecommitdiffstats
path: root/dcae-analytics/dcae-analytics-tca-web/src/main/java
diff options
context:
space:
mode:
authorKai <lukai@chinamobile.com>2020-05-18 09:59:28 +0800
committerKai <lukai@chinamobile.com>2020-05-18 10:03:49 +0800
commitddb9b0f7e578aefd06ee9e3f01d810b0b9034f3a (patch)
treeb4612d9976e3348b09029961560e7ceb36c90baa /dcae-analytics/dcae-analytics-tca-web/src/main/java
parent13bb744669580623fd779f287ca9ce647d6182b6 (diff)
for policy update work
Issue-ID: DCAEGEN2-2198 Signed-off-by: Kai Lu <lukai@chinamobile.com> Change-Id: I8e1fec6f180ea3f44fa6df707048b5396b8d5a39
Diffstat (limited to 'dcae-analytics/dcae-analytics-tca-web/src/main/java')
-rw-r--r--dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/config/TcaMrConfig.java2
-rw-r--r--dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/controller/TcaRestController.java3
-rw-r--r--dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/service/TcaProcessingService.java6
-rw-r--r--dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/service/TcaProcessingServiceImpl.java5
4 files changed, 9 insertions, 7 deletions
diff --git a/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/config/TcaMrConfig.java b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/config/TcaMrConfig.java
index e330914..3579d3e 100644
--- a/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/config/TcaMrConfig.java
+++ b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/config/TcaMrConfig.java
@@ -86,7 +86,7 @@ public class TcaMrConfig {
tcaProcessingService.getTcaExecutionResults(
headers.getOrDefault(REQUEST_ID_HEADER_KEY, headers.get(MessageHeaders.ID)).toString(),
headers.getOrDefault(REQUEST_TRANSACTION_ID_HEADER_KEY, "").toString(),
- tcaPolicyWrapper.getTcaPolicy(), cefMessages))
+ tcaPolicyWrapper, cefMessages))
// transform tca execution results to alerts - if not alerts are detected terminate further processing
.transform(tcaAlertTransformer, c -> c.requiresReply(false))
// post messages to dmaap publisher input channel
diff --git a/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/controller/TcaRestController.java b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/controller/TcaRestController.java
index 0d34f90..402d475 100644
--- a/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/controller/TcaRestController.java
+++ b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/controller/TcaRestController.java
@@ -82,10 +82,11 @@ public class TcaRestController {
@ApiOperation(value = "Applies TCA to provided execution request and generated TCA execution response")
public ResponseEntity<List<TcaExecutionResponse>> execute(@RequestBody final TcaExecutionRequest
tcaExecutionRequest) {
+
// process tca execution request
final List<TcaExecutionContext> executionContexts = tcaProcessingService.getTcaExecutionResults(
tcaExecutionRequest.getRequestId(), tcaExecutionRequest.getTransactionId(),
- tcaExecutionRequest.getTcaPolicy(), TcaUtils.getCefMessagesFromEventListeners
+ tcaPolicyWrapper, TcaUtils.getCefMessagesFromEventListeners
(tcaExecutionRequest.getEventListeners()));
// create execution response
final List<TcaExecutionResponse> tcaExecutionResponses = executionContexts.stream().map(tcaExecutionContext -> {
diff --git a/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/service/TcaProcessingService.java b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/service/TcaProcessingService.java
index 39a985c..5b9f5a8 100644
--- a/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/service/TcaProcessingService.java
+++ b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/service/TcaProcessingService.java
@@ -22,7 +22,7 @@ package org.onap.dcae.analytics.tca.web.service;
import java.util.List;
import org.onap.dcae.analytics.tca.core.service.TcaExecutionContext;
-import org.onap.dcae.analytics.tca.model.policy.TcaPolicy;
+import org.onap.dcae.analytics.tca.web.domain.TcaPolicyWrapper;
/**
* Provides TCA functionality
@@ -36,13 +36,13 @@ public interface TcaProcessingService {
*
* @param requestId request id associated with tca execution request
* @param transactionId transaction id associated with the tca execution request
- * @param tcaPolicy tca policy that needs to be applied to CEF messages
+ * @param tcaPolicyWrapper tca policy that needs to be applied to CEF messages
* @param cefMessages list of CEF messages that needs to be processed by TCA
*
* @return results of TCA Processing
*/
List<TcaExecutionContext> getTcaExecutionResults(String requestId, String transactionId,
- TcaPolicy tcaPolicy,
+ TcaPolicyWrapper tcaPolicyWrapper,
List<String> cefMessages);
diff --git a/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/service/TcaProcessingServiceImpl.java b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/service/TcaProcessingServiceImpl.java
index f5aec0b..e05026c 100644
--- a/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/service/TcaProcessingServiceImpl.java
+++ b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/service/TcaProcessingServiceImpl.java
@@ -37,6 +37,7 @@ import org.onap.dcae.analytics.tca.core.service.TcaExecutionContext;
import org.onap.dcae.analytics.tca.core.util.TcaUtils;
import org.onap.dcae.analytics.tca.core.util.function.calculation.TcaCalculator;
import org.onap.dcae.analytics.tca.model.policy.TcaPolicy;
+import org.onap.dcae.analytics.tca.web.domain.TcaPolicyWrapper;
/**
* @author Rajiv Singla
@@ -56,10 +57,10 @@ public class TcaProcessingServiceImpl implements TcaProcessingService {
@Override
public List<TcaExecutionContext> getTcaExecutionResults(final String requestId,
final String transactionId,
- final TcaPolicy tcaPolicy,
+ final TcaPolicyWrapper tcaPolicyWrapper,
final List<String> cefMessages) {
// create tca policy deep copy as it should be same for current execution
- final TcaPolicy tcaPolicyDeepCopy = TcaUtils.getTcaPolicyDeepCopy(tcaPolicy);
+ final TcaPolicy tcaPolicyDeepCopy = TcaUtils.getTcaPolicyDeepCopy(tcaPolicyWrapper.getTcaPolicy());
// create new request id if not present
final String executionRequestId = isPresent(requestId) ? requestId : REQUEST_ID_SUPPLIER.get();
// create transaction id if not present