Skip to content

Commit

Permalink
RW: fix for duplicated empty field for source attribute of mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Nov 21, 2023
1 parent 3b3b706 commit 41ce3c5
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,22 @@ public void setObject(Collection<VariableBindingDefinitionType> newValues) {
}
});

List<PrismPropertyValueWrapper<VariableBindingDefinitionType>> undeletedValues = sourceItem.getValues().stream()
.filter(value -> value.getStatus() != ValueStatus.DELETED)
.collect(Collectors.toList());
if (undeletedValues.stream().filter(value -> value.getRealValue() != null).count() > 0) {
sourceItem.getValues().removeIf(value -> value.getRealValue() == null);
} else if (undeletedValues.isEmpty()) {
try {
PrismPropertyValue<VariableBindingDefinitionType> newPrismValue
= getPrismContext().itemFactory().createPropertyValue();
newPrismValue.setValue(null);
sourceItem.add(newPrismValue, getPageBase());
} catch (SchemaException e) {
LOGGER.error("Couldn't initialize new null value for Source item", e);
}
}

}
};

Expand Down

0 comments on commit 41ce3c5

Please sign in to comment.