Search in sources :

Example 1 with ViewManager

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);
}
Also used : ConfirmationEventListener(org.activiti.explorer.ui.event.ConfirmationEventListener) ConfirmationEvent(org.activiti.explorer.ui.event.ConfirmationEvent) TaskService(org.activiti.engine.TaskService) ViewManager(org.activiti.explorer.ViewManager) ConfirmationDialogPopupWindow(org.activiti.explorer.ui.custom.ConfirmationDialogPopupWindow) I18nManager(org.activiti.explorer.I18nManager)

Example 2 with ViewManager

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);
    }
}
Also used : Task(org.activiti.engine.task.Task) ActivitiException(org.activiti.engine.ActivitiException) ViewManager(org.activiti.explorer.ViewManager)

Example 3 with ViewManager

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);
}
Also used : ConfirmationEventListener(org.activiti.explorer.ui.event.ConfirmationEventListener) ConfirmationEvent(org.activiti.explorer.ui.event.ConfirmationEvent) ViewManager(org.activiti.explorer.ViewManager) ConfirmationDialogPopupWindow(org.activiti.explorer.ui.custom.ConfirmationDialogPopupWindow) I18nManager(org.activiti.explorer.I18nManager)

Example 4 with ViewManager

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);
}
Also used : ConfirmationEventListener(org.activiti.explorer.ui.event.ConfirmationEventListener) ConfirmationEvent(org.activiti.explorer.ui.event.ConfirmationEvent) RuntimeService(org.activiti.engine.RuntimeService) ViewManager(org.activiti.explorer.ViewManager) ConfirmationDialogPopupWindow(org.activiti.explorer.ui.custom.ConfirmationDialogPopupWindow) I18nManager(org.activiti.explorer.I18nManager)

Aggregations

ViewManager (org.activiti.explorer.ViewManager)4 I18nManager (org.activiti.explorer.I18nManager)3 ConfirmationDialogPopupWindow (org.activiti.explorer.ui.custom.ConfirmationDialogPopupWindow)3 ConfirmationEvent (org.activiti.explorer.ui.event.ConfirmationEvent)3 ConfirmationEventListener (org.activiti.explorer.ui.event.ConfirmationEventListener)3 ActivitiException (org.activiti.engine.ActivitiException)1 RuntimeService (org.activiti.engine.RuntimeService)1 TaskService (org.activiti.engine.TaskService)1 Task (org.activiti.engine.task.Task)1