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());
}
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);
}
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);
}
};
}
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);
}
};
}
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);
}
}
Aggregations