diff options
Diffstat (limited to 'intentanalysis/src/main/java/org/onap')
2 files changed, 6 insertions, 1 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) { |