Skip to content

Commit

Permalink
fix for assign member to org (MID-7295)
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Oct 8, 2021
1 parent a2a8e58 commit 87d741c
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import java.util.List;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.prism.PrismConstants;
import com.evolveum.midpoint.util.QNameUtil;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.panel.Fragment;
Expand Down Expand Up @@ -80,7 +83,21 @@ public boolean isEnabled() {
});
parametersPanel.add(relationContainer);

relationContainer.add(new RelationDropDownChoicePanel(ID_RELATION, relationConfig.getDefaultValue(), relationConfig.getSupportedRelations(), false));
relationContainer.add(new RelationDropDownChoicePanel(
ID_RELATION, getDefaultRelation(), relationConfig.getSupportedRelations(), false));
}

private QName getDefaultRelation() {
QName relation = relationConfig.getDefaultValue();
if (QNameUtil.match(relation, PrismConstants.Q_ANY)) {
QName defRelation = WebComponentUtil.getDefaultRelation();
if (relationConfig.getSupportedRelations().contains(defRelation)) {
relation = defRelation;
} else {
relation = relationConfig.getSupportedRelations().iterator().next();
}
}
return relation;
}

protected ObjectDelta prepareDelta() {
Expand Down

0 comments on commit 87d741c

Please sign in to comment.