Skip to content

Commit

Permalink
MID-8889: fix for using shadow name for shadow description handler (n…
Browse files Browse the repository at this point in the history
…ame of delta view panel)
  • Loading branch information
skublik committed Sep 27, 2023
1 parent 628cd21 commit 961e8dd
Showing 1 changed file with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;

import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

Expand All @@ -44,9 +47,23 @@ public void apply(VisualizationImpl visualization, VisualizationImpl parentVisua

ShadowKindType kind = shadow.getKind() != null ? shadow.getKind() : ShadowKindType.UNKNOWN;

ResourceAttribute<?> namingAttribute = ShadowUtil.getNamingAttribute(shadow);
Object realName = namingAttribute != null ? namingAttribute.getRealValue() : null;
String name = realName != null ? realName.toString() : "ShadowDescriptionHandler.noName";
String name = null;

PolyStringType nameBean = shadow.getName();
if (nameBean != null) {
if (nameBean.getTranslation() != null && StringUtils.isNotEmpty(nameBean.getTranslation().getKey())) {
name = nameBean.getTranslation().getKey();
} else if (StringUtils.isNotEmpty(nameBean.getOrig())) {
name = nameBean.getOrig();
}
}

if (StringUtils.isEmpty(name)) {
ResourceAttribute<?> namingAttribute = ShadowUtil.getNamingAttribute(shadow);
Object realName = namingAttribute != null ? namingAttribute.getRealValue() : null;
name = realName != null ? realName.toString() : "ShadowDescriptionHandler.noName";
}

ChangeType change = visualization.getChangeType();

String intent = shadow.getIntent() != null ? "(" + shadow.getIntent() + ")" : "";
Expand Down

0 comments on commit 961e8dd

Please sign in to comment.