Search in sources :

Example 1 with WorkItemDto

use of com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto in project midpoint by Evolveum.

the class WorkItemsPanel method createTypeIconColumn.

public IColumn<WorkItemDto, String> createTypeIconColumn(final boolean object) {
    // true = object, false = target
    return new IconColumn<WorkItemDto>(createStringResource("")) {

        @Override
        protected IModel<String> createIconModel(IModel<WorkItemDto> rowModel) {
            if (getObjectType(rowModel) == null) {
                return null;
            }
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(rowModel);
            String icon = guiDescriptor != null ? guiDescriptor.getBlackIcon() : ObjectTypeGuiDescriptor.ERROR_ICON;
            return new Model<>(icon);
        }

        private ObjectTypeGuiDescriptor getObjectTypeDescriptor(IModel<WorkItemDto> rowModel) {
            return ObjectTypeGuiDescriptor.getDescriptor(ObjectTypes.getObjectTypeFromTypeQName(getObjectType(rowModel)));
        }

        private QName getObjectType(IModel<WorkItemDto> rowModel) {
            return object ? rowModel.getObject().getObjectType() : rowModel.getObject().getTargetType();
        }

        @Override
        public void populateItem(Item<ICellPopulator<WorkItemDto>> item, String componentId, IModel<WorkItemDto> rowModel) {
            super.populateItem(item, componentId, rowModel);
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(rowModel);
            if (guiDescriptor != null) {
                item.add(AttributeModifier.replace("title", createStringResource(guiDescriptor.getLocalizationKey())));
                item.add(new TooltipBehavior());
            }
        }
    };
}
Also used : PageWorkItem(com.evolveum.midpoint.web.page.admin.workflow.PageWorkItem) Item(org.apache.wicket.markup.repeater.Item) TooltipBehavior(com.evolveum.midpoint.web.util.TooltipBehavior) IModel(org.apache.wicket.model.IModel) IconColumn(com.evolveum.midpoint.web.component.data.column.IconColumn) ObjectTypeGuiDescriptor(com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) WorkItemDto(com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto)

Example 2 with WorkItemDto

use of com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto in project midpoint by Evolveum.

the class TaskWfChildPanel method initLayout.

private void initLayout(final IModel<TaskDto> taskDtoModel) {
    changesModel = new PropertyModel<>(taskDtoModel, TaskDto.F_CHANGE_BEING_APPROVED);
    TaskChangesPanel changesPanel = new TaskChangesPanel(ID_CHANGES, changesModel);
    changesPanel.setOutputMarkupId(true);
    add(changesPanel);
    final ItemApprovalHistoryPanel history = new ItemApprovalHistoryPanel(ID_HISTORY, new PropertyModel<>(taskDtoModel, TaskDto.F_WORKFLOW_CONTEXT), UserProfileStorage.TableId.PAGE_TASK_HISTORY_PANEL, (int) parentPage.getItemsPerPage(UserProfileStorage.TableId.PAGE_TASK_HISTORY_PANEL));
    history.setOutputMarkupId(true);
    add(history);
    add(WebComponentUtil.createHelp(ID_HISTORY_HELP));
    WebMarkupContainer workItemsContainer = new WebMarkupContainer(ID_CURRENT_WORK_ITEMS_CONTAINER);
    final ISortableDataProvider<WorkItemDto, String> provider = new ListDataProvider(this, new PropertyModel<List<WorkItemDto>>(taskDtoModel, TaskDto.F_WORK_ITEMS));
    final WorkItemsPanel workItemsPanel = new WorkItemsPanel(ID_CURRENT_WORK_ITEMS, provider, UserProfileStorage.TableId.PAGE_TASK_CURRENT_WORK_ITEMS_PANEL, (int) parentPage.getItemsPerPage(UserProfileStorage.TableId.PAGE_TASK_CURRENT_WORK_ITEMS_PANEL), WorkItemsPanel.View.ITEMS_FOR_PROCESS);
    workItemsPanel.setOutputMarkupId(true);
    workItemsContainer.add(workItemsPanel);
    workItemsContainer.setOutputMarkupId(true);
    workItemsContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return provider.size() > 0;
        }
    });
    workItemsContainer.add(WebComponentUtil.createHelp(ID_CURRENT_WORK_ITEMS_HELP));
    add(workItemsContainer);
    final PropertyModel<List<ProcessInstanceDto>> relatedRequestsModel = new PropertyModel<>(taskDtoModel, TaskDto.F_WORKFLOW_REQUESTS);
    WebMarkupContainer relatedRequestsContainer = new WebMarkupContainer(ID_RELATED_REQUESTS_CONTAINER);
    relatedRequestsContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return CollectionUtils.isNotEmpty(relatedRequestsModel.getObject());
        }
    });
    relatedRequestsContainer.setOutputMarkupId(true);
    add(relatedRequestsContainer);
    ISortableDataProvider<ProcessInstanceDto, String> requestsProvider = new ListDataProvider(this, relatedRequestsModel);
    relatedRequestsContainer.add(new ProcessInstancesPanel(ID_RELATED_REQUESTS, requestsProvider, null, 10, ProcessInstancesPanel.View.TASKS_FOR_PROCESS, null));
    relatedRequestsContainer.add(WebComponentUtil.createHelp(ID_RELATED_REQUESTS_HELP));
    add(new AjaxFallbackLink(ID_SHOW_PARENT) {

        public void onClick(AjaxRequestTarget target) {
            String oid = taskDtoModel.getObject().getParentTaskOid();
            if (oid != null) {
                PageParameters parameters = new PageParameters();
                parameters.add(OnePageParameterEncoder.PARAMETER, oid);
                ((PageBase) getPage()).navigateToNext(PageTaskEdit.class, parameters);
            }
        }
    });
    add(WebComponentUtil.createHelp(ID_SHOW_PARENT_HELP));
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) ProcessInstancesPanel(com.evolveum.midpoint.web.page.admin.workflow.ProcessInstancesPanel) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) PropertyModel(org.apache.wicket.model.PropertyModel) AjaxFallbackLink(org.apache.wicket.ajax.markup.html.AjaxFallbackLink) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ItemApprovalHistoryPanel(com.evolveum.midpoint.web.component.wf.processes.itemApproval.ItemApprovalHistoryPanel) WorkItemsPanel(com.evolveum.midpoint.web.component.wf.WorkItemsPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) WorkItemDto(com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto) ArrayList(java.util.ArrayList) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 3 with WorkItemDto

use of com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto in project midpoint by Evolveum.

the class WorkItemPanel method initLayout.

protected void initLayout(Form mainForm, PageBase pageBase) {
    WebMarkupContainer additionalInfoColumn = new WebMarkupContainer(ID_ADDITIONAL_INFO_COLUMN);
    WebMarkupContainer historyContainer = new WebMarkupContainer(ID_HISTORY_CONTAINER);
    historyContainer.add(new ItemApprovalHistoryPanel(ID_HISTORY, new PropertyModel<>(getModel(), WorkItemDto.F_WORKFLOW_CONTEXT), UserProfileStorage.TableId.PAGE_WORK_ITEM_HISTORY_PANEL, (int) pageBase.getItemsPerPage(UserProfileStorage.TableId.PAGE_WORK_ITEM_HISTORY_PANEL)));
    final VisibleEnableBehaviour historyContainerVisible = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return getModelObject().hasHistory();
        }
    };
    historyContainer.add(historyContainerVisible);
    historyContainer.add(WebComponentUtil.createHelp(ID_HISTORY_HELP));
    additionalInfoColumn.add(historyContainer);
    WebMarkupContainer relatedWorkItemsContainer = new WebMarkupContainer(ID_RELATED_WORK_ITEMS_CONTAINER);
    final IModel<List<WorkItemDto>> relatedWorkItemsModel = new PropertyModel<>(getModel(), WorkItemDto.F_OTHER_WORK_ITEMS);
    final ISortableDataProvider<WorkItemDto, String> relatedWorkItemsProvider = new ListDataProvider<>(this, relatedWorkItemsModel);
    relatedWorkItemsContainer.add(new WorkItemsPanel(ID_RELATED_WORK_ITEMS, relatedWorkItemsProvider, null, 10, WorkItemsPanel.View.ITEMS_FOR_PROCESS));
    final VisibleEnableBehaviour relatedWorkItemsContainerVisible = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !relatedWorkItemsModel.getObject().isEmpty();
        }
    };
    relatedWorkItemsContainer.add(relatedWorkItemsContainerVisible);
    relatedWorkItemsContainer.add(WebComponentUtil.createHelp(ID_RELATED_WORK_ITEMS_HELP));
    additionalInfoColumn.add(relatedWorkItemsContainer);
    final WebMarkupContainer relatedWorkflowRequestsContainer = new WebMarkupContainer(ID_RELATED_REQUESTS_CONTAINER);
    final IModel<List<ProcessInstanceDto>> relatedWorkflowRequestsModel = new PropertyModel<>(getModel(), WorkItemDto.F_RELATED_WORKFLOW_REQUESTS);
    final ISortableDataProvider<ProcessInstanceDto, String> relatedWorkflowRequestsProvider = new ListDataProvider<>(this, relatedWorkflowRequestsModel);
    relatedWorkflowRequestsContainer.add(new ProcessInstancesPanel(ID_RELATED_REQUESTS, relatedWorkflowRequestsProvider, null, 10, ProcessInstancesPanel.View.TASKS_FOR_PROCESS, new PropertyModel<>(getModel(), WorkItemDto.F_PROCESS_INSTANCE_ID)));
    final VisibleEnableBehaviour relatedWorkflowRequestsContainerVisible = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !relatedWorkflowRequestsModel.getObject().isEmpty();
        }
    };
    relatedWorkflowRequestsContainer.add(relatedWorkflowRequestsContainerVisible);
    relatedWorkflowRequestsContainer.add(WebComponentUtil.createHelp(ID_RELATED_REQUESTS_HELP));
    additionalInfoColumn.add(relatedWorkflowRequestsContainer);
    final VisibleEnableBehaviour additionalInfoColumnVisible = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return historyContainerVisible.isVisible() || relatedWorkItemsContainerVisible.isVisible() || relatedWorkflowRequestsContainerVisible.isVisible();
        }
    };
    additionalInfoColumn.add(additionalInfoColumnVisible);
    add(additionalInfoColumn);
    WebMarkupContainer primaryInfoColumn = new WebMarkupContainer(ID_PRIMARY_INFO_COLUMN);
    //		primaryInfoColumn.add(new Label(ID_REQUESTED_BY, new PropertyModel(getModel(), WorkItemDto.F_REQUESTER_NAME)));
    //		primaryInfoColumn.add(new Label(ID_REQUESTED_BY_FULL_NAME, new PropertyModel(getModel(), WorkItemDto.F_REQUESTER_FULL_NAME)));
    //		primaryInfoColumn.add(new Label(ID_REQUESTED_ON, new PropertyModel(getModel(), WorkItemDto.F_STARTED_FORMATTED_FULL)));
    primaryInfoColumn.add(new Label(ID_WORK_ITEM_CREATED_ON, new PropertyModel(getModel(), WorkItemDto.F_CREATED_FORMATTED_FULL)));
    primaryInfoColumn.add(new Label(ID_WORK_ITEM_DEADLINE, new PropertyModel(getModel(), WorkItemDto.F_DEADLINE_FORMATTED_FULL)));
    primaryInfoColumn.add(new Label(ID_ORIGINALLY_ALLOCATED_TO, new PropertyModel(getModel(), WorkItemDto.F_ORIGINAL_ASSIGNEE_FULL)));
    primaryInfoColumn.add(new Label(ID_CURRENTLY_ALLOCATED_TO, new PropertyModel(getModel(), WorkItemDto.F_CURRENT_ASSIGNEES_FULL)));
    primaryInfoColumn.add(new Label(ID_CANDIDATES, new PropertyModel(getModel(), WorkItemDto.F_CANDIDATES)));
    WebMarkupContainer stageInfoContainer = new WebMarkupContainer(ID_STAGE_INFO_CONTAINER);
    primaryInfoColumn.add(stageInfoContainer);
    stageInfoContainer.add(new Label(ID_STAGE_INFO, new PropertyModel<String>(getModel(), WorkItemDto.F_STAGE_INFO)));
    stageInfoContainer.add(new VisibleBehaviour(() -> getModelObject().getStageInfo() != null));
    WebMarkupContainer escalationLevelInfoContainer = new WebMarkupContainer(ID_ESCALATION_LEVEL_INFO_CONTAINER);
    primaryInfoColumn.add(escalationLevelInfoContainer);
    escalationLevelInfoContainer.add(new Label(ID_ESCALATION_LEVEL_INFO, new PropertyModel<String>(getModel(), WorkItemDto.F_ESCALATION_LEVEL_INFO)));
    escalationLevelInfoContainer.add(new VisibleBehaviour(() -> getModelObject().getEscalationLevelInfo() != null));
    WebMarkupContainer requesterCommentContainer = new WebMarkupContainer(ID_REQUESTER_COMMENT_CONTAINER);
    requesterCommentContainer.setOutputMarkupId(true);
    primaryInfoColumn.add(requesterCommentContainer);
    requesterCommentContainer.add(new Label(ID_REQUESTER_COMMENT_MESSAGE, new PropertyModel<String>(getModel(), WorkItemDto.F_REQUESTER_COMMENT)));
    //primaryInfoColumn.add(new ScenePanel(ID_DELTAS_TO_BE_APPROVED, new PropertyModel<SceneDto>(getModel(), WorkItemDto.F_DELTAS)));
    primaryInfoColumn.add(new TaskChangesPanel(ID_DELTAS_TO_BE_APPROVED, new PropertyModel<>(getModel(), WorkItemDto.F_CHANGES)));
    primaryInfoColumn.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return additionalInfoColumnVisible.isVisible() ? "col-md-5" : "col-md-12";
        }
    }));
    add(primaryInfoColumn);
    add(new AjaxFallbackLink(ID_SHOW_REQUEST) {

        public void onClick(AjaxRequestTarget target) {
            String oid = WorkItemPanel.this.getModelObject().getTaskOid();
            if (oid != null) {
                PageParameters parameters = new PageParameters();
                parameters.add(OnePageParameterEncoder.PARAMETER, oid);
                getPageBase().navigateToNext(PageTaskEdit.class, parameters);
            }
        }
    });
    add(WebComponentUtil.createHelp(ID_SHOW_REQUEST_HELP));
    WebMarkupContainer additionalInformation = new InformationListPanel(ID_ADDITIONAL_INFORMATION, new PropertyModel<>(getModel(), WorkItemDto.F_ADDITIONAL_INFORMATION));
    add(additionalInformation);
    WorkItemDto dto = getModelObject();
    ApprovalStageDefinitionType level = WfContextUtil.getCurrentStageDefinition(dto.getWorkflowContext());
    WebMarkupContainer additionalAttribues = new WebMarkupContainer(ID_ADDITIONAL_ATTRIBUTES);
    add(additionalAttribues);
    additionalAttribues.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        public boolean isVisible() {
            return (level != null && level.getFormRef() != null && level.getFormRef().getOid() != null);
        }

        ;
    });
    if (level != null && level.getFormRef() != null && level.getFormRef().getOid() != null) {
        String formOid = level.getFormRef().getOid();
        ObjectType focus = dto.getFocus(pageBase);
        if (focus == null) {
            // TODO FIXME (this should not occur anyway)
            focus = new UserType(pageBase.getPrismContext());
        }
        Task task = pageBase.createSimpleTask(OPERATION_LOAD_CUSTOM_FORM);
        DynamicFormPanel<?> customForm = new DynamicFormPanel<>(ID_CUSTOM_FORM, focus.asPrismObject(), formOid, mainForm, task, pageBase);
        additionalAttribues.add(customForm);
    } else {
        additionalAttribues.add(new Label(ID_CUSTOM_FORM));
    }
    add(new TextArea<>(ID_APPROVER_COMMENT, new PropertyModel<String>(getModel(), WorkItemDto.F_APPROVER_COMMENT)));
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Task(com.evolveum.midpoint.task.api.Task) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) Label(org.apache.wicket.markup.html.basic.Label) AjaxFallbackLink(org.apache.wicket.ajax.markup.html.AjaxFallbackLink) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) TaskChangesPanel(com.evolveum.midpoint.web.page.admin.server.TaskChangesPanel) ItemApprovalHistoryPanel(com.evolveum.midpoint.web.component.wf.processes.itemApproval.ItemApprovalHistoryPanel) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) ApprovalStageDefinitionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ApprovalStageDefinitionType) WorkItemDto(com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) PageTaskEdit(com.evolveum.midpoint.web.page.admin.server.PageTaskEdit) PropertyModel(org.apache.wicket.model.PropertyModel) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) AttributeModifier(org.apache.wicket.AttributeModifier) WorkItemsPanel(com.evolveum.midpoint.web.component.wf.WorkItemsPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DynamicFormPanel(com.evolveum.midpoint.web.component.prism.DynamicFormPanel) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)

Example 4 with WorkItemDto

use of com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto in project midpoint by Evolveum.

the class PageWorkItem method delegateConfirmedPerformed.

private void delegateConfirmedPerformed(AjaxRequestTarget target, UserType delegate) {
    OperationResult result = new OperationResult(OPERATION_DELEGATE_WORK_ITEM);
    try {
        WorkItemDto dto = workItemDtoModel.getObject();
        List<ObjectReferenceType> delegates = Collections.singletonList(ObjectTypeUtil.createObjectRef(delegate));
        getWorkflowService().delegateWorkItem(dto.getWorkItemId(), delegates, WorkItemDelegationMethodType.ADD_ASSIGNEES, result);
    } catch (Exception ex) {
        result.recordFatalError("Couldn't delegate work item.", ex);
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't delegate work item", ex);
    }
    processResult(target, result, false);
}
Also used : WorkItemDto(com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 5 with WorkItemDto

use of com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto in project midpoint by Evolveum.

the class PageSelfDashboard method initLayout.

private void initLayout() {
    DashboardSearchPanel dashboardSearchPanel = new DashboardSearchPanel(ID_SEARCH_PANEL, null);
    List<String> searchPanelActions = Arrays.asList(AuthorizationConstants.AUTZ_UI_USERS_ALL_URL, AuthorizationConstants.AUTZ_UI_USERS_URL, AuthorizationConstants.AUTZ_UI_RESOURCES_ALL_URL, AuthorizationConstants.AUTZ_UI_RESOURCES_URL, AuthorizationConstants.AUTZ_UI_TASKS_ALL_URL, AuthorizationConstants.AUTZ_UI_TASKS_URL);
    dashboardSearchPanel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            UserInterfaceElementVisibilityType visibilityType = getComponentVisibility(PredefinedDashboardWidgetId.SEARCH);
            return WebComponentUtil.getElementVisibility(visibilityType, searchPanelActions);
        }
    });
    add(dashboardSearchPanel);
    LinksPanel linksPanel = new LinksPanel(ID_LINKS_PANEL, Model.ofList(loadLinksList()));
    linksPanel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            UserInterfaceElementVisibilityType visibilityType = getComponentVisibility(PredefinedDashboardWidgetId.SHORTCUTS);
            return WebComponentUtil.getElementVisibility(visibilityType);
        }
    });
    add(linksPanel);
    // TODO is this correct? [med]
    application = getApplication();
    final Session session = Session.get();
    AsyncDashboardPanel<Object, List<WorkItemDto>> workItemsPanel = new AsyncDashboardPanel<Object, List<WorkItemDto>>(ID_WORK_ITEMS_PANEL, createStringResource("PageSelfDashboard.workItems"), GuiStyleConstants.CLASS_OBJECT_WORK_ITEM_ICON, GuiStyleConstants.CLASS_OBJECT_WORK_ITEM_BOX_CSS_CLASSES, true) {

        private static final long serialVersionUID = 1L;

        @Override
        protected SecurityContextAwareCallable<CallableResult<List<WorkItemDto>>> createCallable(Authentication auth, IModel callableParameterModel) {
            return new SecurityContextAwareCallable<CallableResult<List<WorkItemDto>>>(getSecurityEnforcer(), auth) {

                private static final long serialVersionUID = 1L;

                @Override
                public CallableResult<List<WorkItemDto>> callWithContextPrepared() throws Exception {
                    // TODO is this correct? [med]
                    setupContext(application, session);
                    return loadWorkItems();
                }
            };
        }

        @Override
        protected Component getMainComponent(String markupId) {
            ISortableDataProvider provider = new ListDataProvider(this, new PropertyModel<List<WorkItemDto>>(getModel(), CallableResult.F_VALUE));
            return new WorkItemsPanel(markupId, provider, null, 10, WorkItemsPanel.View.DASHBOARD);
        }
    };
    workItemsPanel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            UserInterfaceElementVisibilityType visibilityType = getComponentVisibility(PredefinedDashboardWidgetId.MY_WORKITEMS);
            return getWorkflowManager().isEnabled() && WebComponentUtil.getElementVisibility(visibilityType);
        }
    });
    add(workItemsPanel);
    AsyncDashboardPanel<Object, List<ProcessInstanceDto>> myRequestsPanel = new AsyncDashboardPanel<Object, List<ProcessInstanceDto>>(ID_REQUESTS_PANEL, createStringResource("PageSelfDashboard.myRequests"), GuiStyleConstants.CLASS_SHADOW_ICON_REQUEST, GuiStyleConstants.CLASS_OBJECT_SERVICE_BOX_CSS_CLASSES, true) {

        private static final long serialVersionUID = 1L;

        @Override
        protected SecurityContextAwareCallable<CallableResult<List<ProcessInstanceDto>>> createCallable(Authentication auth, IModel callableParameterModel) {
            return new SecurityContextAwareCallable<CallableResult<List<ProcessInstanceDto>>>(getSecurityEnforcer(), auth) {

                private static final long serialVersionUID = 1L;

                @Override
                public CallableResult<List<ProcessInstanceDto>> callWithContextPrepared() throws Exception {
                    setupContext(application, session);
                    return loadMyRequests();
                }
            };
        }

        @Override
        protected Component getMainComponent(String markupId) {
            ISortableDataProvider provider = new ListDataProvider(this, new PropertyModel<List<ProcessInstanceDto>>(getModel(), CallableResult.F_VALUE));
            return new ProcessInstancesPanel(markupId, provider, null, 10, ProcessInstancesPanel.View.DASHBOARD, null);
        }
    };
    myRequestsPanel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            UserInterfaceElementVisibilityType visibilityType = getComponentVisibility(PredefinedDashboardWidgetId.MY_REQUESTS);
            return getWorkflowManager().isEnabled() && WebComponentUtil.getElementVisibility(visibilityType);
        }
    });
    add(myRequestsPanel);
    initMyAccounts();
    initAssignments();
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) LinksPanel(com.evolveum.midpoint.web.page.self.component.LinksPanel) ISortableDataProvider(org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider) WorkItemDto(com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) IModel(org.apache.wicket.model.IModel) ProcessInstancesPanel(com.evolveum.midpoint.web.page.admin.workflow.ProcessInstancesPanel) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) SecurityContextAwareCallable(com.evolveum.midpoint.web.component.SecurityContextAwareCallable) DashboardSearchPanel(com.evolveum.midpoint.web.page.self.component.DashboardSearchPanel) WorkItemsPanel(com.evolveum.midpoint.web.component.wf.WorkItemsPanel) AsyncDashboardPanel(com.evolveum.midpoint.web.page.admin.home.component.AsyncDashboardPanel) Authentication(org.springframework.security.core.Authentication) PrismObject(com.evolveum.midpoint.prism.PrismObject) CallableResult(com.evolveum.midpoint.web.component.util.CallableResult) AccountCallableResult(com.evolveum.midpoint.web.page.admin.home.dto.AccountCallableResult) Session(org.apache.wicket.Session)

Aggregations

WorkItemDto (com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto)14 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)7 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)4 IModel (org.apache.wicket.model.IModel)4 WorkflowService (com.evolveum.midpoint.model.api.WorkflowService)3 Task (com.evolveum.midpoint.task.api.Task)3 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)3 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)3 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)3 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)3 WorkItemsPanel (com.evolveum.midpoint.web.component.wf.WorkItemsPanel)3 ProcessInstanceDto (com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto)3 ArrayList (java.util.ArrayList)3 PropertyModel (org.apache.wicket.model.PropertyModel)3 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)2 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)2 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)2 LinkColumn (com.evolveum.midpoint.web.component.data.column.LinkColumn)2 ItemApprovalHistoryPanel (com.evolveum.midpoint.web.component.wf.processes.itemApproval.ItemApprovalHistoryPanel)2