use of com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto in project midpoint by Evolveum.
the class PageSelfDashboard method loadWorkItems.
private CallableResult<List<WorkItemDto>> loadWorkItems() {
LOGGER.debug("Loading work items.");
AccountCallableResult callableResult = new AccountCallableResult();
List<WorkItemDto> list = new ArrayList<>();
callableResult.setValue(list);
if (!getWorkflowManager().isEnabled()) {
return callableResult;
}
PrismObject<UserType> user = principalModel.getObject();
if (user == null) {
return callableResult;
}
Task task = createSimpleTask(OPERATION_LOAD_WORK_ITEMS);
OperationResult result = task.getResult();
callableResult.setResult(result);
try {
ObjectQuery query = QueryBuilder.queryFor(WorkItemType.class, getPrismContext()).item(WorkItemType.F_ASSIGNEE_REF).ref(user.getOid()).desc(F_CREATE_TIMESTAMP).build();
Collection<SelectorOptions<GetOperationOptions>> options = GetOperationOptions.resolveItemsNamed(new ItemPath(T_PARENT, WfContextType.F_OBJECT_REF), new ItemPath(T_PARENT, WfContextType.F_TARGET_REF));
List<WorkItemType> workItems = getModelService().searchContainers(WorkItemType.class, query, options, task, result);
for (WorkItemType workItem : workItems) {
list.add(new WorkItemDto(workItem));
}
} catch (Exception e) {
result.recordFatalError("Couldn't get list of work items.", e);
}
result.recordSuccessIfUnknown();
result.recomputeStatus();
LOGGER.debug("Finished work items loading.");
return callableResult;
}
use of com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto in project midpoint by Evolveum.
the class WorkItemsPanel method getSelectedWorkItems.
public List<WorkItemDto> getSelectedWorkItems() {
DataTable table = getWorkItemTable().getDataTable();
WorkItemDtoProvider provider = (WorkItemDtoProvider) table.getDataProvider();
List<WorkItemDto> selected = new ArrayList<>();
for (WorkItemDto row : provider.getAvailableData()) {
if (row.isSelected()) {
selected.add(row);
}
}
return selected;
}
use of com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto in project midpoint by Evolveum.
the class WorkItemsPanel method createTargetNameColumn.
IColumn<WorkItemDto, String> createTargetNameColumn(final String headerKey) {
return new LinkColumn<WorkItemDto>(createStringResource(headerKey), WorkItemDto.F_TARGET_NAME) {
@Override
protected IModel<String> createLinkModel(IModel<WorkItemDto> rowModel) {
return Model.of(WebModelServiceUtils.resolveReferenceName(rowModel.getObject().getTargetRef(), getPageBase()));
}
@Override
public void onClick(AjaxRequestTarget target, IModel<WorkItemDto> rowModel) {
WorkItemDto dto = rowModel.getObject();
dispatchToObjectDetailsPage(dto.getTargetRef(), getPageBase(), false);
}
@Override
public void populateItem(Item<ICellPopulator<WorkItemDto>> cellItem, String componentId, final IModel<WorkItemDto> rowModel) {
super.populateItem(cellItem, componentId, rowModel);
Component c = cellItem.get(componentId);
c.add(new AttributeAppender("title", getTargetObjectDescription(rowModel)));
}
};
}
use of com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto in project midpoint by Evolveum.
the class WorkItemsPanel method createObjectNameColumn.
IColumn<WorkItemDto, String> createObjectNameColumn(final String headerKey) {
return new LinkColumn<WorkItemDto>(createStringResource(headerKey), WorkItemDto.F_OBJECT_NAME) {
private static final long serialVersionUID = 1L;
@Override
protected IModel<String> createLinkModel(IModel<WorkItemDto> rowModel) {
return Model.of(WebModelServiceUtils.resolveReferenceName(rowModel.getObject().getObjectRef(), getPageBase()));
}
@Override
public void onClick(AjaxRequestTarget target, IModel<WorkItemDto> rowModel) {
WorkItemDto dto = rowModel.getObject();
dispatchToObjectDetailsPage(dto.getObjectRef(), getPageBase(), false);
}
};
}
use of com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto in project midpoint by Evolveum.
the class PageWorkItem method savePerformed.
private void savePerformed(AjaxRequestTarget target, boolean decision) {
OperationResult result = new OperationResult(OPERATION_SAVE_WORK_ITEM);
try {
WorkItemDto dto = workItemDtoModel.getObject();
ObjectDelta delta = getWorkItemPanel().getDeltaFromForm();
getWorkflowService().completeWorkItem(dto.getWorkItemId(), decision, dto.getApproverComment(), delta, result);
} catch (Exception ex) {
result.recordFatalError("Couldn't save work item.", ex);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't save work item", ex);
}
processResult(target, result, false);
}
Aggregations