Add intent investigation process code . 42/130442/1
authorhekeguang <hekeguang@chinamobile.com>
Thu, 25 Aug 2022 03:13:58 +0000 (11:13 +0800)
committerhekeguang <hekeguang@chinamobile.com>
Thu, 25 Aug 2022 03:14:12 +0000 (11:14 +0800)
Issue-ID: USECASEUI-696
Change-Id: I4da04a605207212fb8359c47959392138c0b4696
Signed-off-by: hekeguang <hekeguang@chinamobile.com>
22 files changed:
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ExpectationType.java
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/IntentGoalType.java [moved from intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/DetectionGoalType.java with 89% similarity]
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportArea.java
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentGoalBean.java [moved from intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/DetectionGoalBean.java with 70% similarity]
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessKnowledgeModule.java
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/IntentHandleService.java
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/DecisionModule.java
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionService.java
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentInvestigationService.java
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessService.java
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IMFRegInfoMapper.java
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ImfRegInfoService.java [new file with mode: 0644]
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImpl.java [new file with mode: 0644]
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/CommonUtil.java [new file with mode: 0644]
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/CustomTrustManager.java
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/RestfulServices.java
intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml
intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml

index fbddde2..34b0b8b 100644 (file)
 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;
 
@@ -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;
     }
index 3cf08f7..6543580 100644 (file)
@@ -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;
 
 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() {
     }
 }
index b137942..7b3ff5a 100644 (file)
@@ -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;
+
 }
index 8214b46..bcda367 100644 (file)
 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;
+    }
 }
index 43a6247..372b0d5 100644 (file)
@@ -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);
         }
     }
 
index ab2419f..2d420d7 100644 (file)
  */
 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());
     }
 }
index 1762e63..76601a8 100644 (file)
 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);
 }
index 4bb803b..d5caf1f 100644 (file)
@@ -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);
 }
index 13ed2fd..699c1b1 100644 (file)
@@ -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);
index 8c39066..36476b1 100644 (file)
  */
 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);
     }
-
-
 }
index 5fa4b98..6bff142 100644 (file)
 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();
index ca4318d..0e76679 100644 (file)
  * 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 (file)
index 0000000..0d7a6b1
--- /dev/null
@@ -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 (file)
index 0000000..85ae90e
--- /dev/null
@@ -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();
+    }
+}
index 7f491c9..dd3b9fe 100644 (file)
@@ -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 (file)
index 0000000..260115a
--- /dev/null
@@ -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("-", "");
+    }
+}
index daed733..46d9abf 100644 (file)
@@ -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;
index f37021f..7e7e6c2 100644 (file)
@@ -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;
index d77c06a..8a39762 100644 (file)
@@ -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}
index 8f6cd3c..7b8a115 100644 (file)
@@ -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>