Skip to content

Commit

Permalink
#255 added some preconditions
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos-lg committed Nov 27, 2020
1 parent 156065c commit b495e80
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,12 @@ public void merge(UUID entityToReplaceKey, UUID replacementKey, String user) {
T entityToReplace = baseMapper.get(entityToReplaceKey);
checkArgument(
entityToReplace != null, "Not found entity to replace with key " + entityToReplaceKey);
checkArgument(entityToReplace.getDeleted() == null, "Cannot merge a deleted entity");

T replacement = baseMapper.get(replacementKey);
checkArgument(replacement != null, "Not found replacement entity with key " + replacementKey);
checkArgument(
replacement.getDeleted() == null, "Cannot merge an entity with a deleted replacement");

// check IH_IRN identifiers. If both entities have them we don't allow to do the replacement
// because we wouldn't know how to sync them with IH: if we move it to the replacement this
Expand Down

0 comments on commit b495e80

Please sign in to comment.