Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Mar 21, 2023
2 parents f62206c + 0b26e13 commit 6d9b2d2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.evolveum.midpoint.schema.processor.*;
import com.evolveum.midpoint.util.DisplayableValue;
import com.evolveum.midpoint.util.QNameUtil;
import com.evolveum.midpoint.web.util.ExpressionUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import com.evolveum.prism.xml.ns._public.types_3.ItemPathType;
Expand Down Expand Up @@ -251,7 +252,15 @@ private static <T> void cleanupEmptyValues(Item item) {
Iterator<PrismPropertyValue<T>> iterator = pVals.iterator();
while (iterator.hasNext()) {
PrismPropertyValue<T> pVal = iterator.next();
if (pVal == null || pVal.isEmpty() || pVal.getRealValue() == null) {
if (pVal == null) {
iterator.remove();
continue;
}
if (pVal.getRealValue() instanceof ExpressionType && ExpressionUtil.isEmpty((ExpressionType)pVal.getRealValue())) {
iterator.remove();
continue;
}
if (pVal.isEmpty() || pVal.getRealValue() == null) {
iterator.remove();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@

import javax.xml.namespace.QName;

import com.evolveum.midpoint.prism.ItemDefinition;
import com.evolveum.midpoint.prism.PrismValue;
import com.evolveum.midpoint.prism.delta.ItemDelta;
import com.evolveum.midpoint.util.exception.SchemaException;

import com.evolveum.midpoint.web.util.ExpressionUtil;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand All @@ -16,6 +23,8 @@
import com.evolveum.midpoint.prism.PrismProperty;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import java.util.Collection;

/**
* Created by honchar
*/
Expand Down Expand Up @@ -133,4 +142,12 @@ public Integer getDisplayOrder() {
public @NotNull QName getTypeName() {
return CUSTOM_Q_NAME;
}

@Override
protected <D extends ItemDelta<? extends PrismValue, ? extends ItemDefinition>> void addValueToDelta(
PrismPropertyValueWrapper<ExpressionType> value, D delta) throws SchemaException {
if (!ExpressionUtil.isEmpty(value.getRealValue())) {
super.addValueToDelta(value, delta);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public ItemWrapperImpl(PrismContainerValueWrapper<?> parent, I item, ItemStatus
}

for (VW value : values) {
value.addToDelta(delta);
addValueToDelta(value, delta);
}

if (delta.isEmpty()) {
Expand All @@ -116,6 +116,11 @@ public ItemWrapperImpl(PrismContainerValueWrapper<?> parent, I item, ItemStatus
return MiscUtil.createCollection(delta);
}

protected <D extends ItemDelta<? extends PrismValue, ? extends ItemDefinition>> void addValueToDelta(VW value, D delta)
throws SchemaException {
value.addToDelta(delta);
}

@Override
public String getDisplayName() {
if (displayName == null) {
Expand Down

0 comments on commit 6d9b2d2

Please sign in to comment.