@Override
 public List<TaskSummary> getTasksOwnedByExpirationDateBeforeSpecifiedDate(
     String userId, List<Status> status, Date date) {
   synchronized (ksession) {
     return taskService.getTasksOwnedByExpirationDateBeforeSpecifiedDate(userId, status, date);
   }
 }
 @Override
 public List<TaskSummary> getTasksByStatusByProcessInstanceId(
     long processInstanceId, List<Status> status, String language) {
   synchronized (ksession) {
     return taskService.getTasksByStatusByProcessInstanceId(processInstanceId, status, language);
   }
 }
 @Override
 public List<TaskSummary> getTasksOwnedByStatus(
     String userId, List<Status> status, String language) {
   synchronized (ksession) {
     return taskService.getTasksOwnedByStatus(userId, status, language);
   }
 }
 @Override
 public List<TaskSummary> getTasksOwnedByExpirationDateOptional(
     String userId, List<Status> statuses, Date expirationDate) {
   synchronized (ksession) {
     return taskService.getTasksOwnedByExpirationDateOptional(userId, statuses, expirationDate);
   }
 }
 @Override
 public List<TaskSummary> getTasksAssignedAsPotentialOwnerByStatus(
     String salaboy, List<Status> status, String language) {
   synchronized (ksession) {
     return taskService.getTasksAssignedAsPotentialOwnerByStatus(salaboy, status, language);
   }
 }
 @Override
 public List<TaskSummary> getTasksAssignedAsPotentialOwner(
     String userId, List<String> groupIds, String language) {
   synchronized (ksession) {
     return taskService.getTasksAssignedAsExcludedOwner(userId, language);
   }
 }
 @Override
 public List<TaskSummary> getSubTasksAssignedAsPotentialOwner(
     long parentId, String userId, String language) {
   synchronized (ksession) {
     return taskService.getSubTasksAssignedAsPotentialOwner(parentId, userId, language);
   }
 }
 @Override
 public List<TaskSummary> getTasksAssignedAsPotentialOwnerByStatusByGroup(
     String userId, List<String> groupIds, List<Status> status, String language) {
   synchronized (ksession) {
     return taskService.getTasksAssignedAsPotentialOwnerByStatusByGroup(
         userId, groupIds, status, language);
   }
 }
 @Override
 public List<TaskSummary> getTasksAssignedAsPotentialOwner(
     String userId, List<String> groupIds, String language, int firstResult, int maxResults) {
   synchronized (ksession) {
     return taskService.getTasksAssignedAsPotentialOwner(
         userId, groupIds, language, firstResult, maxResults);
   }
 }
 @Override
 public List<TaskSummary> getTasksAssignedAsPotentialOwnerByExpirationDate(
     String userId, List<Status> statuses, Date expirationDate) {
   synchronized (ksession) {
     return taskService.getTasksAssignedAsPotentialOwnerByExpirationDate(
         userId, statuses, expirationDate);
   }
 }
 @Override
 public int getPendingTaskByUserId(String userId) {
   synchronized (ksession) {
     return taskService.getPendingTaskByUserId(userId);
   }
 }
 @Override
 public void claim(long taskId, String userId) {
   synchronized (ksession) {
     taskService.claim(taskId, userId);
   }
 }
 @Override
 public <T> T execute(Command<T> command) {
   synchronized (ksession) {
     return taskService.execute(command);
   }
 }
 @Override
 public Comment getCommentById(long commentId) {
   synchronized (ksession) {
     return taskService.getCommentById(commentId);
   }
 }
 @Override
 public Map<String, Object> getTaskContent(long taskId) {
   synchronized (ksession) {
     return taskService.getTaskContent(taskId);
   }
 }
 @Override
 public SubTasksStrategy getSubTaskStrategy(long taskId) {
   synchronized (ksession) {
     return taskService.getSubTaskStrategy(taskId);
   }
 }
 @Override
 public List<Comment> getAllCommentsByTaskId(long taskId) {
   synchronized (ksession) {
     return taskService.getAllCommentsByTaskId(taskId);
   }
 }
Exemplo n.º 18
0
 @Override
 public List<AuditTask> getAllAuditTasks(QueryFilter filter) {
   return taskService.execute(new GetAllHistoryAuditTasksCommand(filter));
 }
Exemplo n.º 19
0
 @Override
 public List<TaskEvent> getAllTaskEvents(long taskId, QueryFilter filter) {
   return taskService.execute(new GetAuditEventsCommand(taskId, filter));
 }
 @Override
 public void claimNextAvailable(String userId, List<String> groupIds, String language) {
   synchronized (ksession) {
     taskService.claimNextAvailable(userId, groupIds, language);
   }
 }
 @Override
 public Map<Long, List<String>> getPotentialOwnersForTaskIds(List<Long> taskIds) {
   synchronized (ksession) {
     return taskService.getPotentialOwnersForTaskIds(taskIds);
   }
 }
 @Override
 public Task getTaskInstanceById(long taskId) {
   synchronized (ksession) {
     return taskService.getTaskInstanceById(taskId);
   }
 }
 @Override
 public void claim(long taskId, String userId, List<String> groupIds) {
   synchronized (ksession) {
     taskService.claim(taskId, userId, groupIds);
   }
 }
 @Override
 public List<TaskSummary> getTasksAssignedByGroups(List<String> groupIds, String language) {
   synchronized (ksession) {
     return taskService.getTasksAssignedByGroups(groupIds, language);
   }
 }
  @Test
  public void testSessionPerProcessInstance() throws Exception {
    RuntimeEnvironment environment =
        RuntimeEnvironmentBuilder.Factory.get()
            .newDefaultBuilder()
            .entityManagerFactory(emf)
            .userGroupCallback(userGroupCallback)
            .addAsset(
                ResourceFactory.newClassPathResource(
                    "org/jbpm/test/functional/timer/IntermediateCatchEventTimerCycleWithHT.bpmn2"),
                ResourceType.BPMN2)
            .schedulerService(globalScheduler)
            .get();

    long startTimeStamp = System.currentTimeMillis();
    long maxEndTime = startTimeStamp + maxWaitTime;

    manager = RuntimeManagerFactory.Factory.get().newPerProcessInstanceRuntimeManager(environment);
    // prepare task service with users and groups
    RuntimeEngine engine = manager.getRuntimeEngine(EmptyContext.get());
    TaskService taskService = engine.getTaskService();

    Group grouphr = TaskModelProvider.getFactory().newGroup();
    ((InternalOrganizationalEntity) grouphr).setId("HR");

    User mary = TaskModelProvider.getFactory().newUser();
    ((InternalOrganizationalEntity) mary).setId("mary");
    User john = TaskModelProvider.getFactory().newUser();
    ((InternalOrganizationalEntity) john).setId("john");

    ((InternalTaskService) taskService).addGroup(grouphr);
    ((InternalTaskService) taskService).addUser(mary);
    ((InternalTaskService) taskService).addUser(john);

    manager.disposeRuntimeEngine(engine);

    completedStart = 0;
    for (int i = 0; i < nbThreadsProcess; i++) {
      new StartProcessPerProcessInstanceRunnable(manager, i).run();
    }
    completedTask = 0;
    for (int i = 0; i < nbThreadsTask; i++) {
      new Thread(new CompleteTaskPerProcessInstanceRunnable(manager, i)).start();
    }
    while (completedStart < nbThreadsProcess || completedTask < nbThreadsTask) {
      Thread.sleep(100);
      if (System.currentTimeMillis() > maxEndTime) {
        fail("Failure, did not finish in time most likely hanging");
      }
    }
    // make sure all process instance were completed
    engine = manager.getRuntimeEngine(EmptyContext.get());
    AuditService logService = engine.getAuditService();
    // active
    List<? extends ProcessInstanceLog> logs =
        logService.findActiveProcessInstances("IntermediateCatchEvent");
    assertNotNull(logs);
    for (ProcessInstanceLog log : logs) {
      logger.debug("Left over {}", log.getProcessInstanceId());
    }
    assertEquals(0, logs.size());

    // completed
    logs = logService.findProcessInstances("IntermediateCatchEvent");
    assertNotNull(logs);
    assertEquals(nbThreadsProcess, logs.size());
    manager.disposeRuntimeEngine(engine);

    logger.debug("Done");
  }
 @Override
 public long addComment(long taskId, Comment comment) {
   synchronized (ksession) {
     return taskService.addComment(taskId, comment);
   }
 }
Exemplo n.º 27
0
 @Override
 public List<TaskEvent> getAllTaskEventsByProcessInstanceId(
     long processInstanceId, QueryFilter filter) {
   return taskService.execute(
       new GetAuditEventsByProcessInstanceIdCommand(processInstanceId, filter));
 }
 @Override
 public int archiveTasks(List<TaskSummary> tasks) {
   synchronized (ksession) {
     return taskService.archiveTasks(tasks);
   }
 }
Exemplo n.º 29
0
 @Override
 public List<AuditTask> getAllAuditTasksByUser(String userId, QueryFilter filter) {
   return taskService.execute(new GetAllHistoryAuditTasksByUserCommand(userId, filter));
 }
 @Override
 public void deleteComment(long taskId, long commentId) {
   synchronized (ksession) {
     taskService.deleteComment(taskId, commentId);
   }
 }