Skip to content

Commit

Permalink
MID-7976 refactoring a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Aug 11, 2022
1 parent 19c0523 commit 87a6347
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ public void onClick(AjaxRequestTarget target) {
() -> StringUtils.isNotEmpty(getModelObject().getIconCss()) ? getModelObject().getIconCss() : "far fa-fw fa-circle"));
link.add(icon);

Label label = new Label(ID_LABEL, () -> getModelObject().getLabel());
Label label = new Label(ID_LABEL, () -> {
String key = getModelObject().getLabel();
return getString(key, null, key);
});
link.add(label);

Label badge = new Label(ID_BADGE, () -> getModelObject().getBadge());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright (c) 2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.gui.impl.page.self.requestAccess;

import javax.xml.namespace.QName;

import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.util.QNameUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

/**
* Created by Viliam Repan (lazyman).
*/
public enum StaticObjectCollection {

ALL_ROLES(SchemaConstants.OBJECT_COLLECTION_ALL_ROLES_QNAME, RoleType.class),

ALL_SERVICES(SchemaConstants.OBJECT_COLLECTION_ALL_SERVICES_QNAME, ServiceType.class),

ALL_ORGS(SchemaConstants.OBJECT_COLLECTION_ALL_ORGS_QNAME, OrgType.class),

ALL_USERS(SchemaConstants.OBJECT_COLLECTION_USER_ASSIGNMENTS_QNAME, AbstractRoleType.class),

ROLE_CATALOG_VIEW(SchemaConstants.OBJECT_COLLECTION_ROLE_CATALOG_QNAME, AbstractRoleType.class);

private QName uri;

private Class<? extends ObjectType> type;

StaticObjectCollection(QName uri, Class<? extends ObjectType> type) {
this.uri = uri;
this.type = type;
}

public QName getUri() {
return uri;
}

public Class<? extends ObjectType> getType() {
return type;
}

public String getStringUri() {
return QNameUtil.qNameToUri(uri);
}

public static StaticObjectCollection findCollection(String identifier) {
if (identifier == null) {
return null;
}

for (StaticObjectCollection collection : values()) {
if (identifier.equals(collection.getUri().getLocalPart())) {
return collection;
}

if (identifier.equals(collection.getStringUri())) {
return collection;
}
}

return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -698,46 +698,6 @@
<identifier>admin-dashboard</identifier>
<configurableDashboardRef oid="00000000-0000-0000-0001-000000000001" relation="org:default" type="c:DashboardType"/>
</configurableUserDashboard>
<accessRequest>
<relationSelection>
<relation>
<ref>org:default</ref>
<display>
<label>Member</label>
<icon>
<cssClass>fa-solid fa-user</cssClass>
</icon>
</display>
</relation>
<relation>
<ref>org:manager</ref>
<display>
<label>Manager</label>
<icon>
<cssClass>fa-solid fa-user-tie</cssClass>
</icon>
</display>
</relation>
<relation>
<ref>org:approver</ref>
<display>
<label>Approver</label>
<icon>
<cssClass>fa-solid fa-clipboard-check</cssClass>
</icon>
</display>
</relation>
<relation>
<ref>org:owner</ref>
<display>
<label>Owner</label>
<icon>
<cssClass>fa-solid fa-crown</cssClass>
</icon>
</display>
</relation>
</relationSelection>
</accessRequest>
</adminGuiConfiguration>

<expressions>
Expand Down

0 comments on commit 87a6347

Please sign in to comment.