From e9b9b7f526101fbeb8742b8643b750e3ca6d72fd Mon Sep 17 00:00:00 2001 From: hekeguang Date: Mon, 19 Sep 2022 15:42:50 +0800 Subject: Add bug fix code. Issue-ID: USECASEUI-696 Change-Id: I50981f768dd385773942278778e1aef60b085edc Signed-off-by: hekeguang --- .../cllBusinessModule/CLLBusinessActuationModule.java | 5 +++-- .../cllBusinessModule/CLLBusinessDecisionModule.java | 19 ++++++++++--------- .../CLLAssuranceActuationModule.java | 3 ++- .../clldeliverymodule/CLLDeliveryActuationModule.java | 3 ++- .../FormatIntentInputActuationModule.java | 3 ++- .../intentModule/ActuationModule.java | 2 +- .../intentModule/KnowledgeModule.java | 3 --- .../intentProcessService/IntentOperationService.java | 6 +++--- .../intentProcessService/IntentProcessService.java | 2 +- .../IntentOperationServiceTest.java | 3 ++- 10 files changed, 26 insertions(+), 23 deletions(-) diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java index 11bc504..d6d72a6 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java @@ -17,6 +17,7 @@ package org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule import org.onap.usecaseui.intentanalysis.bean.models.Intent; +import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; import org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService.IntentProcessService; @@ -52,7 +53,7 @@ public class CLLBusinessActuationModule extends ActuationModule { } @Override - public void fulfillIntent(Intent intent, IntentManagementFunction intentHandler) { - toNextIntentHandler(intent,intentHandler); + public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) { + toNextIntentHandler(intentGoalBean.getIntent(),intentHandler); } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java index 83a8931..95da991 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java @@ -17,6 +17,7 @@ package org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule import lombok.extern.log4j.Log4j2; +import org.apache.commons.lang.StringUtils; import org.onap.usecaseui.intentanalysis.bean.enums.ExpectationType; import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType; import org.onap.usecaseui.intentanalysis.bean.enums.ObjectType; @@ -74,9 +75,9 @@ public class CLLBusinessDecisionModule extends DecisionModule { return true; } else { List objectTypeList = intentExpectations.stream().map(x -> - x.getExpectationObject().getObjectType()).collect(Collectors.toList()); + x.getExpectationObject().getObjectType()).distinct().collect(Collectors.toList()); if (objectTypeList.size() > 1) { - return true; + return true; } } } @@ -110,13 +111,13 @@ public class CLLBusinessDecisionModule extends DecisionModule { public List intentOrchestration(List subIntentGoalList) { List sortList = new ArrayList<>(); - List deliveryGoalList = subIntentGoalList.stream().filter(x -> x.getIntent().getIntentName() - .equalsIgnoreCase("delivery")).collect(Collectors.toList()); - List assuranceGoalList = subIntentGoalList.stream().filter(x -> x.getIntent().getIntentName() - .equalsIgnoreCase("assurance")).collect(Collectors.toList()); - List otherGoalList = subIntentGoalList.stream().filter(x -> !x.getIntent().getIntentName() - .equalsIgnoreCase("assurance") && !x.getIntent().getIntentName() - .equalsIgnoreCase("delivery")).collect(Collectors.toList()); + List deliveryGoalList = subIntentGoalList.stream().filter(x -> + StringUtils.containsIgnoreCase(x.getIntent().getIntentName(), "delivery")).collect(Collectors.toList()); + List assuranceGoalList = subIntentGoalList.stream().filter(x -> + StringUtils.containsIgnoreCase(x.getIntent().getIntentName(), "assurance")).collect(Collectors.toList()); + List otherGoalList = subIntentGoalList.stream().filter(x -> + !StringUtils.containsIgnoreCase(x.getIntent().getIntentName(), "delivery") + && !StringUtils.containsIgnoreCase(x.getIntent().getIntentName(), "assurance")).collect(Collectors.toList()); sortList.addAll(deliveryGoalList); sortList.addAll(assuranceGoalList); sortList.addAll(otherGoalList); diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java index 325e980..9e4697f 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java @@ -16,6 +16,7 @@ package org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt.cllassurancemodule; import org.onap.usecaseui.intentanalysis.bean.models.Intent; +import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; import org.springframework.stereotype.Component; @@ -38,7 +39,7 @@ public class CLLAssuranceActuationModule extends ActuationModule { } @Override - public void fulfillIntent(Intent intent, IntentManagementFunction intentHandler) { + public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) { directOperation(); } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java index b111a9f..10b8cb7 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java @@ -16,6 +16,7 @@ package org.onap.usecaseui.intentanalysis.clldeliveryIntentmgt.clldeliverymodule; import org.onap.usecaseui.intentanalysis.bean.models.Intent; +import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; import org.springframework.stereotype.Component; @@ -38,7 +39,7 @@ public class CLLDeliveryActuationModule extends ActuationModule { } @Override - public void fulfillIntent(Intent intent, IntentManagementFunction intentHandler) { + public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) { this.directOperation(); } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java index 2d308c4..230fcb8 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java @@ -22,6 +22,7 @@ import org.onap.usecaseui.intentanalysis.bean.enums.OperatorType; import org.onap.usecaseui.intentanalysis.bean.models.Condition; import org.onap.usecaseui.intentanalysis.bean.models.Context; import org.onap.usecaseui.intentanalysis.bean.models.Intent; +import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; import org.onap.usecaseui.intentanalysis.formatintentinputMgt.FormatIntentInputManagementFunction; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; @@ -55,7 +56,7 @@ public class FormatIntentInputActuationModule extends ActuationModule { } @Override - public void fulfillIntent(Intent intent, IntentManagementFunction intentHandler) { + public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) { } @Override public void saveIntentToDb(Intent intent){ diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java index ec60df2..90256eb 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java @@ -58,5 +58,5 @@ public abstract class ActuationModule { } //determine if the intent is to be processed directly or sent to the next-level processor - public abstract void fulfillIntent(Intent intent, IntentManagementFunction intentHandler); + public abstract void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler); } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java index b3dbcc2..8c86ca7 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java @@ -17,11 +17,8 @@ package org.onap.usecaseui.intentanalysis.intentBaseService.intentModule; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; -import org.onap.usecaseui.intentanalysis.bean.enums.OperatorType; import org.onap.usecaseui.intentanalysis.bean.models.*; -import org.onap.usecaseui.intentanalysis.formatintentinputMgt.FormatIntentInputManagementFunction; import org.onap.usecaseui.intentanalysis.service.IntentService; -import org.onap.usecaseui.intentanalysis.util.CommonUtil; import org.springframework.beans.factory.annotation.Autowired; import java.util.ArrayList; diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationService.java index d2eb313..74cd89c 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationService.java @@ -16,7 +16,7 @@ package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService; -import org.onap.usecaseui.intentanalysis.bean.models.Intent; +import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule; @@ -37,13 +37,13 @@ public class IntentOperationService { } } - public void operationProcess(Intent intent) { + public void operationProcess(IntentGoalBean intentGoalBean) { DecisionModule intentDecisionModule = intentOwner.getDecisionModule(); ActuationModule intentActuationModule = intentHandler.getActuationModule(); //intentDecisionModule.interactWithTemplateDb(); intentActuationModule.interactWithIntentHandle(); //determine whether to operate directly or send to next intent handler - intentActuationModule.fulfillIntent(intent, intentHandler); + intentActuationModule.fulfillIntent(intentGoalBean, intentHandler); } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessService.java index fc18bf7..3bc58e1 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessService.java @@ -74,7 +74,7 @@ public class IntentProcessService { intentDistributionService.distributionProcess(next); intentOperationService.setIntentRole(intentOwner, next.getValue()); - intentOperationService.operationProcess(next.getKey().getIntent()); + intentOperationService.operationProcess(next.getKey()); } } diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationServiceTest.java index f2167e6..a806fb3 100644 --- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationServiceTest.java +++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationServiceTest.java @@ -83,7 +83,8 @@ public class IntentOperationServiceTest { @Test public void testIntentOperation() { intentOperationService.setIntentRole(intentOwner, formatIntentInputManagementFunction); - intentOperationService.operationProcess(intent); + IntentGoalBean intentGoalBean = new IntentGoalBean(intent,IntentGoalType.CREATE); + intentOperationService.operationProcess(intentGoalBean); Assert.assertTrue(true); } } \ No newline at end of file -- cgit 1.2.3-korg