summaryrefslogtreecommitdiffstats
path: root/cps-ri
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2023-06-30 12:14:07 +0100
committerdanielhanrahan <daniel.hanrahan@est.tech>2023-07-11 11:48:28 +0100
commit9cfc03f3af00d0128a5b22e32cc5ba439de627b6 (patch)
tree591da6d42a571882219e6df207e5ad3cd1167566 /cps-ri
parent0ed77bfc78fbb1f33fe6708234759dab2413e0f7 (diff)
Combine alreadyDefinedException classes
Issue-ID: CPS-1774 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I52ff9074a9f8188e8635a811b0d2713a97cb4b10
Diffstat (limited to 'cps-ri')
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java
index 7fed534b7..f4afe3d73 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java
@@ -52,7 +52,6 @@ import org.onap.cps.spi.entities.AnchorEntity;
import org.onap.cps.spi.entities.DataspaceEntity;
import org.onap.cps.spi.entities.FragmentEntity;
import org.onap.cps.spi.exceptions.AlreadyDefinedException;
-import org.onap.cps.spi.exceptions.AlreadyDefinedExceptionBatch;
import org.onap.cps.spi.exceptions.ConcurrencyException;
import org.onap.cps.spi.exceptions.CpsAdminException;
import org.onap.cps.spi.exceptions.CpsPathException;
@@ -105,12 +104,12 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService
for (final Collection<DataNode> newList : newLists) {
try {
addChildrenDataNodes(anchorEntity, parentNodeXpath, newList);
- } catch (final AlreadyDefinedExceptionBatch e) {
- failedXpaths.addAll(e.getAlreadyDefinedXpaths());
+ } catch (final AlreadyDefinedException alreadyDefinedException) {
+ failedXpaths.addAll(alreadyDefinedException.getAlreadyDefinedObjectNames());
}
}
if (!failedXpaths.isEmpty()) {
- throw new AlreadyDefinedExceptionBatch(failedXpaths);
+ throw AlreadyDefinedException.forDataNodes(failedXpaths, anchorEntity.getName());
}
}
@@ -122,7 +121,8 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService
try {
fragmentRepository.save(newChildAsFragmentEntity);
} catch (final DataIntegrityViolationException e) {
- throw AlreadyDefinedException.forDataNode(newChild.getXpath(), anchorEntity.getName(), e);
+ throw AlreadyDefinedException.forDataNodes(Collections.singletonList(newChild.getXpath()),
+ anchorEntity.getName());
}
}
@@ -156,7 +156,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService
}
}
if (!failedXpaths.isEmpty()) {
- throw new AlreadyDefinedExceptionBatch(failedXpaths);
+ throw AlreadyDefinedException.forDataNodes(failedXpaths, anchorEntity.getName());
}
}
@@ -189,7 +189,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService
}
}
if (!failedXpaths.isEmpty()) {
- throw new AlreadyDefinedExceptionBatch(failedXpaths);
+ throw AlreadyDefinedException.forDataNodes(failedXpaths, anchorEntity.getName());
}
}