diff options
author | hekeguang <hekeguang@chinamobile.com> | 2022-10-17 15:39:41 +0800 |
---|---|---|
committer | hekeguang <hekeguang@chinamobile.com> | 2022-10-17 15:40:04 +0800 |
commit | 64b84cc8b0f77b7100ef992aa55abaad4a1f5077 (patch) | |
tree | 191c502bcee609e2ff66de455332fb83555903b2 | |
parent | 337b5ae680d3a1a37eba96b05a860f95dada7fe4 (diff) |
Add expectationtarget info.
Issue-ID: USECASEUI-696
Change-Id: I5ad9ebd958ad6b45161cfb3dfae4b0fda8029f9e
Signed-off-by: hekeguang <hekeguang@chinamobile.com>
10 files changed, 91 insertions, 8 deletions
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 722fce9..3e4a53c 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 @@ -26,6 +26,7 @@ import org.onap.usecaseui.intentanalysis.bean.models.*; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule; import org.onap.usecaseui.intentanalysis.service.ImfRegInfoService; +import org.onap.usecaseui.intentanalysis.service.IntentService; import org.onap.usecaseui.intentanalysis.util.CommonUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; @@ -42,6 +43,9 @@ public class CLLBusinessDecisionModule extends DecisionModule { @Autowired private ApplicationContext applicationContext; + @Autowired + IntentService intentService; + @Override public void determineUltimateGoal() { } @@ -141,5 +145,27 @@ public class CLLBusinessDecisionModule extends DecisionModule { return intentMap; } + @Override + public void updateIntentInfo(Intent originIntent, IntentGoalBean intentGoalBean){ + + Intent subIntent = intentGoalBean.getIntent(); + if (subIntent.getIntentName().contains("delivery")){ + List<Expectation> deliveryIntentExpectationList = intentGoalBean.getIntent().getIntentExpectations(); + List<Expectation> originIntentExpectationList = originIntent.getIntentExpectations(); + ExpectationObject deliveryExpectationObject = deliveryIntentExpectationList.get(0).getExpectationObject(); + String objectInstance = deliveryExpectationObject.getObjectInstance(); + + for (Expectation originExpectation : originIntentExpectationList) { + ExpectationObject originExpectationObject = originExpectation.getExpectationObject(); + originExpectationObject.setObjectInstance(objectInstance); + } + } + } + + @Override + public void updateIntentWithOriginIntent(Intent originIntent, Intent intent){ + + } + } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceDecisionModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceDecisionModule.java index b2bf018..3e60bf5 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceDecisionModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceDecisionModule.java @@ -15,6 +15,9 @@ */ package org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt.cllassurancemodule; +import java.util.List; +import org.onap.usecaseui.intentanalysis.bean.models.Expectation; +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.DecisionModule; @@ -29,6 +32,11 @@ public class CLLAssuranceDecisionModule extends DecisionModule { } @Override + public void updateIntentInfo(Intent originIntent, IntentGoalBean intentGoalBean){ + + } + + @Override public IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean) { return null; } @@ -48,4 +56,21 @@ public class CLLAssuranceDecisionModule extends DecisionModule { public LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean) { return null; } + + @Override + public void updateIntentWithOriginIntent(Intent originIntent, Intent intent){ + List<Expectation> originIntentExpectationList = originIntent.getIntentExpectations(); + + String instanceId = ""; + for (Expectation expectation : originIntentExpectationList) { + if (expectation.getExpectationName().contains("assurance")){ + instanceId = expectation.getExpectationObject().getObjectInstance(); + break; + } + } + + for (Expectation expectation : intent.getIntentExpectations()) { + expectation.getExpectationObject().setObjectInstance(instanceId); + } + } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryDecisionModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryDecisionModule.java index 62d7d4c..0ae0867 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryDecisionModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryDecisionModule.java @@ -15,6 +15,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.DecisionModule; @@ -48,4 +49,14 @@ public class CLLDeliveryDecisionModule extends DecisionModule { public LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean) { return null; } + + @Override + public void updateIntentWithOriginIntent(Intent originIntent, Intent intent){ + + } + + @Override + public void updateIntentInfo(Intent originIntent, IntentGoalBean intentGoalBean){ + + } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java index dddadc6..7a24bf2 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java @@ -17,6 +17,7 @@ package org.onap.usecaseui.intentanalysis.formatintentinputMgt.formatintentinput import org.apache.commons.lang.StringUtils; import org.onap.usecaseui.intentanalysis.bean.models.Expectation; +import org.onap.usecaseui.intentanalysis.bean.models.Intent; import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.CLLBusinessIntentManagementFunction; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; @@ -87,4 +88,15 @@ public class FormatIntentInputDecisionModule extends DecisionModule { //todo return null; } + + + @Override + public void updateIntentWithOriginIntent(Intent originIntent, Intent intent){ + + } + + @Override + public void updateIntentInfo(Intent originIntent, IntentGoalBean intentGoalBean){ + + } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/DecisionModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/DecisionModule.java index 7701acc..a8beef3 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/DecisionModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/DecisionModule.java @@ -32,18 +32,23 @@ public abstract class DecisionModule { // find intentManageFunction public abstract IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean); - public Intent intentDefinition(Intent intent) { + public Intent intentDefinition(Intent originIntent, Intent intent) { intent.setIntentId(CommonUtil.getUUid()); List<Expectation> originalExpectationList = intent.getIntentExpectations(); List<Expectation> newExpectationList = getNewExpectationList(originalExpectationList); intent.setIntentExpectations(newExpectationList); + updateIntentWithOriginIntent(originIntent, intent); return intent; } + public abstract void updateIntentWithOriginIntent(Intent originIntent, Intent intent); + public abstract void decideSuitableAction(); public abstract void interactWithTemplateDb(); + public abstract void updateIntentInfo(Intent originIntent, IntentGoalBean intentGoalBean); + public abstract LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean); diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionService.java index a0e2eed..d2fc54f 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionService.java @@ -40,10 +40,10 @@ public class IntentDefinitionService { } } - public void definitionPorcess(Map.Entry<IntentGoalBean, IntentManagementFunction> entry) { + public void definitionPorcess(Intent originIntent, Map.Entry<IntentGoalBean, IntentManagementFunction> entry) { DecisionModule intentDecisionModule = intentOwner.getDecisionModule(); ActuationModule intentActuationModule = intentOwner.getActuationModule(); - Intent newIdIntent = intentDecisionModule.intentDefinition(entry.getKey().getIntent()); + Intent newIdIntent = intentDecisionModule.intentDefinition(originIntent, entry.getKey().getIntent()); intentActuationModule.saveIntentToDb(newIdIntent);//id type } } 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 74cd89c..575ca55 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,6 +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; @@ -37,7 +38,7 @@ public class IntentOperationService { } } - public void operationProcess(IntentGoalBean intentGoalBean) { + public void operationProcess(Intent originIntent, IntentGoalBean intentGoalBean) { DecisionModule intentDecisionModule = intentOwner.getDecisionModule(); ActuationModule intentActuationModule = intentHandler.getActuationModule(); @@ -45,5 +46,8 @@ public class IntentOperationService { intentActuationModule.interactWithIntentHandle(); //determine whether to operate directly or send to next intent handler intentActuationModule.fulfillIntent(intentGoalBean, intentHandler); + + //update origin intent if need + intentDecisionModule.updateIntentInfo(originIntent, intentGoalBean); } } 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 3bc58e1..8b50a47 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 @@ -67,14 +67,14 @@ public class IntentProcessService { Map.Entry<IntentGoalBean, IntentManagementFunction> next = iterator.next(); //definition process save subintent intentDefinitionService.setIntentRole(intentOwner, intentHandler); - intentDefinitionService.definitionPorcess(next); + intentDefinitionService.definitionPorcess(intent, next); //distribution process intentDistributionService.setIntentRole(intentOwner, intentHandler); intentDistributionService.distributionProcess(next); intentOperationService.setIntentRole(intentOwner, next.getValue()); - intentOperationService.operationProcess(next.getKey()); + intentOperationService.operationProcess(intent, next.getKey()); } } diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionServiceTest.java index 6aaeb02..c31aea1 100644 --- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionServiceTest.java +++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionServiceTest.java @@ -89,7 +89,7 @@ public class IntentDefinitionServiceTest { LinkedHashMap<IntentGoalBean, IntentManagementFunction> map = new LinkedHashMap<>(); IntentGoalBean gb = new IntentGoalBean(intent, IntentGoalType.CREATE); map.put(gb, new IntentManagementFunction()); - intentDefinitionService.definitionPorcess(map.entrySet().iterator().next()); + intentDefinitionService.definitionPorcess(intent, map.entrySet().iterator().next()); Assert.assertTrue(true); } }
\ No newline at end of file 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 f52cfa3..65e425c 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 @@ -84,7 +84,7 @@ public class IntentOperationServiceTest { public void testIntentOperation() { intentOperationService.setIntentRole(intentOwner, formatIntentInputManagementFunction); IntentGoalBean intentGoalBean = new IntentGoalBean(intent,IntentGoalType.CREATE); - intentOperationService.operationProcess(intentGoalBean); + intentOperationService.operationProcess(intent, intentGoalBean); Assert.assertTrue(true); } }
\ No newline at end of file |