diff options
Diffstat (limited to 'intentanalysis/src/main/java')
4 files changed, 162 insertions, 0 deletions
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<List<Intent>> getIntentList() { + return ResponseEntity.ok(intentService.getIntentList()); + } + + @GetMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity<Intent> getIntentById( + @PathVariable(INTENT_ID) String intentId) { + return ResponseEntity.ok(intentService.getIntentById(intentId)); + } + + @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity<Intent> createIntent(@RequestBody Intent intent) { + return ResponseEntity.ok(intentService.createIntent(intent)); + } + + @PutMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity<Intent> 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<ExpectationPo> expectationPoList, String intentId); + + void deleteExpectationListById(String intentId); + + void updateExpectationListById(List<ExpectationPo> expectationPoList, String intentId); + + List<ExpectationPo> 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<Intent> 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<StatePo> statePoList, String expectationId); + + void deleteStateListByExpectationId(String expectationId); + + void updateStateListByExpectationId(List<StatePo> statePoList, String expectationId); + + List<StatePo> getStateListByExpectationId(String expectationId); +} |