Esempio n. 1
0
  private String getSubstitutesRespString() throws ISPACException {
    if (StringUtils.isEmpty(resp)) {

      TreeSet respList = new TreeSet();
      DbCnt cnt = context.getConnection();

      try {
        Responsible user = context.getUser();
        respList.addAll(user.getRespList());

        if (mWorkMode == IWorklistAPI.SUPERVISOR) {

          SecurityMgr security = new SecurityMgr(cnt);

          // Sustituir (sustituidos por el usuario y por los grupos a los que pertenece el usuario)
          IItemCollection collection = security.getAllSubstitutes(user);
          addRespListFromEntryUID(respList, collection, "UID_SUSTITUIDO");
        }
      } finally {
        context.releaseConnection(cnt);
      }

      resp = "'" + StringUtils.join(respList, "','") + "'";
    }
    if (logger.isDebugEnabled()) {
      logger.debug("getSubstitutesRespString:" + resp);
    }
    return resp;
  }
Esempio n. 2
0
  /* (non-Javadoc)
   * @see ieci.tdw.ispac.api.IWorklistAPI#getRespString()
   */
  public String getRespString() throws ISPACException {

    if (StringUtils.isEmpty(resp)) {

      TreeSet respList = new TreeSet();
      DbCnt cnt = context.getConnection();

      try {
        Responsible user = context.getUser();
        List respListUser = user.getRespList();
        respList.addAll(respListUser);
        if (mWorkMode == IWorklistAPI.SUPERVISOR) {
          SecurityMgr securityMgr = new SecurityMgr(cnt);

          // Comprobar si el usuario tiene asignada la función de Supervisor
          if (securityMgr.isSupervisor(user.getUID())) {
            return Responsible.SUPERVISOR;
          }

          // Supervisar (supervisados del usuario, del departamento y de los grupos a los que
          // pertenece el usuario)
          IItemCollection collection = securityMgr.getAllSuperviseds(user);
          addRespListFromEntryUID(respList, collection, "UID_SUPERVISADO");
          // Sustituir (sustituidos por el usuario, por el departamento y por los grupos a los que
          // pertenece el usuario)
          collection = securityMgr.getAllSubstitutes(user);
          addRespListFromEntryUID(respList, collection, "UID_SUSTITUIDO");
        }
      } finally {
        context.releaseConnection(cnt);
      }

      resp = "'" + StringUtils.join(respList, "','") + "'";
    }
    if (logger.isDebugEnabled()) {
      logger.debug("getRespString:" + resp);
    }
    return resp;
  }