use of org.activiti.explorer.ViewManager in project Activiti by Activiti.
the class DeleteSubTaskClickListener method click.
public void click(ClickEvent event) {
I18nManager i18nManager = ExplorerApp.get().getI18nManager();
ViewManager viewManager = ExplorerApp.get().getViewManager();
final TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
ConfirmationDialogPopupWindow popup = new ConfirmationDialogPopupWindow(i18nManager.getMessage(Messages.TASK_CONFIRM_DELETE_SUBTASK, subTask.getName()));
popup.addListener(new ConfirmationEventListener() {
private static final long serialVersionUID = 1L;
protected void rejected(ConfirmationEvent event) {
}
protected void confirmed(ConfirmationEvent event) {
// delete subtask
taskService.deleteTask(subTask.getId());
// Refresh UI
subTaskComponent.refreshSubTasks();
}
});
viewManager.showPopupWindow(popup);
}
use of org.activiti.explorer.ViewManager in project Activiti by Activiti.
the class TaskNavigator method directToSpecificTaskPage.
protected void directToSpecificTaskPage(String category, String taskId, UriFragment uriFragment) {
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
ViewManager viewManager = ExplorerApp.get().getViewManager();
String loggedInUserId = ExplorerApp.get().getLoggedInUser().getId();
boolean pageFound = false;
if (CATEGORY_TASKS.equals(category)) {
if (loggedInUserId.equals(task.getOwner())) {
viewManager.showTasksPage(task.getId());
pageFound = true;
}
} else if (CATEGORY_INBOX.equals(category)) {
if (loggedInUserId.equals(task.getAssignee())) {
viewManager.showInboxPage(task.getId());
pageFound = true;
}
} else if (CATEGORY_QUEUED.equals(category)) {
String groupId = uriFragment.getParameter(PARAMETER_GROUP);
boolean isTaskAssignedToGroup = taskService.createTaskQuery().taskId(task.getId()).taskCandidateGroup(groupId).count() == 1;
boolean isUserMemberOfGroup = identityService.createGroupQuery().groupMember(loggedInUserId).groupId(groupId).count() == 1;
if (isTaskAssignedToGroup && isUserMemberOfGroup) {
viewManager.showQueuedPage(groupId, task.getId());
pageFound = true;
}
} else if (CATEGORY_INVOLVED.equals(category)) {
boolean isUserInvolved = taskService.createTaskQuery().taskInvolvedUser(loggedInUserId).count() == 1;
if (isUserInvolved) {
viewManager.showInvolvedPage(task.getId());
pageFound = true;
}
} else if (CATEGORY_ARCHIVED.equals(category)) {
if (task == null) {
boolean isOwner = historyService.createHistoricTaskInstanceQuery().taskId(taskId).taskOwner(loggedInUserId).finished().count() == 1;
if (isOwner) {
viewManager.showArchivedPage(taskId);
pageFound = true;
}
}
} else {
throw new ActivitiException("Couldn't find a matching category");
}
if (!pageFound) {
// If URL doesnt match anymore, we must use the task data to redirect to the right page
viewManager.showTaskPage(taskId);
}
}
use of org.activiti.explorer.ViewManager in project Activiti by Activiti.
the class DeleteMembershipListener method click.
public void click(ClickEvent event) {
I18nManager i18nManager = ExplorerApp.get().getI18nManager();
ViewManager viewManager = ExplorerApp.get().getViewManager();
// Add listener to confirmation window. If confirmed, membership is deleted
ConfirmationDialogPopupWindow confirmationPopup = new ConfirmationDialogPopupWindow(i18nManager.getMessage(Messages.USER_CONFIRM_DELETE_GROUP, userId, groupId));
confirmationPopup.addListener(new ConfirmationEventListener() {
protected void rejected(ConfirmationEvent event) {
}
protected void confirmed(ConfirmationEvent event) {
identityService.deleteMembership(userId, groupId);
membershipChangeListener.notifyMembershipChanged();
}
});
// Show popup
viewManager.showPopupWindow(confirmationPopup);
}
use of org.activiti.explorer.ViewManager in project Activiti by Activiti.
the class DeleteProcessInstanceClickListener method buttonClick.
public void buttonClick(ClickEvent event) {
I18nManager i18nManager = ExplorerApp.get().getI18nManager();
ViewManager viewManager = ExplorerApp.get().getViewManager();
final ConfirmationDialogPopupWindow confirmPopup = new ConfirmationDialogPopupWindow(i18nManager.getMessage(Messages.PROCESS_INSTANCE_DELETE_POPUP_TITLE, processInstanceId), i18nManager.getMessage(Messages.PROCESS_INSTANCE_DELETE_POPUP_DESCRIPTION, processInstanceId));
confirmPopup.addListener(new ConfirmationEventListener() {
private static final long serialVersionUID = 1L;
protected void confirmed(ConfirmationEvent event) {
RuntimeService runtimeService = ProcessEngines.getDefaultProcessEngine().getRuntimeService();
runtimeService.deleteProcessInstance(processInstanceId, null);
processInstancePage.refreshSelectNext();
}
});
viewManager.showPopupWindow(confirmPopup);
}
Aggregations