use of com.evolveum.midpoint.web.component.assignment.AssignmentEditorDto in project midpoint by Evolveum.
the class PageMergeObjects method createMainPanel.
@Override
protected AbstractObjectMainPanel<UserType> createMainPanel(String id) {
return new FocusMainPanel<UserType>(id, getObjectModel(), new CountableLoadableModel<AssignmentEditorDto>() {
@Override
protected List<AssignmentEditorDto> load() {
return new ArrayList<>();
}
}, new LoadableModel<List<FocusSubwrapperDto<ShadowType>>>() {
@Override
protected List<FocusSubwrapperDto<ShadowType>> load() {
return new ArrayList<>();
}
}, this) {
@Override
protected List<ITab> createTabs(final PageAdminObjectDetails<UserType> parentPage) {
List<ITab> tabs = new ArrayList<>();
tabs.add(new PanelTab(parentPage.createStringResource("PageMergeObjects.tabTitle"), new VisibleEnableBehaviour()) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
mergeObjectsPanel = new MergeObjectsPanel(panelId, mergeObjectModel, mergeWithObjectModel, type, PageMergeObjects.this);
return mergeObjectsPanel;
}
});
return tabs;
}
@Override
protected boolean isPreviewButtonVisible() {
return false;
}
@Override
protected boolean getOptionsPanelVisibility() {
return false;
}
};
}
use of com.evolveum.midpoint.web.component.assignment.AssignmentEditorDto in project midpoint by Evolveum.
the class PageUser method processDeputyAssignments.
@Override
protected boolean processDeputyAssignments() {
boolean isAnythingChanged = false;
for (AssignmentEditorDto dto : delegationsModel.getObject()) {
if (!UserDtoStatus.MODIFY.equals(dto.getStatus())) {
UserType user = dto.getDelegationOwner();
List<AssignmentEditorDto> userAssignmentsDtos = new ArrayList<>();
userAssignmentsDtos.add(dto);
saveDelegationToUser(user, userAssignmentsDtos);
isAnythingChanged = true;
}
}
return isAnythingChanged;
}
use of com.evolveum.midpoint.web.component.assignment.AssignmentEditorDto in project midpoint by Evolveum.
the class PageUser method loadDelegatedByMeAssignments.
private List<AssignmentEditorDto> loadDelegatedByMeAssignments() {
OperationResult result = new OperationResult(OPERATION_LOAD_DELEGATED_BY_ME_ASSIGNMENTS);
List<AssignmentEditorDto> list = new ArrayList<>();
try {
Task task = createSimpleTask(OPERATION_LOAD_DELEGATED_BY_ME_ASSIGNMENTS);
PrismReferenceValue referenceValue = new PrismReferenceValue(getObjectWrapper().getOid(), UserType.COMPLEX_TYPE);
referenceValue.setRelation(SchemaConstants.ORG_DEPUTY);
ObjectFilter refFilter = QueryBuilder.queryFor(UserType.class, getPrismContext()).item(UserType.F_ASSIGNMENT, AssignmentType.F_TARGET_REF).ref(referenceValue).buildFilter();
ObjectQuery query = new ObjectQuery();
query.setFilter(refFilter);
List<PrismObject<UserType>> usersList = getModelService().searchObjects(UserType.class, query, null, task, result);
List<String> processedUsersOid = new ArrayList<>();
if (usersList != null && usersList.size() > 0) {
for (PrismObject<UserType> user : usersList) {
if (processedUsersOid.contains(user.getOid())) {
continue;
}
List<AssignmentType> assignments = user.asObjectable().getAssignment();
for (AssignmentType assignment : assignments) {
if (assignment.getTargetRef() != null && StringUtils.isNotEmpty(assignment.getTargetRef().getOid()) && assignment.getTargetRef().getOid().equals(getObjectWrapper().getOid())) {
AssignmentEditorDto dto = new AssignmentEditorDto(UserDtoStatus.MODIFY, assignment, this, user.asObjectable());
dto.setEditable(false);
list.add(dto);
}
}
processedUsersOid.add(user.getOid());
}
}
} catch (Exception ex) {
result.recomputeStatus();
showResult(result);
}
Collections.sort(list);
return list;
}
Aggregations