diff options
Diffstat (limited to 'intentanalysis/src')
22 files changed, 310 insertions, 80 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ExpectationType.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ExpectationType.java index fbddde2..34b0b8b 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ExpectationType.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ExpectationType.java @@ -17,12 +17,11 @@ package org.onap.usecaseui.intentanalysis.bean.enums; import lombok.Getter; -import lombok.Setter; @Getter public enum ExpectationType { - EXPECTATION1(0, "expectationType1"), - EXPECTATION2(1, "expectationType2"); + DELIVERY(0, "delivery"), + ASSURANCE(1, "assurance"); private int index; diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/DetectionGoalType.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/IntentGoalType.java index abe3ef0..624f1e2 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/DetectionGoalType.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/IntentGoalType.java @@ -19,8 +19,8 @@ package org.onap.usecaseui.intentanalysis.bean.enums; import lombok.Getter; @Getter -public enum DetectionGoalType { - ADD(0, "add"), +public enum IntentGoalType { + CREATE(0, "create"), UPDATE(1, "update"), DELETE(2, "delete"); @@ -28,7 +28,7 @@ public enum DetectionGoalType { private String desc; - DetectionGoalType(int index, String desc) { + IntentGoalType(int index, String desc) { this.index = index; this.desc = desc; } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportArea.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportArea.java index 3cf08f7..6543580 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportArea.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportArea.java @@ -22,8 +22,9 @@ import lombok.Getter; @Getter public enum SupportArea { SLICING(0, "slicing"), - FEMALE(1, "5g"), - MALE(2, "4g"); + CLLBUSINESS(1, "cllbusiness"), + DELIVERY(2, "delivery"), + ASSURANCE(3, "assurance"); private int type; private String desc; diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/DetectionGoalBean.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentGoalBean.java index 6ea045b..b4ae516 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/DetectionGoalBean.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentGoalBean.java @@ -16,15 +16,19 @@ package org.onap.usecaseui.intentanalysis.bean.models; import lombok.Data; -import org.onap.usecaseui.intentanalysis.bean.enums.DetectionGoalType; +import lombok.NoArgsConstructor; +import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType; @Data -public class DetectionGoalBean { +public class IntentGoalBean { private Intent intent; - private DetectionGoalType detectionGoalType; + private IntentGoalType intentGoalType; - public DetectionGoalBean(Intent intent, DetectionGoalType detectionGoalType) { + public IntentGoalBean(Intent intent, IntentGoalType intentGoalType) { this.intent = intent; - this.detectionGoalType = detectionGoalType; + this.intentGoalType = intentGoalType; + } + + public IntentGoalBean() { } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java index b137942..7b3ff5a 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java @@ -30,5 +30,7 @@ public class IntentManagementFunctionRegInfo { private String supportModel; private List<SupportInterface> supportInterfaces; private String handleName; - private IntentFunctionType intentFunctionType;//out or in + //distinguish internal or external function + private IntentFunctionType intentFunctionType; + } 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 8214b46..bcda367 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 @@ -16,39 +16,145 @@ package org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule; -import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule; +import lombok.extern.log4j.Log4j2; +import org.onap.usecaseui.intentanalysis.bean.enums.ExpectationType; +import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType; +import org.onap.usecaseui.intentanalysis.bean.enums.ObjectType; +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.bean.models.IntentManagementFunctionRegInfo; 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.util.CommonUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Service; +import java.util.*; +import java.util.stream.Collectors; + +@Log4j2 @Service public class CLLBusinessDecisionModule implements DecisionModule { - @Override - public void determineUltimateGoal() {} + @Autowired + private ImfRegInfoService imfRegInfoService; + @Autowired + private ApplicationContext applicationContext; @Override - public IntentManagementFunction exploreIntentHandlers() { - - return null; - + public void determineUltimateGoal() { } @Override - public void intentDefinition() {} + public IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean) { + // db filter imf supportArea; + //SupportInterface> supportInterfaces; + IntentGoalType intentGoalType = intentGoalBean.getIntentGoalType(); + String intentName = intentGoalBean.getIntent().getIntentName(); + List<IntentManagementFunctionRegInfo> imfRegInfoList = imfRegInfoService.getImfRegInfoList(); + //todo + List<IntentManagementFunctionRegInfo> imfList = imfRegInfoList.stream(). + filter(x -> x.getSupportArea().contains(intentName) + && x.getSupportInterfaces().contains(intentGoalType)).collect(Collectors.toList()); + if (!Optional.ofNullable(imfList).isPresent()) { + log.info("The intent name is %s not find the corresponding IntentManagementFunction", intentName); + } + return (IntentManagementFunction) applicationContext.getBean(imfList.get(0).getHandleName()); + } @Override - public void decideSuitableAction() {} + public void intentDefinition() { + } @Override - public boolean needDecompostion() { + public void decideSuitableAction() { + } + + + public boolean needDecompostion(IntentGoalBean intentGoalBean) { + //different expectationType need decompostion ExpectationType>1 or objtype>1 + if (intentGoalBean.getIntentGoalType().equals(IntentGoalType.CREATE)) { + List<Expectation> intentExpectations = intentGoalBean.getIntent().getIntentExpectations(); + List<ExpectationType> expectationTypeList = intentExpectations.stream() + .map(Expectation::getExpectationType).distinct().collect(Collectors.toList()); + if (expectationTypeList.size() > 1) { + return true; + } else { + List<ObjectType> objectTypeList = intentExpectations.stream().map(x -> + x.getExpectationObject().getObjectType()).collect(Collectors.toList()); + if (objectTypeList.size() > 1) { + return true; + } + } + } return false; } - @Override - public void intentDecomposition() {} + public List<IntentGoalBean> intentDecomposition(IntentGoalBean intentGoalBean) { + //ExpectationType expectation.ExpectationObject.objtype + Map<ExpectationType, List<Expectation>> expectationTypeListMap = intentGoalBean.getIntent().getIntentExpectations() + .stream().collect(Collectors.groupingBy(x -> x.getExpectationType())); + List<IntentGoalBean> subIntentGoalList = new ArrayList<>(); + IntentGoalType intentGoalType = intentGoalBean.getIntentGoalType(); + for (Map.Entry<ExpectationType, List<Expectation>> entry : expectationTypeListMap.entrySet()) { + + Map<ObjectType, List<Expectation>> objTypeMap = entry.getValue().stream() + .collect(Collectors.groupingBy(x -> x.getExpectationObject().getObjectType())); + for (Map.Entry<ObjectType, List<Expectation>> objEntry : objTypeMap.entrySet()) { + IntentGoalBean subIntentGoalBean = new IntentGoalBean(); + Intent subIntent = new Intent(); + subIntent.setIntentId(CommonUtil.getUUid()); + subIntent.setIntentName(objEntry.getValue().get(0).getExpectationName().replace("Expectation", "Intent")); + subIntent.setIntentExpectations(objEntry.getValue()); + //TODO intentFulfilmentInfo intentContexts + subIntentGoalBean.setIntentGoalType(intentGoalType); + subIntentGoalBean.setIntent(subIntent); + subIntentGoalList.add(subIntentGoalBean); + } + } + return subIntentGoalList; + } + + public List<IntentGoalBean> intentOrchestration(List<IntentGoalBean> subIntentGoalList) { + List<IntentGoalBean> sortList = new ArrayList<>(); + List<IntentGoalBean> deliveryGoalList = subIntentGoalList.stream().filter(x -> x.getIntent().getIntentName() + .equalsIgnoreCase("delivery")).collect(Collectors.toList()); + List<IntentGoalBean> assuranceGoalList = subIntentGoalList.stream().filter(x -> x.getIntent().getIntentName() + .equalsIgnoreCase("assurance")).collect(Collectors.toList()); + List<IntentGoalBean> otherGoalList = subIntentGoalList.stream().filter(x -> !x.getIntent().getIntentName() + .equalsIgnoreCase("assurance") && !x.getIntent().getIntentName() + .equalsIgnoreCase("delivery")).collect(Collectors.toList()); + sortList.addAll(deliveryGoalList); + sortList.addAll(assuranceGoalList); + sortList.addAll(otherGoalList); + return sortList; + } @Override - public void intentOrchestration() {} + public void interactWithTemplateDb() { + } @Override - public void interactWithTemplateDb() {} + public List<Map<IntentGoalBean, IntentManagementFunction>> findHandler(IntentGoalBean intentGoalBean) { + boolean needDecompostion = needDecompostion(intentGoalBean); + List<Map<IntentGoalBean, IntentManagementFunction>> intentMapList = new ArrayList<>(); + if (needDecompostion) { + List<IntentGoalBean> subIntentGoalList = intentDecomposition(intentGoalBean); + List<IntentGoalBean> sortList = intentOrchestration(subIntentGoalList); + for (IntentGoalBean subIntentGoal : sortList) { + Map<IntentGoalBean, IntentManagementFunction> map = new HashMap<>(); + IntentManagementFunction imf = exploreIntentHandlers(subIntentGoal); + //TODO call probe interface if fail intentFulfilmentInfo throw exception + map.put(subIntentGoal, imf); + intentMapList.add(map); + } + } else { + Map<IntentGoalBean, IntentManagementFunction> map = new HashMap<>(); + map.put(intentGoalBean, exploreIntentHandlers(intentGoalBean)); + intentMapList.add(map); + } + return intentMapList; + } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessKnowledgeModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessKnowledgeModule.java index 43a6247..372b0d5 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessKnowledgeModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessKnowledgeModule.java @@ -16,8 +16,8 @@ package org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule; import org.apache.commons.collections.CollectionUtils; -import org.onap.usecaseui.intentanalysis.bean.enums.DetectionGoalType; -import org.onap.usecaseui.intentanalysis.bean.models.DetectionGoalBean; +import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType; +import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; import org.onap.usecaseui.intentanalysis.bean.models.Expectation; import org.onap.usecaseui.intentanalysis.bean.models.ExpectationTarget; import org.onap.usecaseui.intentanalysis.bean.models.Intent; @@ -40,11 +40,10 @@ public class CLLBusinessKnowledgeModule implements KnowledgeModule { IntentService intentService; @Override - public Intent intentCognition(Intent intent) { + public IntentGoalBean intentCognition(Intent intent) { List<String> intendIdList = intentResolution(intent); getSystemStatus(); - determineDetectionGoal(intent, intendIdList); - return null; + return determineDetectionGoal(intent, intendIdList); } /** @@ -54,11 +53,8 @@ public class CLLBusinessKnowledgeModule implements KnowledgeModule { */ public List<String> intentResolution(Intent intent) { - //dc contain original intent - String intentName = intent.getIntentName(); - List<Intent> intentList = intentService.getIntentList(); - List<Intent> sameNameIntentList = intentList.stream().filter(x -> x.getIntentName() - .contains(intentName)).collect(Collectors.toList()); + //db contain original intent + List<Intent> sameNameIntentList = intentService.getIntentByName(intent.getIntentName()); List<String> intentIdList = new ArrayList<>(); if (CollectionUtils.isNotEmpty(sameNameIntentList)) { List<Expectation> expectationList = intent.getIntentExpectations(); @@ -110,12 +106,12 @@ public class CLLBusinessKnowledgeModule implements KnowledgeModule { /** * Determine add, delete, modify according to theobject,target and context of the expectation */ - DetectionGoalBean determineDetectionGoal(Intent intent, List<String> intentIdList) { + public IntentGoalBean determineDetectionGoal(Intent intent, List<String> intentIdList) { int size = intentIdList.size(); if (size == 0) { - return new DetectionGoalBean(intent, DetectionGoalType.ADD); + return new IntentGoalBean(intent, IntentGoalType.CREATE); } else { - return new DetectionGoalBean(intent, DetectionGoalType.UPDATE); + return new IntentGoalBean(intent, IntentGoalType.UPDATE); } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/IntentHandleService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/IntentHandleService.java index ab2419f..2d420d7 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/IntentHandleService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/IntentHandleService.java @@ -15,25 +15,38 @@ */ package org.onap.usecaseui.intentanalysis.intentBaseService; +import lombok.extern.slf4j.Slf4j; import org.onap.usecaseui.intentanalysis.bean.models.Intent; import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo; +import org.onap.usecaseui.intentanalysis.common.ResponseConsts; +import org.onap.usecaseui.intentanalysis.exception.DataBaseException; import org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService.IntentProcessService; +import org.onap.usecaseui.intentanalysis.service.ImfRegInfoService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Service; - +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +@Slf4j @Service public class IntentHandleService { @Autowired private IntentProcessService processService; + @Autowired + private ImfRegInfoService imfRegInfoService; + @Autowired + private ApplicationContext applicationContext; /** * Process the original intent and find the corresponding IntentManagementFunction + * * @param intent */ - public void handleOriginalIntent(Intent intent){ - IntentManagementFunction intentOwner = getOtigalIMF(intent); - handleIntent(intent,intentOwner); + public void handleOriginalIntent(Intent intent) { + IntentManagementFunction intentOwner = getOriginalIMF(intent); + handleIntent(intent, intentOwner); } public void handleIntent(Intent intent, IntentManagementFunction intentOwner) { @@ -55,9 +68,17 @@ public class IntentHandleService { //This is used to get he IntentManagementFunction for a subIntent decomposition. return null; } - - public IntentManagementFunction getOtigalIMF(Intent intent){ + + public IntentManagementFunction getOriginalIMF(Intent intent) { //select IntentManagementFunction based on intent name - return null; + String intentName = intent.getIntentName(); + List<IntentManagementFunctionRegInfo> imfRegInfoList = imfRegInfoService.getImfRegInfoList(); + List<IntentManagementFunctionRegInfo> list = imfRegInfoList.stream().filter(x -> x.getSupportArea().contains(intentName)).collect(Collectors.toList()); + if (!Optional.ofNullable(list).isPresent()) { + String msg = String.format("Intent name %s doesn't exist IntentManagementFunction in database.", intent.getIntentName()); + log.error(msg); + throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY); + } + return (IntentManagementFunction) applicationContext.getBean(list.get(0).getHandleName()); } } 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 1762e63..76601a8 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 @@ -16,23 +16,22 @@ package org.onap.usecaseui.intentanalysis.intentBaseService.intentModule; +import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; -public interface DecisionModule { - void determineUltimateGoal();// - IntentManagementFunction exploreIntentHandlers(); - void intentDefinition(); - void decideSuitableAction(); +import java.util.List; +import java.util.Map; - //confirm whether the intent needs to be decomposed and orchestrated - public boolean needDecompostion(); +public interface DecisionModule { + void determineUltimateGoal(); - //call decomposition module - public void intentDecomposition(); + IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean); - //call orchestration module - public void intentOrchestration(); + void intentDefinition(); + void decideSuitableAction(); public void interactWithTemplateDb(); + + public List<Map<IntentGoalBean, IntentManagementFunction>> findHandler(IntentGoalBean intentGoalBean); } 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 4bb803b..d5caf1f 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 @@ -16,8 +16,9 @@ package org.onap.usecaseui.intentanalysis.intentBaseService.intentModule; import org.onap.usecaseui.intentanalysis.bean.models.Intent; +import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; public interface KnowledgeModule { //Parse, decompose, orchestrate the original intent - Intent intentCognition(Intent intent); + IntentGoalBean intentCognition(Intent intent); } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionService.java index 13ed2fd..699c1b1 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionService.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.KnowledgeModule; import org.springframework.stereotype.Service; @@ -35,7 +36,7 @@ public class IntentDetectionService { } } - public Intent detectionProcess(Intent intent) { + public IntentGoalBean detectionProcess(Intent intent) { KnowledgeModule ownerKnowledgeModule = intentOwner.getKnowledgeModule(); return ownerKnowledgeModule.intentCognition(intent); diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentInvestigationService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentInvestigationService.java index 8c39066..36476b1 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentInvestigationService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentInvestigationService.java @@ -15,11 +15,16 @@ */ 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.DecisionModule; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; @Service public class IntentInvestigationService { @@ -35,15 +40,8 @@ public class IntentInvestigationService { } } - public List<IntentManagementFunction> investigationProcess() { + public List<Map<IntentGoalBean,IntentManagementFunction>> investigationProcess(IntentGoalBean intentGoalBean) { DecisionModule intentDecisionModule = intentOwner.getDecisionModule(); - intentDecisionModule.needDecompostion(); - intentDecisionModule.intentDecomposition(); - intentDecisionModule.intentOrchestration(); - intentDecisionModule.decideSuitableAction(); - intentDecisionModule.exploreIntentHandlers();//返回handler - return null; + return intentDecisionModule.findHandler(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 5fa4b98..6bff142 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 @@ -16,11 +16,13 @@ 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.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; @Service public class IntentProcessService { @@ -49,14 +51,15 @@ public class IntentProcessService { } public void intentProcess(Intent intent) { intentDetectionService.setIntentRole(intentOwner,intentHandler); - Intent detectIntent = intentDetectionService.detectionProcess(intent); + IntentGoalBean intentGoalBean = intentDetectionService.detectionProcess(intent); //investigation process intentInvestigationService.setIntentRole(intentOwner,intentHandler); - List<IntentManagementFunction> intentManagementFunctions = - intentInvestigationService.investigationProcess();//List<handler>? + List<Map<IntentGoalBean,IntentManagementFunction>> intentListMap = + intentInvestigationService.investigationProcess(intentGoalBean); - for (IntentManagementFunction intentHandler : intentManagementFunctions) { + + for (Map<IntentGoalBean,IntentManagementFunction> map : intentListMap) { //definition process intentDefinitionService.setIntentRole(intentOwner,intentHandler); intentDefinitionService.definitionPorcess(); diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IMFRegInfoMapper.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IMFRegInfoMapper.java index ca4318d..0e76679 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IMFRegInfoMapper.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IMFRegInfoMapper.java @@ -13,14 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.usecaseui.intentanalysis.mapper; import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo; +import java.util.List; @Mapper public interface IMFRegInfoMapper { - void insertIMFRegInfoRegInfo(@Param(value = "fulfilmentInfo") IntentManagementFunctionRegInfo imfregInfo); + int insertIMFRegInfoRegInfo(IntentManagementFunctionRegInfo info); + + List<IntentManagementFunctionRegInfo> getImfRegInfoList(); } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ImfRegInfoService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ImfRegInfoService.java new file mode 100644 index 0000000..0d7a6b1 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ImfRegInfoService.java @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2022 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.intentanalysis.service; + +import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo; + +import java.util.List; + +public interface ImfRegInfoService { + + int insertIMFRegInfoRegInfo(IntentManagementFunctionRegInfo regInfo); + List<IntentManagementFunctionRegInfo> getImfRegInfoList(); +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImpl.java new file mode 100644 index 0000000..85ae90e --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImpl.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2022 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.intentanalysis.service.impl; + +import lombok.extern.slf4j.Slf4j; +import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo; +import org.onap.usecaseui.intentanalysis.mapper.IMFRegInfoMapper; +import org.onap.usecaseui.intentanalysis.service.ImfRegInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +@Slf4j +public class ImfRegInfoServiceImpl implements ImfRegInfoService { + @Autowired + private IMFRegInfoMapper imfRegInfoMapper; + + @Override + public int insertIMFRegInfoRegInfo(org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo regInfo) { + return imfRegInfoMapper.insertIMFRegInfoRegInfo(regInfo); + } + + @Override + public List<IntentManagementFunctionRegInfo> getImfRegInfoList() { + return imfRegInfoMapper.getImfRegInfoList(); + } +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java index 7f491c9..dd3b9fe 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java @@ -133,6 +133,8 @@ public class IntentServiceImpl implements IntentService { if (CollectionUtils.isNotEmpty(intentList)) { for (Intent intent:intentList) { intent.setIntentExpectations(expectationService.getIntentExpectationsByIntentId(intent.getIntentId())); + // intent.setIntentContexts(); + // } return intentList; } else { diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/CommonUtil.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/CommonUtil.java new file mode 100644 index 0000000..260115a --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/CommonUtil.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2022 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.intentanalysis.util; + +import java.util.UUID; + +public class CommonUtil { + public static String getUUid() { + return UUID.randomUUID().toString().trim().replaceAll("-", ""); + } +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/CustomTrustManager.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/CustomTrustManager.java index daed733..46d9abf 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/CustomTrustManager.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/CustomTrustManager.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.usecaseui.intentanalysis.utils; +package org.onap.usecaseui.intentanalysis.util; import javax.net.ssl.X509TrustManager; import java.security.cert.CertificateException; diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/RestfulServices.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/RestfulServices.java index f37021f..7e7e6c2 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/RestfulServices.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/RestfulServices.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.usecaseui.intentanalysis.utils; +package org.onap.usecaseui.intentanalysis.util; import okhttp3.MediaType; import okhttp3.OkHttpClient; diff --git a/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml index d77c06a..8a39762 100644 --- a/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml +++ b/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml @@ -21,7 +21,7 @@ </insert> <!-- 这里的查询有问题--> - <select id="selectConditionByParentId" resultType="org.onap.usecaseui.intentanalysis.bean.models.Context"> + <select id="selectConditionByParentId" resultType="org.onap.usecaseui.intentanalysis.bean.models.Condition"> select condition_id conditionId, condition_name conditiontName, operator_type operatorType from condition where condition_id = #{parentId} diff --git a/intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml index 8f6cd3c..7b8a115 100644 --- a/intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml +++ b/intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml @@ -10,4 +10,8 @@ (#{imfregInfo.id}, #{imfregInfo.description}, #{imfregInfo.supportArea},#{imfregInfo.handleName},#{imfregInfo.intentFunctionType}) </insert> + <select id="getImfRegInfoList" resultType="org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo"> + select * from intent_management_function_reg_info + </select> + </mapper> |