Skip to content

Commit

Permalink
fix for MID-5146 - delete jpegPhoto inbound
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Oct 17, 2019
1 parent a44604c commit 9376c1d
Showing 1 changed file with 15 additions and 1 deletion.
Expand Up @@ -235,12 +235,13 @@ private void handlePhoto(Object bean, ItemDelta delta) throws SchemaException {
RFocus<?> focus = (RFocus<?>) bean;
Set<RFocusPhoto> photos = focus.getJpegPhoto();

if (delta.isDelete()) {
if (isDelete(delta)) {
photos.clear();
return;
}

MapperContext context = new MapperContext();

context.setRepositoryContext(new RepositoryContext(repositoryService, prismContext, relationRegistry, extItemDictionary,
baseHelper.getConfiguration()));
context.setDelta(delta);
Expand Down Expand Up @@ -269,6 +270,19 @@ private void handlePhoto(Object bean, ItemDelta delta) throws SchemaException {
oldPhoto.setPhoto(photo.getPhoto());
}

private boolean isDelete(ItemDelta delta) {
if (delta.isDelete()) {
return true;
}

if (delta.isReplace()) {
if (delta.getAnyValue() == null) {
return true;
}
}

return false;
}
@SuppressWarnings("Duplicates")
private void handleWholeMetadata(Metadata<?> bean, ItemDelta delta) {
PrismValue value = null;
Expand Down

0 comments on commit 9376c1d

Please sign in to comment.