summaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'intentanalysis/src/main')
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationObjectServiceImpl.java5
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationTargetServiceImpl.java2
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml8
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml6
4 files changed, 14 insertions, 7 deletions
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
index d3bfd34..2e7db09 100644
--- 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
@@ -51,6 +51,11 @@ public class ExpectationObjectServiceImpl implements ExpectationObjectService {
@Override
public void createExpectationObject(ExpectationObject expectationObject, String expectationId) {
+ if (expectationObjectService.getExpectationObject(expectationId) != null) {
+ String msg = String.format("It already exists an object for the expectation %s, update might work.", expectationId);
+ log.error(msg);
+ throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
+ }
contextService.createContextList(expectationObject.getObjectContexts(),
expectationObjectMapper.selectExpectationObjectId(expectationId));
if (expectationObjectMapper.insertExpectationObject(expectationObject, expectationId) < 1) {
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
index ebf430d..1dff5a7 100644
--- 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
@@ -151,7 +151,7 @@ public class ExpectationTargetServiceImpl implements ExpectationTargetService {
}
expectationTargetIdListFromDB.remove(expectationTargetId);
} else {
- expectationTargetService.createExpectationTarget(expectationTarget, expectationTargetId);
+ expectationTargetService.createExpectationTarget(expectationTarget, expectationId);
}
}
for (String expectationTargetIdFromDB : expectationTargetIdListFromDB) {
diff --git a/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml
index ff04551..6eb44e3 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml
@@ -40,10 +40,14 @@
</update>
<delete id="deleteContext">
- DELETE FROM context WHERE context_id = #{context.contextId}
+ DELETE
+ FROM context
+ WHERE context_id = #{contextId}
</delete>
<delete id="deleteContextList">
- DELETE FROM context WHERE parent_id = #{parentId}
+ DELETE
+ FROM context
+ WHERE parent_id = #{parentId}
</delete>
</mapper>
diff --git a/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml
index 16c7850..e6a3b26 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml
@@ -21,15 +21,13 @@
</insert>
<select id="selectIntentExpectationList" resultType="org.onap.usecaseui.intentanalysis.bean.models.Expectation">
- select expectation_id expectationId, expectation_name expectationName, expectation_type expectationType,
- intent_id intentId
+ select expectation_id expectationId, expectation_name expectationName, expectation_type expectationType
from expectation
where intent_id = #{intentId}
</select>
<select id="selectIntentExpectation" resultType="org.onap.usecaseui.intentanalysis.bean.models.Expectation">
- select expectation_id expectationId, expectation_name expectationName, expectation_type expectationType,
- intent_id intentId
+ select expectation_id expectationId, expectation_name expectationName, expectation_type expectationType
from expectation
where expectation_id = #{expectationId}
</select>