aboutsummaryrefslogtreecommitdiffstats
path: root/intentanalysis/src
diff options
context:
space:
mode:
authorShuhaoCai <caishuhao@huawei.com>2022-07-08 09:44:16 +0800
committerShuhaoCai <caishuhao@huawei.com>2022-07-11 16:40:31 +0800
commit2369b55a48d6ca3ce251b86e0c4150806e60f183 (patch)
treedcd4d626473e0b7289df465bc78b794b0d28ccd3 /intentanalysis/src
parent5cc8f3f6a5f57ef530daae0cf5de145f02e15fa7 (diff)
intent schema definition
springboot framework init and intent dto and po definition Signed-off-by: ShuhaoCai <caishuhao@huawei.com> Issue-ID: USECASEUI-692 Change-Id: I4c1f9c4aa05c10f62d04b9e557ebb4089124dcf7
Diffstat (limited to 'intentanalysis/src')
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/IntentAnalysisApplication.java29
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Expectation.java55
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Intent.java53
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/State.java40
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/ExpectationPo.java57
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/IntentPo.java52
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/po/StatePo.java43
-rw-r--r--intentanalysis/src/main/resources/application.yaml4
8 files changed, 333 insertions, 0 deletions
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<State> 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<StatePo> getStatePoList() {
+ List<StatePo> 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<Expectation> expectationList;
+
+ public IntentPo transferToIntentPo() {
+ IntentPo intentPo = new IntentPo();
+ intentPo.setIntentPoId(this.intentId);
+ intentPo.setIntentPoName(this.intentName);
+ intentPo.setExpectationPoList(getExpectationPoList());
+ return intentPo;
+ }
+
+ private List<ExpectationPo> getExpectationPoList() {
+ List<ExpectationPo> 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<StatePo> 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<State> getStateList() {
+ List<State> 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<ExpectationPo> expectationPoList;
+
+ public Intent transferToIntent() {
+ Intent intent = new Intent();
+ intent.setIntentId(this.intentPoId);
+ intent.setIntentName(this.intentPoName);
+ intent.setExpectationList(getExpectationList());
+ return intent;
+ }
+
+ private List<Expectation> getExpectationList() {
+ List<Expectation> 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