Search in sources :

Example 16 with AssignmentEditorDto

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;
        }
    };
}
Also used : PanelTab(com.evolveum.midpoint.gui.api.component.tabs.PanelTab) MergeObjectsPanel(com.evolveum.midpoint.web.page.admin.users.component.MergeObjectsPanel) AssignmentEditorDto(com.evolveum.midpoint.web.component.assignment.AssignmentEditorDto) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) ArrayList(java.util.ArrayList) PageAdminObjectDetails(com.evolveum.midpoint.web.page.admin.PageAdminObjectDetails) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) FocusMainPanel(com.evolveum.midpoint.web.component.objectdetails.FocusMainPanel) ArrayList(java.util.ArrayList) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 17 with AssignmentEditorDto

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;
}
Also used : AssignmentEditorDto(com.evolveum.midpoint.web.component.assignment.AssignmentEditorDto)

Example 18 with AssignmentEditorDto

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;
}
Also used : AssignmentEditorDto(com.evolveum.midpoint.web.component.assignment.AssignmentEditorDto) Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) PrismObject(com.evolveum.midpoint.prism.PrismObject) PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue)

Aggregations

AssignmentEditorDto (com.evolveum.midpoint.web.component.assignment.AssignmentEditorDto)18 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)5 ArrayList (java.util.ArrayList)4 PanelTab (com.evolveum.midpoint.gui.api.component.tabs.PanelTab)3 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)3 DelegationEditorPanel (com.evolveum.midpoint.web.component.assignment.DelegationEditorPanel)3 FocusMainPanel (com.evolveum.midpoint.web.component.objectdetails.FocusMainPanel)3 PageAdminObjectDetails (com.evolveum.midpoint.web.page.admin.PageAdminObjectDetails)3 List (java.util.List)3 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 CountablePanelTab (com.evolveum.midpoint.gui.api.component.tabs.CountablePanelTab)2 FocusTabVisibleBehavior (com.evolveum.midpoint.gui.api.util.FocusTabVisibleBehavior)2 ContainerDelta (com.evolveum.midpoint.prism.delta.ContainerDelta)2 ObjectFilter (com.evolveum.midpoint.prism.query.ObjectFilter)2 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)2 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)2 RoleCatalogStorage (com.evolveum.midpoint.web.session.RoleCatalogStorage)2 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)2 ITab (org.apache.wicket.extensions.markup.html.tabs.ITab)2 ObjectBrowserPanel (com.evolveum.midpoint.gui.api.component.ObjectBrowserPanel)1