Skip to content

Commit

Permalink
adding getDeletedValuesFor() helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-lizner committed Mar 16, 2017
1 parent 2c4629a commit d559855
Showing 1 changed file with 20 additions and 0 deletions.
Expand Up @@ -1688,4 +1688,24 @@ public List<PrismValue> getNewValuesFor(ItemPath itemPath) {
}
}
}

public List<PrismValue> getDeletedValuesFor(ItemPath itemPath) {
if (isAdd()) {
Item<PrismValue, ItemDefinition> item = objectToAdd.findItem(itemPath);
return item != null ? item.getValues() : Collections.emptyList();
} else if (isDelete()) {
return Collections.emptyList();
} else {
ItemDelta itemDelta = ItemDelta.findItemDelta(modifications, itemPath, ItemDelta.class);
if (itemDelta != null) {
if (itemDelta.getValuesToDelete() != null) {
return (List<PrismValue>) itemDelta.getValuesToDelete();
} else {
return Collections.emptyList();
}
} else {
return Collections.emptyList();
}
}
}
}

0 comments on commit d559855

Please sign in to comment.