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.empaquetador.presentacion.basico.desagregar.DesagregarBasicoControllerImpl.java

/**
 * @see es.pode.empaquetador.presentacion.basico.desagregar.DesagregarBasicoController#desagregarPersonales(org.apache.struts.action.ActionMapping, es.pode.empaquetador.presentacion.basico.desagregar.DesagregarPersonalesForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *//*w  w w .  j  ava  2  s.  co  m*/
public final void desagregarPersonales(ActionMapping mapping,
        es.pode.empaquetador.presentacion.basico.desagregar.DesagregarPersonalesForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    try {
        String idOde = this.getEmpaquetadorSession(request).getIdLocalizador();
        GrupoVO[] items = (GrupoVO[]) this.getDesagregarBasicoSession(request).getGrupos()
                .toArray(new GrupoVO[] {});
        logger.debug("Llamando a desagregarItem para desagregar en personales");
        String id = this.getSrvEmpaquetadorBasicoService().desagregarItem(idOde, items);
        logger.debug("Desagregado con identificador " + id);
        saveSuccessMessage(request, "gestor_basico.desagregar.personales.success", new String[] { id });
    } catch (Exception e) {
        logger.error("Error inesperado", e);
        throw new ValidatorException("{gestor_basico.error.inesperado}");
    }
}

From source file:es.pode.administracion.presentacion.descargas.crear.CrearDescargaControllerImpl.java

public void guardarDescarga(ActionMapping mapping, GuardarDescargaForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    ResourceBundle resources = ResourceBundle.getBundle(applicationResources,
            (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE));
    if (resources.getString("comun.aceptar").equals(form.getAction())) {
        ConfigurarDescargaSession sesion = getConfigurarDescargaSession(request);
        List<DescDescargaVO> descripciones = new ArrayList<DescDescargaVO>();
        boolean alMenosUna = false;

        String desc;/*from w  w  w.  ja v a2  s  .co  m*/
        String titulo;
        String idioma;

        desc = compruebaDescripcion(form.getDescripcion_es(), request);
        titulo = compruebaTitulo(form.getTitulo_es(), request);
        idioma = "es";
        alMenosUna = addDescripcion(descripciones, alMenosUna, desc, titulo, idioma);

        desc = compruebaDescripcion(form.getDescripcion_ca(), request);
        titulo = compruebaTitulo(form.getTitulo_ca(), request);
        idioma = "ca";
        alMenosUna = addDescripcion(descripciones, alMenosUna, desc, titulo, idioma);

        desc = compruebaDescripcion(form.getDescripcion_en(), request);
        titulo = compruebaTitulo(form.getTitulo_en(), request);
        idioma = "en";
        alMenosUna = addDescripcion(descripciones, alMenosUna, desc, titulo, idioma);

        desc = compruebaDescripcion(form.getDescripcion_eu(), request);
        titulo = compruebaTitulo(form.getTitulo_eu(), request);
        idioma = "eu";
        alMenosUna = addDescripcion(descripciones, alMenosUna, desc, titulo, idioma);

        desc = compruebaDescripcion(form.getDescripcion_gl(), request);
        titulo = compruebaTitulo(form.getTitulo_gl(), request);
        idioma = "gl";
        alMenosUna = addDescripcion(descripciones, alMenosUna, desc, titulo, idioma);

        desc = compruebaDescripcion(form.getDescripcion_va(), request);
        titulo = compruebaTitulo(form.getTitulo_va(), request);
        idioma = "va";
        alMenosUna = addDescripcion(descripciones, alMenosUna, desc, titulo, idioma);

        if (!alMenosUna) {
            throw new ValidatorException("{crearDescarga.noDescripcion.exception}");
        }

        String path = "";
        if (sesion.getPath() == null || !sesion.getPath().equals(form.getPath())) {
            path = form.getPath();
        }

        Long identificador = sesion.getIdentificador() != null ? sesion.getIdentificador() : null;

        identificador = getSrvDescargas().modificarDescarga(identificador, path, sesion.getActiva(),
                descripciones.toArray(new DescDescargaVO[] {}));
        if (identificador == null) {
            throw new ValidatorException("{crearDescarga.noFichero.exception}");
        }
        form.setIdModificada(identificador);
    }
    removeConfigurarDescargaSession(request);

}

From source file:es.pode.empaquetador.presentacion.agregar.local.AgregarLocalControllerImpl.java

/**
 * @see es.pode.empaquetador.presentacion.agregar.local.AgregarLocalController#submit(org.apache.struts.action.ActionMapping, es.pode.empaquetador.presentacion.agregar.local.SubmitForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *///from   w  w w  . j  a v  a2s .co  m
public final void submit(ActionMapping mapping, es.pode.empaquetador.presentacion.agregar.local.SubmitForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    java.util.Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE);
    ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale);

    String accion = form.getAction();
    FormFile archivos = form.getArchivo();
    if (accion.equals(i18n.getString("portal_empaquetado_gestorSubman_agregarLocal.aceptar"))) {
        if ((archivos == null) || (archivos.getFileSize() == 0)) {
            throw new ValidatorException("{exportar.subirArchivo}");
        }

    }
}

From source file:es.pode.administracion.presentacion.planificador.descripcionTarea.DescripcionTareaControllerImpl.java

/**
 * Mtodo que discrimina la tarea a crear
 * //from  w  ww.j  av a 2 s .  co  m
 * Retorna 1: Carga de ODEs 2: Reindexado 3: Eliminar ODEs 4:Infome fecha 5:Informe rango 6:Informe usuario 7:Informe Federado 8:Informe catalogo
 */
public final String obtenerTipoTarea(ActionMapping mapping, ObtenerTipoTareaForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    String tipoTarea = null;
    String tipoTareaDevolver = null;

    try {
        //obtnemos el tipoTarea
        TrabajoVO trabajo = new TrabajoVO();

        trabajo.setTrabajo(form.getTrabajo());
        trabajo.setGrupoTrabajo(form.getGrupoTrabajo());
        trabajo.setUsuario(LdapUserDetailsUtils.getUsuario());

        tipoTarea = this.getSrvPlanificadorService().obtenerTipoTarea(trabajo);
        if (log.isDebugEnabled())
            log.debug("el tipo de tarea al recogerlo vale -> " + tipoTarea);

        //si el tipoTarea es de informes debemos mirar que informe concreto es para redirigirnos a una de las 3 pantallas de informes
        if (tipoTarea.equalsIgnoreCase("GenerarInforme")) {
            //obtenemos el tipo de informe
            TareaInformesVO tarea = new TareaInformesVO();

            tarea.setTrabajo(form.getTrabajo());
            tarea.setGrupoTrabajo(form.getGrupoTrabajo());
            tarea.setTrigger(form.getTrigger());
            tarea.setGrupoTrigger(form.getGrupoTrigger());

            TareaInformesVO tareaInformes = this.getSrvPlanificadorService().obtenerTareaInformes(tarea);
            String informe = tareaInformes.getInforme();

            if (log.isDebugEnabled())
                log.debug("estamos dentro de generar informe");
            if (informe.equalsIgnoreCase("estadoOdes") || informe.equalsIgnoreCase("operacionesRealizadas")
                    || informe.equalsIgnoreCase("nivelAgregacion")
                    || informe.equalsIgnoreCase("coberturaCurricular")
                    || informe.equalsIgnoreCase("odesLicencias") || informe.equalsIgnoreCase("usuarios")
                    || informe.equalsIgnoreCase("procesosPlanificados")) {
                if (log.isDebugEnabled())
                    log.debug("cargo informe con fechas");
                tipoTareaDevolver = "InformeFecha";
            }

            else if (informe.equalsIgnoreCase("terminosBusqueda") || informe.equalsIgnoreCase("masValorado")
                    || informe.equalsIgnoreCase("masMostrado") || informe.equalsIgnoreCase("masPrevisualizado")
                    || informe.equalsIgnoreCase("masVisualizado") || informe.equalsIgnoreCase("masDescargado")
                    || informe.equalsIgnoreCase("tamanio")) {
                if (log.isDebugEnabled())
                    log.debug("cargo informe con rango");
                tipoTareaDevolver = "InformeFechaRango";
            } else if (informe.equalsIgnoreCase("odesUsuario")) {
                if (log.isDebugEnabled())
                    log.debug("cargo informe con usuario");
                tipoTareaDevolver = "InformeFechaUsuario";
            }

        }

        //el tipoTarea es informeFederado
        else if (tipoTarea.equalsIgnoreCase("GenerarInformeFederado")) {
            tipoTareaDevolver = "InformeFederado";
        } else if (tipoTarea.equalsIgnoreCase("repositorio")) {
            tipoTareaDevolver = "InformeCatalogo";
        }
        //Si el tipoTarea es Reindexado, carga ODEs o eliminar ODEs el tipo tarea se mantiene
        else
            tipoTareaDevolver = tipoTarea;

        if (log.isDebugEnabled())
            log.debug("tipoTarea -> " + tipoTarea);

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

    log.debug("tipoTarea: " + tipoTarea);
    return tipoTareaDevolver;
}

From source file:es.pode.gestorFlujo.presentacion.objetosPersonales.eliminar.eliminarPersonalesControllerImpl.java

/**
 * @see es.pode.gestorFlujo.presentacion.objetosPersonales.eliminar.eliminarController#cargarDatos(org.apache.struts.action.ActionMapping, es.pode.gestorFlujo.presentacion.objetosPersonales.eliminar.CargarDatosForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *//*w ww. j ava2s.c  om*/
public final void cargarDatos(ActionMapping mapping,
        es.pode.gestorFlujo.presentacion.objetosPersonales.eliminar.CargarDatosForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

    request.getSession().setAttribute(ORIGEN_DE_LA_LLAMADA, ((EliminarPersonalesCUFormImpl) form).getOrigen());
    try {
        String[] idODEs = (String[]) ((EliminarPersonalesCUFormImpl) form).getListODEs();
        if (idODEs != null && idODEs.length > 0) {
            // obtenemos los ids y los titulos de los odes que vamos a
            // eliminar,
            // que vienen concatenados en el mismo string

            String[] titulos = new String[idODEs.length];
            String[] ids = new String[idODEs.length];
            desconcatena(idODEs, ids, titulos);

            request.getSession().setAttribute(IDS_ELIMINAR_GF, ids);
            request.getSession().setAttribute(TITULOS_ELIMINAR_GF, titulos);
            form.setTitulos(titulos);
            form.setSeleccion("ALGUN_ODE_SELEC");
            logger.info("carga de datos eliminar correcta");

        } else {
            logger.warn("No se han seleccionado elementos a eliminar");
            form.setSeleccion("NINGUN_ODE_SELEC");
            saveErrorMessage(request, "gestorFlujo.error.eliminar.seleccione");
        }
    } catch (Exception ex) {
        logger.error("Excepcion cargando datos eliminar", ex);
        throw new ValidatorException("{gestorFlujo.error.inesperado}");
    }
}

From source file:es.pode.administracion.presentacion.noticias.noticias.NoticiasControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.noticias.noticias.NoticiasController#obtenerNoticias(org.apache.struts.action.ActionMapping,
 *      es.pode.administracion.presentacion.noticias.noticias.ObtenerNoticiasForm,
 *      javax.servlet.http.HttpServletRequest,
 *      javax.servlet.http.HttpServletResponse)
 *//* www .j  a  va  2s  .  co  m*/
public final void obtenerNoticias(ActionMapping mapping,
        es.pode.administracion.presentacion.noticias.noticias.ObtenerNoticiasForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    try {
        //Se borra de la request los valores si estuvieran llenos
        request.getSession().setAttribute(VERNOTICIAVO, null);
        request.getSession().setAttribute(CATEGORIAMODVO, null);
        request.getSession().setAttribute(CATEGORIAVO, null);
        request.getSession().setAttribute(IMAGEN, null);

        /**
          * **************************************************************************************************************************************
          * ****************************************** SE OBTIENEN LOS IDIOMAS TRADUCIBLES *******************************************************
          * **************************************************************************************************************************************
          * */
        if (logger.isDebugEnabled())
            logger.debug("Obtenemos los idiomas traducibles");

        String[] idiomasPlataforma = I18n.getInstance().obtenerIdiomasPlataforma();
        if (logger.isDebugEnabled())
            logger.debug("Hay [" + idiomasPlataforma.length + "] en la plataforma");

        String idiomaLogado = LdapUserDetailsUtils.getIdioma();
        String idiomaPrioritario = I18n.getInstance().obtenerIdiomaDefectoPlataforma();
        String idiomaSecundario = I18n.getInstance().obtenerIdiomaSecundarioPlataforma();
        if (logger.isDebugEnabled())
            logger.debug(
                    "El idioma del usuario es [" + idiomaLogado + "], idioma prioritario de la plataforma es ["
                            + idiomaPrioritario + "] y el secundario es [" + idiomaSecundario + "]");

        /**
         * **************************************************************************************************************************************
         * ********************************************* SE RECUPERAN LAS NOTICIAS **************************************************************
         * **************************************************************************************************************************************
         * */
        NoticiaTraducidaVO[] noticias = this.getSrvNoticiasService()
                .obtenerNoticiasTraducidas(devuelveIdiomasTraducibles(idiomasPlataforma, idiomaLogado,
                        idiomaPrioritario, idiomaSecundario));
        if (logger.isDebugEnabled())
            logger.debug("Se han recuperado [" + noticias.length + "]");

        for (int h = 0; h < noticias.length; h++) {
            //sustituimos @,",:,%,+,-,' por su codigo correspondiente en ASCII
            noticias[h].setTitulo(noticias[h].getTitulo().replaceAll("@", "&#64"));
            noticias[h].setTitulo(noticias[h].getTitulo().replaceAll("\\\"", "&#34"));
            noticias[h].setTitulo(noticias[h].getTitulo().replaceAll(":", "&#58"));
            noticias[h].setTitulo(noticias[h].getTitulo().replaceAll("%", "&#37"));
            noticias[h].setTitulo(noticias[h].getTitulo().replaceAll("\\+", "&#43"));
            noticias[h].setTitulo(noticias[h].getTitulo().replaceAll("-", "&#45"));
            noticias[h].setTitulo(noticias[h].getTitulo().replaceAll("'", "&#39"));
        }
        /**
         * **************************************************************************************************************************************
         * ************************************* SE INTRODUCEN LOS DATOS EN EL FORMULARIO *******************************************************
         * **************************************************************************************************************************************
         * */
        form.setNoticiasAsArray(noticias);

    } catch (Exception e) {
        logger.error("Error recuperando las noticias", e);
        throw new ValidatorException("{error.noticias.recuperando}");
    }
}

From source file:es.pode.gestorFlujo.presentacion.objetosPersonales.importar.ImportarControllerImpl.java

/**
 * @throws ValidatorException //  w w  w.j a  v  a2 s.c om
 * @see es.pode.gestorFlujo.presentacion.objetosPersonales.importar.ImportarController#importarODE(org.apache.struts.action.ActionMapping, es.pode.gestorFlujo.presentacion.objetosPersonales.importar.ImportarODEForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */
public final void importarODE(ActionMapping mapping,
        es.pode.gestorFlujo.presentacion.objetosPersonales.importar.ImportarODEForm form,
        HttpServletRequest request, HttpServletResponse response) throws ValidatorException {
    //      ResultadoOperacionVO unResultado = new ResultadoOperacionVO();
    int nr_archivos_subidos = 0;
    String archivosSubidos = new String("(");
    boolean hemoshechoalgo = false;
    //      Long diferencia=new Long(0);
    Long diferencia = form.getEspacioLibre();
    ArrayList<ResultadoImportacion> resultado = new ArrayList<ResultadoImportacion>();

    //Wrapping
    CurrentState estadoActual = new CurrentState();
    //TODO Fusionar declaraciones anteriores con asignacin actual
    estadoActual.diferencia = diferencia;
    estadoActual.resultado = resultado;
    estadoActual.archivosSubidos = archivosSubidos;
    estadoActual.nr_archivos_subidos = nr_archivos_subidos;
    estadoActual.hemoshechoalgo = hemoshechoalgo;

    logger.debug("Importando odes");
    // comprobamos las 5 cajas:

    FormFile formFile = form.getFicheroODE1();
    String caja = "caja 1";
    String odeOrder = "primer";
    comprobarFormFile(form, request, estadoActual, formFile, caja, odeOrder);

    formFile = form.getFicheroODE2();
    caja = "caja 2";
    odeOrder = "segundo";
    comprobarFormFile(form, request, estadoActual, formFile, caja, odeOrder);

    formFile = form.getFicheroODE3();
    caja = "caja 3";
    odeOrder = "tercer";
    comprobarFormFile(form, request, estadoActual, formFile, caja, odeOrder);

    formFile = form.getFicheroODE4();
    caja = "caja 4";
    odeOrder = "cuarto";
    comprobarFormFile(form, request, estadoActual, formFile, caja, odeOrder);

    formFile = form.getFicheroODE5();
    caja = "caja 5";
    odeOrder = "quinto";
    comprobarFormFile(form, request, estadoActual, formFile, caja, odeOrder);

    //Unwrapping
    resultado = estadoActual.resultado;
    archivosSubidos = estadoActual.archivosSubidos;
    nr_archivos_subidos = estadoActual.nr_archivos_subidos;
    hemoshechoalgo = estadoActual.hemoshechoalgo;

    // si no hemos importado nada mostramos mensajito de informacin:
    if (!hemoshechoalgo) {
        logger.warn("Formfile sin longitud ");
        throw new ValidatorException("{gestorFlujo.error.vacio}");
    }
    logger.debug("ArchivosSubidos: " + archivosSubidos);
    if (nr_archivos_subidos > 0) {
        logger.info("Se han importado correctamente los archivos: " + archivosSubidos);
        if (archivosSubidos.endsWith(",")) {
            archivosSubidos = (String) archivosSubidos.subSequence(0, archivosSubidos.length() - 1);
            archivosSubidos = nr_archivos_subidos + ": " + archivosSubidos;
            archivosSubidos = archivosSubidos + ")";
        }

        //         saveSuccessMessage(request, "gestorFlujo.importar.importados", new String[] { archivosSubidos });
    }
    form.setResultado(resultado);

}

From source file:es.pode.administracion.presentacion.categorias.categorias.CategoriasControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.categorias.categorias.CategoriasController#obtenerCategoriasNoticias(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.categorias.categorias.ObtenerCategoriasNoticiasForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */// w w  w.j  av  a  2s  .c  o m
public final void obtenerCategoriasNoticias(ActionMapping mapping,
        es.pode.administracion.presentacion.categorias.categorias.ObtenerCategoriasNoticiasForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    try {
        //Se elimina de la request los valores
        request.getSession().setAttribute(CATEGORIAVO, null);
        request.getSession().setAttribute(CATEGORIASNOTICIAS, null);
        request.getSession().setAttribute(NOTICIASCATEGORIAS, null);

        /**
         * **************************************************************************************************************************************
         * ****************************************** SE OBTIENEN LOS IDIOMAS TRADUCIBLES *******************************************************
         * **************************************************************************************************************************************
         * */
        if (logger.isDebugEnabled())
            logger.debug("Obtenemos los idiomas traducibles");

        String[] idiomasPlataforma = I18n.getInstance().obtenerIdiomasPlataforma();
        if (logger.isDebugEnabled())
            logger.debug("Hay [" + idiomasPlataforma.length + "] en la plataforma");

        String idiomaLogado = LdapUserDetailsUtils.getIdioma();
        String idiomaPrioritario = I18n.getInstance().obtenerIdiomaDefectoPlataforma();
        String idiomaSecundario = I18n.getInstance().obtenerIdiomaSecundarioPlataforma();
        if (logger.isDebugEnabled())
            logger.debug(
                    "El idioma del usuario es [" + idiomaLogado + "], idioma prioritario de la plataforma es ["
                            + idiomaPrioritario + "] y el secundario es [" + idiomaSecundario + "]");

        /**
         * **************************************************************************************************************************************
         * ******************************************* SE RECUPERAN LAS CATEGORIAS **************************************************************
         * **************************************************************************************************************************************
         * */
        NoticiasControllerImpl noticiasController = new NoticiasControllerImpl();
        CategoriaNoticiaTraducidaVO[] categorias = this.getSrvNoticiasService()
                .obtenerCategoriasTraducidas(noticiasController.devuelveIdiomasTraducibles(idiomasPlataforma,
                        idiomaLogado, idiomaPrioritario, idiomaSecundario));
        if (logger.isDebugEnabled())
            logger.debug("Se han recuperado [" + categorias.length + "] categorias noticias");

        for (int i = 0; i < categorias.length; i++) {
            //         sustituimos @,",:,%,+,-,' por su codigo correspondiente en ASCII         
            categorias[i].setNombreCategoria(categorias[i].getNombreCategoria().replaceAll("@", "&#64"));
            categorias[i].setNombreCategoria(categorias[i].getNombreCategoria().replaceAll("\\\"", "&#34"));
            categorias[i].setNombreCategoria(categorias[i].getNombreCategoria().replaceAll(":", "&#58"));
            categorias[i].setNombreCategoria(categorias[i].getNombreCategoria().replaceAll("%", "&#37"));
            categorias[i].setNombreCategoria(categorias[i].getNombreCategoria().replaceAll("\\+", "&#43"));
            categorias[i].setNombreCategoria(categorias[i].getNombreCategoria().replaceAll("-", "&#45"));
            categorias[i].setNombreCategoria(categorias[i].getNombreCategoria().replaceAll("'", "&#39"));
        }

        /**
         * **************************************************************************************************************************************
         * ************************************* SE INTRODUCEN LOS DATOS EN EL FORMULARIO *******************************************************
         * **************************************************************************************************************************************
         * */
        form.setCategoriasNoticiasAsArray(categorias);

    } catch (Exception e) {
        logger.error("Error recuperando las categorias de las noticias", e);
        throw new ValidatorException("{errors.categorias.borrar.cargar}");
    }

}

From source file:es.pode.administracion.presentacion.categoriasFaqs.categoriasFaqs.CategoriasFaqControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.categoriasFaqs.categoriasFaqs.CategoriasFaqController#obtenerCategoriasFaqs(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.categoriasFaqs.categoriasFaqs.ObtenerCategoriasFaqsForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *///from   w w w.j  av a  2 s  . c  om
public final void obtenerCategoriasFaqs(ActionMapping mapping,
        es.pode.administracion.presentacion.categoriasFaqs.categoriasFaqs.ObtenerCategoriasFaqsForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    try {
        //          Se elimina de la request los valores
        request.getSession().setAttribute(CATEGORIAFAQVO, null);
        request.getSession().setAttribute(CATEGORIASFAQS, null);
        request.getSession().setAttribute(FAQSCATEGORIAS, null);

        /**
         * **************************************************************************************************************************************
         * ****************************************** SE OBTIENEN LOS IDIOMAS TRADUCIBLES *******************************************************
         * **************************************************************************************************************************************
         * */
        if (logger.isDebugEnabled())
            logger.debug("Obtenemos los idiomas traducibles");

        String[] idiomasPlataforma = I18n.getInstance().obtenerIdiomasPlataforma();
        if (logger.isDebugEnabled())
            logger.debug("Hay [" + idiomasPlataforma.length + "] en la plataforma");

        String idiomaLogado = LdapUserDetailsUtils.getIdioma();
        String idiomaPrioritario = I18n.getInstance().obtenerIdiomaDefectoPlataforma();
        String idiomaSecundario = I18n.getInstance().obtenerIdiomaSecundarioPlataforma();
        if (logger.isDebugEnabled())
            logger.debug(
                    "El idioma del usuario es [" + idiomaLogado + "], idioma prioritario de la plataforma es ["
                            + idiomaPrioritario + "] y el secundario es [" + idiomaSecundario + "]");

        /**
         * **************************************************************************************************************************************
         * ******************************************* SE RECUPERAN LAS CATEGORIAS **************************************************************
         * **************************************************************************************************************************************
         * */
        NoticiasControllerImpl noticiasController = new NoticiasControllerImpl();
        CategoriaTraducidaVO[] categoriasFaq = this.getSrvFaqService()
                .obtenerCategoriasTraducidas(noticiasController.devuelveIdiomasTraducibles(idiomasPlataforma,
                        idiomaLogado, idiomaPrioritario, idiomaSecundario));
        if (logger.isDebugEnabled())
            logger.debug("Se han recuperado [" + categoriasFaq.length + "] categorias faqs");

        for (int i = 0; i < categoriasFaq.length; i++) {
            //         sustituimos @,",:,%,+,-,' por su codigo correspondiente en ASCII         
            categoriasFaq[i].setNombre(categoriasFaq[i].getNombre().replaceAll("@", "&#64"));
            categoriasFaq[i].setNombre(categoriasFaq[i].getNombre().replaceAll("\\\"", "&#34"));
            categoriasFaq[i].setNombre(categoriasFaq[i].getNombre().replaceAll(":", "&#58"));
            categoriasFaq[i].setNombre(categoriasFaq[i].getNombre().replaceAll("%", "&#37"));
            categoriasFaq[i].setNombre(categoriasFaq[i].getNombre().replaceAll("\\+", "&#43"));
            categoriasFaq[i].setNombre(categoriasFaq[i].getNombre().replaceAll("-", "&#45"));
            categoriasFaq[i].setNombre(categoriasFaq[i].getNombre().replaceAll("'", "&#39"));
        }

        /**
         * **************************************************************************************************************************************
         * ************************************* SE INTRODUCEN LOS DATOS EN EL FORMULARIO *******************************************************
         * **************************************************************************************************************************************
         * */
        form.setCategoriasAsArray(categoriasFaq);

    } catch (Exception e) {
        logger.error("Error recuperando las categorias de las faqs", e);
        throw new ValidatorException("{errors.categorias.borrar.cargar}");
    }

}

From source file:es.pode.empaquetador.presentacion.avanzado.submanifiestos.desagregar.DesagregarSubmanifiestoControllerImpl.java

public String selectAction(ActionMapping mapping, SelectActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    /*/*  w  ww. j  a v a 2 s  .  c o  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.getDestino();
    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}");
    } else if (form.getAction().equals("Cancelar")) {
        return "Cancelar";
    }
    //Cancelar
    else if (actionSubmit
            .equals(i18n.getString("portal_empaquetado_gestorSubmanifiestos.desagregar.repositorio"))) {
        result = "personales";
    }
    //Aceptar
    else if (actionSubmit.equals(i18n.getString("portal_empaquetado_gestorSubmanifiestos.desagregar.local"))) {
        result = "local";
    }

    return result;
}