private boolean hasUserPendingOrAssignedTasks(long userId, Long processInstanceId) throws SExecutionException { return taskInvolvementDelegate.hasUserPendingOrAssignedTasks(userId, processInstanceId); }
public boolean isInvolvedInHumanTaskInstance(long userId, long humanTaskInstanceId) throws ActivityInstanceNotFoundException, UserNotFoundException { return taskInvolvementDelegate.isInvolvedInHumanTaskInstance(userId, humanTaskInstanceId); }
@Override public SearchResult<HumanTaskInstance> searchPendingTasksManagedBy(final long managerUserId, final SearchOptions searchOptions) throws SearchException { return taskInvolvementDelegate.searchPendingTasksManagedBy(managerUserId, searchOptions); }
public boolean isInvolvedInProcessInstance(final long userId, final long processInstanceId) throws ProcessInstanceNotFoundException { final TaskInvolvementDelegate taskInvolvementDelegate = new TaskInvolvementDelegate(); // IS_PROCESS_INITIATOR rule if (isProcessOrArchivedProcessInitiator(userId, processInstanceId)) { return true; } try { // IS_TASK_PERFORMER rule if (taskInvolvementDelegate.isExecutorOfArchivedTaskOfProcess(userId, processInstanceId)) { return true; } } catch (SBonitaReadException e) { throw new RetrieveException(e); } try { // IS_INVOLVED_IN_PROCESS_INSTANCE rule if (taskInvolvementDelegate.hasUserPendingOrAssignedTasks(userId, processInstanceId)) { return true; } } catch (SExecutionException e) { throw new RetrieveException(e); } return false; }
public boolean isExecutorOfArchivedTaskOfProcess(long userId, Long rootProcessInstanceId) throws SBonitaReadException { final ActivityInstanceService activityInstanceService = getTenantServiceAccessor().getActivityInstanceService(); QueryOptions archivedQueryOptions = buildArchivedTasksQueryOptions(rootProcessInstanceId); List<SAHumanTaskInstance> sArchivedHumanTasks = activityInstanceService.searchArchivedTasks(archivedQueryOptions); while (!sArchivedHumanTasks.isEmpty()) { for (final SAHumanTaskInstance sArchivedHumanTask : sArchivedHumanTasks) { if (userId == sArchivedHumanTask.getExecutedBy()) { return true; } } archivedQueryOptions = QueryOptions.getNextPage(archivedQueryOptions); sArchivedHumanTasks = activityInstanceService.searchArchivedTasks(archivedQueryOptions); } return false; }
final ProcessInstanceService processInstanceService = tenantServiceAccessor.getProcessInstanceService(); final IdentityService identityService = tenantServiceAccessor.getIdentityService(); final TaskInvolvementDelegate taskInvolvementDelegate = new TaskInvolvementDelegate(); final ActivityInstanceService activityInstanceService = tenantServiceAccessor.getActivityInstanceService(); if (taskInvolvementDelegate.searchPendingTasksManagedBy(managerUserId, new SearchOptionsBuilder(0, 1).filter(HumanTaskInstanceSearchDescriptor.PROCESS_INSTANCE_ID, processInstanceId).done()) .getCount() > 0) {
public boolean hasUserPendingOrAssignedTasks(long userId, Long processInstanceId) throws SExecutionException { final ActivityInstanceService activityInstanceService = getTenantServiceAccessor().getActivityInstanceService(); // is user assigned or has pending tasks on this process instance: final QueryOptions queryOptions = new QueryOptions(0, 1, Collections.EMPTY_LIST, Arrays.asList(new FilterOption(SHumanTaskInstance.class, "logicalGroup2", processInstanceId)), null); try { return activityInstanceService.getNumberOfPendingOrAssignedTasks(userId, queryOptions) > 0; } catch (SBonitaReadException e) { throw new SExecutionException(e); } }
public ProcessAPIImpl() { this(new ProcessManagementAPIImplDelegate(), new DocumentAPIImpl(), new ProcessConfigurationAPIImpl(), new TaskInvolvementDelegate(), new ProcessInvolvementDelegate()); }
@Override public boolean isAllowed(String key, Map<String, Serializable> context) throws SExecutionException { try { long userId = getLoggedUserId(sessionAccessor, sessionService); Long processInstanceId = getLongParameter(context, URLAdapterConstants.ID_QUERY_PARAM); if (processInstanceId == null) { throw new IllegalArgumentException( "Parameter 'id' is mandatory to execute Page Authorization rule 'IsProcessInitiatorRule'"); } return taskInvolvementDelegate.isExecutorOfArchivedTaskOfProcess(userId, processInstanceId); } catch (final SBonitaException e) { throw new SExecutionException(e); } }
public boolean isInvolvedInProcessInstance(final long userId, final long processInstanceId) throws ProcessInstanceNotFoundException { final TaskInvolvementDelegate taskInvolvementDelegate = new TaskInvolvementDelegate(); // IS_PROCESS_INITIATOR rule if (isProcessOrArchivedProcessInitiator(userId, processInstanceId)) { return true; } try { // IS_TASK_PERFORMER rule if (taskInvolvementDelegate.isExecutorOfArchivedTaskOfProcess(userId, processInstanceId)) { return true; } } catch (SBonitaReadException e) { throw new RetrieveException(e); } try { // IS_INVOLVED_IN_PROCESS_INSTANCE rule if (taskInvolvementDelegate.hasUserPendingOrAssignedTasks(userId, processInstanceId)) { return true; } } catch (SExecutionException e) { throw new RetrieveException(e); } return false; }
public boolean isExecutorOfArchivedTaskOfProcess(long userId, Long rootProcessInstanceId) throws SBonitaReadException { final ActivityInstanceService activityInstanceService = getTenantServiceAccessor().getActivityInstanceService(); QueryOptions archivedQueryOptions = buildArchivedTasksQueryOptions(rootProcessInstanceId); List<SAHumanTaskInstance> sArchivedHumanTasks = activityInstanceService.searchArchivedTasks(archivedQueryOptions); while (!sArchivedHumanTasks.isEmpty()) { for (final SAHumanTaskInstance sArchivedHumanTask : sArchivedHumanTasks) { if (userId == sArchivedHumanTask.getExecutedBy()) { return true; } } archivedQueryOptions = QueryOptions.getNextPage(archivedQueryOptions); sArchivedHumanTasks = activityInstanceService.searchArchivedTasks(archivedQueryOptions); } return false; }
final ProcessInstanceService processInstanceService = tenantServiceAccessor.getProcessInstanceService(); final IdentityService identityService = tenantServiceAccessor.getIdentityService(); final TaskInvolvementDelegate taskInvolvementDelegate = new TaskInvolvementDelegate(); final ActivityInstanceService activityInstanceService = tenantServiceAccessor.getActivityInstanceService(); if (taskInvolvementDelegate.searchPendingTasksManagedBy(managerUserId, new SearchOptionsBuilder(0, 1).filter(HumanTaskInstanceSearchDescriptor.PROCESS_INSTANCE_ID, processInstanceId).done()) .getCount() > 0) {
public boolean hasUserPendingOrAssignedTasks(long userId, Long processInstanceId) throws SExecutionException { final ActivityInstanceService activityInstanceService = getTenantServiceAccessor().getActivityInstanceService(); // is user assigned or has pending tasks on this process instance: final QueryOptions queryOptions = new QueryOptions(0, 1, Collections.EMPTY_LIST, Arrays.asList(new FilterOption(SHumanTaskInstance.class, "logicalGroup2", processInstanceId)), null); try { return activityInstanceService.getNumberOfPendingOrAssignedTasks(userId, queryOptions) > 0; } catch (SBonitaReadException e) { throw new SExecutionException(e); } }
public ProcessAPIImpl() { this(new ProcessManagementAPIImplDelegate(), new DocumentAPIImpl(), new ProcessConfigurationAPIImpl(), new TaskInvolvementDelegate(), new ProcessInvolvementDelegate()); }
@Override public boolean isAllowed(String key, Map<String, Serializable> context) throws SExecutionException { try { long userId = getLoggedUserId(sessionAccessor, sessionService); Long processInstanceId = getLongParameter(context, URLAdapterConstants.ID_QUERY_PARAM); if (processInstanceId == null) { throw new IllegalArgumentException( "Parameter 'id' is mandatory to execute Page Authorization rule 'IsProcessInitiatorRule'"); } return taskInvolvementDelegate.isExecutorOfArchivedTaskOfProcess(userId, processInstanceId); } catch (final SBonitaException e) { throw new SExecutionException(e); } }
public boolean isInvolvedInHumanTaskInstance(long userId, long humanTaskInstanceId) throws ActivityInstanceNotFoundException { final ActivityInstanceService activityInstanceService = getTenantServiceAccessor().getActivityInstanceService(); try { long assigneeId; final SHumanTaskInstance humanTaskInstance = activityInstanceService.getHumanTaskInstance(humanTaskInstanceId); assigneeId = humanTaskInstance.getAssigneeId(); if (assigneeId > 0) { //check if the user is the assigned user return userId == assigneeId; } else { //if the task is not assigned check if the user is mapped to the actor of the task return activityInstanceService.isTaskPendingForUser(humanTaskInstanceId, userId); } } catch (SActivityInstanceNotFoundException e) { throw new ActivityInstanceNotFoundException(humanTaskInstanceId); } catch (SBonitaReadException | SActivityReadException e) { throw new RetrieveException(e); } }
@Override public SearchResult<HumanTaskInstance> searchPendingTasksManagedBy(final long managerUserId, final SearchOptions searchOptions) throws SearchException { return taskInvolvementDelegate.searchPendingTasksManagedBy(managerUserId, searchOptions); }
public boolean isInvolvedInHumanTaskInstance(long userId, long humanTaskInstanceId) throws ActivityInstanceNotFoundException, UserNotFoundException { return taskInvolvementDelegate.isInvolvedInHumanTaskInstance(userId, humanTaskInstanceId); }
private boolean hasUserPendingOrAssignedTasks(long userId, Long processInstanceId) throws SExecutionException { return taskInvolvementDelegate.hasUserPendingOrAssignedTasks(userId, processInstanceId); }
public boolean isInvolvedInHumanTaskInstance(long userId, long humanTaskInstanceId) throws ActivityInstanceNotFoundException { final ActivityInstanceService activityInstanceService = getTenantServiceAccessor().getActivityInstanceService(); try { long assigneeId; final SHumanTaskInstance humanTaskInstance = activityInstanceService.getHumanTaskInstance(humanTaskInstanceId); assigneeId = humanTaskInstance.getAssigneeId(); if (assigneeId > 0) { //check if the user is the assigned user return userId == assigneeId; } else { //if the task is not assigned check if the user is mapped to the actor of the task return activityInstanceService.isTaskPendingForUser(humanTaskInstanceId, userId); } } catch (SActivityInstanceNotFoundException e) { throw new ActivityInstanceNotFoundException(humanTaskInstanceId); } catch (SBonitaReadException | SActivityReadException e) { throw new RetrieveException(e); } }