summaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/resources
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/resources
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/resources')
-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
7 files changed, 133 insertions, 26 deletions
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>