From 411dfd0c420ad82d698e2b383edbe6248e13ad5c Mon Sep 17 00:00:00 2001 From: cmrizhangzhen <781953240@qq.com> Date: Fri, 22 Jul 2022 11:05:36 +0800 Subject: add intentFunction manage Issue-ID: USECASEUI-696 Signed-off-by: cmrizhangzhen <781953240@qq.com> Change-Id: I7983c487a2920487f1caecc44ca376956d0e5239 --- .../bean/enums/IntentFunctionType.java | 47 ++++++++++++++ .../intentanalysis/bean/enums/SupportArea.java | 47 ++++++++++++++ .../bean/enums/SupportInterface.java | 48 +++++++++++++++ .../bean/models/IntentManagerRegInfo.java | 35 +++++++++++ .../CLLBusinessIntentManagementFunction.java | 2 + .../intentModuleImpl/ActuationModuleImpl.java | 1 + .../controller/IntentFunctionManageController.java | 57 +++++++++++++++++ .../IntentFunctionManageService.java | 31 ++++++++++ .../impl/IntentFunctionManageServiceImpl.java | 72 ++++++++++++++++++++++ .../IntentDistributionService.java | 1 - 10 files changed, 340 insertions(+), 1 deletion(-) create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/IntentFunctionType.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportArea.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportInterface.java create 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/controller/IntentFunctionManageController.java create 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/IntentFunctionManageServiceImpl.java (limited to 'intentanalysis/src') diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/IntentFunctionType.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/IntentFunctionType.java new file mode 100644 index 0000000..c9d00a2 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/IntentFunctionType.java @@ -0,0 +1,47 @@ +/* + * + * * 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 IntentFunctionType { + INTERNALFUNCTION(0,"internalFunction"), + EXTERNALFUNCTION(1,"externalFunction"); + private int type; + private String desc; + + IntentFunctionType(int type, String desc) { + this.type = type; + this.desc = desc; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportArea.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportArea.java new file mode 100644 index 0000000..5f1a003 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportArea.java @@ -0,0 +1,47 @@ +/* + * + * * 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 SupportArea { + SLICING(0, "slicing"), + FEMALE(1, "5g"), + MALE(2, "4g"); + private int type; + private String desc; + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + SupportArea(int type, String desc) { + this.type = type; + this.desc = desc; + } +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportInterface.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportInterface.java new file mode 100644 index 0000000..a375e68 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportInterface.java @@ -0,0 +1,48 @@ +/* + * + * * 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 SupportInterface { + //CREATE,DELETE,UPDATE,SEARCH; + CREATE(0,"CREATE"), + DELETE(1,"DELETE"), + UPDATE(2,"UPDATE"), + SEARCH(3,"SEARCH"); + private int type; + private String name; + SupportInterface(int type, String name) { + this.type = type; + this.name = name; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} 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 new file mode 100644 index 0000000..24ef19e --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagerRegInfo.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 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 fc4696f..53e13e0 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 @@ -24,8 +24,10 @@ import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.Actuatio 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(); 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 index bb7fbb5..4d9eac7 100644 --- 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 @@ -35,6 +35,7 @@ public class ActuationModuleImpl implements ActuationModule { @Override public void sendToNonIntentHandler() { + System.out.println("hahha"); } @Override 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 new file mode 100644 index 0000000..cd5ca8c --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentFunctionManageController.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.IntentManagerRegInfo; +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 IntentManagerRegInfo 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 updateIntentById( + @PathVariable(value = "id") String id, @RequestBody IntentManagerRegInfo intentManage) { + return ResponseEntity.ok(intentFunctionManageService.updateIntentById(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/IntentFunctionManageService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/IntentFunctionManageService.java new file mode 100644 index 0000000..b3a05b2 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/IntentFunctionManageService.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.IntentManagerRegInfo; + +import java.util.List; + +public interface IntentFunctionManageService { + int createFunctionManage(IntentManagerRegInfo intentManage) ; + + int deleteFunctionManage(String id); + + int updateIntentById(String id, IntentManagerRegInfo intentManage); + + 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 new file mode 100644 index 0000000..edf4e7f --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IntentFunctionManageServiceImpl.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.Intent; +import org.onap.usecaseui.intentanalysis.bean.models.IntentManagerRegInfo; +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(IntentManagerRegInfo intentManage) { + IntentManagementFunction intentManagementFunction = (IntentManagementFunction)applicationContext.getBean("CLLBusinessIntentManagementFunction"); + return 0; + } + + @Override + public int deleteFunctionManage(String id) { + return 0; + } + + @Override + public int updateIntentById(String id, IntentManagerRegInfo intentManage) { + return 0; + } + + @Override + public List getIntentManage() { + return null; + } + + public List filterHanleFunction(Intent intent) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { + String functionName ="CLLBusinessIntentManagementFunction"; + + IntentManagementFunction function = + (IntentManagementFunction)applicationContext.getBean(functionName); + + ActuationModule actuationModule = function.getActuationModule(); + actuationModule.sendToNonIntentHandler(); +// + IntentManagementFunction intentManagementFunction = + (IntentManagementFunction) Class.forName(functionName) + .getDeclaredConstructor().newInstance(); + ActuationModule actuationModule1 = intentManagementFunction.getActuationModule(); + return null; + } + +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java index eb58546..4622aa1 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java @@ -23,7 +23,6 @@ import org.springframework.stereotype.Service; @Service public class IntentDistributionService { - @Autowired private IntentManagementFunction intentHandler; private IntentManagementFunction intentOwner; -- cgit 1.2.3-korg