add intentFunction manage 05/130005/1
authorcmrizhangzhen <781953240@qq.com>
Fri, 22 Jul 2022 03:05:36 +0000 (11:05 +0800)
committercmrizhangzhen <781953240@qq.com>
Fri, 22 Jul 2022 03:05:57 +0000 (11:05 +0800)
Issue-ID: USECASEUI-696
Signed-off-by: cmrizhangzhen <781953240@qq.com>
Change-Id: I7983c487a2920487f1caecc44ca376956d0e5239

intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/IntentFunctionType.java [new file with mode: 0644]
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportArea.java [new file with mode: 0644]
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportInterface.java [new file with mode: 0644]
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagerRegInfo.java [new file with mode: 0644]
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunction.java
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/intentModuleImpl/ActuationModuleImpl.java
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentFunctionManageController.java [new file with mode: 0644]
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/IntentFunctionManageService.java [new file with mode: 0644]
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IntentFunctionManageServiceImpl.java [new file with mode: 0644]
intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java

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 (file)
index 0000000..c9d00a2
--- /dev/null
@@ -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 (file)
index 0000000..5f1a003
--- /dev/null
@@ -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 (file)
index 0000000..a375e68
--- /dev/null
@@ -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 (file)
index 0000000..24ef19e
--- /dev/null
@@ -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> supportArea;
+    private String supportModel;
+    private List<SupportInterface> supportInterfaces;
+    private String handleName;
+    private IntentFunctionType intentFunctionType;
+
+}
index fc4696f..53e13e0 100644 (file)
@@ -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/controller/IntentFunctionManageController.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentFunctionManageController.java
new file mode 100644 (file)
index 0000000..cd5ca8c
--- /dev/null
@@ -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<List<IntentManagerRegInfo>> 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 (file)
index 0000000..b3a05b2
--- /dev/null
@@ -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<IntentManagerRegInfo> 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 (file)
index 0000000..edf4e7f
--- /dev/null
@@ -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<IntentManagerRegInfo> getIntentManage() {
+        return null;
+    }
+
+    public List<IntentManagementFunction> 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;
+    }
+
+}