From a5038f38bdce4137583338e59a419690c6cffd52 Mon Sep 17 00:00:00 2001 From: hekeguang Date: Tue, 16 Aug 2022 09:39:05 +0800 Subject: Modify intent base code. Issue-ID: USECASEUI-696 Change-Id: I66ef2a36e555d4c0ee50c91a5ae37d3285922eb3 Signed-off-by: hekeguang --- .../models/IntentManagementFunctionRegInfo.java | 35 +++++++++++++ .../bean/models/IntentManagerRegInfo.java | 35 ------------- .../CLLBusinessIntentManagementFunction.java | 14 +++--- .../CLLBusinessActuationModule.java | 54 ++++++++++++++++++++ .../CLLBusinessDecisionModule.java | 54 ++++++++++++++++++++ .../CLLBusinessKnowledgeModule.java | 58 ++++++++++++++++++++++ .../intentModuleImpl/ActuationModuleImpl.java | 48 ------------------ .../intentModuleImpl/DecisoinModuleImpl.java | 54 -------------------- .../intentModuleImpl/KnownledgeModuleImpl.java | 36 -------------- .../controller/IntentController.java | 10 ++++ .../controller/IntentFunctionManageController.java | 8 +-- .../intentBaseService/IntentHandleService.java | 58 ++++++++++++++++++++++ .../IntentFunctionManageService.java | 8 +-- .../impl/IntentFunctionManageServiceImpl.java | 11 ++-- .../intentModule/KnowledgeModule.java | 9 ++-- .../IntentDetectionService.java | 8 ++- .../IntentInvestigationService.java | 5 +- .../intentProcessService/IntentProcessService.java | 34 +++++++------ 18 files changed, 320 insertions(+), 219 deletions(-) create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java delete mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagerRegInfo.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessKnowledgeModule.java delete mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/intentModuleImpl/ActuationModuleImpl.java delete mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/intentModuleImpl/DecisoinModuleImpl.java delete mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/intentModuleImpl/KnownledgeModuleImpl.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/IntentHandleService.java (limited to 'intentanalysis/src/main') 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 new file mode 100644 index 0000000..34f56b7 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java @@ -0,0 +1,35 @@ +/* + * 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; +import org.onap.usecaseui.intentanalysis.bean.enums.IntentFunctionType; +import org.onap.usecaseui.intentanalysis.bean.enums.SupportArea; +import org.onap.usecaseui.intentanalysis.bean.enums.SupportInterface; + +import java.util.List; + +@Data +public class IntentManagementFunctionRegInfo { + private String id; + private String description; + private List supportArea; + private String supportModel; + private List supportInterfaces; + private String handleName; + private IntentFunctionType intentFunctionType; + +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagerRegInfo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagerRegInfo.java deleted file mode 100644 index 24ef19e..0000000 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagerRegInfo.java +++ /dev/null @@ -1,35 +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; -import org.onap.usecaseui.intentanalysis.bean.enums.IntentFunctionType; -import org.onap.usecaseui.intentanalysis.bean.enums.SupportArea; -import org.onap.usecaseui.intentanalysis.bean.enums.SupportInterface; - -import java.util.List; - -@Data -public class IntentManagerRegInfo { - private String id; - private String description; - private List supportArea; - private String supportModel; - private List supportInterfaces; - private String handleName; - private IntentFunctionType intentFunctionType; - -} 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 53e13e0..9061036 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 @@ -17,21 +17,21 @@ package org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt; import lombok.Data; -import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.intentModuleImpl.ActuationModuleImpl; -import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.intentModuleImpl.DecisoinModuleImpl; -import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.intentModuleImpl.KnownledgeModuleImpl; +import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule.CLLBusinessActuationModule; +import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule.CLLBusinessDecisionModule; +import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule.CLLBusinessKnowledgeModule; +import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.KnowledgeModule; -import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; import org.springframework.stereotype.Component; @Data @Component("CLLBusinessIntentManagementFunction") public class CLLBusinessIntentManagementFunction extends IntentManagementFunction { - private ActuationModule actuationModule = new ActuationModuleImpl(); - private DecisionModule decisoinModule = new DecisoinModuleImpl(); - private KnowledgeModule knowledgeModule = new KnownledgeModuleImpl(); + private ActuationModule actuationModule = new CLLBusinessActuationModule(); + private DecisionModule decisoinModule = new CLLBusinessDecisionModule(); + private KnowledgeModule knowledgeModule = new CLLBusinessKnowledgeModule(); } 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 new file mode 100644 index 0000000..1612090 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java @@ -0,0 +1,54 @@ +/* + * 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.cllBusinessIntentMgt.cllBusinessModule; + + +import org.onap.usecaseui.intentanalysis.bean.models.Intent; +import org.onap.usecaseui.intentanalysis.intentBaseService.IntentHandleService; +import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; +import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; +import org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService.IntentProcessService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class CLLBusinessActuationModule implements ActuationModule { + @Autowired + IntentProcessService processService; + @Autowired + IntentHandleService intentHandleService; + + + @Override + public void sendToIntentHandler(IntentManagementFunction IntentHandler) { + + } + + @Override + public void sendToNonIntentHandler() { + + } + + @Override + public void interactWithIntentHandle() { + + } + + @Override + public void saveIntentToDb() { + + } +} 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 new file mode 100644 index 0000000..8214b46 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java @@ -0,0 +1,54 @@ +/* + * 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.cllBusinessIntentMgt.cllBusinessModule; + + +import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule; +import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; +import org.springframework.stereotype.Service; + +@Service +public class CLLBusinessDecisionModule implements DecisionModule { + @Override + public void determineUltimateGoal() {} + + @Override + public IntentManagementFunction exploreIntentHandlers() { + + return null; + + } + + @Override + public void intentDefinition() {} + + @Override + public void decideSuitableAction() {} + + @Override + public boolean needDecompostion() { + return false; + } + + @Override + public void intentDecomposition() {} + + @Override + public void intentOrchestration() {} + + @Override + public void interactWithTemplateDb() {} +} 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 new file mode 100644 index 0000000..51a4ee2 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessKnowledgeModule.java @@ -0,0 +1,58 @@ +/* + * 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.cllBusinessIntentMgt.cllBusinessModule; + +import org.onap.usecaseui.intentanalysis.bean.models.Expectation; +import org.onap.usecaseui.intentanalysis.bean.models.Intent; +import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.KnowledgeModule; +import org.springframework.stereotype.Service; + +@Service +public class CLLBusinessKnowledgeModule implements KnowledgeModule { + + @Override + public Intent intentCognition(Intent intent) { + intentResolution(intent); + //intentReportResolution(); + getSystemStatus(); + //interactWithIntentOwner(); + determineDetectionGoal(); + return null; + } + + //find similar intents in DB + void intentResolution(Intent intent) { + + } + + 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 + void determineDetectionGoal() { + } + +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/intentModuleImpl/ActuationModuleImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/intentModuleImpl/ActuationModuleImpl.java deleted file mode 100644 index bb7fbb5..0000000 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/intentModuleImpl/ActuationModuleImpl.java +++ /dev/null @@ -1,48 +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.cllBusinessIntentMgt.intentModuleImpl; - - -import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; -import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; -import org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService.IntentProcessService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class ActuationModuleImpl implements ActuationModule { - @Autowired - IntentProcessService processService; - - @Override - public void sendToIntentHandler(IntentManagementFunction intentHandler) { - processService.setIntentRole(intentHandler, null); - processService.intentProcess(); - } - - @Override - public void sendToNonIntentHandler() { - } - - @Override - public void interactWithIntentHandle() { - - } - - @Override - public void saveIntentToDb() { - } -} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/intentModuleImpl/DecisoinModuleImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/intentModuleImpl/DecisoinModuleImpl.java deleted file mode 100644 index 0439a03..0000000 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/intentModuleImpl/DecisoinModuleImpl.java +++ /dev/null @@ -1,54 +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.cllBusinessIntentMgt.intentModuleImpl; - - -import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule; -import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; -import org.springframework.stereotype.Service; - -@Service -public class DecisoinModuleImpl implements DecisionModule { - @Override - public void determineUltimateGoal() {} - - @Override - public IntentManagementFunction exploreIntentHandlers() { - - return null; - - } - - @Override - public void intentDefinition() {} - - @Override - public void decideSuitableAction() {} - - @Override - public boolean needDecompostion() { - return false; - } - - @Override - public void intentDecomposition() {} - - @Override - public void intentOrchestration() {} - - @Override - public void interactWithTemplateDb() {} -} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/intentModuleImpl/KnownledgeModuleImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/intentModuleImpl/KnownledgeModuleImpl.java deleted file mode 100644 index 14b2ea0..0000000 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/intentModuleImpl/KnownledgeModuleImpl.java +++ /dev/null @@ -1,36 +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.cllBusinessIntentMgt.intentModuleImpl; - -import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.KnowledgeModule; -import org.springframework.stereotype.Service; - -@Service -public class KnownledgeModuleImpl implements KnowledgeModule { - @Override - public void intentResolution() {} - - @Override - public void intentReportResolution() {} - - @Override - public void getSystemStatus() {} - - @Override - public void interactWithIntentOwner() { - - } -} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java index 85b683b..ce51440 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java @@ -18,6 +18,8 @@ package org.onap.usecaseui.intentanalysis.controller; import java.util.List; + +import org.onap.usecaseui.intentanalysis.intentBaseService.IntentHandleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -35,6 +37,9 @@ public class IntentController { @Autowired private IntentService intentService; + @Autowired + private IntentHandleService intentHandleService; + @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity> getIntentList() { return ResponseEntity.ok(intentService.getIntentList()); @@ -63,4 +68,9 @@ public class IntentController { intentService.deleteIntentById(intentId); } + @PostMapping(value="/handleIntent",produces = MediaType.APPLICATION_JSON_VALUE) + public void handleIntent(@RequestBody Intent intent) { + intentHandleService.handleOriginalIntent(intent); + + } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentFunctionManageController.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentFunctionManageController.java index 785a001..f36df23 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentFunctionManageController.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentFunctionManageController.java @@ -18,7 +18,7 @@ package org.onap.usecaseui.intentanalysis.controller; -import org.onap.usecaseui.intentanalysis.bean.models.IntentManagerRegInfo; +import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo; import org.onap.usecaseui.intentanalysis.intentBaseService.intentFunctionManageService.IntentFunctionManageService; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -34,7 +34,7 @@ public class IntentFunctionManageController { IntentFunctionManageService intentFunctionManageService; @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity createIntentManage(@RequestBody IntentManagerRegInfo intentManage) { + public ResponseEntity createIntentManage(@RequestBody IntentManagementFunctionRegInfo intentManage) { return ResponseEntity.ok(intentFunctionManageService.createFunctionManage(intentManage)); } @@ -45,12 +45,12 @@ public class IntentFunctionManageController { @PutMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity updateIntentManageById( - @PathVariable(value = "id") String id, @RequestBody IntentManagerRegInfo intentManage) { + @PathVariable(value = "id") String id, @RequestBody IntentManagementFunctionRegInfo intentManage) { return ResponseEntity.ok(intentFunctionManageService.updateIntentManageById(id, intentManage)); } @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity> getIntentManageByID() { + public ResponseEntity> getIntentManageByID() { return ResponseEntity.ok(intentFunctionManageService.getIntentManage()); } 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 new file mode 100644 index 0000000..6144e97 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/IntentHandleService.java @@ -0,0 +1,58 @@ +/* + * 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.intentBaseService; + +import org.onap.usecaseui.intentanalysis.bean.models.Intent; +import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo; +import org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService.IntentProcessService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +@Service +public class IntentHandleService { + @Autowired + private IntentProcessService processService; + + /** + * Process the original intent and find the corresponding IntentManagementFunction + * @param intent + */ + public void handleOriginalIntent(Intent intent){ + IntentManagementFunction intentOwner = selectIntentManagementFunction(intent); + handleIntent(intent,intentOwner); + } + + public void handleIntent(Intent intent, IntentManagementFunction intentOwner) { + processService.setIntentRole(intentOwner, null); + processService.intentProcess(intent); + } + + public IntentManagementFunction selectIntentManagementFunction(Intent intent) { + //select the IntentManagementFunctionRegInfo Based on the IMFRegistry information. + //Only internalFunction support. + //and based on the IntentManagementFunctionRegInfo, get the right IntentManagementFunction bean. + //if no IntentManagementFunction selected, that means this intent is not supported by this system. + return null; + } + + public IntentManagementFunctionRegInfo selectIntentManagementFunctionRegInfo(Intent intent) { + //select the IntentManagementFunctionRegInfo Based on the IMFRegistry information. + //Both internalFunction and externalFunction support. + //This is used to get he IntentManagementFunction for a subIntent decomposition. + return null; + } +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/IntentFunctionManageService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/IntentFunctionManageService.java index bccc416..8a1f918 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/IntentFunctionManageService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/IntentFunctionManageService.java @@ -15,17 +15,17 @@ */ package org.onap.usecaseui.intentanalysis.intentBaseService.intentFunctionManageService; -import org.onap.usecaseui.intentanalysis.bean.models.IntentManagerRegInfo; +import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo; import java.util.List; public interface IntentFunctionManageService { - int createFunctionManage(IntentManagerRegInfo intentManage) ; + int createFunctionManage(IntentManagementFunctionRegInfo intentManage) ; int deleteFunctionManage(String id); - int updateIntentManageById(String id, IntentManagerRegInfo intentManage); + int updateIntentManageById(String id, IntentManagementFunctionRegInfo intentManage); - List getIntentManage(); + List getIntentManage(); } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IntentFunctionManageServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IntentFunctionManageServiceImpl.java index 71bf8fa..71a6914 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IntentFunctionManageServiceImpl.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IntentFunctionManageServiceImpl.java @@ -15,8 +15,7 @@ */ package org.onap.usecaseui.intentanalysis.intentBaseService.intentFunctionManageService.impl; -import org.onap.usecaseui.intentanalysis.bean.models.Intent; -import org.onap.usecaseui.intentanalysis.bean.models.IntentManagerRegInfo; +import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; import org.onap.usecaseui.intentanalysis.intentBaseService.intentFunctionManageService.IntentFunctionManageService; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; @@ -32,7 +31,7 @@ public class IntentFunctionManageServiceImpl implements IntentFunctionManageServ @Autowired private ApplicationContext applicationContext; @Override - public int createFunctionManage(IntentManagerRegInfo intentManage) { + public int createFunctionManage(IntentManagementFunctionRegInfo intentManage) { return 0; } @@ -42,16 +41,16 @@ public class IntentFunctionManageServiceImpl implements IntentFunctionManageServ } @Override - public int updateIntentManageById(String id, IntentManagerRegInfo intentManage) { + public int updateIntentManageById(String id, IntentManagementFunctionRegInfo intentManage) { return 0; } @Override - public List getIntentManage() { + public List getIntentManage() { return null; } - public List filterHandleFunction(IntentManagerRegInfo managementRegInfo) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { + public List filterHandleFunction(IntentManagementFunctionRegInfo managementRegInfo) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { String managetFunctionRegName =managementRegInfo.getHandleName(); IntentManagementFunction function = 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 2a0032a..4bb803b 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 @@ -15,10 +15,9 @@ */ package org.onap.usecaseui.intentanalysis.intentBaseService.intentModule; +import org.onap.usecaseui.intentanalysis.bean.models.Intent; + public interface KnowledgeModule { - void intentResolution(); - void intentReportResolution(); - void getSystemStatus(); - void interactWithIntentOwner(); - //actuationModel & knownledgeModel interact + //Parse, decompose, orchestrate the original intent + Intent 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 0232620..13ed2fd 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 @@ -15,6 +15,7 @@ */ package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService; +import org.onap.usecaseui.intentanalysis.bean.models.Intent; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.KnowledgeModule; import org.springframework.stereotype.Service; @@ -34,12 +35,9 @@ public class IntentDetectionService { } } - public void detectionProcess() { + public Intent detectionProcess(Intent intent) { KnowledgeModule ownerKnowledgeModule = intentOwner.getKnowledgeModule(); - ownerKnowledgeModule.intentResolution(); - ownerKnowledgeModule.intentReportResolution(); - ownerKnowledgeModule.getSystemStatus(); - ownerKnowledgeModule.interactWithIntentOwner(); + 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 2dc740a..8c39066 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 @@ -19,6 +19,8 @@ import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunct import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule; import org.springframework.stereotype.Service; +import java.util.List; + @Service public class IntentInvestigationService { private IntentManagementFunction intentHandler; @@ -33,13 +35,14 @@ public class IntentInvestigationService { } } - public void investigationProcess() { + public List investigationProcess() { DecisionModule intentDecisionModule = intentOwner.getDecisionModule(); intentDecisionModule.needDecompostion(); intentDecisionModule.intentDecomposition(); intentDecisionModule.intentOrchestration(); intentDecisionModule.decideSuitableAction(); intentDecisionModule.exploreIntentHandlers();//返回handler + return null; } 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 aadbda0..5fa4b98 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 @@ -15,14 +15,17 @@ */ package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService; +import org.onap.usecaseui.intentanalysis.bean.models.Intent; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + @Service public class IntentProcessService { @Autowired - IntentDetectionService intentDetectionServiceImpl; + IntentDetectionService intentDetectionService; @Autowired IntentInvestigationService intentInvestigationService; @Autowired @@ -44,25 +47,28 @@ public class IntentProcessService { this.intentHandler= intentHandler; } } - public void intentProcess() { - intentDetectionServiceImpl.setIntentRole(intentOwner,intentHandler); - intentDetectionServiceImpl.detectionProcess(); + public void intentProcess(Intent intent) { + intentDetectionService.setIntentRole(intentOwner,intentHandler); + Intent detectIntent = intentDetectionService.detectionProcess(intent); //investigation process intentInvestigationService.setIntentRole(intentOwner,intentHandler); - intentInvestigationService.investigationProcess();//List? + List intentManagementFunctions = + intentInvestigationService.investigationProcess();//List? - //definition process - intentDefinitionService.setIntentRole(intentOwner,intentHandler); - intentDefinitionService.definitionPorcess(); + for (IntentManagementFunction intentHandler : intentManagementFunctions) { + //definition process + intentDefinitionService.setIntentRole(intentOwner,intentHandler); + intentDefinitionService.definitionPorcess(); - //distribution process - intentDistributionService.setIntentRole(intentOwner,intentHandler); - intentDistributionService.distributionProcess(); + //distribution process + intentDistributionService.setIntentRole(intentOwner,intentHandler); + intentDistributionService.distributionProcess(); - //operation process - intentOperationService.setIntentRole(intentOwner,intentHandler); - intentOperationService.operationProcess(); + //operation process + intentOperationService.setIntentRole(intentOwner,intentHandler); + intentOperationService.operationProcess(); + } } -- cgit 1.2.3-korg