From 45392ebae1ef9559951b9bf660e8aeb099bba19e Mon Sep 17 00:00:00 2001 From: kaixiliu Date: Thu, 31 Aug 2023 14:48:06 +0800 Subject: Delete useless code Issue-ID: USECASEUI-819 Change-Id: Ia84c5aad828a8870ba8d6b1f86d039dd7f6d1229 Signed-off-by: kaixiliu --- .../bean/models/IntentReportFulfillmentInfo.java | 25 ----------- .../intentanalysis/bean/models/State.java | 32 -------------- .../CLLBusinessIntentManagementFunction.java | 14 +++---- .../CLLBusinessActuationModule.java | 12 ------ .../CLLBusinessDecisionModule.java | 16 +------ .../CLLBusinessKnowledgeModule.java | 32 -------------- .../CLLAssuranceActuationModule.java | 14 ++----- .../CLLAssuranceDecisionModule.java | 17 +------- .../CLLDeliveryActuationModule.java | 10 ----- .../CLLDeliveryDecisionModule.java | 17 +------- .../FormatIntentInputManagementFunction.java | 10 ++--- .../FormatIntentInputActuationModule.java | 12 ------ .../FormatIntentInputDecisionModule.java | 17 +------- .../FormatIntentInputKnowledgeModule.java | 14 ------- .../intentModule/ActuationModule.java | 13 ------ .../intentModule/DecisionModule.java | 10 +---- .../intentModule/KnowledgeModule.java | 19 +++++++-- .../src/main/resources/intent-analysis-init.sql | 8 ---- .../intentanalysis/bean/models/StateTest.java | 49 ---------------------- 19 files changed, 35 insertions(+), 306 deletions(-) delete mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentReportFulfillmentInfo.java delete mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/State.java delete mode 100644 intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/StateTest.java diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentReportFulfillmentInfo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentReportFulfillmentInfo.java deleted file mode 100644 index ee3bd4e..0000000 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentReportFulfillmentInfo.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2023 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.bean.models; - -import lombok.Data; - -@Data -public class IntentReportFulfillmentInfo extends FulfillmentInfo{ - // This id is the intentReportId of the associated intentReport - private String intentReportId; -} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/State.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/State.java deleted file mode 100644 index 865c805..0000000 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/State.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.bean.models; - -import lombok.Data; - -@Data -public class State { - - private String stateId; - - private String stateName; - - private String condition; - - private Boolean isSatisfied; - -} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunction.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunction.java index 2ca3352..3487b4b 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunction.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunction.java @@ -157,21 +157,19 @@ public class CLLBusinessIntentManagementFunction extends IntentManagementFunctio @SneakyThrows public boolean implementIntent(Intent originIntent, LinkedHashMap linkedIntentMap) { - Iterator> iterator = linkedIntentMap.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry next = iterator.next(); + for (Map.Entry next : linkedIntentMap.entrySet()) { IntentGoalBean newIntentGoalBean = next.getKey(); IntentGoalType intentGoalType = newIntentGoalBean.getIntentGoalType(); IntentManagementFunction handler = next.getValue(); if (intentGoalType == IntentGoalType.CREATE) { Intent newIdIntent = decisionModule.intentObjectDefine(originIntent, next.getKey().getIntent()); - intentContextService.updateIntentOwnerHandlerContext(newIdIntent, this, next.getValue()); + intentContextService.updateIntentOwnerHandlerContext(newIdIntent, this, handler); intentContextService.updateParentIntentContext(originIntent, newIdIntent); intentContextService.updateChindIntentContext(originIntent, newIdIntent); // contextService.updateContextList(originIntent.getIntentContexts(), originIntent.getIntentId()); //intent-Distribution-create boolean isAcceptCreate = intentInterfaceService.createInterface(originIntent, - new IntentGoalBean(newIdIntent, IntentGoalType.CREATE), next.getValue()); + new IntentGoalBean(newIdIntent, IntentGoalType.CREATE), handler); // TODO: 2023/3/27 isParallel status need deal before distribution boolean isParallel = false; if (!isParallel) { @@ -185,7 +183,7 @@ public class CLLBusinessIntentManagementFunction extends IntentManagementFunctio } log.debug("Try to get record of intent CREATE event from DB."); IntentEventRecord record = intentEventRecordService.getIntentEventRecordByIntentId( - newIdIntent.getIntentId(), intentGoalType.toString()); + newIdIntent.getIntentId(), intentGoalType.toString()); if (record != null) { isPublish = true; log.debug("Successfully got Intent Event Record from DB."); @@ -201,12 +199,12 @@ public class CLLBusinessIntentManagementFunction extends IntentManagementFunctio //define process just send probe interface // intent-Distribution-update boolean isAcceptupdate = intentInterfaceService.updateInterface(originIntent, - next.getKey(), next.getValue()); + next.getKey(), handler); } else { // actuationModule.deleteIntentToDb(next.getKey().getIntent()); // intent-Distribution-delete boolean isAcceptDelete = intentInterfaceService.deleteInterface(originIntent, - next.getKey(), next.getValue()); + next.getKey(), handler); } } return false; 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 243a313..6365c23 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 @@ -15,7 +15,6 @@ */ package org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule; - import org.onap.usecaseui.intentanalysis.bean.models.Intent; import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; @@ -32,27 +31,16 @@ public class CLLBusinessActuationModule extends ActuationModule { @Autowired IntentInterfaceService intentInterfaceService; - - @Override - public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) { - } - @Override public void directOperation(IntentGoalBean intentGoalBean) { } - @Override - public void interactWithIntentHandle() { - - } - @Override public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) { //toNextIntentHandler(intentGoalBean, intentHandler); intentHandler.receiveIntentAsOwner(intentGoalBean); } - @Override public void updateIntentOperationInfo(Intent originIntent, IntentGoalBean intentGoalBean){ 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 7ed852c..2706914 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 @@ -54,10 +54,6 @@ public class CLLBusinessDecisionModule extends DecisionModule { @Autowired IntentContextService intentContextService; - @Override - public void determineUltimateGoal() { - } - @Override public IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean) { // db filter imf supportArea; @@ -66,12 +62,6 @@ public class CLLBusinessDecisionModule extends DecisionModule { return (IntentManagementFunction) applicationContext.getBean(imfRegInfo.getHandleName()); } - - @Override - public void decideSuitableAction() { - } - - public boolean needDecompostion(IntentGoalBean intentGoalBean) { //different expectationType need decompostion ExpectationType>1 or objtype>1 if (intentGoalBean.getIntentGoalType().equals(IntentGoalType.CREATE)) { @@ -137,10 +127,6 @@ public class CLLBusinessDecisionModule extends DecisionModule { return sortList; } - @Override - public void interactWithTemplateDb() { - } - @Override public LinkedHashMap investigationCreateProcess(IntentGoalBean intentGoalBean) { log.info("CLLBusinessIntentManagementFunction investigation create process start"); @@ -186,7 +172,7 @@ public class CLLBusinessDecisionModule extends DecisionModule { } } - if (false == bFindIntent) { + if (!bFindIntent) { intentContextService.deleteSubIntentContext(originIntent, intent.getIntentId()); IntentGoalBean subIntentGoalBean = new IntentGoalBean(intent, IntentGoalType.DELETE); intentMap.put(subIntentGoalBean, intentHandlerInfo); 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 9625cb6..c0c1918 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 @@ -15,13 +15,10 @@ */ package org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule; -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.intentModule.KnowledgeModule; import org.onap.usecaseui.intentanalysis.service.IntentService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -29,15 +26,12 @@ import java.util.List; @Component public class CLLBusinessKnowledgeModule extends KnowledgeModule { - private static Logger LOGGER = LoggerFactory.getLogger(CLLBusinessKnowledgeModule.class); - @Autowired IntentService intentService; @Override public IntentGoalBean intentCognition(Intent intent) { List intendIdList = intentResolution(intent); - getSystemStatus(); return determineDetectionGoal(intent, intendIdList); } @@ -55,30 +49,4 @@ public class CLLBusinessKnowledgeModule extends KnowledgeModule { public boolean recieveDeleteIntent() { return true; } - - void intentReportResolution() { - } - - /** - * query the implementation of intent requirements in the system - */ - void getSystemStatus() { - } - - - void interactWithIntentOwner() { - } - - /** - * Determine add, delete, modify according to theobject,target and context of the expectation - */ - public IntentGoalBean determineDetectionGoal(Intent intent, List intentIdList) { - int size = intentIdList.size(); - if (size == 0) { - return new IntentGoalBean(intent, IntentGoalType.CREATE); - } else { - return new IntentGoalBean(intent, IntentGoalType.UPDATE); - } - } - } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java index 1c515c7..222dbf8 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java @@ -40,15 +40,14 @@ public class CLLAssuranceActuationModule extends ActuationModule { @Autowired private PolicyService policyService; - @Override - public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) { - - } - @Override public void directOperation(IntentGoalBean intentGoalBean) { Intent intent = intentGoalBean.getIntent(); List cllIds = getCLLId(intent); + if (CollectionUtils.isEmpty(cllIds)) { + log.info("get cllId is empty"); + return; + } cllIds.forEach(cllId -> { String bandwidth = getBandwidth(cllId); IntentGoalType intentGoalType = intentGoalBean.getIntentGoalType(); @@ -62,11 +61,6 @@ public class CLLAssuranceActuationModule extends ActuationModule { }); } - @Override - public void interactWithIntentHandle() { - - } - @Override public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) { directOperation(intentGoalBean); 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 3ea832d..e335da9 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 @@ -21,29 +21,14 @@ import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.Decision import org.springframework.stereotype.Component; import java.util.LinkedHashMap; + @Component public class CLLAssuranceDecisionModule extends DecisionModule { - @Override - public void determineUltimateGoal() { - - } - @Override public IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean) { return null; } - - @Override - public void decideSuitableAction() { - - } - - @Override - public void interactWithTemplateDb() { - - } - @Override public LinkedHashMap investigationCreateProcess(IntentGoalBean intentGoalBean) { return null; diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java index 93b7043..384056a 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java @@ -63,11 +63,6 @@ public class CLLDeliveryActuationModule extends ActuationModule { @Autowired private IntentService intentService; - @Override - public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) { - - } - @Override public void directOperation(IntentGoalBean intentGoalBean) { Intent intent = intentGoalBean.getIntent(); @@ -115,11 +110,6 @@ public class CLLDeliveryActuationModule extends ActuationModule { } } - @Override - public void interactWithIntentHandle() { - - } - @Override public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) { this.directOperation(intentGoalBean); 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 9e344e8..e2ca357 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 @@ -21,29 +21,14 @@ import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.Decision import org.springframework.stereotype.Component; import java.util.LinkedHashMap; + @Component public class CLLDeliveryDecisionModule extends DecisionModule { - @Override - public void determineUltimateGoal() { - - } - @Override public IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean) { return null; } - - @Override - public void decideSuitableAction() { - - } - - @Override - public void interactWithTemplateDb() { - - } - @Override public LinkedHashMap investigationCreateProcess(IntentGoalBean intentGoalBean) { return null; 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 1090eba..de30c3d 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 @@ -112,9 +112,7 @@ public class FormatIntentInputManagementFunction extends IntentManagementFunctio } public boolean implementIntent(Intent originIntent, LinkedHashMap linkedIntentMap) { - Iterator> iterator = linkedIntentMap.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry next = iterator.next(); + for (Map.Entry next : linkedIntentMap.entrySet()) { IntentGoalBean newIntentGoalBean = next.getKey(); IntentGoalType intentGoalType = newIntentGoalBean.getIntentGoalType(); if (intentGoalType == IntentGoalType.CREATE) { @@ -127,7 +125,7 @@ public class FormatIntentInputManagementFunction extends IntentManagementFunctio new IntentGoalBean(newIdIntent, IntentGoalType.CREATE), next.getValue()); originIntent.setIntentGenerateType(IntentGenerateType.USERINPUT); //save user input intent - intentService.createIntent(originIntent); + actuationModule.saveIntentToDb(originIntent); return isAcceptCreate; } else if (intentGoalType == IntentGoalType.UPDATE) { log.info("formatIntentInputIMF UPDATE"); @@ -135,13 +133,13 @@ public class FormatIntentInputManagementFunction extends IntentManagementFunctio Intent subIntent = newIntentGoalBean.getIntent(); updateIntentInfo(originIntent, subIntent); //update userInput intent - intentService.updateIntent(originIntent); + actuationModule.updateIntentToDb(originIntent); // intent-Distribution and operate |update cllBusiness intent boolean isAcceptUpdate = intentInterfaceService.updateInterface(originIntent, new IntentGoalBean(subIntent, IntentGoalType.UPDATE), next.getValue()); } else { //deal with userInput intent - intentService.deleteIntent(originIntent.getIntentId()); + actuationModule.deleteIntentToDb(originIntent); // intent-Distribution-delete boolean isAcceptDelete = intentInterfaceService.deleteInterface(originIntent, next.getKey(), next.getValue()); } 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 a9beafe..adff5f6 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 @@ -30,28 +30,16 @@ public class FormatIntentInputActuationModule extends ActuationModule { @Autowired IntentService intentService; - @Override - public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) { - log.info("do nothing"); - } - @Override public void directOperation(IntentGoalBean intentGoalBean) { } - @Override - public void interactWithIntentHandle() { - } - @Override public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) { } - - public void updateIntentOperationInfo(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 334a6d3..96c8623 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 @@ -48,10 +48,6 @@ public class FormatIntentInputDecisionModule extends DecisionModule { @Autowired public IntentService intentService; - @Override - public void determineUltimateGoal() { - } - @Override public IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean) { // if intentName contain cll return @@ -64,15 +60,6 @@ public class FormatIntentInputDecisionModule extends DecisionModule { } } - - @Override - public void decideSuitableAction() { - } - - @Override - public void interactWithTemplateDb() { - } - @Override public LinkedHashMap investigationCreateProcess(IntentGoalBean intentGoalBean) { log.info("FormatIntentInputMgt investigation create process start"); @@ -97,9 +84,7 @@ public class FormatIntentInputDecisionModule extends DecisionModule { if (expectationNameList.size() > 1) { List cllList = expectationNameList.stream().filter(x -> StringUtils.containsIgnoreCase(x, "cll")).collect(Collectors.toList()); List slicingList = expectationNameList.stream().filter(x -> StringUtils.containsIgnoreCase(x, "slicing")).collect(Collectors.toList()); - if (cllList.size() > 0 && slicingList.size() > 0) { - return true; - } + return cllList.size() > 0 && slicingList.size() > 0; } return false; } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputKnowledgeModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputKnowledgeModule.java index bf1a887..f846fcb 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputKnowledgeModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputKnowledgeModule.java @@ -15,7 +15,6 @@ */ package org.onap.usecaseui.intentanalysis.formatintentinputMgt.formatintentinputModule; -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.intentModule.KnowledgeModule; @@ -33,7 +32,6 @@ public class FormatIntentInputKnowledgeModule extends KnowledgeModule { @Override public IntentGoalBean intentCognition(Intent intent) { List intendIdList = intentResolution(intent); - getSystemStatus(); return determineDetectionGoal(intent, intendIdList); } @@ -51,16 +49,4 @@ public class FormatIntentInputKnowledgeModule extends KnowledgeModule { public boolean recieveDeleteIntent() { return false; } - - public void getSystemStatus() { - } - - public IntentGoalBean determineDetectionGoal(Intent intent, List intentIdList) { - int size = intentIdList.size(); - if (size == 0) { - return new IntentGoalBean(intent, IntentGoalType.CREATE); - } else { - return new IntentGoalBean(intent, IntentGoalType.UPDATE); - } - } } 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 5e7792d..49768b1 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 @@ -15,7 +15,6 @@ */ package org.onap.usecaseui.intentanalysis.intentBaseService.intentModule; -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; @@ -23,22 +22,15 @@ import org.onap.usecaseui.intentanalysis.intentBaseService.intentinterfaceservic import org.onap.usecaseui.intentanalysis.service.IntentService; import org.springframework.beans.factory.annotation.Autowired; -import java.util.Map; - public abstract class ActuationModule { @Autowired IntentInterfaceService intentInterfaceService; @Autowired IntentService intentService; - //send to the next level intent handler - public abstract void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler); - //Direct operation public abstract void directOperation(IntentGoalBean intentGoalBean); - public abstract void interactWithIntentHandle(); - //Save intent information to the intent instance database public void saveIntentToDb(Intent intent) { intentService.createIntent(intent); @@ -54,11 +46,6 @@ public abstract class ActuationModule { intentService.deleteIntent(intent.getIntentId()); } - public boolean distrubuteIntentToHandler(Map.Entry entry) { - IntentGoalType intentGoalType = entry.getKey().getIntentGoalType(); - return false; - } - //determine if the intent is to be processed directly or sent to the next-level processor public abstract void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler); 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 549672c..8c1c5eb 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 @@ -15,7 +15,6 @@ */ package org.onap.usecaseui.intentanalysis.intentBaseService.intentModule; - import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; import org.onap.usecaseui.intentanalysis.bean.enums.IntentGenerateType; @@ -28,10 +27,9 @@ import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; + @Slf4j public abstract class DecisionModule { - public abstract void determineUltimateGoal(); - // find intentManageFunction public abstract IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean); @@ -54,10 +52,6 @@ public abstract class DecisionModule { return newIntent; } - public abstract void decideSuitableAction(); - - public abstract void interactWithTemplateDb(); - public abstract LinkedHashMap investigationCreateProcess(IntentGoalBean intentGoalBean); public abstract LinkedHashMap investigationUpdateProcess(IntentGoalBean intentGoalBean); @@ -175,6 +169,4 @@ public abstract class DecisionModule { } return context; } - - } 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 f225d60..8b55a5a 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java @@ -17,6 +17,7 @@ package org.onap.usecaseui.intentanalysis.intentBaseService.intentModule; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; +import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType; import org.onap.usecaseui.intentanalysis.bean.models.*; import org.onap.usecaseui.intentanalysis.service.IntentService; import org.springframework.beans.factory.annotation.Autowired; @@ -39,7 +40,7 @@ public abstract class KnowledgeModule { public abstract boolean recieveDeleteIntent(); - public List intentResolution(Intent intent) { + protected List intentResolution(Intent intent) { //db contain original intent List sameNameIntentList = intentService.getIntentByName(intent.getIntentName()); List intentIdList = new ArrayList<>(); @@ -79,7 +80,19 @@ public abstract class KnowledgeModule { return intentIdList; } - public List filterIntent(List list) { + /** + * Determine add, delete, modify according to theobject,target and context of the expectation + */ + protected IntentGoalBean determineDetectionGoal(Intent intent, List intentIdList) { + int size = intentIdList.size(); + if (size == 0) { + return new IntentGoalBean(intent, IntentGoalType.CREATE); + } else { + return new IntentGoalBean(intent, IntentGoalType.UPDATE); + } + } + + private List filterIntent(List list) { List fiterList = new ArrayList<>(); for (Intent intent : list) { //filter the intent which save first time in controller @@ -107,7 +120,7 @@ public abstract class KnowledgeModule { break; } } - if (equals == true) { + if (equals) { break; } } diff --git a/intentanalysis/src/main/resources/intent-analysis-init.sql b/intentanalysis/src/main/resources/intent-analysis-init.sql index dedb4f4..0b8307d 100644 --- a/intentanalysis/src/main/resources/intent-analysis-init.sql +++ b/intentanalysis/src/main/resources/intent-analysis-init.sql @@ -46,14 +46,6 @@ create table if not exists fulfillment_info( achieve_value varchar(255) ); -create table if not exists state( - state_id varchar(255) primary key, - state_name varchar(255), - is_satisfied boolean, - condition varchar(255), - expectation_id varchar(255) -); - create table if not exists condition( condition_id varchar(255) primary key, condition_name varchar(255), diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/StateTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/StateTest.java deleted file mode 100644 index e04ea3a..0000000 --- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/StateTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.bean.models; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class StateTest { - @Before - public void before() throws Exception { - } - - @After - public void after() throws Exception { - } - - @Test - public void testGetStateTest() { - State test = new State(); - test.getStateId(); - test.getStateName(); - test.getCondition(); - test.getIsSatisfied(); - - } - - @Test - public void testSetStateTest() { - State test = new State(); - test.setStateId(""); - test.setStateName(""); - test.setCondition(""); - test.setIsSatisfied(true); - } -} -- cgit 1.2.3-korg