summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--.gitignore3
-rw-r--r--intentanalysis/pom.xml91
-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
-rw-r--r--pom.xml33
11 files changed, 460 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 6980558..7915757 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,6 @@ target/
# IntelliJ files
.idea/
*.iml
+
+# Generated by Springboot Init Tool
+.mvn/ \ No newline at end of file
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-parent</artifactId>
+ <version>2.5.2</version>
+ <relativePath/> <!-- lookup parent from repository -->
+ </parent>
+ <groupId>org.onap.usecase-ui.intent-analysis</groupId>
+ <artifactId>server</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <name>server</name>
+ <properties>
+ <java.version>11</java.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.18.22</version>
+ </dependency>
+ <!-- swagger -->
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger2</artifactId>
+ <version>2.9.2</version>
+ </dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger-ui</artifactId>
+ <version>2.9.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mybatis.spring.boot</groupId>
+ <artifactId>mybatis-spring-boot-starter</artifactId>
+ <version>2.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.persistence</groupId>
+ <artifactId>javax.persistence</artifactId>
+ <version>2.1.0</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ <filtering>false</filtering>
+ </resource>
+ </resources>
+ </build>
+
+</project>
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
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..96ecf00
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onap.oparent</groupId>
+ <artifactId>oparent</artifactId>
+ <version>3.2.0</version>
+ <relativePath />
+ </parent>
+
+ <groupId>org.onap.usecase-ui.intent-analysis</groupId>
+ <artifactId>usecase-ui-intent-analysis-parent</artifactId>
+ <packaging>pom</packaging>
+ <version>0.0.1-SNAPSHOT</version>
+ <modules>
+ <module>intentanalysis</module>
+ </modules>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <sonar.projectVersion>${project.version}</sonar.projectVersion>
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
+ <nexusproxy>https://nexus.onap.org</nexusproxy>
+ <snapshotNexusPath>content/repositories/snapshots/</snapshotNexusPath>
+ <releaseNexusPath>content/repositories/releases/</releaseNexusPath>
+ <siteNexusPath>content/sites/site/${project.groupId}/${project.artifactId}/${project.version}/</siteNexusPath>
+ </properties>
+
+</project>