Пример #1
0
  private IItemCollection getClosedTasksCTL(
      int taskCtlId, InputStream tasklistxml, String resp, int pcdId) throws ISPACException {

    DbCnt cnt = context.getConnection();
    try {
      WLTaskListFactory wlfactory = new WLTaskListFactory();
      WLTaskListBuilder wlbuilder = null;

      wlbuilder = wlfactory.getClosedTaskListBuilder(tasklistxml);
      if (wlbuilder == null)
        throw new ISPACException(
            "No se ha podido construir WLTaskListBuilder para tramites cerrados");

      CollectionDAO coldao = wlbuilder.getTaskList(cnt, taskCtlId, resp, pcdId);
      return coldao.disconnect();
    } catch (ISPACException ie) {
      throw new ISPACException(
          "Error en WLWorklist:getClosedTasksCTL("
              + taskCtlId
              + ", tasklistxml, pcdId["
              + pcdId
              + "])",
          ie);
    } finally {
      context.releaseConnection(cnt);
    }
  }
Пример #2
0
  public CollectionDAO getSyncnodes(DbCnt cnt) throws ISPACException {
    String sql = "WHERE ID_EXP = " + getInt(IDKEY);
    CollectionDAO objlist = new CollectionDAO(TXSincNodoDAO.class);

    objlist.query(cnt, sql);
    return objlist;
  }
Пример #3
0
  /* (non-Javadoc)
   * @see ieci.tdw.ispac.api.IWorklistAPI#getTasksPCD(int, InputStream)
   */
  public IItemCollection getClosedTasksPCD(int taskPcdId, InputStream tasklistxml)
      throws ISPACException {

    String resp = getRespString();
    DbCnt cnt = context.getConnection();
    try {
      WLTaskListFactory wlfactory = new WLTaskListFactory();
      WLTaskListBuilder wlbuilder = null;

      wlbuilder = wlfactory.getClosedTaskListBuilder(tasklistxml);
      if (wlbuilder == null)
        throw new ISPACException(
            "No se ha podido construir WLTaskListBuilder para tramites cerrados");

      CollectionDAO coldao =
          wlbuilder.getTaskList(
              cnt,
              ISPACEntities.ENTITY_NULLREGKEYID,
              resp,
              ISPACEntities.ENTITY_NULLREGKEYID,
              taskPcdId);
      return coldao.disconnect();
    } catch (ISPACException ie) {
      throw new ISPACException(
          "Error en WLWorklist:getClosedTasksPCD(" + taskPcdId + ", tasklistxml)", ie);
    } finally {
      context.releaseConnection(cnt);
    }
  }
Пример #4
0
  public void deletePermission(int typeObject, int idObject, String resp, int typePermission)
      throws ISPACException {
    StringBuffer sqlWhere = new StringBuffer();
    CollectionDAO objlist = null;
    sqlWhere.append(" WHERE PERMISO= ").append(typePermission);

    switch (typePermission) {
      case ISecurityAPI.PERMISSION_INIT_EXP_PCD:
      case ISecurityAPI.PERMISSION_DELETE_EXP_PCD:
        sqlWhere
            .append(" AND ID_PCD = ")
            .append(idObject)
            .append(" AND UID_USR = '******' ");
        objlist = new CollectionDAO(PermissionsDAO.class);
        objlist.delete(mDbCnt, sqlWhere.toString());
        break;
      default:
        sqlWhere
            .append(" AND TP_OBJ = ")
            .append(typeObject)
            .append(" AND ID_OBJ = ")
            .append(idObject)
            .append(" AND ID_RESP = '")
            .append(DBUtil.replaceQuotes(resp))
            .append("' ");
        objlist = new CollectionDAO(PermissionDAO.class);
        objlist.delete(mDbCnt, sqlWhere.toString());
    }
  }
Пример #5
0
  public IItemCollection getSubProcesses(int pcdId, int idActivityPCD, InputStream istream)
      throws ISPACException {

    DbCnt cnt = null;

    try {

      cnt = context.getConnection();
      WLWorklistFactory wlfactory = new WLWorklistFactory();
      WLProcessListBuilder wlbuilder = wlfactory.getProcessListBuilder(istream);
      if (wlbuilder == null) {
        throw new ISPACException("No se ha podido construir WLProcessListBuilder");
      }

      CollectionDAO coldao =
          wlbuilder.getWorklist(
              cnt, pcdId, idActivityPCD, getRespStringSubProceso(idActivityPCD, 0));
      return coldao.disconnect();

    } catch (ISPACException ie) {
      logger.error("Error al obtener los subprocesos", ie);
      throw new ISPACException("Error en WorklistAPI:getSubProcesses(" + idActivityPCD + ")", ie);
    } finally {
      context.releaseConnection(cnt);
    }
  }
Пример #6
0
 public IStage getStage(DbCnt cnt, int stagePcdId) throws ISPACException {
   String sql = "WHERE ID_EXP = " + getInt(IDKEY) + " AND ID_FASE = " + stagePcdId;
   CollectionDAO objlist = new CollectionDAO(TXFaseDAO.class);
   objlist.query(cnt, sql);
   if (objlist.next()) return (IStage) objlist.value();
   return null;
 }
Пример #7
0
 public IItemCollection getSubstitutesHistorics(String sustitutoUID) throws ISPACException {
   CollectionDAO collDAO =
       SustitucionDAO.getSustitutosHistorics(
           mDbCnt,
           sustitutoUID,
           DBUtil.getToDateByBD(mDbCnt, new Date(System.currentTimeMillis())));
   return collDAO.disconnect();
 }
Пример #8
0
  public IItemCollection getPermissions(int typeObject, int idObject, int[] typePermissions)
      throws ISPACException {
    CollectionDAO coldao =
        PermissionDAO.getPermissions(mDbCnt, typeObject, idObject, typePermissions);

    List list = new ArrayList();
    while (coldao.next()) {

      ObjectDAO permission = coldao.value();
      String respName = permission.getString("RESP_NAME");
      if (StringUtils.isBlank(respName)) {

        String idResp = permission.getString("ID_RESP");
        IResponsible responsible = null;

        try {
          responsible = getResp(idResp);
          // } catch (ISPACException ie) {
        } catch (Exception ie) {
          // java.lang.NumberFormatException
          // si el ID_RESP no es un UID y es el nombre del responsable
        }

        /*
        if (responsible != null) {

        	// Establecer el nombre del responsable
        	permission.set("RESP_NAME", responsible.getRespName());
        	permission.store(mDbCnt);
        } else {
        	// Eliminar el permiso asociado al responsable que ya no existe
        	// permission.delete(mDbCnt);
        	// No eliminar sino no incluirlo en la lista
        	permission = null;
        }
        */

        if (responsible != null) {
          // Establecer el nombre del responsable
          permission.set("RESP_NAME", responsible.getRespName());
          permission.store(mDbCnt);
        }
        /*else {
        	// Establecer el ID como nombre del responsable
        	permission.set("RESP_NAME", idResp);
        }
        permission.store(mDbCnt);
        */
      }

      if (permission != null) {
        list.add(permission);
      }
    }

    return new ListCollection(list);
  }
Пример #9
0
  public IItemCollection getRespPermissions(int idpcd, String uid) throws ISPACException {
    CollectionDAO coldao = PermissionsDAO.getPermissions(mDbCnt, idpcd, uid);
    List list = new ArrayList();
    if (coldao.next()) {
      IResponsible resp = getResp(uid);
      list.add(resp);
    }

    return new ListCollection(list);
  }
Пример #10
0
  public static int countProcess(DbCnt cnt, String numexp, String query) throws ISPACException {
    String sql = "WHERE ";
    if (StringUtils.isNotBlank(numexp)) {
      sql += " NUMEXP = '" + DBUtil.replaceQuotes(numexp) + "'";
    }
    if (sql != null && sql.length() > 0) sql += query;

    CollectionDAO objlist = new CollectionDAO(TXProcesoDAO.class);
    return objlist.count(cnt, sql);
  }
Пример #11
0
  public static IItemCollection getProcessBPM(DbCnt cnt, String idProcessBPM, ClientContext ctx)
      throws ISPACException {
    Object[] argsarr = new Object[1];
    argsarr[0] = ctx;

    String sql = "WHERE ID_PROCESO_BPM = '" + idProcessBPM + "'";

    CollectionDAO objlist = new CollectionDAO(TXProcesoDAO.class, argsarr);
    objlist.query(cnt, sql);
    return objlist.disconnect();
  }
Пример #12
0
  public IItemCollection getRespPermissions(int idpcd, int codePermission) throws ISPACException {
    CollectionDAO coldao = PermissionsDAO.getPermissions(mDbCnt, idpcd, codePermission);
    List list = new ArrayList();
    while (coldao.next()) {
      ObjectDAO dao = coldao.value();
      String uid = dao.getString("UID_USR");
      IResponsible resp = getResp(uid);
      list.add(resp);
    }

    return new ListCollection(list);
  }
Пример #13
0
  private static IItemCollection getProcesses(
      DbCnt cnt, int idProcedimiento, ClientContext ctx, int type) throws ISPACException {
    Object[] argsarr = new Object[1];
    argsarr[0] = ctx;

    String sql = "WHERE ID_PCD = " + idProcedimiento + " AND TIPO = " + type;

    CollectionDAO objlist = new CollectionDAO(TXProcesoDAO.class, argsarr);
    objlist.query(cnt, sql);

    return objlist.disconnect();
  }
Пример #14
0
  private static IItemCollection getProcess(DbCnt cnt, String numexp, ClientContext ctx, int type)
      throws ISPACException {
    Object[] argsarr = new Object[1];
    argsarr[0] = ctx;

    String sql = "WHERE NUMEXP = '" + DBUtil.replaceQuotes(numexp) + "' AND TIPO = " + type;

    CollectionDAO objlist = new CollectionDAO(TXProcesoDAO.class, argsarr);
    objlist.query(cnt, sql);

    return objlist.disconnect();
  }
Пример #15
0
  public static CollectionDAO getOutdatedProcess(DbCnt cnt) throws ISPACException {
    String sql =
        new StringBuffer("WHERE ESTADO=")
            .append(IProcess.OPEN)
            .append(" AND FECHA_LIMITE <= ")
            .append(DBUtil.getToDateByBD(cnt, new Date()))
            .append(" ORDER BY ID ASC ")
            .toString();

    CollectionDAO objlist = new CollectionDAO(TXProcesoDAO.class);
    objlist.query(cnt, sql);
    return objlist;
  }
Пример #16
0
  public IItemCollection getProcesses(String[] numexps) throws ISPACException {

    DbCnt cnt = context.getConnection();
    try {
      WLProcessDAO process = new WLProcessDAO(cnt);
      CollectionDAO colDao = process.loadProcessByNumExps(cnt, numexps);
      return colDao.disconnect();
    } catch (ISPACException ie) {
      throw new ISPACException("Error en WLWorklist:getProcesses(" + numexps.toString() + ")", ie);
    } finally {
      context.releaseConnection(cnt);
    }
  }
Пример #17
0
  public boolean testClosed(DbCnt cnt) throws ISPACException {
    String sql = "WHERE ID_EXP = " + getInt(IDKEY);
    CollectionDAO objlist = new CollectionDAO(TXTramiteDAO.class);
    if (objlist.exist(cnt, sql)) return false;

    sql = "WHERE ID_EXP = " + getInt(IDKEY);
    objlist = new CollectionDAO(TXFaseDAO.class);
    if (objlist.exist(cnt, sql)) return false;

    sql = "WHERE ID_EXP = " + getInt(IDKEY);
    objlist = new CollectionDAO(TXSincNodoDAO.class);
    if (objlist.exist(cnt, sql)) return false;

    return true;
  }
Пример #18
0
  /**
   * Devuelve cierto si el usuario tiene el permiso
   *
   * @param respList cadena de responsabilidad
   * @param type Tipo de permiso a comprobar 0-->Eliminar expediente (enviar a la papelera)
   *     1->Iniciar expediente
   * @param idpcd Identificador del procedimiento para el que se va a comprobar el permiso
   * @return Cierto si el usuario tiene el permiso, falso en caso contrario
   * @throws ISPACException
   */
  public boolean isPermission(String respList, int type, int idpcd) throws ISPACException {

    if (!respList.equals(Responsible.SUPERVISOR)) {
      String sql =
          "WHERE ID_PCD = "
              + idpcd
              + DBUtil.addAndInResponsibleCondition("UID_USR", respList)
              + " AND PERMISO="
              + type;

      CollectionDAO objlist = new CollectionDAO(PermissionsDAO.class);
      return objlist.exist(mDbCnt, sql);
    }
    return false;
  }
Пример #19
0
  public CollectionDAO getSubprocess(DbCnt cnt, String numexp) throws ISPACException {
    try {

      String sql =
          "WHERE NUMEXP = '"
              + DBUtil.replaceQuotes(numexp)
              + "' AND TIPO="
              + IProcess.SUBPROCESS_TYPE;
      ;
      CollectionDAO objlist = new CollectionDAO(TXProcesoDAO.class);
      objlist.query(cnt, sql);
      return objlist;
    } catch (ISPACException e) {
      throw new ISPACException("Error en TXProcesoDAO:getSubprocess()", e);
    }
  }
Пример #20
0
  /**
   * Elimina todos los permisos de un responsable para un idObject en particular.
   *
   * @param typeObject
   * @param idObject
   * @param resp
   * @throws ISPACException
   */
  public void deletePermission(int typeObject, int idObject, String resp) throws ISPACException {
    StringBuffer sqlWhere = new StringBuffer();

    sqlWhere
        .append(" WHERE  ")
        .append(" TP_OBJ = ")
        .append(typeObject)
        .append(" AND ID_OBJ = ")
        .append(idObject)
        .append(" AND ID_RESP = '")
        .append(DBUtil.replaceQuotes(resp))
        .append("' ");

    CollectionDAO objlist = new CollectionDAO(PermissionDAO.class);
    objlist.delete(mDbCnt, sqlWhere.toString());
  }
Пример #21
0
 public String getDeadlineXML(DbCnt cnt) throws ISPACException {
   // obtener el id del proceso
   int idProcedure = getIdProcedure();
   CollectionDAO collDAO =
       PPlazoDAO.getDeadline(cnt, PRelPlazoDAO.DEADLINE_OBJ_PROCEDURE, idProcedure);
   // con el id del proceso obtener el plazo
   if (collDAO != null) {
     IItemCollection coll = collDAO.disconnect();
     if (coll != null) {
       List collList = coll.toList();
       for (Iterator iter = collList.iterator(); iter.hasNext(); ) {
         IItem element = (IItem) iter.next();
         String plazo = element.getString("PLAZO");
         return plazo;
       }
     }
   }
   return null;
 }
Пример #22
0
  /* (non-Javadoc)
   * @see ieci.tdw.ispac.api.IWorklistAPI#getProcesses(int)
   */
  public IItemCollection getProcesses(int idStagePCD, String path) throws ISPACException {
    String resp = getRespString();
    DbCnt cnt = context.getConnection();
    try {
      WLWorklistFactory wlfactory = new WLWorklistFactory();
      WLProcessListBuilder wlbuilder = null;

      wlbuilder = wlfactory.getProcessListBuilder(path);
      if (wlbuilder == null)
        throw new ISPACException("No se ha podido construir WLProcessListBuilder");

      CollectionDAO coldao = wlbuilder.getWorklist(cnt, idStagePCD, resp);
      return coldao.disconnect();
    } catch (ISPACException ie) {
      throw new ISPACException("Error en WLWorklist:getProcesses(" + idStagePCD + ")", ie);
    } finally {
      context.releaseConnection(cnt);
    }
  }
Пример #23
0
  /* (non-Javadoc)
   * @see ieci.tdw.ispac.api.IWorklistAPI#getCreateProcedures()
   */
  public IItemCollection getCreateProcedures() throws ISPACException {
    // Si es supervisor podra crear todos, sino le corresponderan los suyos y y los que pueden crear
    // los que sustituye
    String resp = null;

    DbCnt cnt = context.getConnection();
    try {
      Responsible user = context.getUser();
      SecurityMgr securityMgr = new SecurityMgr(cnt);
      // Comprobar si el usuario tiene asignada la función de Supervisor Total
      if (securityMgr.isSupervisorTotal(user.getUID())) {
        resp = Responsible.SUPERVISOR;
      } else {
        // los que sustituye
        resp = getSubstitutesRespString();
      }

      CollectionDAO pcdset = new CollectionDAO(PProcedimientoDAO.class);

      /* Procedimientos en vigor */
      String sqlquery =
          "WHERE ESTADO="
              + IProcedure.PCD_STATE_CURRENT
              + " AND TIPO="
              + IProcedure.PROCEDURE_TYPE
              + " AND ID IN"
              + " (SELECT ID_PCD FROM SPAC_SS_PERMISOS WHERE  PERMISO="
              + ISecurityAPI.ISPAC_RIGHTS_CREATEEXP
              + DBUtil.addAndInResponsibleCondition("UID_USR", resp)
              + ") ORDER BY NOMBRE";

      pcdset.query(cnt, sqlquery);

      return pcdset.disconnect();
    } catch (ISPACException ie) {
      throw new ISPACException("Error en WLWorklist:getProcs()", ie);
    } finally {
      context.releaseConnection(cnt);
    }
  }
Пример #24
0
  public void deletePermissions(int idpcd, String uid) throws ISPACException {
    String sql = "WHERE ID_PCD = " + idpcd + " AND UID_USR = '******'";

    CollectionDAO objlist = new CollectionDAO(PermissionsDAO.class);
    objlist.delete(mDbCnt, sql);
  }
Пример #25
0
  public IItemCollection getPermissionsResp(int typeObject, int idObject, String uid)
      throws ISPACException {

    CollectionDAO coldao = PermissionDAO.getPermissions(mDbCnt, typeObject, idObject, uid);
    return coldao.disconnect();
  }
Пример #26
0
 public IItemCollection getSustitutos(String uidSustituido) throws ISPACException {
   CollectionDAO collDAO = SustitucionDAO.getSustitutos(mDbCnt, uidSustituido);
   return collDAO.disconnect();
 }
Пример #27
0
 public Map getPermissions(EntityDAO entity, String resp) throws ISPACException {
   CollectionDAO collDAO = PermissionDAO.getPermissions(mDbCnt, entity, resp);
   return collDAO.toMap(PermissionDAO.FIELD_PERMISION_TYPE);
 }
Пример #28
0
 public void deleteSyncNodes(DbCnt cnt) throws ISPACException {
   String sql = "WHERE ID_EXP = " + getInt(IDKEY);
   CollectionDAO objlist = new CollectionDAO(TXSincNodoDAO.class);
   objlist.delete(cnt, sql);
 }
Пример #29
0
 public IItemCollection getSubstitutes(String sustitutoUID) throws ISPACException {
   CollectionDAO collDAO = SustitucionDAO.getSubstitutes(mDbCnt, sustitutoUID);
   return collDAO.disconnect();
 }
Пример #30
0
 public IItemCollection getSubstitutes(int idFechSustitucion) throws ISPACException {
   CollectionDAO collDAO = SustitucionDAO.getSubstitutes(mDbCnt, idFechSustitucion);
   return collDAO.disconnect();
 }