From 2369b55a48d6ca3ce251b86e0c4150806e60f183 Mon Sep 17 00:00:00 2001 From: ShuhaoCai Date: Fri, 8 Jul 2022 09:44:16 +0800 Subject: intent schema definition springboot framework init and intent dto and po definition Signed-off-by: ShuhaoCai Issue-ID: USECASEUI-692 Change-Id: I4c1f9c4aa05c10f62d04b9e557ebb4089124dcf7 --- intentanalysis/pom.xml | 91 ++++++++++++++++++++++ .../intentanalysis/IntentAnalysisApplication.java | 29 +++++++ .../intentanalysis/bean/models/Expectation.java | 55 +++++++++++++ .../intentanalysis/bean/models/Intent.java | 53 +++++++++++++ .../intentanalysis/bean/models/State.java | 40 ++++++++++ .../intentanalysis/bean/po/ExpectationPo.java | 57 ++++++++++++++ .../usecaseui/intentanalysis/bean/po/IntentPo.java | 52 +++++++++++++ .../usecaseui/intentanalysis/bean/po/StatePo.java | 43 ++++++++++ intentanalysis/src/main/resources/application.yaml | 4 + 9 files changed, 424 insertions(+) create mode 100644 intentanalysis/pom.xml create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/IntentAnalysisApplication.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Expectation.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Intent.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/State.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/ExpectationPo.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/IntentPo.java create mode 100644 intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/StatePo.java create mode 100644 intentanalysis/src/main/resources/application.yaml (limited to 'intentanalysis') diff --git a/intentanalysis/pom.xml b/intentanalysis/pom.xml new file mode 100644 index 0000000..969e9f7 --- /dev/null +++ b/intentanalysis/pom.xml @@ -0,0 +1,91 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.5.2 + + + org.onap.usecase-ui.intent-analysis + server + 0.0.1-SNAPSHOT + server + + 11 + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.projectlombok + lombok + 1.18.22 + + + + io.springfox + springfox-swagger2 + 2.9.2 + + + io.springfox + springfox-swagger-ui + 2.9.2 + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.2.0 + + + org.postgresql + postgresql + runtime + + + javax.ws.rs + javax.ws.rs-api + 2.1 + + + org.eclipse.persistence + javax.persistence + 2.1.0 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + src/main/resources + + + src/main/java + + **/*.xml + + false + + + + + diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/IntentAnalysisApplication.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/IntentAnalysisApplication.java new file mode 100644 index 0000000..819c1e7 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/IntentAnalysisApplication.java @@ -0,0 +1,29 @@ +/* + * 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; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class IntentAnalysisApplication { + + public static void main(String[] args) { + SpringApplication.run(IntentAnalysisApplication.class, args); + } + +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Expectation.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Expectation.java new file mode 100644 index 0000000..b883662 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Expectation.java @@ -0,0 +1,55 @@ +/* + * 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.bean.models; + +import org.onap.usecaseui.intentanalysis.bean.po.ExpectationPo; +import org.onap.usecaseui.intentanalysis.bean.po.StatePo; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data + +public class Expectation { + private String expectationId; + + private String expectationName; + + private String targetMOI; + + List stateList; + + public ExpectationPo transferToExpectationPo() { + ExpectationPo expectationPo = new ExpectationPo(); + expectationPo.setExpectationPoId(this.expectationId); + expectationPo.setExpectationPoName(this.expectationName); + expectationPo.setTargetMOI(this.targetMOI); + expectationPo.setStatePoList(getStatePoList()); + return expectationPo; + } + + private List getStatePoList() { + List statePoList = new ArrayList<>(); + if (null == this.stateList) { + return statePoList; + } + for (State state : this.stateList) { + statePoList.add(state.transferToStatePo()); + } + return statePoList; + } +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Intent.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Intent.java new file mode 100644 index 0000000..f2a98ce --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Intent.java @@ -0,0 +1,53 @@ +/* + * 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.bean.models; + +import org.onap.usecaseui.intentanalysis.bean.po.ExpectationPo; +import org.onap.usecaseui.intentanalysis.bean.po.IntentPo; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data + +public class Intent { + private String intentId; + + private String intentName; + + private List expectationList; + + public IntentPo transferToIntentPo() { + IntentPo intentPo = new IntentPo(); + intentPo.setIntentPoId(this.intentId); + intentPo.setIntentPoName(this.intentName); + intentPo.setExpectationPoList(getExpectationPoList()); + return intentPo; + } + + private List getExpectationPoList() { + List expectationPoList = new ArrayList<>(); + if (null == this.expectationList) { + return expectationPoList; + } + for (Expectation expectation : this.expectationList) { + expectationPoList.add(expectation.transferToExpectationPo()); + } + return expectationPoList; + } +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/State.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/State.java new file mode 100644 index 0000000..e39b954 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/State.java @@ -0,0 +1,40 @@ +/* + * 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.bean.models; + +import org.onap.usecaseui.intentanalysis.bean.po.StatePo; +import lombok.Data; + +@Data +public class State { + private String stateId; + + private String stateName; + + private String condition; + + private Boolean isSatisfied; + + public StatePo transferToStatePo() { + StatePo statePo = new StatePo(); + statePo.setStatePoId(this.stateId); + statePo.setStatePoName(this.stateName); + statePo.setCondition(this.condition); + statePo.setIsSatisfied(this.isSatisfied); + return statePo; + } +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/ExpectationPo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/ExpectationPo.java new file mode 100644 index 0000000..00e4b56 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/ExpectationPo.java @@ -0,0 +1,57 @@ +/* + * 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.bean.po; + +import org.onap.usecaseui.intentanalysis.bean.models.Expectation; +import org.onap.usecaseui.intentanalysis.bean.models.State; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +public class ExpectationPo { + + private String expectationPoId; + + private String expectationPoName; + + private String targetMOI; + + private String intentPoId; + + List statePoList; + + public Expectation transferToExpectation() { + Expectation expectation = new Expectation(); + expectation.setExpectationId(this.expectationPoId); + expectation.setExpectationName(this.expectationPoName); + expectation.setTargetMOI(this.targetMOI); + expectation.setStateList(getStateList()); + return expectation; + } + + private List getStateList() { + List stateList = new ArrayList<>(); + if (null == this.statePoList) { + return stateList; + } + for (StatePo statePo : this.statePoList) { + stateList.add(statePo.transferToState()); + } + return stateList; + } +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/IntentPo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/IntentPo.java new file mode 100644 index 0000000..5372081 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/IntentPo.java @@ -0,0 +1,52 @@ +/* + * 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.bean.po; + +import org.onap.usecaseui.intentanalysis.bean.models.Expectation; +import org.onap.usecaseui.intentanalysis.bean.models.Intent; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +public class IntentPo { + + private String intentPoId; + + private String intentPoName; + + private List expectationPoList; + + public Intent transferToIntent() { + Intent intent = new Intent(); + intent.setIntentId(this.intentPoId); + intent.setIntentName(this.intentPoName); + intent.setExpectationList(getExpectationList()); + return intent; + } + + private List getExpectationList() { + List expectationList = new ArrayList<>(); + if (null == this.expectationPoList ) { + return expectationList; + } + for (ExpectationPo expectationPo : this.expectationPoList) { + expectationList.add(expectationPo.transferToExpectation()); + } + return expectationList; + } +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/StatePo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/StatePo.java new file mode 100644 index 0000000..5b334cc --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/StatePo.java @@ -0,0 +1,43 @@ +/* + * 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.bean.po; + +import org.onap.usecaseui.intentanalysis.bean.models.State; +import lombok.Data; + +@Data +public class StatePo { + + private String statePoId; + + private String statePoName; + + private String condition; + + private String expectationPoId; + + private Boolean isSatisfied; + + public State transferToState() { + State state = new State(); + state.setStateId(this.statePoId); + state.setStateName(this.statePoName); + state.setIsSatisfied(this.isSatisfied); + state.setCondition(this.condition); + return state; + } +} diff --git a/intentanalysis/src/main/resources/application.yaml b/intentanalysis/src/main/resources/application.yaml new file mode 100644 index 0000000..644d527 --- /dev/null +++ b/intentanalysis/src/main/resources/application.yaml @@ -0,0 +1,4 @@ +server: + port: 8083 + servlet: + context-path: /api/usecaseui-intent-analysis/v1 -- cgit 1.2.3-korg