785a0017ab12befcc020318fd59f54f4e174e8a9
[usecase-ui/intent-analysis.git] /
1 /*
2  *
3  *  * Copyright (C) 2022 CMCC, Inc. and others. All rights reserved.
4  *  *
5  *  * Licensed under the Apache License, Version 2.0 (the "License");
6  *  * you may not use this file except in compliance with the License.
7  *  * You may obtain a copy of the License at
8  *  *
9  *  *     http://www.apache.org/licenses/LICENSE-2.0
10  *  *
11  *  * Unless required by applicable law or agreed to in writing, software
12  *  * distributed under the License is distributed on an "AS IS" BASIS,
13  *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  * See the License for the specific language governing permissions and
15  *  * limitations under the License.
16  *
17  */
18
19 package org.onap.usecaseui.intentanalysis.controller;
20
21 import org.onap.usecaseui.intentanalysis.bean.models.IntentManagerRegInfo;
22 import org.onap.usecaseui.intentanalysis.intentBaseService.intentFunctionManageService.IntentFunctionManageService;
23 import org.springframework.http.MediaType;
24 import org.springframework.http.ResponseEntity;
25 import org.springframework.web.bind.annotation.*;
26
27 import javax.annotation.Resource;
28 import java.util.List;
29
30 @RestController
31 @RequestMapping(value = "/intentFunctionManage")
32 public class IntentFunctionManageController {
33     @Resource(name = "intentFunctionManageService")
34     IntentFunctionManageService intentFunctionManageService;
35
36     @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
37     public ResponseEntity createIntentManage(@RequestBody IntentManagerRegInfo intentManage) {
38         return ResponseEntity.ok(intentFunctionManageService.createFunctionManage(intentManage));
39     }
40
41     @DeleteMapping(produces = MediaType.APPLICATION_JSON_VALUE)
42     public ResponseEntity deleteIntentManage(@PathVariable(value = "id") String id) {
43         return ResponseEntity.ok(intentFunctionManageService.deleteFunctionManage(id));
44     }
45
46     @PutMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE)
47     public ResponseEntity updateIntentManageById(
48             @PathVariable(value = "id") String id, @RequestBody IntentManagerRegInfo intentManage) {
49         return ResponseEntity.ok(intentFunctionManageService.updateIntentManageById(id, intentManage));
50     }
51
52     @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
53     public ResponseEntity<List<IntentManagerRegInfo>> getIntentManageByID() {
54         return ResponseEntity.ok(intentFunctionManageService.getIntentManage());
55     }
56
57 }