Beispiel #1
0
  /**
   * Obtener el contenido del documento que tenga asignado el CSV recibido.
   *
   * @param context Contexto de tramitación.
   * @param csv CSV del documento
   * @return Contenido del documento.
   * @throws ISPACException Si se produce algún error.
   */
  public static byte[] getContenidoDocumento(IClientContext context, String csv)
      throws ISPACException {

    // Contenido del documento
    byte[] content = null;

    // Consulta
    String sqlQuery = "WHERE COD_COTEJO = '" + DBUtil.replaceQuotes(csv) + "'";
    IItemCollection documents =
        context.getAPI().getEntitiesAPI().queryEntities(SpacEntities.SPAC_DT_DOCUMENTOS, sqlQuery);
    if (documents.next()) {

      IItem document = documents.value();

      // Obtener el identificador del documento en el repositorio
      String guid = document.getString("INFOPAG_RDE");
      if (StringUtils.isBlank(guid)) {
        guid = document.getString("INFOPAG");
      }

      // Obtener el contenido del documento
      content =
          ieci.tdw.ispac.services.helpers.DocumentsHelper.getContenidoDocumento(context, guid);
    }

    return content;
  }
  /**
   * Obtiene el conector de proceso de firma. Portafirmas
   *
   * @return Conector de de proceso de firma. Portafirmas
   * @throws ISPACException si ocurre algún error.
   */
  public ProcessSignConnector getProcessSignConnector() throws ISPACException {

    ProcessSignConnector processSignConnector = null;

    // Comprobar que se haya establecido el nombre de la clase
    if (StringUtils.isBlank(className)) {
      return new ProcessSignConnectorImpl();
    }

    try {

      // Cargar la clase
      Class clazz = Class.forName(className);
      if (!ProcessSignConnector.class.isAssignableFrom(clazz)) {
        throw new ISPACException(className + " no implementa el interfaz ProcessSignConnector");
      }

      // Instanciar la clase
      processSignConnector = (ProcessSignConnector) clazz.newInstance();

      if (logger.isDebugEnabled()) {
        logger.debug("ProcessSignConnector creado [" + className + "]");
      }
    } catch (Exception e) {
      logger.error("Error al instanciar el conector del proceso de firma. Portafirmas", e);
      throw new ISPACException(e);
    }

    return processSignConnector;
  }
Beispiel #3
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);
  }
  public List validate(String name, SessionAPI session) throws ISPACException {

    ArrayList mErrorList = new ArrayList();

    ValidationError error = null;

    if (StringUtils.isBlank(name)) {

      error =
          new ValidationError(
              "property(NEW_CALENDAR_NAME)",
              "errors.required",
              new String[] {
                Messages.getString(
                    session.getClientContext().getAppLanguage(), "form.calendar.propertyLabel.name")
              });
      mErrorList.add(error);
    } else {
      IInvesflowAPI invesFlowAPI = session.getAPI();
      ICatalogAPI catalogAPI = invesFlowAPI.getCatalogAPI();

      // Bloqueo
      IItemCollection itemcol = catalogAPI.queryCTEntities(ICatalogAPI.ENTITY_SPAC_CALENDARIOS, "");
      // Nombre único de calendario

      itemcol =
          (IItemCollection)
              catalogAPI.queryCTEntities(
                  ICatalogAPI.ENTITY_SPAC_CALENDARIOS,
                  " WHERE NOMBRE = '" + DBUtil.replaceQuotes(name) + "'");
      if (itemcol.next()) {

        error =
            new ValidationError(
                "property(NEW_CALENDAR_NAME)",
                "error.calendar.nameDuplicated",
                new String[] {name});
        mErrorList.add(error);
      }
    }
    return mErrorList;
  }