From 61921b6736371405813269eb657ec2ea4841e43b Mon Sep 17 00:00:00 2001 From: ShuhaoCai Date: Tue, 12 Jul 2022 17:24:36 +0800 Subject: Intent controller and service interface definition Issue-ID: USECASEUI-695 Signed-off-by: ShuhaoCai Change-Id: I94396df258441fa2a6cca9c792e3032d949d6ec5 --- .../controller/IntentController.java | 64 ++++++++++++++++++++++ .../intentanalysis/service/ExpectationService.java | 33 +++++++++++ .../intentanalysis/service/IntentService.java | 33 +++++++++++ .../intentanalysis/service/StateService.java | 32 +++++++++++ 4 files changed, 162 insertions(+) create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationService.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/IntentService.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/StateService.java (limited to 'intentanalysis') 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 new file mode 100644 index 0000000..00d8d3a --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java @@ -0,0 +1,64 @@ +/* + * Copyright 2022 Huawei Technologies Co., Ltd. + * + * 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.Intent; +import org.onap.usecaseui.intentanalysis.service.IntentService; +import org.springframework.http.ResponseEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("/intents") +public class IntentController { + + private static final String INTENT_ID = "intentId"; + + @Autowired + private IntentService intentService; + + @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity> getIntentList() { + return ResponseEntity.ok(intentService.getIntentList()); + } + + @GetMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity getIntentById( + @PathVariable(INTENT_ID) String intentId) { + return ResponseEntity.ok(intentService.getIntentById(intentId)); + } + + @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity createIntent(@RequestBody Intent intent) { + return ResponseEntity.ok(intentService.createIntent(intent)); + } + + @PutMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity updateIntentById( + @PathVariable(INTENT_ID) String intentId, + @RequestBody Intent intent) { + return ResponseEntity.ok(intentService.updateIntentById(intentId, intent)); + } + + @DeleteMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE) + public void removeIntentById(@PathVariable(INTENT_ID) String intentId) { + intentService.deleteIntentById(intentId); + } + +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationService.java new file mode 100644 index 0000000..bcdc89e --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationService.java @@ -0,0 +1,33 @@ +/* + * Copyright 2022 Huawei Technologies Co., Ltd. + * + * 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.po.ExpectationPo; + +import java.util.List; + +public interface ExpectationService { + + void createExpectationList(List expectationPoList, String intentId); + + void deleteExpectationListById(String intentId); + + void updateExpectationListById(List expectationPoList, String intentId); + + List getExpectationListByIntentId(String intentId); +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/IntentService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/IntentService.java new file mode 100644 index 0000000..4e8765a --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/IntentService.java @@ -0,0 +1,33 @@ +/* + * Copyright 2022 Huawei Technologies Co., Ltd. + * + * 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.models.Intent; + +import java.util.List; + +public interface IntentService { + List getIntentList(); + + Intent getIntentById(String intentId); + + Intent createIntent(Intent intent); + + Intent updateIntentById(String intentId, Intent intent); + + void deleteIntentById(String intentId); +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/StateService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/StateService.java new file mode 100644 index 0000000..237c54a --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/StateService.java @@ -0,0 +1,32 @@ +/* + * Copyright 2022 Huawei Technologies Co., Ltd. + * + * 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.po.StatePo; + +import java.util.List; + +public interface StateService { + + void createStateList(List statePoList, String expectationId); + + void deleteStateListByExpectationId(String expectationId); + + void updateStateListByExpectationId(List statePoList, String expectationId); + + List getStateListByExpectationId(String expectationId); +} -- cgit 1.2.3-korg