aboutsummaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationObjectServiceImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationObjectServiceImpl.java')
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationObjectServiceImpl.java5
1 files changed, 5 insertions, 0 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) {