Skip to content

Commit

Permalink
MID-4841 add kind/intent information to assignment table
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Aug 31, 2018
1 parent ec9bfb3 commit abf0a0b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Expand Up @@ -241,10 +241,16 @@ protected void addSelectedAssignmentsPerformed(AjaxRequestTarget target, List<As
protected List<IColumn<ContainerValueWrapper<AssignmentType>, String>> initColumns() {
List<IColumn<ContainerValueWrapper<AssignmentType>, String>> columns = new ArrayList<>();

columns.add(new AbstractColumn<ContainerValueWrapper<AssignmentType>, String>(createStringResource("ObjectReferenceType.relation")) {
columns.add(new AbstractColumn<ContainerValueWrapper<AssignmentType>, String>(
createStringResource("AbstractRoleAssignmentPanel.relationKindIntentColumn")) {
@Override
public void populateItem(Item<ICellPopulator<ContainerValueWrapper<AssignmentType>>> item, String componentId, IModel<ContainerValueWrapper<AssignmentType>> assignmentModel) {
item.add(new Label(componentId, getRelationLabelValue(assignmentModel.getObject())));
AssignmentType assignment = assignmentModel.getObject().getContainerValue().asContainerable();
if (assignment.getConstruction() != null){
item.add(new Label(componentId, getKindIntentLabelValue(assignment.getConstruction())));
} else {
item.add(new Label(componentId, getRelationLabelValue(assignmentModel.getObject())));
}
}
});

Expand Down Expand Up @@ -289,6 +295,19 @@ private String getRelationLabelValue(ContainerValueWrapper<AssignmentType> assig
return assignmentWrapper.getContainerValue().getValue().getTargetRef().getRelation().getLocalPart();
}

private String getKindIntentLabelValue(ConstructionType constructionType){
if (constructionType == null){
return "";
}
StringBuilder sb = new StringBuilder();
sb.append(constructionType.getKind() != null && !StringUtils.isEmpty(constructionType.getKind().value()) ?
constructionType.getKind().value() : createStringResource("AssignmentEditorPanel.undefined").getString());
sb.append("/");
sb.append(!StringUtils.isEmpty(constructionType.getIntent()) ? constructionType.getIntent()
: createStringResource("AssignmentEditorPanel.undefined").getString());
return sb.toString();
}

protected boolean showAllAssignmentsVisible(){
return true;
}
Expand Down
Expand Up @@ -4092,6 +4092,7 @@ AssociationDetailsPanel.AssociationHeader=Association
RoleRelationSelectionPanel.select.relation=Select relations to process
operation.com.evolveum.midpoint.web.page.admin.workflow.PageWorkItem.delegateWorkItem=Delegate work item
AbstractRoleAssignmentPanel.relationLabel=Relation
AbstractRoleAssignmentPanel.relationKindIntentColumn=Relation or Kind/Intent
AbstractRoleAssignmentPanel.identifierLabel=Identifier
AbstractRoleMainPanel.inducedEntitlements=Induced entitlements
AbstractObjectMainPanel.editXmlButton=Edit raw
Expand Down

0 comments on commit abf0a0b

Please sign in to comment.