diff options
Diffstat (limited to 'intentanalysis/src')
10 files changed, 54 insertions, 63 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 ecd5b50..dfb0efe 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 @@ -42,7 +42,9 @@ public class CLLBusinessActuationModule extends ActuationModule { @Override - public void sendToIntentHandler(IntentManagementFunction IntentHandler) { + public void sendToIntentHandler(Intent intent,IntentManagementFunction IntentHandler) { + processService.setIntentRole(IntentHandler, null); + processService.intentProcess(intent); } @Override @@ -54,18 +56,4 @@ public class CLLBusinessActuationModule extends ActuationModule { public void interactWithIntentHandle() { } - - @Override - public void saveIntentToDb(List<Map<IntentGoalBean, IntentManagementFunction>> intentMapList) { - List<IntentGoalBean> subIntentGoalLit = new ArrayList<>(); - for (Map<IntentGoalBean, IntentManagementFunction> map : intentMapList) { - subIntentGoalLit.addAll(map.keySet()); - } - List<Intent> subIntentList = subIntentGoalLit.stream().map(IntentGoalBean::getIntent) - .collect(Collectors.toList()); - for (Intent subIntent : subIntentList) { - intentService.createIntent(subIntent); - } - - } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/FormatIntentInputManagementFunction.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/FormatIntentInputManagementFunction.java index ebbe9b8..2e80c88 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/FormatIntentInputManagementFunction.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/FormatIntentInputManagementFunction.java @@ -16,17 +16,10 @@ package org.onap.usecaseui.intentanalysis.formatintentinputMgt; import lombok.Data; -import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule.CLLBusinessActuationModule; -import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule.CLLBusinessDecisionModule; -import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule.CLLBusinessKnowledgeModule; -import org.onap.usecaseui.intentanalysis.formatintentinputMgt.formatintentinputModule.FormatIntentInputActuationModule; -import org.onap.usecaseui.intentanalysis.formatintentinputMgt.formatintentinputModule.FormatIntentInputDecisionModule; -import org.onap.usecaseui.intentanalysis.formatintentinputMgt.formatintentinputModule.FormatIntentInputKnowledgeModule; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.KnowledgeModule; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -40,11 +33,13 @@ public class FormatIntentInputManagementFunction extends IntentManagementFunctio this.knowledgeModule=knowledgeModule; } @Resource(name= "formatIntentInputActuationModule") - public void setKnowledgeModule(ActuationModule actuationModule) { + public void setActuationModule(ActuationModule actuationModule) { + this.actuationModule=actuationModule; } @Resource(name= "formatIntentInputDecisionModule") - public void setKnowledgeModule(DecisionModule decisionModule) { + public void setDecisionModule(DecisionModule decisionModule) { + this.decisionModule=decisionModule; } } 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 df8e714..8042d7f 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 @@ -15,17 +15,20 @@ */ package org.onap.usecaseui.intentanalysis.formatintentinputMgt.formatintentinputModule; -import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; +import org.onap.usecaseui.intentanalysis.bean.models.Intent; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; +import org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService.IntentProcessService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Map; @Component public class FormatIntentInputActuationModule extends ActuationModule { + @Autowired + IntentProcessService processService; @Override - public void sendToIntentHandler(IntentManagementFunction IntentHandler) { + public void sendToIntentHandler(Intent intent, IntentManagementFunction IntentHandler) { + processService.setIntentRole(IntentHandler, null); + processService.intentProcess(intent); } @Override @@ -35,14 +38,4 @@ public class FormatIntentInputActuationModule extends ActuationModule { @Override public void interactWithIntentHandle() { } - - @Override - public void saveIntentToDb(List<Map<IntentGoalBean, IntentManagementFunction>> intentMapList) { - // - } - - @Override - public boolean distrubuteIntentToHandler(Map<IntentGoalBean, IntentManagementFunction> intentMap) { - return false; - } } 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 f49326a..4faa719 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 @@ -25,8 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; @Component public class FormatIntentInputDecisionModule extends DecisionModule { @@ -40,8 +39,8 @@ public class FormatIntentInputDecisionModule extends DecisionModule { @Override public IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean) { // if intentName contain cll return - if (StringUtils.equalsIgnoreCase(intentGoalBean.getIntent().getIntentName(), "cll")) { - return (IntentManagementFunction) applicationContext.getBean(CLLBusinessIntentManagementFunction.class.getName()); + if (intentGoalBean.getIntent().getIntentName().toLowerCase(Locale.ROOT).contains("cll")) { + return (IntentManagementFunction) applicationContext.getBean(CLLBusinessIntentManagementFunction.class.getSimpleName()); } return null; } @@ -60,12 +59,16 @@ public class FormatIntentInputDecisionModule extends DecisionModule { @Override public List<Map<IntentGoalBean, IntentManagementFunction>> findHandler(IntentGoalBean intentGoalBean) { + List<Map<IntentGoalBean, IntentManagementFunction>> intentMapList = new ArrayList<>(); boolean needDecompostion = needDecompostion(intentGoalBean); if (needDecompostion) { intentDecomposition(intentGoalBean); + }else{ + Map<IntentGoalBean, IntentManagementFunction> map = new HashMap<>(); + map.put(intentGoalBean, exploreIntentHandlers(intentGoalBean)); + intentMapList.add(map); } - exploreIntentHandlers(intentGoalBean); - return null; + return intentMapList; } public boolean needDecompostion(IntentGoalBean intentGoalBean) { 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 e9ee3f7..6c7b4f7 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 @@ -17,27 +17,38 @@ package org.onap.usecaseui.intentanalysis.intentBaseService.intentModule; import org.apache.commons.lang.StringUtils; import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType; +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.intentinterfaceservice.IntentInterfaceService; +import org.onap.usecaseui.intentanalysis.service.IntentService; import org.springframework.beans.factory.annotation.Autowired; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; public abstract class ActuationModule { @Autowired IntentInterfaceService intentInterfaceService; + @Autowired + IntentService intentService; //actuationModel & knownledgeModel interact - public abstract void sendToIntentHandler(IntentManagementFunction IntentHandler); + public abstract void sendToIntentHandler(Intent intent, IntentManagementFunction IntentHandler); public abstract void sendToNonIntentHandler();//直接操作 public abstract void interactWithIntentHandle(); //Save intent information to the intent instance database - public abstract void saveIntentToDb(List<Map<IntentGoalBean, IntentManagementFunction>> intentMapList); + public void saveIntentToDb(Map<IntentGoalBean, IntentManagementFunction> intentMap) { + List<Intent> subIntentList = intentMap.keySet().stream().map(IntentGoalBean::getIntent) + .collect(Collectors.toList()); + for (Intent subIntent : subIntentList) { + intentService.createIntent(subIntent); + } + } public boolean distrubuteIntentToHandler(Map<IntentGoalBean, IntentManagementFunction> intentMap) { for (Map.Entry<IntentGoalBean, IntentManagementFunction> entry : intentMap.entrySet()) { 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 a75701d..01581c4 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 @@ -41,10 +41,10 @@ public class IntentDefinitionService { } } - public void definitionPorcess(List<Map<IntentGoalBean,IntentManagementFunction>> intentMapList) { + public void definitionPorcess(Map<IntentGoalBean,IntentManagementFunction> intentMap) { DecisionModule intentDecisionModule = intentOwner.getDecisionModule(); ActuationModule intentActuationModule = intentOwner.getActuationModule(); intentDecisionModule.intentDefinition(); - intentActuationModule.saveIntentToDb(intentMapList);//id type + intentActuationModule.saveIntentToDb(intentMap);//id type } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java index 9e6c921..3a4e48e 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java @@ -16,16 +16,12 @@ package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService; -import org.apache.commons.lang.StringUtils; -import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType; 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.intentinterfaceservice.IntentInterfaceService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.List; import java.util.Map; @Service @@ -47,8 +43,8 @@ public class IntentDistributionService { public boolean distributionProcess(Map<IntentGoalBean, IntentManagementFunction> intentMap) { - intentOwner.getActuationModule().distrubuteIntentToHandler(intentMap); - return false; + return intentOwner.getActuationModule().distrubuteIntentToHandler(intentMap); + } } 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 47fe679..f26be6c 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.intentBaseService.IntentManagementFunction; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule; @@ -36,13 +37,14 @@ public class IntentOperationService { } } - public void operationProcess() { + public void operationProcess(Intent intent) { DecisionModule intentDecisionModule = intentOwner.getDecisionModule(); - ActuationModule intentActuationModule = intentHandler.getActuationModule(); + ActuationModule intentActuationModule = intentOwner.getActuationModule(); //intentDecisionModule.interactWithTemplateDb(); intentActuationModule.interactWithIntentHandle(); - intentActuationModule.sendToIntentHandler(intentHandler); + + intentActuationModule.sendToIntentHandler(intent,intentHandler); intentActuationModule.sendToNonIntentHandler(); } 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 537f582..df1c437 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 @@ -64,15 +64,18 @@ public class IntentProcessService { for (Map<IntentGoalBean,IntentManagementFunction> map : intentListMap) { //definition process save subintent intentDefinitionService.setIntentRole(intentOwner,intentHandler); - intentDefinitionService.definitionPorcess(intentListMap); + intentDefinitionService.definitionPorcess(map); //distribution process intentDistributionService.setIntentRole(intentOwner,intentHandler); intentDistributionService.distributionProcess(map); - //operation process - intentOperationService.setIntentRole(intentOwner,intentHandler); - intentOperationService.operationProcess(); + //operation process enery entry only have one key-value + for (Map.Entry<IntentGoalBean, IntentManagementFunction> entry : map.entrySet()) { + intentOperationService.setIntentRole(intentOwner,entry.getValue()); + intentOperationService.operationProcess(entry.getKey().getIntent()); + } + } } diff --git a/intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml index 7b8a115..03af60b 100644 --- a/intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml +++ b/intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml @@ -7,7 +7,7 @@ <insert id="insertIMFRegInfoRegInfo"> insert into intent_management_function_reg_info(imfr_info_id, imfr_info_description, support_model,handle_name,intent_function_type) values - (#{imfregInfo.id}, #{imfregInfo.description}, #{imfregInfo.supportArea},#{imfregInfo.handleName},#{imfregInfo.intentFunctionType}) + (#{imfregInfo.id}, #{imfregInfo.description}, #{imfregInfo.supportModel},#{imfregInfo.handleName},#{imfregInfo.intentFunctionType}) </insert> <select id="getImfRegInfoList" resultType="org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo"> |