use of com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto in project midpoint by Evolveum.
the class TaskDto method fillInWorkflowAttributes.
private void fillInWorkflowAttributes(TaskType taskType, ModelInteractionService modelInteractionService, WorkflowManager workflowManager, PrismContext prismContext, Task opTask, OperationResult thisOpResult) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException {
workflowDeltasIn = retrieveDeltasToProcess(taskType, modelInteractionService, opTask, thisOpResult);
workflowDeltasOut = retrieveResultingDeltas(taskType, modelInteractionService, opTask, thisOpResult);
final TaskType rootTask;
if (parentTaskType == null) {
rootTask = taskType;
} else {
rootTask = parentTaskType;
}
WfContextType wfc = taskType.getWorkflowContext();
if (wfc != null && parentTaskType != null && (wfc.getProcessorSpecificState() instanceof WfPrimaryChangeProcessorStateType)) {
ChangesByState changesByState = workflowManager.getChangesByState(taskType, rootTask, modelInteractionService, prismContext, thisOpResult);
List<TaskChangesDto> changeCategories = computeChangesCategorizationList(changesByState, modelInteractionService, prismContext, opTask, thisOpResult);
if (changeCategories.size() > 1) {
throw new IllegalStateException("More than one task change category for task " + taskType + ": " + changeCategories);
} else if (changeCategories.size() == 1) {
changesBeingApproved = changeCategories.get(0);
}
}
workflowRequests = new ArrayList<>();
for (TaskType wfSubtask : rootTask.getSubtask()) {
final WfContextType subWfc = wfSubtask.getWorkflowContext();
if (subWfc != null && subWfc.getProcessInstanceId() != null) {
if (this.getOid() == null || !this.getOid().equals(wfSubtask.getOid())) {
workflowRequests.add(new ProcessInstanceDto(wfSubtask));
}
}
}
ChangesByState changesByState = workflowManager.getChangesByState(rootTask, modelInteractionService, prismContext, opTask, thisOpResult);
this.changesCategorizationList = computeChangesCategorizationList(changesByState, modelInteractionService, prismContext, opTask, thisOpResult);
}
use of com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto 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));
}
use of com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto in project midpoint by Evolveum.
the class TaskWfParentPanel method initLayout.
private void initLayout(final IModel<TaskDto> taskDtoModel) {
final PropertyModel<List<ProcessInstanceDto>> requestsModel = new PropertyModel<>(taskDtoModel, TaskDto.F_WORKFLOW_REQUESTS);
final ISortableDataProvider<ProcessInstanceDto, String> requestsProvider = new ListDataProvider<>(this, requestsModel);
processInstancesPanel = new ProcessInstancesPanel(ID_REQUESTS, requestsProvider, null, 10, ProcessInstancesPanel.View.TASKS_FOR_PROCESS, null);
processInstancesPanel.setOutputMarkupId(true);
add(processInstancesPanel);
add(WebComponentUtil.createHelp(ID_REQUESTS_HELP));
changesContainer = new WebMarkupContainer(ID_CHANGES_CONTAINER);
for (int i = 1; i <= CHANGES_NUMBER; i++) {
final int index = i;
final String changesId = ID_CHANGES_PREFIX + i;
final String changesContentId = changesId + ID_CHANGES_CONTENT_SUFFIX;
final WebMarkupContainer changes = new WebMarkupContainer(changesId);
final IModel<TaskChangesDto> changesModel = new AbstractReadOnlyModel<TaskChangesDto>() {
@Override
public TaskChangesDto getObject() {
return taskDtoModel.getObject().getChangesForIndex(index);
}
};
final TaskChangesPanel changesPanel = new TaskChangesPanel(changesContentId, changesModel);
changes.add(changesPanel);
changes.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return changesModel.getObject() != null;
}
});
changesContainer.add(changes);
}
changesContainer.setOutputMarkupId(true);
add(changesContainer);
}
use of com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto in project midpoint by Evolveum.
the class ProcessInstancesPanel method createTypeIconColumn.
public IColumn<ProcessInstanceDto, String> createTypeIconColumn(final boolean object) {
// true = object, false = target
return new IconColumn<ProcessInstanceDto>(createStringResource("")) {
@Override
protected IModel<String> createIconModel(IModel<ProcessInstanceDto> 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<ProcessInstanceDto> rowModel) {
QName type = getObjectType(rowModel);
return ObjectTypeGuiDescriptor.getDescriptor(ObjectTypes.getObjectTypeFromTypeQName(type));
}
private QName getObjectType(IModel<ProcessInstanceDto> rowModel) {
return object ? rowModel.getObject().getObjectType() : rowModel.getObject().getTargetType();
}
@Override
public void populateItem(Item<ICellPopulator<ProcessInstanceDto>> item, String componentId, IModel<ProcessInstanceDto> 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());
}
}
};
}
use of com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto in project midpoint by Evolveum.
the class ProcessInstancesPanel method initLayout.
private void initLayout(UserProfileStorage.TableId tableId, int pageSize, View view, final IModel<String> currentInstanceIdModel) {
BoxedTablePanel<ProcessInstanceDto> table = new BoxedTablePanel<ProcessInstanceDto>(ID_REQUESTS_TABLE, provider, initColumns(view), tableId, pageSize) {
@Override
protected Item<ProcessInstanceDto> customizeNewRowItem(Item<ProcessInstanceDto> item, final IModel<ProcessInstanceDto> rowModel) {
item.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (currentInstanceIdModel == null || currentInstanceIdModel.getObject() == null) {
return "";
}
ProcessInstanceDto rowDto = rowModel.getObject();
if (currentInstanceIdModel.getObject().equals(rowDto.getProcessInstanceId())) {
return "info";
} else {
return "";
}
}
}));
return item;
}
};
table.setOutputMarkupId(true);
table.setAdditionalBoxCssClasses("without-box-header-top-border");
add(table);
}
Aggregations