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.tagging.presentacion.listarMisTags.ListarMisTagsControllerImpl.java

@Override
public void submit(ActionMapping mapping, SubmitForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    // TODO Auto-generated method stub
    TaggingSession taggingSession = this.getTaggingSession(request);
    if (taggingSession != null) {
        String[] tags = form.getTagRowSelectionAsArray();
        if (tags != null && tags.length > 0) {
            form.setTagsEliminarAsArray(tags); //Para mostrar los tag a eliminar en la pantalla de confirmacin

            //guardamos los tag a borrar en sesion para al pasar la pantalla de confirmacin 
            //poder borrarlos
            taggingSession.setTagsEliminar(tags);
        } else {//from  w w w. j ava 2  s .com
            throw new ValidatorException("{tagging.listar.eliminar.exception}");
        }
    }
}

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

/**
 * @see es.pode.empaquetador.presentacion.agregar.local.AgregarLocalController#agregar(org.apache.struts.action.ActionMapping, es.pode.empaquetador.presentacion.agregar.local.AgregarForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *///from w w w. j a  v a 2 s. com
public final void agregar(ActionMapping mapping,
        es.pode.empaquetador.presentacion.agregar.local.AgregarForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    FormFile archivos = form.getArchivo();

    //convierto el FormFile en un DataHandler
    InternetHeaders ih = new InternetHeaders();
    MimeBodyPart mbp = null;
    DataSource source = null;
    DataHandler dFichero = null;
    mbp = new MimeBodyPart(ih, archivos.getFileData());
    source = new MimePartDataSource(mbp);
    dFichero = new DataHandler(source);
    FicheroVO fichero = new FicheroVO();
    fichero.setDatos(dFichero);
    fichero.setNombre(archivos.getFileName());
    fichero.setTipoMime(archivos.getContentType());

    ///////////////////////////

    EmpaquetadorSession sesEmpaq = this.getEmpaquetadorSession(request);
    List subman = sesEmpaq.getSubmanifestPath();

    String identificador = sesEmpaq.getIdLocalizador();

    List idCollection = sesEmpaq.getIdCollection();
    String identificadorUltimo = "";

    if (idCollection != null && idCollection.size() > 0) {
        Object ultimoIdCollection = idCollection.get(idCollection.size() - 1);

        if (idCollection.size() == 1) {

            OrganizacionVO organizacion = (OrganizacionVO) ultimoIdCollection;
            identificadorUltimo = organizacion.getIdentifier();
        } else if (idCollection.size() > 1) {
            GrupoVO grupo = (GrupoVO) ultimoIdCollection;
            identificadorUltimo = grupo.getIdentifier();
        }
    }
    String tipoEmpaquetador = sesEmpaq.getTipoEmpaquetador();
    try {
        if (tipoEmpaquetador.equals("Avanzado")) {
            if (subman.size() == 1) {
                this.getSrvGestorManifestService().agregarManifiestoZIP(identificador, dFichero, null);
            } else if (subman.size() > 1) {
                OdeVO ultimo = (OdeVO) subman.get(subman.size() - 1);
                String submanifestId = ultimo.getIdentifier();
                this.getSrvGestorManifestService().agregarManifiestoZIP(identificador, dFichero, submanifestId);
            }
        }

        else if (tipoEmpaquetador.equals("Basico")) {
            if (logger.isDebugEnabled())
                logger.debug("Estamos en el bsico");
            this.getSrvEmpaquetadorBasicoService().agregarLocal(identificador, fichero, identificadorUltimo);
        }
    } catch (Exception ex) {
        if (logger.isDebugEnabled())
            logger.error("Ocurrio un error al validar ODE " + identificador, ex);
        throw new ValidatorException("{portalempaquetado.avanzado.submanifiesto.error.agregarLocal}");
    }
}

From source file:es.pode.modificador.presentacion.informes.tarea.InformeTareaControllerImpl.java

/**
 * @see es.pode.modificador.presentacion.informes.tarea.InformeTareaController#obtenerOde(org.apache.struts.action.ActionMapping, es.pode.modificador.presentacion.informes.tarea.ObtenerOdeForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */// www.j  a  v  a 2 s.  c  o m
public final void obtenerOde(ActionMapping mapping,
        es.pode.modificador.presentacion.informes.tarea.ObtenerOdeForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    try {
        String idOde = form.getId();
        Long idModificacion = this.getInformeSession(request).getIdModificacion();
        ResultadoModificacionVO ode = null;
        if (idModificacion == null) {
            ode = buscarOde(Long.valueOf(idOde), this.getInformeSession(request).getOdes());
        } else {
            ode = this.getSrvHerramientaModificacion().recuperarResultadoODE(idModificacion,
                    Long.valueOf(idOde));
        }
        form.setOde(ode);
    } catch (Exception e) {
        logger.error("No se pudo obtener el ODE debido a " + e.getMessage());
        if (logger.isDebugEnabled())
            logger.debug(e);
        throw new ValidatorException("{informe.exception}");
    }
}

From source file:es.pode.empaquetador.presentacion.avanzado.organizaciones.crear.CrearOrganizacionControllerImpl.java

public final java.lang.String selectAction(ActionMapping mapping,
        es.pode.empaquetador.presentacion.avanzado.organizaciones.crear.SelectActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    /*/*from  ww  w.  jav  a  2s . 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}");
    }

    else if (actionSubmit.equals(i18n.getString("portal_empaquetado_crearOrganizaciones.aceptar"))) {
        result = "Aceptar";
    } else if (actionSubmit.equals(i18n.getString("portal_empaquetado_crearOrganizaciones.cancelar"))) {
        result = "Cancelar";
    }

    else if (actionSubmit.equals(i18n.getString("portal_empaquetado_crearOrganizaciones.metadatos"))) {
        result = "Metadatos";
    }
    Logger.getLogger(this.getClass())
            .error("El valor del submit no es correcto (actionSubmit = " + actionSubmit + ";");

    return result;
}

From source file:es.pode.empaquetador.presentacion.avanzado.submanifiestos.gestor.GestorSubmanifiestosControllerImpl.java

public final java.lang.String selectAction(ActionMapping mapping,
        es.pode.empaquetador.presentacion.avanzado.submanifiestos.gestor.SelectActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    /*/* www. ja  v  a2  s.  c  om*/
     * 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(EXCEPTION);
    }

    else if (actionSubmit.equals(i18n.getString(AGREGAR))) {
        result = "Agregar";
    } else if (actionSubmit.equals(i18n.getString(DESAGREGAR))) {
        result = "Desagregar";
    } else if (actionSubmit.equals(i18n.getString(ELIMINAR))) {
        result = "Eliminar";
    } else {
        logger.error("El valor del submit no es correcto (actionSubmit = " + actionSubmit + ")");
    }

    return result;
}

From source file:es.pode.gestorFlujo.presentacion.objetosPendientes.Publicar.PublicarControllerImpl.java

/**
 * @see es.pode.gestorFlujo.presentacion.objetosPendientes.Publicar.PublicarController#publicarODE(org.apache.struts.action.ActionMapping,
 *      es.pode.gestorFlujo.presentacion.objetosPendientes.Publicar.PublicarODEForm,
 *      javax.servlet.http.HttpServletRequest,
 *      javax.servlet.http.HttpServletResponse)
 * /*from   w w  w .  j av  a  2  s. c  om*/
 * publica un ode, ya sea despublicado o propuesto.
 */

public final void publicarODE(ActionMapping mapping,
        es.pode.gestorFlujo.presentacion.objetosPendientes.Publicar.PublicarODEForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    ResultadoOperacionVO resultadoPublicacion;
    PublicarSession publiSes = this.getPublicarSession(request);
    logger.info("Publicando ODE: " + publiSes.getTitulo() + " Despublicado?: "
            + publiSes.getEsDespublicado().booleanValue() + " IdODE: " + publiSes.getIdODE());

    boolean comentarioValidado = false;//El comentario es obligatorio en el caso de los despublicados, pero no en el caso de la primera publicaion
    if (publiSes.getEsDespublicado().booleanValue()) {
        if (logger.isDebugEnabled())
            logger.debug("Es un ODE despublicado");
        if (form.getComentarios() != null) {
            if ((form.getComentarios().trim().length() > 0) && (form.getComentarios().length() < 2500)) {
                if (logger.isDebugEnabled())
                    logger.debug("Comentarios correctos publicando ODE :" + publiSes.getIdODE() + " de titulo: "
                            + publiSes.getTitulo() + " Comentarios: " + form.getComentarios()
                            + " tipoLicencia: " + publiSes.getTipoLicencia() + " Comunidades: "
                            + publiSes.getComunidades() + ";");
                comentarioValidado = true;
                publiSes.setEsDespublicado(new Boolean(true));
            } else {
                logger.warn("Longitud de comentario no vlida al publicar el ODE con IdODE["
                        + publiSes.getIdODE() + "] usuario[" + LdapUserDetailsUtils.getUsuario()
                        + "]comentarios[" + form.getComentarios() + "] y titulo[" + publiSes.getTitulo()
                        + "]; longitud: " + form.getComentarios().length());
                throw new ValidatorException("{gestorFlujo.comentario.longitud}");
            }
        } else {
            logger.warn("Longitud de comentario no vlida al publicar el ODE con IdODE[" + publiSes.getIdODE()
                    + "] usuario[" + LdapUserDetailsUtils.getUsuario() + "]comentarios[" + form.getComentarios()
                    + "] y titulo[" + publiSes.getTitulo() + "]; longitud: " + form.getComentarios().length());
            throw new ValidatorException("{gestorFlujo.comentario.longitud}");
        }
    } else if (!publiSes.getEsDespublicado().booleanValue()) {
        if (form.getComentarios().length() < 2500) {
            if (logger.isDebugEnabled())
                logger.debug("Comentarios correctos publicando ODE :" + publiSes.getIdODE() + " de titulo: "
                        + publiSes.getTitulo() + " Comentarios: " + form.getComentarios() + " tipoLicencia: "
                        + publiSes.getTipoLicencia() + " Comunidades: " + publiSes.getComunidades() + ";");
            comentarioValidado = true;
            publiSes.setEsDespublicado(new Boolean(false));
        } else {
            logger.warn("Longitud de comentario no vlida al publicar el ODE con IdODE[" + publiSes.getIdODE()
                    + "] usuario[" + LdapUserDetailsUtils.getUsuario() + "]comentarios[" + form.getComentarios()
                    + "] y titulo[" + publiSes.getTitulo() + "]; longitud: " + form.getComentarios().length());
            throw new ValidatorException("{gestorFlujo.comentario.longitud}");
        }
    } else {
        logger.warn("No se han introducido comentarios al publicar el ODE con IdODE[" + publiSes.getIdODE()
                + "] usuario[" + LdapUserDetailsUtils.getUsuario() + "]comentarios[" + form.getComentarios()
                + "] y titulo[" + publiSes.getTitulo() + "]");
        throw new ValidatorException("{gestorFlujo.comentario.obligatorio}");
    }
    if (logger.isDebugEnabled())
        logger.debug("Comentarios correctos publicando ODE :" + publiSes.getIdODE() + " de titulo: "
                + publiSes.getTitulo() + " Comentarios: " + form.getComentarios() + " tipoLicencia: "
                + publiSes.getTipoLicencia() + " Comunidades: " + publiSes.getComunidades() + ";");

    if (publiSes.getTipoLicencia() != null && publiSes.getTipoLicencia().length() > 0) {
        // Ahora comprobamos que existan las comunidades

        String[] nodosValidos = interseccionNodos(publiSes.getComunidades());
        if ((nodosValidos != null) && nodosValidos.length > 0) {
            String nodosValidosString = "";
            for (int i = 0; i < nodosValidos.length; i++) {//Para que slo haya nodos vlidos en la publicacion y tambien el nodo local
                nodosValidosString = nodosValidosString + nodosValidos[i] + ",";
            }
            nodosValidosString = nodosValidosString.substring(0, nodosValidosString.length() - 1);
            publiSes.setComunidades(nodosValidosString);

            //Si tienes todos los nodos ser universal

            SrvNodoService nodosPlataforma = this.getSrvNodoService();

            String[] nodosListados = obtenNodosLocalesIds(nodosPlataforma);
            if (nodosValidos.length == nodosListados.length) {
                publiSes.setUniversal(getPropertyValue("licencia.acceso.universal"));
            }

            try {
                TerminoYPadreVO[] typ = this.getSrvVocabulariosControladosService()
                        .crearTraduccionAIngles(new String[] { publiSes.getTipoLicencia() });

                publiSes.setTipoLicencia(typ[0].getNomTermino());

                if (publiSes.getEsDespublicado().booleanValue()) {
                    resultadoPublicacion = this.getSrvPublicacionService().publicarDespublicado(
                            publiSes.getIdODE(), LdapUserDetailsUtils.getUsuario(), form.getComentarios(),
                            publiSes.getTitulo(), publiSes.getComunidades(), publiSes.getTipoLicencia(),
                            publiSes.getUniversal());
                    publiSes.setEsDespublicado(true);
                    if (logger.isDebugEnabled())
                        logger.debug("Publicando ODE despublicado: en nodos " + publiSes.getComunidades()
                                + "idODE:" + publiSes.getIdODE() + "idioma usuario:"
                                + LdapUserDetailsUtils.getUsuario() + "comentarios:" + form.getComentarios()
                                + "titulo:" + publiSes.getTitulo() + "comunidades:" + publiSes.getComunidades()
                                + "tipoLicencia:" + publiSes.getTipoLicencia() + "universa?"
                                + publiSes.getUniversal());
                } else {
                    resultadoPublicacion = this.getSrvPublicacionService().publicar(publiSes.getIdODE(),
                            LdapUserDetailsUtils.getUsuario(), form.getComentarios(), publiSes.getTitulo(),
                            publiSes.getComunidades(), publiSes.getTipoLicencia(), publiSes.getUniversal());
                    publiSes.setEsDespublicado(false);
                    if (logger.isDebugEnabled())
                        logger.debug("Publicando ODE publicado: en nodos " + publiSes.getComunidades()
                                + "idODE:" + publiSes.getIdODE() + "idioma usuario:"
                                + LdapUserDetailsUtils.getUsuario() + "comentarios:" + form.getComentarios()
                                + "comunidades:" + publiSes.getComunidades() + "tipoLicencia:"
                                + publiSes.getTipoLicencia() + "universa?" + publiSes.getUniversal());

                }
                // limpiamos la sesin una vez que hemos publicado
                publiSes.setComunidades("");
                publiSes.setIdODE("");
                publiSes.setTipoLicencia("");
                publiSes.setUniversal("");

            } catch (Exception ex) {
                logger.error("ERROR (excepcin) publicando el ODE con IdODE[" + publiSes.getIdODE()
                        + "] usuario[" + LdapUserDetailsUtils.getUsuario() + "]comentarios["
                        + form.getComentarios() + "] y titulo[" + publiSes.getTitulo() + "]" + "\n", ex);
                throw new ValidatorException("{gestorFlujo.excepcion.publicar.publicar}");
            }

            if (!resultadoPublicacion.getIdResultado().equals("0.0")) {
                logger.error("Error publicando el ODE con IdODE[" + publiSes.getIdODE() + "] usuario["
                        + LdapUserDetailsUtils.getUsuario() + "]comentarios[" + form.getComentarios()
                        + "] y titulo[" + publiSes.getTitulo() + "] : "
                        + resultadoPublicacion.getDescripcion());

                // throw new
                // ValidatorException(resultadoPublicacion.getDescripcion());
                // saveErrorMessage(request,
                // "gestorFlujo.error.publicar", new String[] {
                // publiSes.getTitulo(),
                // resultadoPublicacion.getDescripcion() });
                form.setMensajes(resultadoPublicacion.getDescripcion()
                        .substring(0, resultadoPublicacion.getDescripcion().length() - 1).split(SPLITTER_VAL));

            } else {
                logger.info("Publicado correctamente: ODE con IdODE[" + publiSes.getIdODE() + "] usuario["
                        + LdapUserDetailsUtils.getUsuario() + "]comentarios[" + form.getComentarios()
                        + "] y titulo[" + publiSes.getTitulo() + "]");
            }
        } else {
            logger.warn("No se puede publicar pq la licencia no tiene asociadas comunidades["
                    + publiSes.getIdODE() + "] usuario[" + LdapUserDetailsUtils.getUsuario() + "]comentarios["
                    + form.getComentarios() + "] y titulo[" + publiSes.getTitulo() + "]; longitud: "
                    + form.getComentarios().length());
            throw new ValidatorException("{gestorFlujo.publicar.comunidadObligatoria}");
        }
    } else {
        logger.warn("No se puede publicar pq no hay un tipo de licencia asociada[" + publiSes.getIdODE()
                + "] usuario[" + LdapUserDetailsUtils.getUsuario() + "]comentarios[" + form.getComentarios()
                + "] y titulo[" + publiSes.getTitulo() + "]; longitud: " + form.getComentarios().length());
        throw new ValidatorException("{gestorFlujo.publicar.tipoLicenciaObligatoria}");
    }

}

From source file:es.pode.empaquetador.presentacion.agregar.personales.AgregarPersonalesControllerImpl.java

/**
 * @see es.pode.empaquetador.presentacion.agregar.personales.AgregarPersonalesController#submit(org.apache.struts.action.ActionMapping, es.pode.empaquetador.presentacion.agregar.personales.SubmitForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *///from w  w  w .j av a 2 s.c  o m
public final void submit(ActionMapping mapping,
        es.pode.empaquetador.presentacion.agregar.personales.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();
    String identificador = form.getIdODE();
    if (accion.equals(i18n.getString("portal_empaquetado_gestorSubman_agregarLocal.aceptar"))) {
        if ((identificador == null) || (identificador.equals(""))) {
            throw new ValidatorException("{exportar.subirArchivo}");
        }

    }
}

From source file:es.pode.administracion.presentacion.informes.listarInformes.ListarInformesControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.informes.listarInformes.ListarInformesController#recuperarInforme(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.informes.listarInformes.RecuperarInformeForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *//*from w ww . j a v  a  2  s. com*/
public final void recuperarInforme(ActionMapping mapping,
        es.pode.administracion.presentacion.informes.listarInformes.RecuperarInformeForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    try {
        String fichero = (String) form.getNombre();
        DataHandler dataHandler = null;
        SrvInformeService informeService = this.getSrvInformeService();
        try {
            dataHandler = informeService.recuperarInforme(fichero);

        } catch (Exception e) {
            log.error("Error al recuperar el fichero");
        }
        if (dataHandler == null) {
            log.error("El fichero recuperado est vacio");
            throw new ValidatorException("{recuperarInforme.FALLO}");
        }
        if (fichero.endsWith(".pdf")) {
            response.setContentType("application/pdf");
        } else if (fichero.endsWith(".html") || fichero.endsWith(".htm")) {
            response.setContentType("application/html");
        } else if (fichero.endsWith(".xls")) {
            response.setContentType("application/xls");
        } else if (fichero.endsWith(".doc")) {
            response.setContentType("application/doc");
        }
        response.setHeader("Content-Disposition", "attachment;filename=" + fichero);
        OutputStream out = response.getOutputStream();
        InputStream in = dataHandler.getInputStream();
        if (log.isDebugEnabled())
            log.debug("recuperando el fichero " + fichero);
        byte[] buffer = new byte[BUFFER_SIZE];
        int count;
        while ((count = in.read(buffer, 0, BUFFER_SIZE)) != -1) {
            out.write(buffer, 0, count);
        }

        out.flush();
        out.close();

    } catch (ValidatorException e) {
        throw e;
    } catch (Exception e) {
        log.error("Se ha producido el siguiente error: " + e);
        throw e;
    }

}

From source file:es.pode.modificador.presentacion.configurar.objetos.ruta.IndicarRutaControllerImpl.java

/**
 * @see es.pode.modificador.presentacion.configurar.objetos.ruta.IndicarRutaController#aadirObjeto(org.apache.struts.action.ActionMapping, es.pode.modificador.presentacion.configurar.objetos.ruta.AAdirObjetoForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *//*from w ww  .  j  a  v a 2 s  .  c om*/
public final void aadirObjeto(ActionMapping mapping,
        es.pode.modificador.presentacion.configurar.objetos.ruta.AAdirObjetoForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    if (form != null && form.getPath() != null && !(form.getPath().equals(""))) {
        String path = form.getPath();
        ConfiguracionTarea configuracion = getConfigurarModificacionSession(request).getConfiguracion();
        if (configuracion == null) {
            ConfiguracionTarea tarea = new ConfiguracionTarea();
            tarea.setObjetos(new Objects());
            tarea.setCambios(new Changes());
            tarea.getObjetos().setObjetos(new ODE[0]);
            tarea.getObjetos().setPaths(new Folder[0]);
            tarea.getCambios().setCambios(new Change[0]);
            getConfigurarModificacionSession(request).setConfiguracion(tarea);
            configuracion = tarea;
        }

        //         Folder nuevosObjetos[];
        Folder objetos[] = null;

        if (configuracion.getObjetos() != null && configuracion.getObjetos().getPaths() != null) {
            objetos = configuracion.getObjetos().getPaths();
        }
        //            nuevosObjetos = new Folder[objetos.length + 1];
        //         } else {
        //            nuevosObjetos = new Folder[1];
        //         }
        Folder nuevo = new Folder(path.trim(), null);

        if (objetos != null) {
            // Comprobamos si el objeto ya estaba en la lista.
            ArrayList listaObjetos = new ArrayList(Arrays.asList(objetos));
            if (!listaObjetos.contains(nuevo)) {
                //Aado nuevo path a la lista
                listaObjetos.add(nuevo);
                configuracion.getObjetos().setPaths((Folder[]) listaObjetos.toArray(new Folder[] {}));
            } else {
                throw new ValidatorException("{indicarRuta.repeated}");
            }
        }
    } else {
        throw new ValidatorException("{indicarRuta.empty}");
    }
}

From source file:es.pode.administracion.presentacion.categorias.crearCategoriaNoticia.CrearCategoriaNoticiaControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.categorias.crearCategoriaNoticia.CrearCategoriaNoticiaController#guardarCategoriaNoticia(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.categorias.crearCategoriaNoticia.GuardarCategoriaNoticiaForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *//*from w  w w  .  jav  a2 s .  co  m*/
public final void guardarCategoriaNoticia(ActionMapping mapping,
        es.pode.administracion.presentacion.categorias.crearCategoriaNoticia.GuardarCategoriaNoticiaForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    try {
        ArrayList categorias = (ArrayList) form.getNombreCategoria();
        ArrayList idiomas = (ArrayList) form.getIdiomas();
        logger.debug("Se crea la categoria");
        /**
         * **************************************************************************************************************************************
         * ************************************************ SE INSERTA LA CATEGORIA *************************************************************
         * **************************************************************************************************************************************
         * */

        if (categorias != null && categorias.size() > 0) {
            ArrayList listaConTexto = devuelveListaConTexto(categorias, idiomas);
            String[] listaCategorias = (String[]) listaConTexto.get(0);
            String[] listaIdiomas = (String[]) listaConTexto.get(1);

            //         Introducimos las categorias idiomas
            CategoriaNoticiaVO categoriaNoticia = new CategoriaNoticiaVO();
            CategoriaIdiomaNoticiaVO[] categoriaIdiomaNoticia = new CategoriaIdiomaNoticiaVO[listaCategorias.length];
            categoriaNoticia.setNombre(listaCategorias[0]);

            for (int i = 0; i < listaCategorias.length; i++) {
                CategoriaIdiomaNoticiaVO categoriaIdiomaNoticiaAux = new CategoriaIdiomaNoticiaVO();
                categoriaIdiomaNoticiaAux.setIdioma(listaIdiomas[i].trim());
                categoriaIdiomaNoticiaAux.setNombreCategoria(listaCategorias[i].trim());
                categoriaIdiomaNoticia[i] = categoriaIdiomaNoticiaAux;
            }
            categoriaNoticia.setCategoriaIdioma(categoriaIdiomaNoticia);

            logger.debug("Se introduce en la base de datos la categoria");
            Long id = this.getSrvNoticiasService().crearCategoria(categoriaNoticia);
            if (logger.isDebugEnabled())
                logger.debug("Se ha introducido la categoria con identificador [" + id + "]");
            form.setIdModificado(id);
        }

    } catch (Exception e) {
        logger.error("Error insertando la categoria noticia", e);
        throw new ValidatorException("{error.insertando.categoria}");
    }
}