Search in sources :

Example 11 with ProcessInstanceDto

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

the class PageProcessInstances method stopProcessInstancesPerformed.

private void stopProcessInstancesPerformed(AjaxRequestTarget target) {
    MidPointPrincipal user = SecurityUtils.getPrincipalUser();
    List<ProcessInstanceDto> selectedStoppableInstances = new ArrayList<>();
    for (Selectable row : WebComponentUtil.getSelectedData(getTable())) {
        ProcessInstanceDto instance = (ProcessInstanceDto) row;
        if (instance.getEndTimestamp() == null) {
            selectedStoppableInstances.add(instance);
        }
    }
    if (!isSomeItemSelected(selectedStoppableInstances, true, target)) {
        return;
    }
    OperationResult result = new OperationResult(OPERATION_STOP_PROCESS_INSTANCES);
    WorkflowService workflowService = getWorkflowService();
    for (ProcessInstanceDto instance : selectedStoppableInstances) {
        try {
            workflowService.stopProcessInstance(instance.getProcessInstanceId(), WebComponentUtil.getOrigStringFromPoly(user.getName()), result);
        } catch (SchemaException | ObjectNotFoundException | SecurityViolationException | RuntimeException ex) {
            result.createSubresult(OPERATION_STOP_PROCESS_INSTANCE).recordPartialError("Couldn't stop process instance " + instance.getName(), ex);
        }
    }
    if (result.isUnknown()) {
        result.recomputeStatus();
    }
    if (result.isSuccess()) {
        result.recordStatus(OperationResultStatus.SUCCESS, "Selected process instance(s) have been successfully stopped.");
    }
    showResult(result);
    ProcessInstanceDtoProvider provider = (ProcessInstanceDtoProvider) getTable().getDataTable().getDataProvider();
    provider.clearCache();
    //refresh feedback and table
    target.add(getFeedbackPanel());
    target.add(getTable());
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ProcessInstanceDtoProvider(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDtoProvider) Selectable(com.evolveum.midpoint.web.component.util.Selectable) WorkflowService(com.evolveum.midpoint.model.api.WorkflowService) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) MidPointPrincipal(com.evolveum.midpoint.security.api.MidPointPrincipal)

Example 12 with ProcessInstanceDto

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

the class PageProcessInstances method initLayout.

private void initLayout() {
    Form mainForm = new Form(ID_MAIN_FORM);
    add(mainForm);
    ISortableDataProvider<ProcessInstanceDto, String> provider = new ProcessInstanceDtoProvider(PageProcessInstances.this, requestedBy, requestedFor);
    ProcessInstancesPanel panel = new ProcessInstancesPanel(ID_PROCESS_INSTANCES_TABLE, provider, UserProfileStorage.TableId.PAGE_WORKFLOW_REQUESTS, (int) getItemsPerPage(UserProfileStorage.TableId.PAGE_WORKFLOW_REQUESTS), ProcessInstancesPanel.View.FULL_LIST, null);
    panel.setOutputMarkupId(true);
    mainForm.add(panel);
    initItemButtons(mainForm);
}
Also used : Form(org.apache.wicket.markup.html.form.Form) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) ProcessInstanceDtoProvider(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDtoProvider)

Example 13 with ProcessInstanceDto

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

the class ProcessInstancesPanel method createObjectNameColumn.

// copied and adapted from WorkItemsPanel - TODO deduplicate
IColumn<ProcessInstanceDto, String> createObjectNameColumn(final String headerKey) {
    return new LinkColumn<ProcessInstanceDto>(createStringResource(headerKey), ProcessInstanceDto.F_OBJECT_NAME) {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<ProcessInstanceDto> rowModel) {
            ProcessInstanceDto dto = rowModel.getObject();
            dispatchToObjectDetailsPage(dto.getObjectRef(), getPageBase(), false);
        }
    };
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) LinkColumn(com.evolveum.midpoint.web.component.data.column.LinkColumn)

Example 14 with ProcessInstanceDto

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

the class ProcessInstancesPanel method createTargetNameColumn.

IColumn<ProcessInstanceDto, String> createTargetNameColumn(final String headerKey) {
    return new LinkColumn<ProcessInstanceDto>(createStringResource(headerKey), ProcessInstanceDto.F_TARGET_NAME) {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<ProcessInstanceDto> rowModel) {
            ProcessInstanceDto dto = rowModel.getObject();
            dispatchToObjectDetailsPage(dto.getTargetRef(), getPageBase(), false);
        }
    };
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) LinkColumn(com.evolveum.midpoint.web.component.data.column.LinkColumn)

Example 15 with ProcessInstanceDto

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

the class ProcessInstancesPanel method createNameColumn.

@NotNull
private IColumn<ProcessInstanceDto, String> createNameColumn() {
    if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_TASKS_ALL_URL, AuthorizationConstants.AUTZ_UI_TASK_URL)) {
        return new LinkColumn<ProcessInstanceDto>(createStringResource("MyRequestsPanel.name"), "name") {

            @Override
            public void onClick(AjaxRequestTarget target, IModel<ProcessInstanceDto> rowModel) {
                ProcessInstanceDto piDto = rowModel.getObject();
                itemDetailsPerformed(target, piDto.getTaskOid());
            }
        };
    } else {
        return new PropertyColumn<>(createStringResource("MyRequestsPanel.name"), F_NAME);
    }
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) LinkColumn(com.evolveum.midpoint.web.component.data.column.LinkColumn) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ProcessInstanceDto (com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto)15 IModel (org.apache.wicket.model.IModel)7 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)5 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)5 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)4 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)4 ProcessInstanceDtoProvider (com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDtoProvider)4 LinkColumn (com.evolveum.midpoint.web.component.data.column.LinkColumn)3 WorkItemsPanel (com.evolveum.midpoint.web.component.wf.WorkItemsPanel)3 ProcessInstancesPanel (com.evolveum.midpoint.web.page.admin.workflow.ProcessInstancesPanel)3 WorkItemDto (com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)3 PropertyModel (org.apache.wicket.model.PropertyModel)3 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 Task (com.evolveum.midpoint.task.api.Task)2 IconColumn (com.evolveum.midpoint.web.component.data.column.IconColumn)2 ItemApprovalHistoryPanel (com.evolveum.midpoint.web.component.wf.processes.itemApproval.ItemApprovalHistoryPanel)2 AccountCallableResult (com.evolveum.midpoint.web.page.admin.home.dto.AccountCallableResult)2