public List<UserProject> listProjectMembers(Integer projectIDValue) {
   List<UserProject> userProject = userProjectHome.findByProjectID(projectIDValue);
   // System.out.println("listProjectMembers(Integer " + projectIDValue +
   // ")   " + userProject.size() + "  " +
   // userProject.get(0).getUsers().getFirstName());
   return userProject;
 }
  public void modifyProjectMember() {
    System.out.println("userIDValue: " + userIDValue);

    this.userProjectHome.setId(new UserProjectId(projectIDValue, userIDValue));
    currentUserProject = this.userProjectHome.getInstance();

    List<UserProject> userProjectList =
        userProjectHome.findByProjectID(currentUserProject.getId().getProjectId());
    System.out.println("Number of users in project:" + userProjectList.size());

    boolean actionAuthorised = false;
    boolean attemptToModifyOwner = false;

    if (userProjectList.size() > 0) {
      setAndGetUserRole(userProjectsList(), projectIDValue);

      System.out.println(
          String.format("Check if %s is authorised to modify a project member", currentRole));
      actionAuthorised = isAuthorisedToAlterUserRole();

      if (actionAuthorised) {
        System.out.println("Yes, the user is authorised.");

        /** Look through each user in the project */
        System.out.println(
            String.format("There are %d users in this project", userProjectList.size()));
        for (int i = 0; i < userProjectList.size(); i++) {
          UserProject workingUserProject = userProjectList.get(i);
          System.out.println(
              String.format(
                  "Check who we are dealing with. Does user id %d match the current id %d?",
                  workingUserProject.getId().getUserId(), currentUserProject.getId().getUserId()));
          System.out.println(
              String.format("Project Name is %s", workingUserProject.getProject().getName()));
          if (workingUserProject.getId().getUserId() != currentUserProject.getId().getUserId()) {
            System.out.println("No, it doesn't!");
          } else {
            System.out.println(
                String.format(
                    "Yes, this is it. So we want to alter the role of user %d who has role of <%s>",
                    workingUserProject.getId().getUserId(), workingUserProject.getUserRole()));
            /*
             * We know the user doing the work is authorised to do it. Now
             * check if the user to be changed is owner.
             */
            try {
              attemptToModifyOwner =
                  (IAMRoleManager.getInstance()
                          .getOwnerRole()
                          .equals(workingUserProject.getUserRole())
                      || SystemVars.treatAdminAsOwner(workingUserProject.getUserRole()));
            } catch (MalformedURLException e) {
              e.printStackTrace();
            } catch (IOException e) {
              e.printStackTrace();
            }
            if (attemptToModifyOwner) {
              System.out.println("Attempt to modify owner");
              editProjectMemberErrorMessage =
                  "You cannot modify the project owner! Change in role not allowed";
              editProjectMemberInclude = "/popup/editProjectMemberError.xhtml";
            } else {
              System.out.println(
                  String.format(
                      "Role %s is modifyable - so let's modify!",
                      workingUserProject.getUserRole()));
            }
          }

          break;
        }
        if (attemptToModifyOwner) {
          editProjectMemberErrorMessage =
              "You cannot modify the project owner! Change in role not allowed";
          editProjectMemberInclude = "/popup/editProjectMemberError.xhtml";
        } else {
          editProjectMemberInclude = "/popup/editProjectMemberForm.xhtml";
        }
      } else {
        setupErrorFields();
      }
    } else {
      System.out.println("Error - no users in the project. This should never happen.");
    }
    Contexts.getSessionContext().set("currentUserProject", currentUserProject);
  }