Skip to content

Commit

Permalink
default relations icons
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Apr 23, 2019
1 parent 8687be8 commit bfdb19f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
Expand Up @@ -193,6 +193,7 @@ public class GuiStyleConstants {
public static final String EVO_UNEMPLOYER_ICON = "fe fe-unemployer-icon";
public static final String EVO_EMPLOYER_ICON = "fe fe-employer-icon";
public static final String EVO_APPROVER_ICON = "fe fe-approver-object";
public static final String EVO_MANAGER_ICON = "fe fe-manager-tie-object";
public static final String EVO_MP_SHORTER_LINES = "fe fe-midpoint-shorter-lines";
public static final String EVO_MP_WHEEL_ICON = "fe fe-midpoint-wheel";
public static final String EVO_MP_WITH_LINES_ICON = "fe fe-midpoint-with-lines";
Expand Down
Expand Up @@ -34,23 +34,25 @@
*/
public enum RelationTypes {

MEMBER(SchemaConstants.ORG_DEFAULT, "", RelationKindType.MEMBER, null, ADMINISTRATION, ORGANIZATION, SELF_SERVICE),
MANAGER(SchemaConstants.ORG_MANAGER, "Manager", RelationKindType.MANAGER, singletonList(RelationKindType.MEMBER), ADMINISTRATION, GOVERNANCE, ORGANIZATION, SELF_SERVICE),
META(SchemaConstants.ORG_META, "Meta", RelationKindType.META, null, POLICY),
DEPUTY(SchemaConstants.ORG_DEPUTY, "Deputy", RelationKindType.DELEGATION, null /* no values */),
APPROVER(SchemaConstants.ORG_APPROVER, "Approver", RelationKindType.APPROVER, null, ADMINISTRATION, GOVERNANCE, ORGANIZATION, SELF_SERVICE),
OWNER(SchemaConstants.ORG_OWNER, "Owner", RelationKindType.OWNER, null, ADMINISTRATION, GOVERNANCE, ORGANIZATION, SELF_SERVICE),
CONSENT(SchemaConstants.ORG_CONSENT, "Consent", RelationKindType.CONSENT, null, DATA_PROTECTION);
MEMBER(SchemaConstants.ORG_DEFAULT, "", "", RelationKindType.MEMBER, null, ADMINISTRATION, ORGANIZATION, SELF_SERVICE),
MANAGER(SchemaConstants.ORG_MANAGER, "Manager", "fe fe-manager-tie-object", RelationKindType.MANAGER, singletonList(RelationKindType.MEMBER), ADMINISTRATION, GOVERNANCE, ORGANIZATION, SELF_SERVICE),
META(SchemaConstants.ORG_META, "Meta", "", RelationKindType.META, null, POLICY),
DEPUTY(SchemaConstants.ORG_DEPUTY, "Deputy", "", RelationKindType.DELEGATION, null /* no values */),
APPROVER(SchemaConstants.ORG_APPROVER, "Approver", "fe fe-approver-object", RelationKindType.APPROVER, null, ADMINISTRATION, GOVERNANCE, ORGANIZATION, SELF_SERVICE),
OWNER(SchemaConstants.ORG_OWNER, "Owner", "fe fe-crown-object", RelationKindType.OWNER, null, ADMINISTRATION, GOVERNANCE, ORGANIZATION, SELF_SERVICE),
CONSENT(SchemaConstants.ORG_CONSENT, "Consent", "", RelationKindType.CONSENT, null, DATA_PROTECTION);

private final QName relation;
private final String headerLabel;
private final RelationKindType defaultFor;
@NotNull private final Collection<RelationKindType> kinds;
private final AreaCategoryType[] categories;
private final String defaultIconStyle;

RelationTypes(QName relation, String headerLabel, RelationKindType defaultFor, Collection<RelationKindType> additionalKinds, AreaCategoryType... categories) {
RelationTypes(QName relation, String headerLabel, String defaultIconStyle, RelationKindType defaultFor, Collection<RelationKindType> additionalKinds, AreaCategoryType... categories) {
this.relation = relation;
this.headerLabel = headerLabel;
this.defaultIconStyle = defaultIconStyle;
this.kinds = new ArrayList<>();
if (defaultFor != null) {
kinds.add(defaultFor);
Expand Down Expand Up @@ -86,4 +88,8 @@ public Collection<RelationKindType> getKinds() {
public AreaCategoryType[] getCategories() {
return categories;
}

public String getDefaultIconStyle() {
return defaultIconStyle;
}
}
Expand Up @@ -26,6 +26,7 @@
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;

import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -105,6 +106,11 @@ static RelationDefinitionType createRelationDefinitionFromStaticDefinition(Relat
relationDef.setRef(defaultRelationDefinition.getRelation());
DisplayType display = new DisplayType();
display.setLabel(new PolyStringType(defaultRelationDefinition.getLabelKey()));
if (StringUtils.isNotEmpty(defaultRelationDefinition.getDefaultIconStyle())){
IconType icon = new IconType();
icon.setCssClass(defaultRelationDefinition.getDefaultIconStyle());
display.setIcon(icon);
}
relationDef.setDisplay(display);
relationDef.setDefaultFor(defaultRelationDefinition.getDefaultFor());
relationDef.getKind().addAll(defaultRelationDefinition.getKinds());
Expand Down

0 comments on commit bfdb19f

Please sign in to comment.