Example usage for org.apache.commons.validator ValidatorException ValidatorException

List of usage examples for org.apache.commons.validator ValidatorException ValidatorException

Introduction

In this page you can find the example usage for org.apache.commons.validator ValidatorException ValidatorException.

Prototype

public ValidatorException(String message) 

Source Link

Document

Constructs an Exception with the specified detail message.

Usage

From source file:es.pode.administracion.presentacion.logs.eliminar.EliminarLogControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.logs.eliminar.EliminarLogController#eliminarLogs(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.logs.eliminar.EliminarLogsForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *//*from   w w  w  .jav  a2 s  .co  m*/
public final void eliminarLogs(ActionMapping mapping,
        es.pode.administracion.presentacion.logs.eliminar.EliminarLogsForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    try {

        String listaId = request.getParameter("listaId");
        if (log.isDebugEnabled())
            log.debug("los ids de nodos que se quieren eliminar son " + listaId);
        String[] logs = listaId.split(":");
        if (log.isDebugEnabled())
            log.debug("los ids de nodos que se quieren eliminar son " + listaId);
        SrvLogService logService = this.getSrvLogService();
        ValidaBajaLogVO bajaLogVO = logService.eliminarFicheroLog(logs);
        form.setLogsBorrados(bajaLogVO.getLogsBorrados());
        form.setResultado(bajaLogVO.getDescripcionBaja());

    } catch (Exception e) {
        log.error("Se ha producido un error al eliminar el nodo: " + e);
        throw new ValidatorException("{errors.borrarNodo}");
    }
}

From source file:es.pode.administracion.presentacion.adminusuarios.listarUsuarios.ListarUsuariosControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.adminusuarios.listarUsuarios.ListarUsuariosController#obtenerUsuarios(org.apache.struts.action.ActionMapping,
 *      es.pode.administracion.presentacion.adminusuarios.listarUsuarios.ObtenerUsuariosForm,
 *      javax.servlet.http.HttpServletRequest,
 *      javax.servlet.http.HttpServletResponse)
 *///from  w  w  w .  ja  va2  s  . co m
public final void obtenerUsuarios(ActionMapping mapping,
        es.pode.administracion.presentacion.adminusuarios.listarUsuarios.ObtenerUsuariosForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

    //AltaUsuarioBSession altaUsuarioBSession = this.getAltaUsuarioBSession(request);
    // el idioma ser el que tenga en el atributo idioma del usuario
    // que esta en sesion.
    try {
        this.removeAltaUsuarioBSession(request);
        this.removeModificarUsuarioBSession(request);

        UsuarioVO[] usuarioVO = this.getSrvAdminUsuariosService().listarUsuarios();
        if (log.isDebugEnabled())
            log.debug("Obtenemos los usuarios");
        form.setUsuariosAsArray(usuarioVO);
    } catch (Exception e) {
        log.error("Error: " + e);
        throw new ValidatorException("{errors.listarUsuario}");
    }
}

From source file:es.pode.administracion.presentacion.informes.eliminarInformesFederados.EliminarInformesFederadosControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.informes.eliminarInformesFederados.EliminarInformesFederadosController#obtenerInformeFederado(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.informes.eliminarInformesFederados.ObtenerInformeFederadoForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *///  w  w  w. java  2 s .c om
public final void obtenerInformeFederado(ActionMapping mapping,
        es.pode.administracion.presentacion.informes.eliminarInformesFederados.ObtenerInformeFederadoForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    try {

        Iterator iter = (form.getIds()).iterator();
        int i = 0;
        String listaId = "";
        while (iter.hasNext()) {
            String nombre = (String) iter.next();
            listaId = listaId + nombre + ":";
            i = i + 1;
        }
        form.setListaId(listaId.trim());
        form.setInformes((String[]) form.getIds().toArray(new String[0]));

    } catch (Exception e) {
        logger.error("Se ha producido un error al recuperar los informes federados: " + e);
        throw new ValidatorException("{errors.obtenerInformeFederado}");
    }
}

From source file:es.pode.administracion.presentacion.catalogacion.altaCatalogadores.AltaCatalogadoresControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.catalogacion.altaCatalogadores.AltaCatalogadoresController#altaCatalogadores(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.catalogacion.altaCatalogadores.AltaCatalogadoresForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *//*from  www. j  a  v  a  2 s .com*/
public final void altaCatalogadores(ActionMapping mapping,
        es.pode.administracion.presentacion.catalogacion.altaCatalogadores.AltaCatalogadoresForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    try {
        String descripcion = form.getDescripcion();
        String nombre = form.getNombre();

        GrupoTrabajoVO grupoTrabajo = new GrupoTrabajoVO();
        SrvAdminUsuariosService srvAdminUsuariosService = this.getSrvAdminUsuariosService();

        Pattern mask = Pattern.compile("[^\\\\?\\\\!\\>\\#\\&\\<\\@\\$\\/\\\'\\\"]+");
        Matcher matcher = null;

        if ((nombre == null) || (nombre.length() == 0)) {
            if (log.isDebugEnabled())
                log.debug("el nombre introducido es nulo");
            throw new ValidatorException("{errors.altagrupo.descripcion}");

        } else {
            matcher = mask.matcher(nombre);
            if (!matcher.matches()) {
                if (log.isDebugEnabled())
                    log.debug("nombre caracter ilegal");
                throw new ValidatorException("{errors.altagrupo.descripcion.caracterIlegal}");
            }

            matcher = mask.matcher(descripcion);
            if (!matcher.matches()) {
                if (log.isDebugEnabled())
                    log.debug("descripcion caracter ilegal");
                throw new ValidatorException("{errors.altaGrupoTrabajo.caracterIlegal.descripcion}");
            }

            if ((srvAdminUsuariosService.existeNombreTrabajo(nombre, Long.valueOf("-1"))).booleanValue()) {
                if (log.isDebugEnabled())
                    log.debug("ya existe la descripcion");
                throw new ValidatorException("{errors.altagrupo.descripcionExistente}");
            } else {
                grupoTrabajo.setNombre(nombre);
                grupoTrabajo.setDescripcion(descripcion);

                Long identificador = srvAdminUsuariosService.altaGrupoTrabajo(grupoTrabajo);
                form.setIdModificado(identificador);
            }
        }
    } catch (ValidatorException e) {
        throw e;
    } catch (Exception e) {
        log.error("Error: " + e);
        throw new ValidatorException("{errors.altagrupo}");
    }

}

From source file:es.pode.administracion.presentacion.adminusuarios.VerGrupo.VerGrupoControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.adminusuarios.VerGrupo.VerGrupoController#recuperarDescripcion(org.apache.struts.action.ActionMapping,
 *      es.pode.administracion.presentacion.adminusuarios.VerGrupo.RecuperarDescripcionForm,
 *      javax.servlet.http.HttpServletRequest,
 *      javax.servlet.http.HttpServletResponse)
 *///  w  w  w  . ja  va  2 s  .  co m
public final void recuperarDescripcion(ActionMapping mapping,
        es.pode.administracion.presentacion.adminusuarios.VerGrupo.RecuperarDescripcionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

    try {

        Long id = Long.valueOf(request.getParameter("id"));
        GrupoVO grupo = this.getSrvAdminUsuariosService().descripcionGrupo(id);
        form.setDescripcion(grupo.getDescripcion());
        form.setId(id);
        Set set = new HashSet();
        RolVO[] grupos = this.getSrvAdminUsuariosService().descripcionGrupo(id).getRols();
        for (int i = 0; i < grupos.length; i++) {
            set.add(grupos[i]);
        }
        if (log.isDebugEnabled())
            log.debug("Tamanio de la lista de roles del grupo seleccionado " + set.size());
        form.setRoles(set);

    } catch (Exception e) {
        log.error("Error: " + e);
        throw new ValidatorException("{verGrupo.error}");
    }
}

From source file:es.pode.administracion.presentacion.informes.listarInformesFederados.ListarInformesFederadosControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.informes.listarInformesFederados.ListarInformesFederadosController#listarInformesFederados(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.informes.listarInformesFederados.ListarInformesFederadosForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *///from www . ja  v a 2  s . c om
public final void listarInformesFederados(ActionMapping mapping,
        es.pode.administracion.presentacion.informes.listarInformesFederados.ListarInformesFederadosForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

    try {
        SrvInformeService srvInformeService = this.getSrvInformeService();
        InformeVO[] informes = srvInformeService.listarInformesFederados();
        form.setInformesAsArray(cambiarFechaInforme(informes));
    } catch (Exception e) {
        logger.error("Se ha producido un error al listar los informes federados: " + e);
        throw new ValidatorException("{errors.listarInformesFederados}");
    }
}

From source file:es.pode.administracion.presentacion.planificador.eliminarTrabajoEjecutado.EliminarTrabajoControllerImpl.java

/**
 * metodo que obtiene los trabajos que se han seleccionado para eliminar
 *///from  www  .  ja v a 2  s . c o  m
public final void obtenerTrabajos(org.apache.struts.action.ActionMapping mapping,
        es.pode.administracion.presentacion.planificador.eliminarTrabajoEjecutado.ObtenerTrabajosForm form,
        javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
        throws java.lang.Exception {
    String[] arrayIds;
    String listaIds = "";
    String nombreServidor = "";
    String[] arrayNombreServidor;

    try {

        arrayIds = (String[]) form.getIdsAsArray();
        String[] listaNombres = new String[arrayIds.length];

        //Construimos el array de nombres
        for (int i = 0; i < arrayIds.length; i++) {
            nombreServidor = this.getSrvPlanificadorService().obtenerTrabajoEjecutado(new Long(arrayIds[i]))
                    .getTrabajo();
            arrayNombreServidor = nombreServidor.split("!!");

            listaNombres[i] = new String();
            listaNombres[i] = arrayNombreServidor[0];
            log.debug("trabajo a eliminar: " + listaNombres[i]);
            listaIds = listaIds + arrayIds[i] + "#";

        }

        form.setListaIds(listaIds);
        form.setListaNombres(listaNombres);

    } catch (Exception e) {
        log.error("Error: " + e);
        throw new ValidatorException("{tareas.error}");
    }
}

From source file:es.pode.administracion.presentacion.adminusuarios.listarUsuariosPendientes.ListarUsuariosPendientesControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.adminusuarios.listarUsuariosPendientes.ListarUsuariosPendientesController#obtenerUsuariosPendientes(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.adminusuarios.listarUsuariosPendientes.ObtenerUsuariosPendientesForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *//* ww  w. jav a2s. c  o  m*/
public final void obtenerUsuariosPendientes(ActionMapping mapping,
        es.pode.administracion.presentacion.adminusuarios.listarUsuariosPendientes.ObtenerUsuariosPendientesForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

    // el idioma ser el que tenga en el atributo idioma del usuario
    // que esta en sesion.
    try {

        UsuarioVO[] usuarioVO = this.getSrvAdminUsuariosService().listarUsuariosPendientes();
        if (log.isDebugEnabled())
            log.debug("Obtenemos los usuarios pendientes de dar de alta");
        form.setUsuariosAsArray(usuarioVO);
    } catch (Exception e) {
        log.error("Error: " + e);
        throw new ValidatorException("{errors.listarUsuariosPendientes}");
    }
}

From source file:es.pode.empaquetador.presentacion.avanzado.recursos.crear.tipo.CrearRecursoAvanzadoTipoControllerImpl.java

public final java.lang.String selectAction(ActionMapping mapping,
        es.pode.empaquetador.presentacion.avanzado.recursos.crear.tipo.SelectActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    /*/*from w w w.  j  ava2 s . co m*/
     * Metodo de decision para el action. Analiza los parametros
     * actionSubmit (value de los botones submit) para redirigir al caso de
     * uso correspondiente. El actionSubmit llegara internacionalizado, por
     * lo que es necesario acceder al ResouceBundle para obtener el valor
     * correcto en la comparacion.
     */

    String result = null;
    String actionSubmit = form.getAction();
    java.util.Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE);
    ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale);

    if (form.getAction() == (null)) {
        throw new ValidatorException("{portal_empaquetado.exception}");
    }
    // Cancelar
    else if (actionSubmit.equals(i18n.getString("portalempaquetado.avanzado.recursos.crear.paso1.cancelar"))) {
        result = "Cancelar";
    }
    // Aceptar
    else if (actionSubmit.equals(i18n.getString("portalempaquetado.avanzado.recursos.crear.paso1.continuar"))) {
        result = "Continuar";
    }
    // Aceptar
    else if (actionSubmit
            .equals(i18n.getString("portalempaquetado.avanzado.recursos.crear.paso1.anadirmetadatos"))) {
        result = "Metadato";
    } else {
        Logger.getLogger(this.getClass())
                .error("El valor del submit no es correcto (actionSubmit = " + actionSubmit + ";");
    }
    return result;
}

From source file:es.pode.administracion.presentacion.nodos.listarNodos.ListarNodosControllerImpl.java

/**
* @see es.pode.administracion.presentacion.nodos.listarNodos.ListarNodosController#getIds(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.nodos.listarNodos.GetIdsForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*//*from  w  w w  . ja v  a  2s . c o  m*/
public final void getIds(ActionMapping mapping,
        es.pode.administracion.presentacion.nodos.listarNodos.GetIdsForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    log.debug("getIds ");
    try {
        List lista = ((FormularioListarNodosEliminarFormImpl) form).getIdRowSelection();

        if (lista == null) {
            log.error("LISTA NULL");
            throw new ValidatorException("{errors.eliminarnodos.idNulo}");
        }

        form.setIds(lista);
        log.info("Se van a eliminar los siguientes nodos: " + lista);

    } catch (ValidatorException e) {
        log.error("error al eliminar nodo " + e);
        throw e;

    } catch (Exception e) {

        log.error("Se ha producido un error al intentar recuperar los ids para borrar: " + e);
        throw new ValidatorException("{errors.eliminarnodos.idError}");

    }

}