Example #1
0
  /**
   * Converts WorkingUser to Actors
   *
   * @return an object implementing Actor interface
   */
  public Collection<Actor> toActors() throws WorkflowException {
    State state = processInstance.getProcessModel().getState(this.state);
    Collection<Actor> actors = new ArrayList<>();

    // first add user by id
    if (this.getUserId() != null) {
      User user = WorkflowHub.getUserManager().getUser(this.getUserId());
      actors.add(new ActorImpl(user, role, state));
    }

    // then add users by group or role
    if (StringUtil.isDefined(getGroupId())) {
      User[] users = WorkflowHub.getUserManager().getUsersInGroup(getGroupId());
      for (User anUser : users) {
        actors.add(new ActorImpl(anUser, role, state));
      }
    } else {
      // then add users by role
      if (this.usersRole != null) {
        User[] users =
            WorkflowHub.getUserManager().getUsersInRole(usersRole, processInstance.getModelId());
        for (User anUser : users) {
          actors.add(new ActorImpl(anUser, role, state));
        }
      }
    }

    return actors;
  }
Example #2
0
  /**
   * Get User information from an array of workingUsers
   *
   * @param workingUsers an array of WorkingUser objects
   * @return an array of objects implementing User interface and containing user details
   */
  public static User[] toUser(WorkingUser[] workingUsers) throws WorkflowException {
    String[] userIds = new String[workingUsers.length];

    for (int i = 0; i < workingUsers.length; i++) {
      userIds[i] = workingUsers[i].getUserId();
    }

    return WorkflowHub.getUserManager().getUsers(userIds);
  }
Example #3
0
  /**
   * Converts WorkingUser to Actor
   *
   * @return an object implementing Actor interface
   */
  public Actor toActor() throws WorkflowException {
    State state = processInstance.getProcessModel().getState(this.state);
    User user = WorkflowHub.getUserManager().getUser(this.getUserId());

    return new ActorImpl(user, role, state);
  }
Example #4
0
 /**
  * Converts WorkingUser to User
  *
  * @return an object implementing User interface and containing user details
  */
 public User toUser() throws WorkflowException {
   return WorkflowHub.getUserManager().getUser(this.getUserId());
 }