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.catalogadorWeb.presentacion.categoriasAvanzado.relacion.RelacionControllerImpl.java

/**
 * @see es.pode.catalogadorWeb.presentacion.categoriasAvanzado.relacion.RelacionController#eliminarRelacion(org.apache.struts.action.ActionMapping, es.pode.catalogadorWeb.presentacion.categoriasAvanzado.relacion.EliminarRelacionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *//*  w  ww  . jav  a2 s.  c om*/
public final void eliminarRelacion(ActionMapping mapping,
        es.pode.catalogadorWeb.presentacion.categoriasAvanzado.relacion.EliminarRelacionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    boolean esta = false;
    boolean seleccion = false;
    Object valor = request.getSession().getAttribute("form");
    //recupero la coleccion de Elementos para borrarle el que coincida con ese id
    CatalogadorAvSession catalogadorAvSession = this.getCatalogadorAvSession(request);
    //      si expira la sesin, debemos dar error de sesin, comprobamos si el objeto de sesin contiene el identificador
    if ((catalogadorAvSession == null) || (catalogadorAvSession.getIdentificador() == null)) {
        throw new Exception();
    }
    try {
        if (valor instanceof RelacionFormImpl) {
            form.setListadoRelacionesAsArray(((RelacionFormImpl) valor).getListadoRelacionesAsArray());
        } else if (valor instanceof ConfirmacionEliminarCancelarEliminarFormImpl) {
            form.setListadoRelacionesAsArray(
                    ((ConfirmacionEliminarCancelarEliminarFormImpl) valor).getListadoRelacionesAsArray());
        } else if (valor instanceof ConfirmacionEliminarDatosASesionFormImpl) {
            form.setListadoRelacionesAsArray(
                    ((ConfirmacionEliminarDatosASesionFormImpl) valor).getListadoRelacionesAsArray());
        }
        if ((form.getTituloRelacionRowSelection() != null) && (form.getListadoRelacionesAsArray() != null)
                && (form.getListadoRelacionesAsArray().length > 0)) {
            AvRelationVO[] relaciones = (AvRelationVO[]) form.getListadoRelacionesAsArray();
            ArrayList listaRec = new ArrayList();
            for (int indi = 0; indi < relaciones.length; indi++) {
                int indiTitu = 0;
                while ((indiTitu < form.getTituloRelacionRowSelection().size() && (!esta))) {
                    int valorTitu = Integer
                            .parseInt(form.getTituloRelacionRowSelection().get(indiTitu).toString()) - 1;
                    if (valorTitu == indi) {
                        esta = true;
                        seleccion = true;
                    }
                    indiTitu++;
                }
                if (!esta) {
                    listaRec.add(relaciones[indi]);
                }
                esta = false; //Iniciliazamos para la siguiente iteracion
            }
            AvRelationVO[] reAux = (AvRelationVO[]) listaRec.toArray(new AvRelationVO[listaRec.size()]);
            form.setListadoRelacionesAsArray(reAux);

        }

    } catch (org.acegisecurity.AccessDeniedException ad) {
        logger.error("Error de Acceso " + ad);
        throw new java.lang.Exception("relacion", ad);

    } catch (Exception e) {
        logger.error("Error en catalogadorWeb, categora Relacin, metodo eliminarRelacion " + e);
        throw new java.lang.Exception("relacion", e);
    }

    if (!seleccion)
        throw new ValidatorException("{error.EliminarNoSeleccion}");

}

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

/**
 * @see es.pode.empaquetador.presentacion.agregar.personales.AgregarPersonalesController#selectAction(org.apache.struts.action.ActionMapping, es.pode.empaquetador.presentacion.agregar.personales.SelectActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *///from   w  w  w  . j  ava2  s  .  c  om
public final java.lang.String selectAction(ActionMapping mapping,
        es.pode.empaquetador.presentacion.agregar.personales.SelectActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    /*
     * 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_gestorSubman_agregarLocal.aceptar"))) {
        result = "Aceptar";
    } else if (actionSubmit.equals(i18n.getString("portal_empaquetado_gestorSubman_agregarLocal.cancelar"))) {
        result = "Cancelar";
    } else {

        Logger.getLogger(this.getClass())
                .error("El valor del submit no es correcto (actionSubmit = " + actionSubmit + ");");
    }

    return result;
}

From source file:es.pode.administracion.presentacion.noticias.modificar.ModificarControllerImpl.java

public void obtenerIdentificador(ActionMapping mapping, ObtenerIdentificadorForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    try {//from   w  w w .java  2s . c om
        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 + "]");

        // Rellena el combo de categorias
        NoticiasControllerImpl noticiasController = new NoticiasControllerImpl();
        Collection categorias = Arrays.asList(this.getSrvNoticiasService()
                .obtenerCategoriasTraducidas(noticiasController.devuelveIdiomasTraducibles(idiomasPlataforma,
                        idiomaLogado, idiomaPrioritario, idiomaSecundario)));
        form.setCategoriaBackingList(categorias, "idCategoriaNoticia", "nombreCategoria");

        //      Se obtiene los datos de la noticia
        if (logger.isDebugEnabled())
            logger.debug("Se obtiene los datos de la noticia con identificador [" + form.getIdNoticia() + "]");
        NoticiaVO noticia = this.getSrvNoticiasService().obtenerNoticia(form.getIdNoticia());
        request.getSession().setAttribute(VERNOTICIAVO, noticia);
        if (form.getEstado() == null)
            form.setEstado(noticia.getActiva());
        if (form.getCategoria() == null)
            form.setCategoria(noticia.getCategoria().getId());

        if (form.getActivarImagen() == null) {
            //No viene con valor
            //             Tratamiento de la imagen   
            String sURLImagen = noticia.getURLImagen();
            if (sURLImagen != null && sURLImagen.indexOf("/") != -1) {
                form.setActivarImagen(new Integer(1));
                String sToken[] = sURLImagen.split("/");
                //form.setNombreImagen(sToken[sToken.length-1]);
                form.setNombreImagenVO(sToken[sToken.length - 1]);
                form.setAlineamiento(noticia.getAlineamientoImg());
            } else
                form.setActivarImagen(new Integer(2));

        } else if (form.getActivarImagen().intValue() == 3) {
            form.setActivarImagen(new Integer(4));
        }

    } catch (Exception e) {
        logger.error("Error obteniendo la noticia");
        throw new ValidatorException("{errorObteniendoNoticia}");
    }

}

From source file:es.pode.empaquetador.presentacion.basico.gestor.GestorBasicoControllerImpl.java

/**
 * @see es.pode.empaquetador.presentacion.basico.gestor.GestorBasicoController#subir(org.apache.struts.action.ActionMapping,
 *      es.pode.empaquetador.presentacion.basico.gestor.SubirForm,
 *      javax.servlet.http.HttpServletRequest,
 *      javax.servlet.http.HttpServletResponse)
 *///from w  ww. j  a va  2s.  c om
public final void subir(ActionMapping mapping, es.pode.empaquetador.presentacion.basico.gestor.SubirForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    String idODE = this.getEmpaquetadorSession(request).getIdLocalizador();
    if (logger.isDebugEnabled())
        logger.debug("Subiendo el ODE : " + idODE);
    if (idODE != null && form.getIdentifier() != null) {
        try {
            this.getSrvGestorManifestService().subirItem(idODE, form.getIdentifier());
        } catch (Exception e) {
            throw new ValidatorException("{gestor_basico.error_subir}");
        }
    }
}

From source file:es.pode.catalogadorWeb.presentacion.categoriasAvanzado.anotacion.AnotacionControllerImpl.java

/**
 * @see es.pode.catalogadorWeb.presentacion.categoriasAvanzado.anotacion.AnotacionController#eliminarAnotacion(org.apache.struts.action.ActionMapping, es.pode.catalogadorWeb.presentacion.categoriasAvanzado.anotacion.EliminarAnotacionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *//*  w w w  .  j  a  va  2 s.c o  m*/
public final void eliminarAnotacion(ActionMapping mapping,
        es.pode.catalogadorWeb.presentacion.categoriasAvanzado.anotacion.EliminarAnotacionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    boolean esta = false;
    Object valor = request.getSession().getAttribute("form");
    CatalogadorAvSession catalogadorAvSession = this.getCatalogadorAvSession(request);
    boolean seleccion = false;

    try {

        //          si expira la sesin, debemos dar error de sesin, comprobamos si el objeto de sesin contiene el identificador
        if ((catalogadorAvSession == null) || (catalogadorAvSession.getIdentificador() == null)) {
            throw new Exception();
        }
        //recupero la coleccion de Elementos para borrarle el que coincida con ese id
        if (valor instanceof AnotacionFormImpl) {
            form.setListadoAnotacionesAsArray(((AnotacionFormImpl) valor).getListadoAnotacionesAsArray());

        } else if (valor instanceof ConfirmacionEliminarCancelarEliminarFormImpl) {
            form.setListadoAnotacionesAsArray(
                    ((ConfirmacionEliminarCancelarEliminarFormImpl) valor).getListadoAnotacionesAsArray());
        } else if (valor instanceof ConfirmacionEliminarDatosAsesionFormImpl) {
            form.setListadoAnotacionesAsArray(
                    ((ConfirmacionEliminarDatosAsesionFormImpl) valor).getListadoAnotacionesAsArray());
        }

        if ((form.getTituloAnotacionRowSelection() != null) && (form.getListadoAnotacionesAsArray() != null)
                && (form.getListadoAnotacionesAsArray().length > 0)) {
            AvAnnotationVO[] anotaciones = (AvAnnotationVO[]) form.getListadoAnotacionesAsArray();
            ArrayList listaRec = new ArrayList();
            for (int indi = 0; indi < anotaciones.length; indi++) {
                int indiTitu = 0;
                while ((indiTitu < form.getTituloAnotacionRowSelection().size() && (!esta))) {
                    int valorTitu = Integer
                            .parseInt(form.getTituloAnotacionRowSelection().get(indiTitu).toString()) - 1;
                    if (valorTitu == indi) {
                        esta = true;
                        seleccion = true;
                    }
                    indiTitu++;
                }
                if (!esta) {
                    listaRec.add(anotaciones[indi]);
                }
                esta = false; //Iniciliazamos para la siguiente iteracion
            }
            AvAnnotationVO[] anotaAux = (AvAnnotationVO[]) listaRec
                    .toArray(new AvAnnotationVO[listaRec.size()]);

            form.setListadoAnotacionesAsArray(anotaAux);

        }

    } catch (org.acegisecurity.AccessDeniedException ad) {
        logger.error("Error Acceso Denegado " + ad);
        throw new java.lang.Exception("anotacion", ad);
    } catch (Exception e) {
        logger.error("Error AnotacionController, mtodo EliminarAnotacion " + e);
        throw new java.lang.Exception("anotacion", e);
    }
    //System.out.print("  ");
    //cambiamos la comprobacin de Error Validacion, para que esta excepcion no sea capturada por java.lang.Exception
    if (!seleccion)
        throw new ValidatorException("{error.EliminarNoSeleccion}");
}

From source file:es.pode.administracion.presentacion.faqs.modificar.ModificarControllerImpl.java

/**
 * @see es.pode.administracion.presentacion.faqs.modificar.ModificarController#modificarFaqUno(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.faqs.modificar.ModificarFaqUnoForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *///from w  w  w  . j  ava2  s  .  c  o  m
public final void modificarFaqUno(ActionMapping mapping,
        es.pode.administracion.presentacion.faqs.modificar.ModificarFaqUnoForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    FaqTraducidaIdiomaVO[] faqs = null;
    CrearControllerImpl crearController = new CrearControllerImpl();
    /**
    * **************************************************************************************************************************************
    * ********************************************** SE COMPRUEBA LA CATEGORIA *************************************************************
    * **************************************************************************************************************************************
    * */
    if (form.getCategoria() == null) {
        logger.error("Categoria es un campo obligatorio");
        throw new ValidatorException("{errors.noticia.categoria}");
    }
    logger.debug("Se recupera el vo de la faq de la request");
    FaqVO faq = (FaqVO) request.getSession().getAttribute(VERFAQVO);

    if (logger.isDebugEnabled())
        logger.debug("Se obtiene la categoria con identificador [" + form.getCategoria() + "]");
    CategoriaFaqVO categoria = this.getSrvFaqService().obtenerCategoria(form.getCategoria());
    request.getSession().setAttribute(CATEGORIAMODVO, categoria);

    ArrayList idiomasList = new ArrayList();
    CategoriaIdiomaFaqVO[] idiomasCategorias = categoria.getCategoriaIdioma();
    for (int i = 0; i < idiomasCategorias.length; i++)
        idiomasList.add(idiomasCategorias[i].getIdioma());

    form.setIdiomasCategoriasBBDDAsArray((String[]) idiomasList.toArray(new String[0]));

    //Se comprueba la posicion en todos los idiomas
    if (logger.isDebugEnabled())
        logger.debug("Gestin de la posicion de los faqs en cada idioma");

    if (request.getSession().getAttribute(FAQS) != null) {
        //Se recupera de la sesion
        faqs = (FaqTraducidaIdiomaVO[]) request.getSession().getAttribute(FAQS);
    } else {
        //         Se obtiene los faqs en el servicio
        faqs = this.getSrvFaqService().obtenerFaqsBloquesIdiomas(I18n.getInstance().obtenerIdiomasPlataforma());
        request.getSession().setAttribute(FAQS, faqs);
    }
    //      Castellano      
    String[] faqsEs = crearController.dameFaqsIdiomaPosicion(faqs, this.getPropertyValue("castellano"));
    form.setPosicionesCastellanoAsArray(faqsEs);
    //Ingles
    String[] faqsEn = crearController.dameFaqsIdiomaPosicion(faqs, this.getPropertyValue("ingles"));
    form.setPosicionesInglesAsArray(faqsEn);
    //Catalan
    String[] faqsCa = crearController.dameFaqsIdiomaPosicion(faqs, this.getPropertyValue("catalan"));
    form.setPosicionesCatalanAsArray(faqsCa);
    //Valenciano
    String[] faqsVa = crearController.dameFaqsIdiomaPosicion(faqs, this.getPropertyValue("valenciano"));
    form.setPosicionesValencianoAsArray(faqsVa);
    //Gallego
    String[] faqsGl = crearController.dameFaqsIdiomaPosicion(faqs, this.getPropertyValue("gallego"));
    form.setPosicionesGallegoAsArray(faqsGl);
    //Euskera
    String[] faqsEu = crearController.dameFaqsIdiomaPosicion(faqs, this.getPropertyValue("euskera"));
    form.setPosicionesEuskeraAsArray(faqsEu);

    if ((form.getCastellano() != null && form.getCastellano().length > 0)
            || (form.getCatalan() != null && form.getCatalan().length > 0)
            || (form.getEuskera() != null && form.getEuskera().length > 0)
            || (form.getIngles() != null && form.getIngles().length > 0)
            || (form.getValenciano() != null && form.getValenciano().length > 0)
            || (form.getGallego() != null && form.getGallego().length > 0)) {
        String[] castellano = form.getCastellano();
        String[] catalan = form.getCatalan();
        String[] euskera = form.getEuskera();
        String[] ingles = form.getIngles();
        String[] valenciano = form.getValenciano();
        String[] gallego = form.getGallego();

        //Tratamiento de la posicion         
        form.setValuePosicion(
                crearController.dameValuePosiciones(castellano, catalan, ingles, euskera, gallego, valenciano));

        form.setIdiomas(crearController.dameIdiomas(castellano, catalan, ingles, euskera, gallego, valenciano));
        form.setIdiomasAlta(
                crearController.dameIdiomas(castellano, catalan, ingles, euskera, gallego, valenciano));
        form.setTitulo(crearController.dameTitulos(castellano, catalan, ingles, euskera, gallego, valenciano));
        form.setDescripcion(
                crearController.dameDescripciones(castellano, catalan, ingles, euskera, gallego, valenciano));
        form.setNombreCategoria(
                crearController.dameCategorias(castellano, catalan, ingles, euskera, gallego, valenciano));
    } else {

        ArrayList idiomasAlta = new ArrayList();
        ArrayList titulo = new ArrayList();
        ArrayList descripcion = new ArrayList();
        ArrayList valuePosicion = new ArrayList();

        DescripcionFaqVO[] descripcionesFaq = faq.getDescripcionFaq();
        for (int j = 0; descripcionesFaq != null && j < descripcionesFaq.length; j++) {
            if (descripcionesFaq[j].getPregunta() != null && !("").equals(descripcionesFaq[j].getPregunta())) {
                titulo.add(descripcionesFaq[j].getPregunta());
                descripcion.add(descripcionesFaq[j].getRespuesta());
                valuePosicion.add(descripcionesFaq[j].getPosicion().toString());
                idiomasAlta.add(descripcionesFaq[j].getIdioma());
            }
        }

        form.setValuePosicion(valuePosicion);
        form.setTitulo(titulo);
        form.setDescripcion(descripcion);
        form.setIdiomasAlta(idiomasAlta);

        ArrayList nombreCategoria = new ArrayList();
        ArrayList idiomas = new ArrayList();

        //          Se almacena los datos
        if (categoria != null) {
            CategoriaIdiomaFaqVO[] categoriasIdiomas = categoria.getCategoriaIdioma();
            for (int i = 0; categoriasIdiomas != null && i < categoriasIdiomas.length; i++) {
                if (categoriasIdiomas[i].getNombre() != null
                        && !("").equals(categoriasIdiomas[i].getNombre())) {
                    nombreCategoria.add(categoriasIdiomas[i].getNombre());
                    idiomas.add(categoriasIdiomas[i].getIdioma());
                }
            }
        }

        form.setIdiomas(idiomas);
        form.setNombreCategoria(nombreCategoria);

    }
}

From source file:es.pode.empaquetador.presentacion.avanzado.recursos.crear.elementos.CrearRecursoAvanzadoElementosControllerImpl.java

@Override
public final void submitArchivos(ActionMapping mapping,
        es.pode.empaquetador.presentacion.avanzado.recursos.crear.elementos.SubmitArchivosForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

    CrearRecursoAvanzadoSession sesRecurs = this.getCrearRecursoAvanzadoSession(request);

    java.util.Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE);
    ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale);

    String accion = form.getAction();

    if (accion.equals(i18n.getString("portalempaquetado.avanzado.recursos.crear.paso2.archivos.eliminar"))) {
        if (form.getHrefRowSelection() != null && form.getHrefRowSelection().size() > 0) {
            form.setArchivos(form.getHrefRowSelection());
        } else {//from  ww w.j  a v a 2  s . c  o m
            throw new ValidatorException(
                    "{presentacion.avanzado.recursos.crear.elementos.error.seleccionar.archivos}");
        }
    } else if (accion
            .equals(i18n.getString("portalempaquetado.avanzado.recursos.crear.paso2.archivos.principal"))) {
        if ((sesRecurs.getArchivos() != null) && (sesRecurs.getArchivos().size() == 0)) {
            throw new ValidatorException("{portal_empaquetado.exception.archivoPrincipalVacio}");
        }
    }

}

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

public final void navegarSubmanifiesto(ActionMapping mapping,
        es.pode.empaquetador.presentacion.avanzado.submanifiestos.gestor.NavegarSubmanifiestoForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

    boolean encontrado = false;
    String identificador = form.getIdentifier();
    EmpaquetadorSession sesEmpaq = this.getEmpaquetadorSession(request);
    List subman = sesEmpaq.getSubmanifestPath();

    // ultimo ODE
    OdeVO ode = (OdeVO) subman.get(subman.size() - 1);
    Integer index = subman.size() - 1;
    String identificadorOde = index == 0 ? sesEmpaq.getIdLocalizador() : ode.getIdentifier();

    // cojo los hijos del ultimo ODE
    OdeVO[] hijos = ode.getSubmanifiestos();
    // los recorro viendo si coinciden
    for (int i = 0; (encontrado == false && i < hijos.length); i++) {
        if (hijos[i].getIdentifier().equals(identificador)) {
            encontrado = true;/* ww  w. ja v  a  2  s .c o  m*/
            Boolean nuevoOde = this.getSrvGestorManifestService().crearReferenciaEnCache(identificadorOde,
                    identificador);
            if (nuevoOde.booleanValue() == false) {
                throw new ValidatorException("{portal_empaquetado_gestorSubman.exception}");
            } else {
                subman.add(hijos[i]);

            }
        }
    }
    if (encontrado == false) {
        // recorro el sesEmpaq.getSubmanifestPath();
        for (int i = 0; (i < subman.size() && !encontrado); i++) {
            OdeVO submanifiesto = (OdeVO) subman.get(i);
            if (submanifiesto.getIdentifier().equals(identificador)) {
                // Voy a borrar a partir del identificador encontrado
                encontrado = true;

                for (int j = i + 1; j < subman.size(); j++) {
                    OdeVO elemento = (OdeVO) subman.get(j);
                    this.getSrvGestorManifestService().descargarManifest(elemento.getIdentifier());
                    subman.remove(j);
                }

            }
        }
        sesEmpaq.setSubmanifestPath(subman);
    }
}

From source file:es.pode.visualizador.presentacion.noticia.NoticiaControllerImpl.java

public void obtenerCategoria(ActionMapping mapping, ObtenerCategoriaForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    try {//from  ww w.  j a v a2 s.  c o m
        CategoriaNoticiaVO categoriaVO = new CategoriaNoticiaVO();
        if (form.getIdCategoria() != null) {
            categoriaVO = this.getSrvNoticiasService().obtenerCategoria(form.getIdCategoria());
            //            categoriaVO.setNueva(new Boolean (false));
            form.setCategoriaVO(categoriaVO);
        }
    } catch (Exception e) {
        logger.error("La categora no est disponible: ", e);
        throw new ValidatorException("{error.categoria.encontrar}");
    }

}

From source file:es.pode.catalogadorWeb.presentacion.categoriasAvanzado.usoeducativo.UsoeducativoControllerImpl.java

/**
 * @see es.pode.catalogadorWeb.presentacion.categoriasAvanzado.usoeducativo.UsoeducativoController#eliminarUsoEducativo(org.apache.struts.action.ActionMapping, es.pode.catalogadorWeb.presentacion.categoriasAvanzado.usoeducativo.EliminarUsoEducativoForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *//*from  www  . jav  a2 s  . c  o m*/
public final void eliminarUsoEducativo(ActionMapping mapping,
        es.pode.catalogadorWeb.presentacion.categoriasAvanzado.usoeducativo.EliminarUsoEducativoForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    boolean esta = false;
    boolean seleccion = false;

    try {
        Object valor = request.getSession().getAttribute("form");
        CatalogadorAvSession catalogadorAvSession = this.getCatalogadorAvSession(request);
        //         si expira la sesin, debemos dar error de sesin, comprobamos si el objeto de sesin contiene el identificador
        if ((catalogadorAvSession == null) || (catalogadorAvSession.getIdentificador() == null)) {
            throw new Exception();
        }
        //recupero la coleccion de Elementos para borrarle el que coincida con ese id
        if (valor instanceof UsoEducativoFormImpl) {
            form.setListadoUsosEduAsArray(((UsoEducativoFormImpl) valor).getListadoUsosEduAsArray());

        } else if (valor instanceof ConfirmacionEliminarCancelarEliminarFormImpl) {
            form.setListadoUsosEduAsArray(
                    ((ConfirmacionEliminarCancelarEliminarFormImpl) valor).getListadoUsosEduAsArray());
        } else if (valor instanceof ConfirmacionEliminarDatosASesionFormImpl) {
            form.setListadoUsosEduAsArray(
                    ((ConfirmacionEliminarDatosASesionFormImpl) valor).getListadoUsosEduAsArray());
        }
        if ((form.getTituloUsoEduRowSelection() != null) && (form.getListadoUsosEduAsArray() != null)
                && (form.getListadoUsosEduAsArray().length > 0)) {
            AvEducationalVO[] educaciones = (AvEducationalVO[]) form.getListadoUsosEduAsArray();
            ArrayList listaRec = new ArrayList();
            for (int indi = 0; indi < educaciones.length; indi++) {
                int indiTitu = 0;
                while ((indiTitu < form.getTituloUsoEduRowSelection().size() && (!esta))) {
                    int valorTitu = Integer
                            .parseInt(form.getTituloUsoEduRowSelection().get(indiTitu).toString()) - 1;
                    if (valorTitu == indi) {
                        esta = true;
                        seleccion = true;
                    }
                    indiTitu++;
                }
                if (!esta) {
                    listaRec.add(educaciones[indi]);
                }
                esta = false; //Iniciliazamos para la siguiente iteracion
            }
            AvEducationalVO[] eduAux = (AvEducationalVO[]) listaRec
                    .toArray(new AvEducationalVO[listaRec.size()]);
            form.setListadoUsosEduAsArray(eduAux);

        }

    } catch (org.acegisecurity.AccessDeniedException ad) {
        logger.error("Error de Acceso " + ad);
        throw new java.lang.Exception("uso.educativo", ad);

    } catch (Exception e) {
        logger.error("Error en catalogadorWeb, categora Uso Educativo, metodo eliminarUsoEducativo " + e);
        throw new java.lang.Exception("uso.educativo", e);

    }

    if (!seleccion)
        throw new ValidatorException("{error.EliminarNoSeleccion}");

}