Skip to content

Commit

Permalink
fix for translating of relation in generated buttons tooltip (MID-6710)
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Nov 13, 2020
1 parent 66442f0 commit abba82d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Expand Up @@ -3717,13 +3717,14 @@ public static DisplayType getAssignmentObjectRelationDisplayType(PageBase pageBa
displayType.getIcon().setCssClass(def.getDisplay().getIcon().getCssClass());
displayType.getIcon().setColor(def.getDisplay().getIcon().getColor());
}
displayType.setLabel(def.getDisplay().getLabel());
}
if (displayType.getLabel() != null && StringUtils.isNotEmpty(displayType.getLabel().getOrig())){
relationValue = pageBase.createStringResource(displayType.getLabel().getOrig()).getString();
if (displayType.getLabel() != null) {
relationValue = getTranslatedPolyString(displayType.getLabel());
} else {
String relationKey = "RelationTypes." + RelationTypes.getRelationTypeByRelationValue(relation);
relationValue = pageBase.createStringResource(relationValue).getString();
if (StringUtils.isEmpty(relationValue) || relationKey.equals(relationValue)){
relationValue = pageBase.createStringResource(relationKey).getString();
if (StringUtils.isEmpty(relationValue) || relationKey.equals(relationValue)) {
relationValue = relation.getLocalPart();
}
}
Expand Down
Expand Up @@ -93,7 +93,7 @@ public String getDefaultIconColor() {

public static RelationTypes getRelationTypeByRelationValue(QName relation){
for (RelationTypes relationType : values()) {
if (relationType.getRelation().equals(relation)) {
if (QNameUtil.match(relationType.getRelation(), relation)) {
return relationType;
}
}
Expand Down
Expand Up @@ -11,9 +11,11 @@
import com.evolveum.midpoint.schema.RelationRegistry;
import com.evolveum.midpoint.schema.constants.RelationTypes;
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
import com.evolveum.midpoint.util.QNameUtil;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import com.evolveum.prism.xml.ns._public.types_3.PolyStringTranslationType;
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;

import org.apache.commons.lang.BooleanUtils;
Expand Down Expand Up @@ -96,7 +98,11 @@ static RelationDefinitionType createRelationDefinitionFromStaticDefinition(Relat
RelationDefinitionType relationDef = new RelationDefinitionType();
relationDef.setRef(defaultRelationDefinition.getRelation());
DisplayType display = new DisplayType();
display.setLabel(new PolyStringType(defaultRelationDefinition.getLabelKey()));
PolyStringType label = new PolyStringType(QNameUtil.getLocalPart(defaultRelationDefinition.getRelation()));
PolyStringTranslationType translation = new PolyStringTranslationType();
translation.setKey(defaultRelationDefinition.getLabelKey());
label.setTranslation(translation);
display.setLabel(label);
if (StringUtils.isNotEmpty(defaultRelationDefinition.getDefaultIconStyle())){
IconType icon = new IconType();
icon.setCssClass(defaultRelationDefinition.getDefaultIconStyle());
Expand Down

0 comments on commit abba82d

Please sign in to comment.