use of com.evolveum.midpoint.web.component.util.SummaryTag in project midpoint by Evolveum.
the class TaskSummaryPanel method getSummaryTagComponentList.
@Override
protected List<SummaryTag<TaskType>> getSummaryTagComponentList() {
List<SummaryTag<TaskType>> summaryTagList = new ArrayList<>();
SummaryTag<TaskType> tagExecutionState = new SummaryTag<>(ID_SUMMARY_TAG, getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void initialize(TaskType taskType) {
setIconCssClass(getTaskExecutionIcon(taskType));
setLabel(getTaskExecutionLabel(taskType));
// TODO setColor
}
@Override
public String getIconCssClass() {
return getTaskExecutionIcon(getModelObject());
}
@Override
public String getLabel() {
return getTaskExecutionLabel(getModelObject());
}
};
summaryTagList.add(tagExecutionState);
SummaryTag<TaskType> tagResult = new SummaryTag<>(ID_SUMMARY_TAG, getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void initialize(TaskType taskType) {
setIconCssClass(getTaskResultIcon());
setLabel(getTaskResultLabel());
// TODO setColor
}
@Override
public String getIconCssClass() {
return getTaskResultIcon();
}
@Override
public String getLabel() {
return getTaskResultLabel();
}
};
summaryTagList.add(tagResult);
SummaryTag<TaskType> tagLiveSyncToken = new SummaryTag<>(ID_SUMMARY_TAG, getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void initialize(TaskType taskType) {
setIconCssClass(getLiveSyncTokenIcon());
setLabel(getLiveSyncToken(taskType));
// TODO setColor
}
};
tagLiveSyncToken.add(new VisibleBehaviour(() -> {
TaskType task = getModelObject();
return task != null && ObjectTypeUtil.hasArchetype(task, SystemObjectsType.ARCHETYPE_LIVE_SYNC_TASK.value());
}));
summaryTagList.add(tagLiveSyncToken);
return summaryTagList;
}
use of com.evolveum.midpoint.web.component.util.SummaryTag in project midpoint by Evolveum.
the class UserSummaryPanel method getSummaryTagComponentList.
@Override
protected List<SummaryTag<UserType>> getSummaryTagComponentList() {
List<SummaryTag<UserType>> summaryTagList = super.getSummaryTagComponentList();
SummaryTag<UserType> tagSecurity = new SummaryTag<UserType>(ID_SUMMARY_TAG, getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void initialize(UserType object) {
List<AssignmentType> assignments = object.getAssignment();
if (assignments.isEmpty()) {
setIconCssClass(GuiStyleConstants.CLASS_ICON_NO_OBJECTS);
setLabel(getString("user.noAssignments"));
setCssClass(GuiStyleConstants.CLASS_ICON_STYLE_DISABLED);
return;
}
boolean isSuperuser = false;
boolean isEndUser = false;
for (AssignmentType assignment : assignments) {
if (assignment.getTargetRef() == null) {
continue;
}
QName relation = assignment.getTargetRef().getRelation();
if (!WebComponentUtil.isDefaultRelation(relation)) {
continue;
}
if (SystemObjectsType.ROLE_SUPERUSER.value().equals(assignment.getTargetRef().getOid())) {
isSuperuser = true;
} else if (SystemObjectsType.ROLE_END_USER.value().equals(assignment.getTargetRef().getOid())) {
isEndUser = true;
}
}
if (isSuperuser) {
setIconCssClass(GuiStyleConstants.CLASS_ICON_SUPERUSER);
setLabel(getString("user.superuser"));
setCssClass(GuiStyleConstants.CLASS_ICON_STYLE_PRIVILEGED);
} else if (isEndUser) {
setIconCssClass(GuiStyleConstants.CLASS_OBJECT_USER_ICON);
setLabel(getString("user.enduser"));
setCssClass(GuiStyleConstants.CLASS_ICON_STYLE_END_USER);
} else {
setHideTag(true);
}
}
};
summaryTagList.add(tagSecurity);
SummaryTag<UserType> tagOrg = new SummaryTag<UserType>(ID_SUMMARY_TAG, getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void initialize(UserType object) {
List<ObjectReferenceType> parentOrgRefs = object.getParentOrgRef();
if (parentOrgRefs.isEmpty()) {
setIconCssClass(GuiStyleConstants.CLASS_ICON_NO_OBJECTS);
setLabel(getString("user.noOrgs"));
setCssClass(GuiStyleConstants.CLASS_ICON_STYLE_DISABLED);
return;
}
boolean isManager = false;
boolean isMember = false;
for (ObjectReferenceType parentOrgRef : object.getParentOrgRef()) {
if (WebComponentUtil.isManagerRelation(parentOrgRef.getRelation())) {
isManager = true;
} else {
isMember = true;
}
}
if (isManager) {
setIconCssClass(GuiStyleConstants.CLASS_OBJECT_ORG_ICON);
setLabel(getString("user.orgManager"));
setCssClass(GuiStyleConstants.CLASS_ICON_STYLE_MANAGER);
} else if (isMember) {
setIconCssClass(GuiStyleConstants.CLASS_OBJECT_ORG_ICON);
setLabel(getString("user.orgMember"));
} else {
setHideTag(true);
}
}
};
summaryTagList.add(tagOrg);
return summaryTagList;
}
Aggregations