From 69f782c7912d7103632db4676683f3ba6dd9f482 Mon Sep 17 00:00:00 2001 From: hekeguang Date: Tue, 23 Aug 2022 15:33:07 +0800 Subject: Add database code. Issue-ID: USECASEUI-696 Change-Id: I4f13bc73899e55a2b0907fb4a610fcc57db3eddd Signed-off-by: hekeguang --- .../bean/enums/ConditionParentType.java | 32 ++++++++++ .../intentanalysis/bean/enums/OperatorType.java | 45 ++++++++++++++ .../intentanalysis/bean/models/Condition.java | 35 +++++++++++ .../intentanalysis/bean/models/Context.java | 7 +-- .../bean/models/ExpectationTarget.java | 2 +- .../models/IntentManagementFunctionRegInfo.java | 7 +-- .../controller/IMFRegInfoController.java | 57 +++++++++++++++++ .../controller/IntentFunctionManageController.java | 57 ----------------- .../IMFRegInfoService.java | 31 ++++++++++ .../IntentFunctionManageService.java | 31 ---------- .../impl/IMFRegInfoServiceImpl.java | 72 ++++++++++++++++++++++ .../impl/IntentFunctionManageServiceImpl.java | 68 -------------------- .../intentanalysis/mapper/ConditionMapper.java | 36 +++++++++++ .../intentanalysis/mapper/IMFRegInfoMapper.java | 26 ++++++++ .../intentanalysis/service/ConditionService.java | 41 ++++++++++++ .../service/impl/ConditionServiceImpl.java | 71 +++++++++++++++++++++ .../service/impl/ContextServiceImpl.java | 23 +++++-- .../service/impl/ExpectationServiceImpl.java | 7 +-- .../service/impl/ExpectationTargetServiceImpl.java | 8 +++ 19 files changed, 480 insertions(+), 176 deletions(-) create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ConditionParentType.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/OperatorType.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Condition.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IMFRegInfoController.java delete mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentFunctionManageController.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/IMFRegInfoService.java delete mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/IntentFunctionManageService.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IMFRegInfoServiceImpl.java delete mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IntentFunctionManageServiceImpl.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ConditionMapper.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IMFRegInfoMapper.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ConditionService.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ConditionServiceImpl.java diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ConditionParentType.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ConditionParentType.java new file mode 100644 index 0000000..6acd292 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ConditionParentType.java @@ -0,0 +1,32 @@ +/* + * 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.enums; + +public enum ConditionParentType { + CONDITION(0, "condition"), + CONTEXT(1,"context"), + EXPECTATION_TARGET(2, "expectation_target"); + + private int index; + + private String desc; + + ConditionParentType(int index, String desc) { + this.index = index; + this.desc = desc; + } +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/OperatorType.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/OperatorType.java new file mode 100644 index 0000000..9478c69 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/OperatorType.java @@ -0,0 +1,45 @@ +/* + * 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.enums; + +import lombok.Getter; + +@Getter +public enum OperatorType { + OR(0,"or"), + GATHERTHAN(1,"gather than"), + EQUALTO(2,"equal to"), + LESSTHAN(3,"less than"), + NOTEQUALTO(4,"not euqal to"), + ONEOF(5,"one of"), + SOMEOF(6,"some of"), + MAXIMUMVALUE(7,"maximum value"), + MINIMUMVALUE(8,"minimum value"), + MEDIAN(9,"median"), + CREDIBILITY(10,"credibility"), + AND(11,"and"); + + + private int index; + + private String desc; + + OperatorType(int index, String desc) { + this.index = index; + this.desc = desc; + } +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Condition.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Condition.java new file mode 100644 index 0000000..33d295c --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Condition.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.OperatorType; + +import java.util.List; + +@Data +public class Condition { + private String conditionId; + + private String conditionName; + + private OperatorType operator; + + private String conditionValue; + + private List conditionList; +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Context.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Context.java index 02aa2c2..bf36762 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Context.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Context.java @@ -17,7 +17,8 @@ package org.onap.usecaseui.intentanalysis.bean.models; import lombok.Data; -import org.onap.usecaseui.intentanalysis.bean.enums.ContextType; + +import java.util.List; @Data @@ -27,8 +28,6 @@ public class Context { private String contextName; - private ContextType contextType; - - private String contextCondition; + private List contextConditions; } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationTarget.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationTarget.java index 412813d..70cc36b 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationTarget.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationTarget.java @@ -29,7 +29,7 @@ public class ExpectationTarget { private String targetName; - private String targetCondition; + private List targetConditions; private List targetContexts; diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java index 5ea8ef9..b137942 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java @@ -26,10 +26,9 @@ import java.util.List; public class IntentManagementFunctionRegInfo { private String id; private String description; - private List supportArea; //ͨ¹ýintentname cll ͨ¹ýintentName - private String supportModel; // expectation expectationtarget targetCondition value - private List supportInterfaces; // + private List supportArea; + private String supportModel; + private List supportInterfaces; private String handleName; private IntentFunctionType intentFunctionType;//out or in - } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IMFRegInfoController.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IMFRegInfoController.java new file mode 100644 index 0000000..c00103a --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IMFRegInfoController.java @@ -0,0 +1,57 @@ +/* + * + * * 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.controller; + +import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo; +import org.onap.usecaseui.intentanalysis.intentBaseService.intentFunctionManageService.IMFRegInfoService; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +@RestController +@RequestMapping(value = "/intentFunctionManage") +public class IMFRegInfoController { + @Resource(name = "intentFunctionManageService") + IMFRegInfoService IMFRegInfoService; + + @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity createIntentManage(@RequestBody IntentManagementFunctionRegInfo intentManage) { + return ResponseEntity.ok(IMFRegInfoService.createFunctionManage(intentManage)); + } + + @DeleteMapping(produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity deleteIntentManage(@PathVariable(value = "id") String id) { + return ResponseEntity.ok(IMFRegInfoService.deleteFunctionManage(id)); + } + + @PutMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity updateIntentManageById( + @PathVariable(value = "id") String id, @RequestBody IntentManagementFunctionRegInfo intentManage) { + return ResponseEntity.ok(IMFRegInfoService.updateIntentManageById(id, intentManage)); + } + + @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity> getIntentManageByID() { + return ResponseEntity.ok(IMFRegInfoService.getIntentManage()); + } + +} 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 deleted file mode 100644 index f36df23..0000000 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentFunctionManageController.java +++ /dev/null @@ -1,57 +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.controller; - -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; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -@RestController -@RequestMapping(value = "/intentFunctionManage") -public class IntentFunctionManageController { - @Resource(name = "intentFunctionManageService") - IntentFunctionManageService intentFunctionManageService; - - @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity createIntentManage(@RequestBody IntentManagementFunctionRegInfo intentManage) { - return ResponseEntity.ok(intentFunctionManageService.createFunctionManage(intentManage)); - } - - @DeleteMapping(produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity deleteIntentManage(@PathVariable(value = "id") String id) { - return ResponseEntity.ok(intentFunctionManageService.deleteFunctionManage(id)); - } - - @PutMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity updateIntentManageById( - @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() { - return ResponseEntity.ok(intentFunctionManageService.getIntentManage()); - } - -} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/IMFRegInfoService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/IMFRegInfoService.java new file mode 100644 index 0000000..ead7a0c --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/IMFRegInfoService.java @@ -0,0 +1,31 @@ +/* + * 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.intentFunctionManageService; + +import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo; + +import java.util.List; + +public interface IMFRegInfoService { + int createFunctionManage(IntentManagementFunctionRegInfo intentManage) ; + + int deleteFunctionManage(String id); + + int updateIntentManageById(String id, IntentManagementFunctionRegInfo intentManage); + + List getIntentManage(); + +} 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 deleted file mode 100644 index 8a1f918..0000000 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/IntentFunctionManageService.java +++ /dev/null @@ -1,31 +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.intentBaseService.intentFunctionManageService; - -import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo; - -import java.util.List; - -public interface IntentFunctionManageService { - int createFunctionManage(IntentManagementFunctionRegInfo intentManage) ; - - int deleteFunctionManage(String id); - - int updateIntentManageById(String id, IntentManagementFunctionRegInfo intentManage); - - List getIntentManage(); - -} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IMFRegInfoServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IMFRegInfoServiceImpl.java new file mode 100644 index 0000000..cb21982 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IMFRegInfoServiceImpl.java @@ -0,0 +1,72 @@ +/* + * 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.intentFunctionManageService.impl; + +import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo; +import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; +import org.onap.usecaseui.intentanalysis.intentBaseService.intentFunctionManageService.IMFRegInfoService; +import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; +import org.onap.usecaseui.intentanalysis.mapper.IMFRegInfoMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Service; + +import java.lang.reflect.InvocationTargetException; +import java.util.List; + +@Service("intentFunctionManageService") +public class IMFRegInfoServiceImpl implements IMFRegInfoService { + @Autowired + private ApplicationContext applicationContext; + + @Autowired + private IMFRegInfoMapper imfRegInfoMapper; + @Override + public int createFunctionManage(IntentManagementFunctionRegInfo intentManage) { + return 0; + } + + @Override + public int deleteFunctionManage(String id) { + return 0; + } + + @Override + public int updateIntentManageById(String id, IntentManagementFunctionRegInfo intentManage) { + return 0; + } + + @Override + public List getIntentManage() { + return null; + } + + public List filterHandleFunction(IntentManagementFunctionRegInfo managementRegInfo) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { + String managetFunctionRegName =managementRegInfo.getHandleName(); + + IntentManagementFunction function = + (IntentManagementFunction)applicationContext.getBean(managetFunctionRegName); + + ActuationModule actuationModule = function.getActuationModule(); + actuationModule.sendToNonIntentHandler(); + IntentManagementFunction intentManagementFunction = + (IntentManagementFunction) Class.forName(managetFunctionRegName) + .getDeclaredConstructor().newInstance(); + ActuationModule actuationModule1 = intentManagementFunction.getActuationModule(); + return null; + } + +} 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 deleted file mode 100644 index 71a6914..0000000 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IntentFunctionManageServiceImpl.java +++ /dev/null @@ -1,68 +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.intentBaseService.intentFunctionManageService.impl; - -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; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.stereotype.Service; - -import java.lang.reflect.InvocationTargetException; -import java.util.List; - -@Service("intentFunctionManageService") -public class IntentFunctionManageServiceImpl implements IntentFunctionManageService { - @Autowired - private ApplicationContext applicationContext; - @Override - public int createFunctionManage(IntentManagementFunctionRegInfo intentManage) { - return 0; - } - - @Override - public int deleteFunctionManage(String id) { - return 0; - } - - @Override - public int updateIntentManageById(String id, IntentManagementFunctionRegInfo intentManage) { - return 0; - } - - @Override - public List getIntentManage() { - return null; - } - - public List filterHandleFunction(IntentManagementFunctionRegInfo managementRegInfo) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { - String managetFunctionRegName =managementRegInfo.getHandleName(); - - IntentManagementFunction function = - (IntentManagementFunction)applicationContext.getBean(managetFunctionRegName); - - ActuationModule actuationModule = function.getActuationModule(); - actuationModule.sendToNonIntentHandler(); - IntentManagementFunction intentManagementFunction = - (IntentManagementFunction) Class.forName(managetFunctionRegName) - .getDeclaredConstructor().newInstance(); - ActuationModule actuationModule1 = intentManagementFunction.getActuationModule(); - return null; - } - -} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ConditionMapper.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ConditionMapper.java new file mode 100644 index 0000000..6f3c642 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ConditionMapper.java @@ -0,0 +1,36 @@ +/* + * 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.mapper; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.onap.usecaseui.intentanalysis.bean.enums.ConditionParentType; +import org.onap.usecaseui.intentanalysis.bean.models.Condition; + +import java.util.List; + +@Mapper +public interface ConditionMapper { + + void insertConditionList(@Param(value = "conditionList") List conditionList); + + void insertConditionParentList(@Param(value = "conditionList") List conditionList, + @Param(value = "parentType") ConditionParentType conditionParentType, + @Param(value = "parentId") String parentId); + + List selectConditionByParentId(String parentId); +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IMFRegInfoMapper.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IMFRegInfoMapper.java new file mode 100644 index 0000000..ca4318d --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IMFRegInfoMapper.java @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2022 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.intentanalysis.mapper; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo; + +@Mapper +public interface IMFRegInfoMapper { + void insertIMFRegInfoRegInfo(@Param(value = "fulfilmentInfo") IntentManagementFunctionRegInfo imfregInfo); +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ConditionService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ConditionService.java new file mode 100644 index 0000000..474fce2 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ConditionService.java @@ -0,0 +1,41 @@ +/* + * 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.enums.ConditionParentType; +import org.onap.usecaseui.intentanalysis.bean.models.Condition; +import org.springframework.stereotype.Service; + + +import java.util.List; + + +public interface ConditionService { + + void createConditionList(List cnditionList, ConditionParentType conditionParentType, String parentId); + + void insertCondition(Condition condition, String parentId); + + void deleteConditionListByParentId(String parentId); + + void deleteConditionById(String conditionId); + + void updateConditionListByParentId(List conditionList, String parentId); + + List getConditionListByParentId(String parentId); + +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ConditionServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ConditionServiceImpl.java new file mode 100644 index 0000000..a553b90 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ConditionServiceImpl.java @@ -0,0 +1,71 @@ +/* + * 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 org.onap.usecaseui.intentanalysis.bean.enums.ConditionParentType; +import org.onap.usecaseui.intentanalysis.bean.models.Condition; +import org.onap.usecaseui.intentanalysis.mapper.ConditionMapper; +import org.onap.usecaseui.intentanalysis.service.ConditionService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + + +@Service +public class ConditionServiceImpl implements ConditionService { + + private static Logger LOGGER = LoggerFactory.getLogger(ContextServiceImpl.class); + + @Autowired + private ConditionMapper conditionMapper; + + @Autowired + private ConditionService conditionService; + + @Override + public void createConditionList(List conditionList, ConditionParentType conditionParentType, String parentId) { + conditionMapper.insertConditionList(conditionList); + conditionMapper.insertConditionParentList(conditionList,conditionParentType,parentId); + } + + @Override + public void insertCondition(Condition condition, String parentId) { + + } + + @Override + public void deleteConditionListByParentId(String parentId) { + + } + + @Override + public void deleteConditionById(String conditionId) { + + } + + @Override + public void updateConditionListByParentId(List conditionList, String parentId) { + + } + + @Override + public List getConditionListByParentId(String parentId) { + return conditionMapper.selectConditionByParentId(parentId); + } +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ContextServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ContextServiceImpl.java index ff2b7da..c0f472d 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ContextServiceImpl.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ContextServiceImpl.java @@ -17,32 +17,43 @@ package org.onap.usecaseui.intentanalysis.service.impl; -import java.util.ArrayList; -import java.util.List; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; +import org.onap.usecaseui.intentanalysis.bean.enums.ConditionParentType; import org.onap.usecaseui.intentanalysis.bean.enums.ContextParentType; import org.onap.usecaseui.intentanalysis.bean.models.Context; import org.onap.usecaseui.intentanalysis.mapper.ContextMapper; +import org.onap.usecaseui.intentanalysis.service.ConditionService; import org.onap.usecaseui.intentanalysis.service.ContextService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; @Service public class ContextServiceImpl implements ContextService { - private static Logger LOGGER = LoggerFactory.getLogger(ContextServiceImpl.class); + static Logger LOGGER = LoggerFactory.getLogger(ContextServiceImpl.class); + private ConditionParentType conditionParentType; @Autowired private ContextMapper contextMapper; @Autowired private ContextService contextService; + @Autowired + private ConditionService conditionService; + @Override public void createContextList(List contextList, ContextParentType contextParentType, String parentId) { contextMapper.insertContextList(contextList); + + for (Context context: contextList) { + conditionService.createConditionList(context.getContextConditions(),conditionParentType.CONTEXT,context.getContextId()); + } + contextMapper.insertContextParentList(contextList, contextParentType, parentId); } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java index 5fb7128..d5db0ca 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java @@ -20,6 +20,7 @@ package org.onap.usecaseui.intentanalysis.service.impl; import java.util.ArrayList; import java.util.List; import lombok.extern.slf4j.Slf4j; +import org.onap.usecaseui.intentanalysis.service.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.onap.usecaseui.intentanalysis.bean.enums.ContextParentType; @@ -28,11 +29,6 @@ import org.onap.usecaseui.intentanalysis.bean.models.ExpectationTarget; import org.onap.usecaseui.intentanalysis.common.ResponseConsts; import org.onap.usecaseui.intentanalysis.exception.DataBaseException; import org.onap.usecaseui.intentanalysis.mapper.ExpectationMapper; -import org.onap.usecaseui.intentanalysis.service.ContextService; -import org.onap.usecaseui.intentanalysis.service.ExpectationService; -import org.onap.usecaseui.intentanalysis.service.ExpectationObjectService; -import org.onap.usecaseui.intentanalysis.service.ExpectationTargetService; -import org.onap.usecaseui.intentanalysis.service.FulfilmentInfoService; @Service @@ -54,6 +50,7 @@ public class ExpectationServiceImpl implements ExpectationService { @Autowired private ContextService contextService; + @Autowired private FulfilmentInfoService fulfilmentInfoService; diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationTargetServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationTargetServiceImpl.java index f45ef30..87e8435 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationTargetServiceImpl.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationTargetServiceImpl.java @@ -19,6 +19,9 @@ package org.onap.usecaseui.intentanalysis.service.impl; import java.util.ArrayList; import java.util.List; + +import org.onap.usecaseui.intentanalysis.bean.enums.ConditionParentType; +import org.onap.usecaseui.intentanalysis.service.ConditionService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -38,18 +41,22 @@ public class ExpectationTargetServiceImpl implements ExpectationTargetService { private ContextParentType contextParentType; + private ConditionParentType conditionParentType; @Autowired private ExpectationTargetMapper expectationTargetMapper; @Autowired private ExpectationTargetService expectationTargetService; + @Autowired private FulfilmentInfoService fulfilmentInfoService; @Autowired private ContextService contextService; + @Autowired + private ConditionService conditionService; @Override public void createTarget(ExpectationTarget expectationTarget, String expectationId) { expectationTargetMapper.insertExpectationTarget(expectationTarget, expectationId); @@ -58,6 +65,7 @@ public class ExpectationTargetServiceImpl implements ExpectationTargetService { expectationTarget.getTargetId()); fulfilmentInfoService.createFulfilmentInfo(expectationTarget.getTargetFulfilmentInfo(), expectationTarget.getTargetId()); + conditionService.createConditionList(expectationTarget.getTargetConditions(),conditionParentType.EXPECTATION_TARGET,expectationId); } @Override -- cgit 1.2.3-korg