aboutsummaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main
diff options
context:
space:
mode:
authorxudan16 <xudan16@huawei.com>2022-08-10 17:35:36 +0800
committerxudan16 <xudan16@huawei.com>2022-08-11 14:25:10 +0800
commite0d1a15a32bdf8143389259bb23ce3c2bf88177c (patch)
tree343cf0d8e19adfed0544c6eac66886ffbe86e9d0 /intentanalysis/src/main
parente1bb026dc18d66bb3a0417625c8dfb32a1109bee (diff)
Update intent module and intent API of creation
Signed-off-by: xudan16 <xudan16@huawei.com> Issue-ID: USECASEUI-710 Change-Id: Ic0428915e9470b4478e8a7493635da60a8445a56
Diffstat (limited to 'intentanalysis/src/main')
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ContextParentType.java37
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ContextType.java35
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ExpectationType.java35
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/FulfilmentStatus.java35
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/IntentFunctionType.java4
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/NotFulfilledState.java39
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ObjectType.java35
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportInterface.java8
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Context.java34
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Expectation.java17
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationObject.java34
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationTarget.java37
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfo.java33
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Intent.java10
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java10
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ContextMapper.java37
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationMapper.java19
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationObjectMapper.java32
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationTargetMapper.java31
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/FulfilmentInfoMapper.java32
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentMapper.java3
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/StateMapper.java8
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ContextService.java38
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationObjectService.java26
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationService.java14
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationTargetService.java29
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/FulfilmentInfoService.java30
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/IntentService.java3
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/StateService.java3
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ContextServiceImpl.java69
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationObjectServiceImpl.java56
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java106
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationTargetServiceImpl.java71
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/FulfilmentInfoServiceImpl.java57
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java64
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/StateServiceImpl.java4
-rw-r--r--intentanalysis/src/main/resources/application.yaml4
-rw-r--r--intentanalysis/src/main/resources/intent-analysis-init.sql36
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml30
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml42
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/ExpectationObjectMapper.xml14
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml14
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/FulfilmentInfoMapper.xml19
43 files changed, 1161 insertions, 133 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ContextParentType.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ContextParentType.java
new file mode 100644
index 0000000..354f14b
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ContextParentType.java
@@ -0,0 +1,37 @@
+/*
+ * 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.enums;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+public enum ContextParentType {
+ INTENT(0, "intent"),
+ EXPECTATION(1, "expectation"),
+ EXPECTATION_OBJECT(2, "expectation_object"),
+ EXPECTATION_TARGET(3, "expectation_target");
+
+ private int index;
+
+ private String desc;
+
+ ContextParentType(int index, String desc) {
+ this.index = index;
+ this.desc = desc;
+ }
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ContextType.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ContextType.java
new file mode 100644
index 0000000..8b7b60c
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ContextType.java
@@ -0,0 +1,35 @@
+/*
+ * 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.enums;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+public enum ContextType {
+ CONTEXTTYPE1(0, "contextType1"),
+ CONTEXTTYPE2(1, "contextType2");
+
+ private int index;
+
+ private String desc;
+
+ ContextType(int index, String desc) {
+ this.index = index;
+ this.desc = desc;
+ }
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ExpectationType.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ExpectationType.java
new file mode 100644
index 0000000..b18ce21
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ExpectationType.java
@@ -0,0 +1,35 @@
+/*
+ * 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.enums;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+public enum ExpectationType {
+ EXPECTATION1(0, "expectationType1"),
+ EXPECTATION2(1, "expectationType2");
+
+ private int index;
+
+ private String desc;
+
+ ExpectationType(int index, String desc) {
+ this.index = index;
+ this.desc = desc;
+ }
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/FulfilmentStatus.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/FulfilmentStatus.java
new file mode 100644
index 0000000..a5fdeb3
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/FulfilmentStatus.java
@@ -0,0 +1,35 @@
+/*
+ * 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.enums;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+public enum FulfilmentStatus {
+ FULFILLED(0, "fulfilled"),
+ NOT_FULFILLED(1, "not_fulfilled");
+
+ private int index;
+
+ private String desc;
+
+ FulfilmentStatus(int index, String desc) {
+ this.index = index;
+ this.desc = desc;
+ }
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/IntentFunctionType.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/IntentFunctionType.java
index 93a5221..25cb1e5 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/IntentFunctionType.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/IntentFunctionType.java
@@ -23,8 +23,8 @@ import lombok.Setter;
@Getter
public enum IntentFunctionType {
- INTERNALFUNCTION(0,"internalFunction"),
- EXTERNALFUNCTION(1,"externalFunction");
+ INTERNALFUNCTION(0, "internalFunction"),
+ EXTERNALFUNCTION(1, "externalFunction");
private int type;
private String desc;
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/NotFulfilledState.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/NotFulfilledState.java
new file mode 100644
index 0000000..6153497
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/NotFulfilledState.java
@@ -0,0 +1,39 @@
+/*
+ * 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.enums;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+public enum NotFulfilledState {
+ ACKNOWLEDGED(0, "acknowledge"),
+ COMPLIANT(1, "compliant"),
+ DEGRADED(2, "degraded"),
+ SUSPENDED(3, "suspended"),
+ TERMINATED(4, "terminated"),
+ FULFILMENTFAILED(5, "fulfilmentfailed");
+
+ private int index;
+
+ private String desc;
+
+ NotFulfilledState(int index, String desc) {
+ this.index = index;
+ this.desc = desc;
+ }
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ObjectType.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ObjectType.java
new file mode 100644
index 0000000..8c659aa
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ObjectType.java
@@ -0,0 +1,35 @@
+/*
+ * 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.enums;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+public enum ObjectType {
+ OBJECT1(0, "objectType1"),
+ OBJECT2(1, "objectType2");
+
+ private int index;
+
+ private String desc;
+
+ ObjectType(int index, String desc) {
+ this.index = index;
+ this.desc = desc;
+ }
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportInterface.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportInterface.java
index 2ae7262..d3414bc 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportInterface.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportInterface.java
@@ -22,10 +22,10 @@ import lombok.Getter;
@Getter
public enum SupportInterface {
//CREATE,DELETE,UPDATE,SEARCH;
- CREATE(0,"CREATE"),
- DELETE(1,"DELETE"),
- UPDATE(2,"UPDATE"),
- SEARCH(3,"SEARCH");
+ CREATE(0, "CREATE"),
+ DELETE(1, "DELETE"),
+ UPDATE(2, "UPDATE"),
+ SEARCH(3, "SEARCH");
private int type;
private String name;
SupportInterface(int type, String name) {
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Context.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Context.java
new file mode 100644
index 0000000..539c239
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/Context.java
@@ -0,0 +1,34 @@
+/*
+ * 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 lombok.Data;
+import org.onap.usecaseui.intentanalysis.bean.enums.ContextType;
+
+@Data
+
+public class Context {
+
+ private String contextId;
+
+ private String contextName;
+
+ private ContextType contextType;
+
+ private String contextCondition;
+
+}
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
index ee1fc49..8107186 100644
--- 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
@@ -13,12 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.usecaseui.intentanalysis.bean.models;
-import lombok.Data;
-import java.util.ArrayList;
import java.util.List;
+import lombok.Data;
+import org.onap.usecaseui.intentanalysis.bean.enums.ExpectationType;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationTarget;
+
@Data
@@ -28,8 +32,13 @@ public class Expectation {
private String expectationName;
- private String targetMOI;
+ private ExpectationType expectationType;
+
+ private ExpectationObject expectationObject;
+
+ private List<ExpectationTarget> expectationTargets;
- List<State> stateList;
+ private List<Context> expectationContexts;
+ private FulfilmentInfo expectationFulfilmentInfo;
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationObject.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationObject.java
new file mode 100644
index 0000000..8cb9bb2
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationObject.java
@@ -0,0 +1,34 @@
+/*
+ * 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 java.util.List;
+import lombok.Data;
+import org.onap.usecaseui.intentanalysis.bean.enums.ObjectType;
+
+
+@Data
+
+public class ExpectationObject {
+
+ private ObjectType objectType;
+
+ private String objectInstance;
+
+ private List<Context> objectContexts;
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationTarget.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationTarget.java
new file mode 100644
index 0000000..09cb994
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationTarget.java
@@ -0,0 +1,37 @@
+/*
+ * 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 java.util.List;
+import lombok.Data;
+
+
+@Data
+
+public class ExpectationTarget {
+
+ private String targetId;
+
+ private String targetName;
+
+ private String targetCondition;
+
+ private List<Context> targetContexts;
+
+ private FulfilmentInfo targetFulfilmentInfo;
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfo.java
new file mode 100644
index 0000000..a03b828
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfo.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.bean.models;
+
+import lombok.Data;
+import org.onap.usecaseui.intentanalysis.bean.enums.FulfilmentStatus;
+import org.onap.usecaseui.intentanalysis.bean.enums.NotFulfilledState;
+
+@Data
+
+public class FulfilmentInfo {
+
+ private FulfilmentStatus fulfilmentStatus;
+
+ private NotFulfilledState notFulfilledState;
+
+ private String notFulfilledReason;
+
+}
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
index 69138e4..536695c 100644
--- 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
@@ -16,10 +16,10 @@
package org.onap.usecaseui.intentanalysis.bean.models;
-import lombok.Data;
-import java.util.ArrayList;
import java.util.List;
+import lombok.Data;
+
@Data
@@ -28,6 +28,10 @@ public class Intent {
private String intentName;
- private List<Expectation> expectationList;
+ private List<Expectation> intentExpectations;
+
+ private List<Context> intentContexts;
+
+ private FulfilmentInfo intentFulfilmentInfo;
}
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
index d1b4aac..85b683b 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java
@@ -13,16 +13,18 @@
* 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 java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
+import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
-import java.util.List;
@RestController
@RequestMapping("/intents")
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ContextMapper.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ContextMapper.java
new file mode 100644
index 0000000..4e5acea
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ContextMapper.java
@@ -0,0 +1,37 @@
+/*
+ * 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.mapper;
+
+
+import java.util.List;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.onap.usecaseui.intentanalysis.bean.enums.ContextParentType;
+import org.onap.usecaseui.intentanalysis.bean.models.Context;
+
+
+@Mapper
+public interface ContextMapper {
+
+ void insertContextList(@Param(value = "contextList") List<Context> contextList);
+
+ void insertContextParentList(@Param(value = "contextList") List<Context> contextList,
+ @Param(value = "parentType") ContextParentType contextParentType,
+ @Param(value = "parentId") String parentId);
+
+ List<Context> selectContextByParentId(String parentId);
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationMapper.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationMapper.java
index 9e910b5..8f8eea1 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationMapper.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationMapper.java
@@ -13,25 +13,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.usecaseui.intentanalysis.mapper;
+
+import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.onap.usecaseui.intentanalysis.bean.models.Expectation;
-import java.util.List;
+
@Mapper
public interface ExpectationMapper {
- int insertExpectationList(@Param(value = "expectationList") List<Expectation> expectationList, @Param(value = "intentId") String intentId);
+ int insertIntentExpectations(@Param(value = "intentExpectations") List<Expectation> intentExpectations,
+ @Param(value = "intentId") String intentId);
- List<Expectation> selectExpectationByIntentId(String intentId);
+ int insertIntentExpectation(@Param(value = "expectation") Expectation expectation,
+ @Param(value = "intentId") String intentId);
- int deleteExpectationByIntentId(String intentId);
+ int deleteIntentExpectationsByIntentId(String intentId);
- int updateExpectation(Expectation expectation);
+ int updateIntentExpectation(Expectation expectation);
- int insertExpectation(@Param(value = "expectation") Expectation expectation, @Param(value = "intentId") String intentId);
+ int deleteIntentExpectationById(String expectationId);
- int deleteExpectationById(String expectationId);
+ List<Expectation> selectIntentExpectationsByIntentId(String intentId);
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationObjectMapper.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationObjectMapper.java
new file mode 100644
index 0000000..5b5a70f
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationObjectMapper.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.mapper;
+
+
+import java.util.List;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.onap.usecaseui.intentanalysis.bean.enums.ObjectType;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
+
+
+@Mapper
+public interface ExpectationObjectMapper {
+
+ void insertExpectationObject(@Param(value = "expectationObject") ExpectationObject expectationObject,
+ @Param(value = "expectationId") String expectationId);
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationTargetMapper.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationTargetMapper.java
new file mode 100644
index 0000000..945795e
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/ExpectationTargetMapper.java
@@ -0,0 +1,31 @@
+/*
+ * 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.mapper;
+
+
+import java.util.List;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationTarget;
+
+
+@Mapper
+public interface ExpectationTargetMapper {
+
+ void insertExpectationTarget(@Param(value = "expectationTarget") ExpectationTarget expectationTarget,
+ @Param(value = "expectationId") String expectationId);
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/FulfilmentInfoMapper.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/FulfilmentInfoMapper.java
new file mode 100644
index 0000000..2b7cd9a
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/FulfilmentInfoMapper.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.mapper;
+
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.onap.usecaseui.intentanalysis.bean.models.FulfilmentInfo;
+
+
+@Mapper
+public interface FulfilmentInfoMapper {
+
+ void insertFulfilmentInfo(@Param(value = "fulfilmentInfo") FulfilmentInfo fulfilmentInfo,
+ @Param(value = "parentId") String parentId);
+
+ FulfilmentInfo selectFulfilmentInfoById(String parentId);
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentMapper.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentMapper.java
index 7cf69a0..44e2a01 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentMapper.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentMapper.java
@@ -16,10 +16,11 @@
package org.onap.usecaseui.intentanalysis.mapper;
+
+import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
-import java.util.List;
@Mapper
public interface IntentMapper {
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/StateMapper.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/StateMapper.java
index ad7d3a1..ce261a1 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/StateMapper.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/StateMapper.java
@@ -16,16 +16,20 @@
package org.onap.usecaseui.intentanalysis.mapper;
+
+import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.onap.usecaseui.intentanalysis.bean.models.Expectation;
import org.onap.usecaseui.intentanalysis.bean.models.State;
-import java.util.List;
+
@Mapper
+
public interface StateMapper {
- int insertStateList(@Param(value = "stateList") List<State> state, @Param(value = "expectationId") String expectationId);
+ int insertStateList(@Param(value = "stateList") List<State> state,
+ @Param(value = "expectationId") String expectationId);
List<State> selectStateByExpectation(String expectationId);
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ContextService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ContextService.java
new file mode 100644
index 0000000..2cabbf6
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ContextService.java
@@ -0,0 +1,38 @@
+/*
+ * 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 java.util.List;
+import org.onap.usecaseui.intentanalysis.bean.enums.ContextParentType;
+import org.onap.usecaseui.intentanalysis.bean.models.Context;
+
+
+public interface ContextService {
+
+ void createContextList(List<Context> contextList, ContextParentType contextParentType, String parentId);
+
+ void insertContext(Context context, String parentId);
+
+ void deleteContextListByParentId(String parentId);
+
+ void deleteContextById(String contextId);
+
+ void updateContextListByParentId(List<Context> contextList, String parentId);
+
+ List<Context> getContextListByParentId(String parentId);
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationObjectService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationObjectService.java
new file mode 100644
index 0000000..a5e2462
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationObjectService.java
@@ -0,0 +1,26 @@
+/*
+ * 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.ExpectationObject;
+
+
+public interface ExpectationObjectService {
+
+ void createObject(ExpectationObject expectationObject, String expectationId);
+}
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
index ba51de1..baee400 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationService.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationService.java
@@ -17,21 +17,21 @@
package org.onap.usecaseui.intentanalysis.service;
+import java.util.List;
import org.onap.usecaseui.intentanalysis.bean.models.Expectation;
-import java.util.List;
public interface ExpectationService {
- void createExpectationList(List<Expectation> expectationList, String intentId);
+ void createIntentExpectations(List<Expectation> intentExpectations, String intentId);
- void deleteExpectationListById(String intentId);
+ void insertIntentExpectation(Expectation expectation, String intentId);
- void updateExpectationListById(List<Expectation> expectationList, String intentId);
+ void deleteIntentExpectationsByIntentId(String intentId);
- List<Expectation> getExpectationListByIntentId(String intentId);
+ void deleteIntentExpectationById(String expectationId);
- void insertExpectation(Expectation expectation, String intentId);
+ void updateIntentExpectationsByIntentId(List<Expectation> intentExpectations, String intentId);
- void deleteExpectationById(String expectationId);
+ List<Expectation> getIntentExpectationsByIntentId(String intentId);
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationTargetService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationTargetService.java
new file mode 100644
index 0000000..255e4c5
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/ExpectationTargetService.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.service;
+
+
+import java.util.List;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationTarget;
+
+
+public interface ExpectationTargetService {
+
+ void createTarget(ExpectationTarget expectationTarget, String expectationId);
+
+ void createTargets(List<ExpectationTarget> expectationTargets, String expectationId);
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/FulfilmentInfoService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/FulfilmentInfoService.java
new file mode 100644
index 0000000..4572a2f
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/FulfilmentInfoService.java
@@ -0,0 +1,30 @@
+/*
+ * 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.FulfilmentInfo;
+
+public interface FulfilmentInfoService {
+
+ void createFulfilmentInfo(FulfilmentInfo fulfilmentInfo, String parentId);
+
+ void deleteFulfilmentInfoByParentId(String parentId);
+
+ void updateFulfilmentInfoByParentId(FulfilmentInfo fulfilmentInfo, String parentId);
+
+ FulfilmentInfo getFulfilmentInfoByParentId(String parentId);
+}
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
index 36615ab..c177caa 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/IntentService.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/IntentService.java
@@ -16,9 +16,10 @@
package org.onap.usecaseui.intentanalysis.service;
-import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import java.util.List;
+import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+
public interface IntentService {
List<Intent> getIntentList();
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
index 6ee82d6..fd34c77 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/StateService.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/StateService.java
@@ -16,9 +16,10 @@
package org.onap.usecaseui.intentanalysis.service;
-import org.onap.usecaseui.intentanalysis.bean.models.State;
import java.util.List;
+import org.onap.usecaseui.intentanalysis.bean.models.State;
+
public interface StateService {
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ContextServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ContextServiceImpl.java
new file mode 100644
index 0000000..ff2b7da
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ContextServiceImpl.java
@@ -0,0 +1,69 @@
+/*
+ * 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.impl;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.onap.usecaseui.intentanalysis.bean.enums.ContextParentType;
+import org.onap.usecaseui.intentanalysis.bean.models.Context;
+import org.onap.usecaseui.intentanalysis.mapper.ContextMapper;
+import org.onap.usecaseui.intentanalysis.service.ContextService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+@Service
+public class ContextServiceImpl implements ContextService {
+
+ private static Logger LOGGER = LoggerFactory.getLogger(ContextServiceImpl.class);
+
+ @Autowired
+ private ContextMapper contextMapper;
+
+ @Autowired
+ private ContextService contextService;
+
+ @Override
+ public void createContextList(List<Context> contextList, ContextParentType contextParentType, String parentId) {
+ contextMapper.insertContextList(contextList);
+ contextMapper.insertContextParentList(contextList, contextParentType, parentId);
+ }
+
+ @Override
+ public void insertContext(Context context, String parentId) {
+ }
+
+ @Override
+ public void deleteContextListByParentId(String parentId) {
+ }
+
+ @Override
+ public void deleteContextById(String contextId) {
+ }
+
+ @Override
+ public void updateContextListByParentId(List<Context> contextList, String parentId) {
+ }
+
+ @Override
+ public List<Context> getContextListByParentId(String parentId) {
+ return contextMapper.selectContextByParentId(parentId);
+ }
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationObjectServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationObjectServiceImpl.java
new file mode 100644
index 0000000..32ae35c
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationObjectServiceImpl.java
@@ -0,0 +1,56 @@
+/*
+ * 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.impl;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.onap.usecaseui.intentanalysis.bean.enums.ContextParentType;
+import org.onap.usecaseui.intentanalysis.bean.enums.ObjectType;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
+import org.onap.usecaseui.intentanalysis.mapper.ExpectationObjectMapper;
+import org.onap.usecaseui.intentanalysis.service.ContextService;
+import org.onap.usecaseui.intentanalysis.service.ExpectationObjectService;
+
+
+@Service
+public class ExpectationObjectServiceImpl implements ExpectationObjectService {
+
+ private static Logger LOGGER = LoggerFactory.getLogger(ExpectationObjectServiceImpl.class);
+
+ private ContextParentType contextParentType;
+
+ @Autowired
+ private ExpectationObjectMapper expectationObjectMapper;
+
+ @Autowired
+ private ExpectationObjectService expectationObjectService;
+
+ @Autowired
+ private ContextService contextService;
+
+ @Override
+ public void createObject(ExpectationObject expectationObject, String expectationId) {
+ expectationObjectMapper.insertExpectationObject(expectationObject, expectationId);
+ contextService.createContextList(expectationObject.getObjectContexts(),
+ contextParentType.EXPECTATION_OBJECT, expectationId);
+ }
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java
index b8f6c3e..5fb7128 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java
@@ -17,21 +17,24 @@
package org.onap.usecaseui.intentanalysis.service.impl;
+import java.util.ArrayList;
+import java.util.List;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.onap.usecaseui.intentanalysis.bean.enums.ContextParentType;
import org.onap.usecaseui.intentanalysis.bean.models.Expectation;
-import org.onap.usecaseui.intentanalysis.bean.models.State;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationTarget;
+import org.onap.usecaseui.intentanalysis.common.ResponseConsts;
import org.onap.usecaseui.intentanalysis.exception.DataBaseException;
import org.onap.usecaseui.intentanalysis.mapper.ExpectationMapper;
+import org.onap.usecaseui.intentanalysis.service.ContextService;
import org.onap.usecaseui.intentanalysis.service.ExpectationService;
-import org.onap.usecaseui.intentanalysis.service.StateService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.onap.usecaseui.intentanalysis.common.ResponseConsts;
+import org.onap.usecaseui.intentanalysis.service.ExpectationObjectService;
+import org.onap.usecaseui.intentanalysis.service.ExpectationTargetService;
+import org.onap.usecaseui.intentanalysis.service.FulfilmentInfoService;
-import java.util.ArrayList;
-import java.util.List;
-
@Service
@Slf4j
public class ExpectationServiceImpl implements ExpectationService {
@@ -40,19 +43,38 @@ public class ExpectationServiceImpl implements ExpectationService {
private ExpectationMapper expectationMapper;
@Autowired
- private StateService stateService;
+ private ExpectationService expectationService;
@Autowired
- private ExpectationService expectationService;
+ private ExpectationObjectService expectationObjectService;
+
+ @Autowired
+ private ExpectationTargetService expectationTargetService;
+
+ @Autowired
+ private ContextService contextService;
+
+ @Autowired
+ private FulfilmentInfoService fulfilmentInfoService;
+
+ private ContextParentType contextParentType;
@Override
- public void createExpectationList(List<Expectation> expectationList, String intentId) {
- for (Expectation expectation : expectationList) {
+ public void createIntentExpectations(List<Expectation> intentExpectations, String intentId) {
+ for (Expectation expectation : intentExpectations) {
if (null != expectation) {
- stateService.createStateList(expectation.getStateList(), expectation.getExpectationId());
+ expectationObjectService.createObject(expectation.getExpectationObject(),
+ expectation.getExpectationId());
+ expectationTargetService.createTargets(expectation.getExpectationTargets(),
+ expectation.getExpectationId());
+ contextService.createContextList(expectation.getExpectationContexts(),
+ contextParentType.EXPECTATION,
+ expectation.getExpectationId());
+ fulfilmentInfoService.createFulfilmentInfo(expectation.getExpectationFulfilmentInfo(),
+ expectation.getExpectationId());
}
}
- int res = expectationMapper.insertExpectationList(expectationList, intentId);
+ int res = expectationMapper.insertIntentExpectations(intentExpectations, intentId);
if (res < 1) {
String msg = "Create expectation to database failed.";
log.error(msg);
@@ -61,42 +83,35 @@ public class ExpectationServiceImpl implements ExpectationService {
}
@Override
- public List<Expectation> getExpectationListByIntentId(String intentId) {
- List<Expectation> expectationList = expectationMapper.selectExpectationByIntentId(intentId);
- if (expectationList == null) {
- String msg = String.format("Intent id %s doesn't exist in database.", intentId);
+ public void insertIntentExpectation(Expectation expectation, String intentId) {
+ int res = expectationMapper.insertIntentExpectation(expectation, intentId);
+ if (res < 1) {
+ String msg = "Create expectation to database failed.";
log.error(msg);
- throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
- }
- for (Expectation expectation : expectationList) {
- List<State> stateList = stateService.getStateListByExpectationId(expectation.getExpectationId());
- expectation.setStateList(stateList);
+ throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
}
- return expectationList;
}
@Override
- public void deleteExpectationListById(String intentId) {
- List<Expectation> expectationList = expectationMapper.selectExpectationByIntentId(intentId);
+ public List<Expectation> getIntentExpectationsByIntentId(String intentId) {
+ List<Expectation> expectationList = expectationMapper.selectIntentExpectationsByIntentId(intentId);
if (expectationList == null) {
String msg = String.format("Intent id %s doesn't exist in database.", intentId);
log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
}
- int res = expectationMapper.deleteExpectationByIntentId(intentId);
+ int res = expectationMapper.deleteIntentExpectationsByIntentId(intentId);
if (res < 1) {
String msg = "Delete expectation in database failed.";
log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_DELETE_DATA_FAIL);
}
- for (Expectation expectation : expectationList) {
- stateService.deleteStateListByExpectationId(expectation.getExpectationId());
- }
+ return expectationList;
}
@Override
- public void updateExpectationListById(List<Expectation> expectationList, String intentId) {
- List<Expectation> expectationDBList = expectationMapper.selectExpectationByIntentId(intentId);
+ public void updateIntentExpectationsByIntentId(List<Expectation> intentExpectations, String intentId) {
+ List<Expectation> expectationDBList = expectationMapper.selectIntentExpectationsByIntentId(intentId);
if (expectationDBList == null) {
String msg = String.format("Intent id %s doesn't exist in database.", intentId);
log.error(msg);
@@ -107,10 +122,9 @@ public class ExpectationServiceImpl implements ExpectationService {
expectationDBIdList.add(expectationDB.getExpectationId());
}
- for (Expectation expectation : expectationList) {
+ for (Expectation expectation : intentExpectations) {
if (expectationDBIdList.contains(expectation.getExpectationId())) {
- stateService.updateStateListByExpectationId(expectation.getStateList(), expectation.getExpectationId());
- int res = expectationMapper.updateExpectation(expectation);
+ int res = expectationMapper.updateIntentExpectation(expectation);
if (res < 1) {
String msg = "Update expectation in database failed.";
log.error(msg);
@@ -118,28 +132,34 @@ public class ExpectationServiceImpl implements ExpectationService {
}
expectationDBIdList.remove(expectation.getExpectationId());
} else {
- expectationService.insertExpectation(expectation, intentId);
+ expectationService.insertIntentExpectation(expectation, intentId);
}
}
for (String expectationDBId : expectationDBIdList) {
- expectationService.deleteExpectationById(expectationDBId);
+ expectationService.deleteIntentExpectationById(expectationDBId);
}
log.info("Expectations are successfully updated.");
}
@Override
- public void insertExpectation(Expectation expectation, String intentId) {
- int res = expectationMapper.insertExpectation(expectation, intentId);
+ public void deleteIntentExpectationById(String expectationId) {
+ int res = expectationMapper.deleteIntentExpectationById(expectationId);
if (res < 1) {
- String msg = "Create expectation to database failed.";
+ String msg = "Delete expectation in database failed.";
log.error(msg);
- throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
+ throw new DataBaseException(msg, ResponseConsts.RET_DELETE_DATA_FAIL);
}
}
@Override
- public void deleteExpectationById(String expectationId) {
- int res = expectationMapper.deleteExpectationById(expectationId);
+ public void deleteIntentExpectationsByIntentId(String intentId) {
+ List<Expectation> expectationList = expectationMapper.selectIntentExpectationsByIntentId(intentId);
+ if (expectationList == null) {
+ String msg = String.format("Intent id %s doesn't exist in database.", intentId);
+ log.error(msg);
+ throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
+ }
+ int res = expectationMapper.deleteIntentExpectationsByIntentId(intentId);
if (res < 1) {
String msg = "Delete expectation in database failed.";
log.error(msg);
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationTargetServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationTargetServiceImpl.java
new file mode 100644
index 0000000..f45ef30
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationTargetServiceImpl.java
@@ -0,0 +1,71 @@
+/*
+ * 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.impl;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.onap.usecaseui.intentanalysis.bean.enums.ContextParentType;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationTarget;
+import org.onap.usecaseui.intentanalysis.mapper.ExpectationTargetMapper;
+import org.onap.usecaseui.intentanalysis.service.ContextService;
+import org.onap.usecaseui.intentanalysis.service.ExpectationTargetService;
+import org.onap.usecaseui.intentanalysis.service.FulfilmentInfoService;
+
+
+@Service
+public class ExpectationTargetServiceImpl implements ExpectationTargetService {
+
+ private static Logger LOGGER = LoggerFactory.getLogger(ExpectationTargetServiceImpl.class);
+
+ private ContextParentType contextParentType;
+
+ @Autowired
+ private ExpectationTargetMapper expectationTargetMapper;
+
+ @Autowired
+ private ExpectationTargetService expectationTargetService;
+
+ @Autowired
+ private FulfilmentInfoService fulfilmentInfoService;
+
+ @Autowired
+ private ContextService contextService;
+
+ @Override
+ public void createTarget(ExpectationTarget expectationTarget, String expectationId) {
+ expectationTargetMapper.insertExpectationTarget(expectationTarget, expectationId);
+ contextService.createContextList(expectationTarget.getTargetContexts(),
+ contextParentType.EXPECTATION_TARGET,
+ expectationTarget.getTargetId());
+ fulfilmentInfoService.createFulfilmentInfo(expectationTarget.getTargetFulfilmentInfo(),
+ expectationTarget.getTargetId());
+ }
+
+ @Override
+ public void createTargets(List<ExpectationTarget> expectationTargets, String expectationId) {
+ for (ExpectationTarget expectationTarget : expectationTargets) {
+ if (null != expectationTarget) {
+ expectationTargetService.createTarget(expectationTarget, expectationId);
+ }
+ }
+ }
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/FulfilmentInfoServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/FulfilmentInfoServiceImpl.java
new file mode 100644
index 0000000..3f7947d
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/FulfilmentInfoServiceImpl.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.service.impl;
+
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.onap.usecaseui.intentanalysis.bean.models.FulfilmentInfo;
+import org.onap.usecaseui.intentanalysis.mapper.FulfilmentInfoMapper;
+import org.onap.usecaseui.intentanalysis.service.FulfilmentInfoService;
+
+
+@Service
+public class FulfilmentInfoServiceImpl implements FulfilmentInfoService {
+
+ private static Logger LOGGER = LoggerFactory.getLogger(FulfilmentInfoServiceImpl.class);
+
+ @Autowired
+ private FulfilmentInfoMapper fulfilmentInfoMapper;
+
+ @Autowired
+ private FulfilmentInfoService fulfilmentInfoService;
+
+ @Override
+ public void createFulfilmentInfo(FulfilmentInfo fulfilmentInfo, String parentId) {
+ fulfilmentInfoMapper.insertFulfilmentInfo(fulfilmentInfo, parentId);
+ }
+
+ @Override
+ public void deleteFulfilmentInfoByParentId(String parentId) {
+ }
+
+ @Override
+ public void updateFulfilmentInfoByParentId(FulfilmentInfo fulfilmentInfo, String parentId) {
+ }
+
+ @Override
+ public FulfilmentInfo getFulfilmentInfoByParentId(String parentId) {
+ return fulfilmentInfoMapper.selectFulfilmentInfoById(parentId);
+ }
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java
index 2564c2a..f4e49d8 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java
@@ -17,19 +17,22 @@
package org.onap.usecaseui.intentanalysis.service.impl;
+import java.util.ArrayList;
+import java.util.List;
import lombok.extern.slf4j.Slf4j;
-import org.onap.usecaseui.intentanalysis.bean.models.Intent;
-import org.onap.usecaseui.intentanalysis.mapper.IntentMapper;
-import org.onap.usecaseui.intentanalysis.service.ExpectationService;
-import org.onap.usecaseui.intentanalysis.service.IntentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import org.onap.usecaseui.intentanalysis.exception.DataBaseException;
+import org.onap.usecaseui.intentanalysis.bean.enums.ContextParentType;
+import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.common.ResponseConsts;
+import org.onap.usecaseui.intentanalysis.exception.DataBaseException;
+import org.onap.usecaseui.intentanalysis.mapper.IntentMapper;
+import org.onap.usecaseui.intentanalysis.service.ContextService;
+import org.onap.usecaseui.intentanalysis.service.ExpectationService;
+import org.onap.usecaseui.intentanalysis.service.FulfilmentInfoService;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
-import java.util.ArrayList;
-import java.util.List;
@Service
@Slf4j
@@ -41,6 +44,30 @@ public class IntentServiceImpl implements IntentService {
@Autowired
private ExpectationService expectationService;
+ @Autowired
+ private ContextService contextService;
+
+ private ContextParentType contextParentType;
+
+ @Autowired
+ private FulfilmentInfoService fulfilmentInfoService;
+
+ @Transactional(rollbackFor = RuntimeException.class)
+ @Override
+ public Intent createIntent(Intent intent) {
+ int res = intentMapper.insertIntent(intent);
+ if (res < 1) {
+ String msg = "Create intent to database failed.";
+ log.error(msg);
+ throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
+ }
+ expectationService.createIntentExpectations(intent.getIntentExpectations(), intent.getIntentId());
+ contextService.createContextList(intent.getIntentContexts(), contextParentType.INTENT, intent.getIntentId());
+ fulfilmentInfoService.createFulfilmentInfo(intent.getIntentFulfilmentInfo(), intent.getIntentId());
+ log.debug("Intent was successfully created.");
+ return intent;
+ }
+
@Override
public List<Intent> getIntentList() {
List<Intent> intentList = intentMapper.selectIntents();
@@ -50,7 +77,7 @@ public class IntentServiceImpl implements IntentService {
throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
}
for (Intent intent : intentList) {
- intent.setExpectationList(expectationService.getExpectationListByIntentId(intent.getIntentId()));
+ intent.setIntentExpectations(expectationService.getIntentExpectationsByIntentId(intent.getIntentId()));
}
return intentList;
}
@@ -59,7 +86,7 @@ public class IntentServiceImpl implements IntentService {
public Intent getIntentById(String intentId) {
Intent intent = intentMapper.selectIntentById(intentId);
if (intent != null) {
- intent.setExpectationList(expectationService.getExpectationListByIntentId(intent.getIntentId()));
+ intent.setIntentExpectations(expectationService.getIntentExpectationsByIntentId(intent.getIntentId()));
return intent;
} else {
String msg = String.format("Intent id %s doesn't exist in database.", intentId);
@@ -68,21 +95,6 @@ public class IntentServiceImpl implements IntentService {
}
}
- @Transactional(rollbackFor = RuntimeException.class)
- @Override
- public Intent createIntent(Intent intent) {
- int res = intentMapper.insertIntent(intent);
- if (res < 1) {
- String msg = "Create intent to database failed.";
- log.error(msg);
- throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
- }
- // saving expectation list into expectation table
- expectationService.createExpectationList(intent.getExpectationList(), intent.getIntentId());
- log.debug("Intent was successfully created.");
- return intent;
- }
-
@Override
public Intent updateIntent(Intent intent) {
Intent intentDB = intentMapper.selectIntentById(intent.getIntentId());
@@ -91,7 +103,7 @@ public class IntentServiceImpl implements IntentService {
log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
}
- expectationService.updateExpectationListById(intent.getExpectationList(), intent.getIntentId());
+ expectationService.updateIntentExpectationsByIntentId(intent.getIntentExpectations(), intent.getIntentId());
int res = intentMapper.updateIntent(intent);
if (res < 1) {
String msg = "Update intent in database failed.";
@@ -110,7 +122,7 @@ public class IntentServiceImpl implements IntentService {
log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_DELETE_DATA_FAIL);
}
- expectationService.deleteExpectationListById(intentId);
+ expectationService.deleteIntentExpectationsByIntentId(intentId);
log.debug("Intent has been deleted successfully.");
}
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/StateServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/StateServiceImpl.java
index 5a748d9..11b31a5 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/StateServiceImpl.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/StateServiceImpl.java
@@ -23,11 +23,11 @@ import org.onap.usecaseui.intentanalysis.common.ResponseConsts;
import org.onap.usecaseui.intentanalysis.exception.DataBaseException;
import org.onap.usecaseui.intentanalysis.mapper.StateMapper;
import org.onap.usecaseui.intentanalysis.service.StateService;
+import java.util.ArrayList;
+import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.ArrayList;
-import java.util.List;
@Service
@Slf4j
diff --git a/intentanalysis/src/main/resources/application.yaml b/intentanalysis/src/main/resources/application.yaml
index 22f59a5..39b8e02 100644
--- a/intentanalysis/src/main/resources/application.yaml
+++ b/intentanalysis/src/main/resources/application.yaml
@@ -8,9 +8,7 @@ spring:
username: ${POSTGRES_USERNAME}
password: ${POSTGRES_PASSWORD}
driver-class-name: org.postgresql.Driver
- schema: classpath:intent-analysis-init.sql
- initialization-mode: always
mybatis:
configuration:
database-id: PostgreSQL
- mapper-locations: classpath*:mybatis/sql/*.xml \ No newline at end of file
+ mapper-locations: classpath*:mybatis/sql/*.xml
diff --git a/intentanalysis/src/main/resources/intent-analysis-init.sql b/intentanalysis/src/main/resources/intent-analysis-init.sql
index 64074fa..3e34576 100644
--- a/intentanalysis/src/main/resources/intent-analysis-init.sql
+++ b/intentanalysis/src/main/resources/intent-analysis-init.sql
@@ -6,10 +6,43 @@ create table if not exists intent(
create table if not exists expectation(
expectation_id varchar(255) primary key,
expectation_name varchar(255),
- target_moi varchar(255),
+ expectation_type varchar(255),
intent_id varchar(255)
);
+create table if not exists expectation_object(
+ expectation_id varchar(255) primary key,
+ object_type varchar(255),
+ object_instance varchar(255)
+);
+
+create table if not exists expectation_target(
+ target_id varchar(255) primary key,
+ target_name varchar(255),
+ target_condition varchar(255),
+ expectation_id varchar(255)
+);
+
+create table if not exists context(
+ context_id varchar(255) primary key,
+ context_name varchar(255),
+ context_type varchar(255),
+ context_condition varchar(255)
+);
+
+create table if not exists context_mapping(
+ context_id varchar(255) primary key,
+ parent_type varchar(255),
+ parent_id varchar(255)
+);
+
+create table if not exists fulfilment_info(
+ fulfilment_info_id varchar(255) primary key,
+ fulfilment_info_status varchar(255),
+ not_fulfilled_state varchar(255),
+ not_fulfilled_reason varchar(255)
+);
+
create table if not exists state(
state_id varchar(255) primary key,
state_name varchar(255),
@@ -17,4 +50,3 @@ create table if not exists state(
condition varchar(255),
expectation_id varchar(255)
);
-
diff --git a/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml
new file mode 100644
index 0000000..450721d
--- /dev/null
+++ b/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.onap.usecaseui.intentanalysis.mapper.ContextMapper">
+
+
+ <insert id="insertContextList">
+ insert into context(context_id, context_name, context_type, context_condition)
+ values
+ <foreach collection="contextList" index="index" item="item" separator=",">
+ (#{item.contextId}, #{item.contextName}, #{item.contextType}, #{item.contextCondition})
+ </foreach>
+ </insert>
+
+ <insert id="insertContextParentList">
+ insert into context_mapping(context_id, parent_type, parent_id)
+ values
+ <foreach collection="contextList" index="index" item="item" separator=",">
+ (#{item.contextId}, #{parentType}, #{parentId})
+ </foreach>
+ </insert>
+
+ <select id="selectContextByParentId" resultType="org.onap.usecaseui.intentanalysis.bean.models.Context">
+ select context_id contextId, context_name contextName, context_type contextType, context_condition contextCondition
+ from context
+ where intent_id = #{parentId}
+ </select>
+
+</mapper>
diff --git a/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml
index 3b0923f..98aa3dd 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml
@@ -5,27 +5,27 @@
<mapper namespace="org.onap.usecaseui.intentanalysis.mapper.ExpectationMapper">
- <select id="selectExpectationByIntentId" resultType="org.onap.usecaseui.intentanalysis.bean.models.Expectation">
- select expectation_id expectationId, expectation_name expectationName,
- target_moi targetMOI, intent_id intentId
- from expectation
- where intent_id = #{intentId}
- </select>
-
- <insert id="insertExpectationList">
- insert into expectation(expectation_id, expectation_name, target_moi, intent_id)
+ <insert id="insertIntentExpectations">
+ insert into expectation(expectation_id, expectation_name, expectation_type, intent_id)
values
- <foreach collection="expectationList" index="index" item="item" separator=",">
- (#{item.expectationId}, #{item.expectationName}, #{item.targetMOI}, #{intentId})
+ <foreach collection="intentExpectations" index="index" item="item" separator=",">
+ (#{item.expectationId}, #{item.expectationName}, #{item.expectationType}, #{intentId})
</foreach>
</insert>
- <delete id="deleteExpectationByIntentId">
- delete from expectation
+ <insert id="insertIntentExpectation">
+ insert into expectation(expectation_id, expectation_name, expectation_type, intent_id)
+ values (#{expectation.expectationId}, #{expectation.expectationName}, #{expectation.expectationType}, #{intentId})
+ </insert>
+
+ <select id="selectIntentExpectationsByIntentId" resultType="org.onap.usecaseui.intentanalysis.bean.models.Expectation">
+ select expectation_id expectationId, expectation_name expectationName,
+ target_moi targetMOI, intent_id intentId
+ from expectation
where intent_id = #{intentId}
- </delete>
+ </select>
- <update id="updateExpectation">
+ <update id="updateIntentExpectation">
update expectation
<trim prefix="set" suffixOverrides=",">
<if test="expectationName != null">expectation_name = #{expectationName},</if>
@@ -34,15 +34,15 @@
where expectation_id = #{expectationId}
</update>
- <insert id="insertExpectation">
- insert into expectation(expectation_id, expectation_name, target_moi, intent_id)
- values (#{expectation.expectationId}, #{expectation.expectationName}, #{expectation.targetMOI}, #{intentId})
- </insert>
+ <delete id="deleteIntentExpectationsByIntentId">
+ delete from expectation
+ where intent_id = #{intentId}
+ </delete>
- <delete id="deleteExpectationById">
+ <delete id="deleteIntentExpectationById">
delete
from expectation
where expectation_id = #{expectationId}
</delete>
-</mapper> \ No newline at end of file
+</mapper>
diff --git a/intentanalysis/src/main/resources/mybatis/sql/ExpectationObjectMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ExpectationObjectMapper.xml
new file mode 100644
index 0000000..d67b9bf
--- /dev/null
+++ b/intentanalysis/src/main/resources/mybatis/sql/ExpectationObjectMapper.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.onap.usecaseui.intentanalysis.mapper.ExpectationObjectMapper">
+
+
+ <insert id="insertExpectationObject">
+ insert into expectation_object(expectation_id, object_type, object_instance)
+ values
+ (#{expectationId}, #{expectationObject.objectType}, #{expectationObject.objectInstance})
+ </insert>
+
+</mapper>
diff --git a/intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml
new file mode 100644
index 0000000..0a915bf
--- /dev/null
+++ b/intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.onap.usecaseui.intentanalysis.mapper.ExpectationTargetMapper">
+
+
+ <insert id="insertExpectationTarget">
+ insert into expectation_target(target_id, target_name, target_condition, expectation_id)
+ values
+ (#{expectationTarget.targetId}, #{expectationTarget.targetName}, #{expectationTarget.targetCondition}, #{expectationId})
+ </insert>
+
+</mapper>
diff --git a/intentanalysis/src/main/resources/mybatis/sql/FulfilmentInfoMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/FulfilmentInfoMapper.xml
new file mode 100644
index 0000000..e5a9668
--- /dev/null
+++ b/intentanalysis/src/main/resources/mybatis/sql/FulfilmentInfoMapper.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.onap.usecaseui.intentanalysis.mapper.FulfilmentInfoMapper">
+
+
+ <insert id="insertFulfilmentInfo">
+ insert into fulfilment_info(fulfilment_info_id, fulfilment_info_status, not_fulfilled_state, not_fulfilled_reason)
+ values (#{parentId}, #{fulfilmentInfo.fulfilmentStatus}, #{fulfilmentInfo.notFulfilledState}, #{fulfilmentInfo.notFulfilledReason})
+ </insert>
+
+ <select id="selectFulfilmentInfoById" resultType="org.onap.usecaseui.intentanalysis.bean.models.FulfilmentInfo">
+ select fulfilment_info_status fulfilmentStatus, not_fulfilled_state notFulfilledState,
+ not_fulfilled_reason notFulfilledReason from fulfilment_info
+ where parent_id = #{parentId}
+ </select>
+
+</mapper>