List of usage examples for org.apache.commons.validator ValidatorException ValidatorException
public ValidatorException(String message)
From source file:es.pode.administracion.presentacion.categorias.modificarCategoriaNoticia.ModificarCategoriaNoticiaControllerImpl.java
public void modificarCategoriaNoticia(ActionMapping mapping, ModificarCategoriaNoticiaForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { logger.debug("Se modifica la categoria"); try {/*from w ww.j av a2s .c om*/ /** * ************************************************************************************************************************************** * ************************************************ SE MODIFICA LA CATEGORIA ************************************************************* * ************************************************************************************************************************************** * */ ArrayList categorias = (ArrayList) form.getNombreCategoria(); ArrayList idiomas = (ArrayList) form.getIdiomas(); if (categorias != null && categorias.size() > 0) { CrearCategoriaNoticiaControllerImpl categoriasNoti = new CrearCategoriaNoticiaControllerImpl(); //Se obtienen solo las categorias que estan rellenas ArrayList listaConTexto = categoriasNoti.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]; 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; } //Se introducen en el vo de la noticia a modificar los datos de la categoria que no han sido modificados. Se obtienen de la request CategoriaNoticiaVO categoriaRequest = (CategoriaNoticiaVO) request.getSession() .getAttribute(CATEGORIAVO); categoriaNoticia.setFechaPublicacion(categoriaRequest.getFechaPublicacion()); categoriaNoticia.setCategoriaIdioma(categoriaIdiomaNoticia); categoriaNoticia.setId(form.getIdCategoriaNoticia()); categoriaNoticia.setNombre(categoriaRequest.getNombre()); this.getSrvNoticiasService().limpiarCategoria(form.getIdCategoriaNoticia()); logger.debug("Se modifica en la base de datos la categoria"); this.getSrvNoticiasService().modificarCategoria(categoriaNoticia); form.setIdModificado(form.getIdCategoriaNoticia()); // Se elimina de la request la categoria request.getSession().setAttribute(CATEGORIAVO, null); } } catch (Exception e) { logger.error("Error modificando la categoria noticia", e); throw new ValidatorException("{error.modificando.categoria}"); } }
From source file:es.pode.modificador.presentacion.pendientes.ModificacionesPendientesControllerImpl.java
/** * @see es.pode.modificador.presentacion.pendientes.ModificacionesPendientesController#submit(org.apache.struts.action.ActionMapping, es.pode.modificador.presentacion.pendientes.SubmitForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *///w w w . j a v a 2 s . c o m public final void submit(ActionMapping mapping, es.pode.modificador.presentacion.pendientes.SubmitForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { java.util.Locale locale = (java.util.Locale) request.getSession() .getAttribute(ConstantesAgrega.DEFAULT_LOCALE); ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale); String accion = form.getAction(); if (accion.equals(i18n.getString("modificacionesPendientes.eliminar"))) { if (form.getIdModificacionRowSelection() == null || form.getIdModificacionRowSelection().size() == 0) { throw new ValidatorException("{modificacionesPendientes.elementoSeleccionado.exception}"); } // Transformo a Long[] ArrayList lista = new ArrayList(); String[] ids = form.getIdModificacionRowSelectionAsArray(); for (int i = 0; i < ids.length; i++) { lista.add(Long.valueOf(ids[i])); } form.setIdentificadores(lista); } }
From source file:es.pode.administracion.presentacion.categoriasFaqs.modificarCategoriaFaq.ModificarCategoriaFaqControllerImpl.java
/** * @see es.pode.administracion.presentacion.categoriasFaqs.modificarCategoriaFaq.ModificarCategoriaFaqController#modificarCategoriaFaq(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.categoriasFaqs.modificarCategoriaFaq.ModificarCategoriaFaqForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *///from w w w. java 2 s . c om public final void modificarCategoriaFaq(ActionMapping mapping, es.pode.administracion.presentacion.categoriasFaqs.modificarCategoriaFaq.ModificarCategoriaFaqForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ArrayList categorias = (ArrayList) form.getNombreCategoria(); ArrayList idiomas = (ArrayList) form.getIdiomas(); logger.debug("Se modifica la categoria"); try { /** * ************************************************************************************************************************************** * ************************************************ SE MODIFICA LA CATEGORIA ************************************************************* * ************************************************************************************************************************************** * */ if (categorias != null && categorias.size() > 0) { CrearCategoriaNoticiaControllerImpl categoriasNoti = new CrearCategoriaNoticiaControllerImpl(); // Se obtienen solo las categorias que estan rellenas ArrayList listaConTexto = categoriasNoti.devuelveListaConTexto(categorias, idiomas); String[] listaCategorias = (String[]) listaConTexto.get(0); String[] listaIdiomas = (String[]) listaConTexto.get(1); // Introducimos las categorias idiomas CategoriaFaqVO categoriaFaq = new CategoriaFaqVO(); CategoriaIdiomaFaqVO[] categoriaIdiomaFaq = new CategoriaIdiomaFaqVO[listaCategorias.length]; for (int i = 0; i < listaCategorias.length; i++) { CategoriaIdiomaFaqVO categoriaIdiomaFaqAux = new CategoriaIdiomaFaqVO(); categoriaIdiomaFaqAux.setIdioma(listaIdiomas[i]); categoriaIdiomaFaqAux.setNombre(listaCategorias[i]); categoriaIdiomaFaq[i] = categoriaIdiomaFaqAux; } // Se introducen en el vo de la faq a modificar los datos de la categoria que no han sido modificados. Se obtienen de la request CategoriaFaqVO categoriaRequest = (CategoriaFaqVO) request.getSession() .getAttribute(CATEGORIAFAQVO); categoriaFaq.setFechaAlta(categoriaRequest.getFechaAlta()); categoriaFaq.setCategoriaIdioma(categoriaIdiomaFaq); categoriaFaq.setId(form.getId()); categoriaFaq.setNombre(categoriaRequest.getNombre()); this.getSrvFaqService().limpiarCategoria(form.getId()); logger.debug("Se modifica en la base de datos la categoria"); this.getSrvFaqService().modificarCategoria(categoriaFaq); form.setIdModificado(form.getId()); //Se elimina de la request la categoria request.getSession().setAttribute(CATEGORIAFAQVO, null); } } catch (Exception e) { logger.error("Error modificando la categoria faq", e); throw new ValidatorException("{error.modificando.categoria}"); } }
From source file:es.pode.administracion.presentacion.noticias.crear.CrearControllerImpl.java
public void obtenerCategoria(ActionMapping mapping, ObtenerCategoriaForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { try {/*from www.j a va 2 s.c o m*/ /** * ************************************************************************************************************************************** * ****************************************** 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 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"); if (estaLleno(form.getNombreImagen())) form.setActivarImagen(new Integer(1)); //Introducimos los valores por defecto si estos vienen vacios if (form.getEstado() == null)//por defecto la noticia esta activa form.setEstado(new Boolean(true)); if (form.getActivarImagen() == null) { //Por defecto se selecciona la opcion de aadir una imagen a la noticia form.setActivarImagen(new Integer(3)); //Por defecto se selecciona el alineamiento arriba-izquierda form.setAlineamiento(new Integer(0)); } } catch (Exception e) { logger.error("Error recuperando las categorias"); throw new ValidatorException("{errors.categorias.recuperar}"); } }
From source file:es.pode.empaquetador.presentacion.basico.asociar.AsociarControllerImpl.java
/** * @see es.pode.empaquetador.presentacion.basico.asociar.AsociarController#selectActionObject(org.apache.struts.action.ActionMapping, es.pode.empaquetador.presentacion.basico.asociar.SelectActionObjectForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *//*from w w w.j a va 2s . c om*/ public final java.lang.String selectActionObject(ActionMapping mapping, es.pode.empaquetador.presentacion.basico.asociar.SelectActionObjectForm 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 resultado = null; if (accion.equals(i18n.getString("portalempaquetado.Aceptar"))) { if (form.getTexto() == null || form.getTexto().equals("")) { if (logger.isDebugEnabled()) logger.debug("el texto embebido es null"); throw new ValidatorException("{portalempaquetado.basico.asociar.embed.error.vacio}"); } resultado = "Aceptar"; } else { resultado = "Cancelar"; form.setTipo("Object"); } return resultado; }
From source file:es.pode.empaquetador.presentacion.salir.SalirControllerImpl.java
public final String selectAction(ActionMapping mapping, SelectActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String result = null;/*from ww w. j a v a 2s . co m*/ 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("empaquetador.presentacion.salir.BotonCancelar"))) { result = "Cancelar"; } else if (actionSubmit.equals(i18n.getString("empaquetador.presentacion.salir.BotonSi"))) { result = "Guardar"; } else if (actionSubmit.equals(i18n.getString("empaquetador.presentacion.salir.BotonNo"))) { result = "Salir"; } Logger.getLogger(this.getClass()) .error("El valor del submit no es correcto (actionSubmit = " + actionSubmit + ";"); return result; }
From source file:es.pode.empaquetador.presentacion.agregar.personales.AgregarPersonalesControllerImpl.java
/** * @see es.pode.empaquetador.presentacion.agregar.personales.AgregarPersonalesController#agregar(org.apache.struts.action.ActionMapping, es.pode.empaquetador.presentacion.agregar.personales.AgregarForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *//*w ww . j a v a 2s.co m*/ public final void agregar(ActionMapping mapping, es.pode.empaquetador.presentacion.agregar.personales.AgregarForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String idAgregar = form.getIdODE(); EmpaquetadorSession sesEmpaq = this.getEmpaquetadorSession(request); List subman = sesEmpaq.getSubmanifestPath(); String identificador = sesEmpaq.getIdLocalizador(); List idCollection = sesEmpaq.getIdCollection(); Object ultimoIdCollection; String identificadorUltimo = ""; if (idCollection.size() > 0) { 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 (logger.isDebugEnabled()) logger.debug("Estamos en el avanzado "); if (subman.size() == 1) { this.getSrvGestorManifestService().agregarManifiestoRepositorio(identificador, idAgregar, null); } else if (subman.size() > 1) { OdeVO ultimo = (OdeVO) subman.get(subman.size() - 1); String submanifestId = ultimo.getIdentifier(); this.getSrvGestorManifestService().agregarManifiestoRepositorio(identificador, idAgregar, submanifestId); } } else if (tipoEmpaquetador.equals("Basico")) { if (logger.isDebugEnabled()) logger.debug("Estamos en el bsico"); this.getSrvEmpaquetadorBasicoService().agregarRepositorio(identificador, idAgregar, identificadorUltimo); } } catch (Exception ex) { if (logger.isDebugEnabled()) logger.error("Ocurrio un error al validar ODE " + identificador); throw new ValidatorException("{portalempaquetado.avanzado.submanifiesto.error.agregarLocal}"); } }
From source file:es.pode.empaquetador.presentacion.archivos.gestor.GestorArchivosControllerImpl.java
/** * @see es.pode.empaquetador.presentacion.archivos.gestor.GestorArchivosController#submit(org.apache.struts.action.ActionMapping, es.pode.empaquetador.presentacion.archivos.gestor.SubmitForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *///w ww .j ava2 s . com public final void submit(ActionMapping mapping, es.pode.empaquetador.presentacion.archivos.gestor.SubmitForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { GestorArchivosSession sesArch = this.getGestorArchivosSession(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(COPIAR))) || (accion.equals(i18n.getString(CORTAR))) || (accion.equals(i18n.getString(ELIMINAR)))) { List archivosARecuperar = new ArrayList(); List elementos = form.getNombreRowSelection(); if (elementos != null && elementos.size() > 0) { /* * voy a recorrer la lista recuperando los nombres * para recuperar los ArchivosVO */ for (int i = 0; i < elementos.size(); i++) { String nombre = (String) elementos.get(i); //hijos del ultimo elemento del path List path = sesArch.getPath(); //obtengo el ultimo elemento ArchivoVO ultimoElemento = (ArchivoVO) path.get(path.size() - 1); ArchivoVO[] hijosUltimoElemento = ultimoElemento.getContenidos(); boolean encontrado = false; //comparo los nombres de los archivosVO y si es =, lo inserto en la lista "archivosARecuperar" for (int j = 0; (encontrado == false && j < hijosUltimoElemento.length); j++) { if (hijosUltimoElemento[j].getNombre().equals(nombre)) { ArchivoVO voEncontrado = hijosUltimoElemento[j]; archivosARecuperar.add(voEncontrado); encontrado = true; } } } //fin_for (int i=0; i<elementos.size();i++) //inserto la lista de ArchivosVO que he recuperado form.setArchivosVO(archivosARecuperar); Logger.getLogger(this.getClass()).info("Archivos aadidos al portapapeles"); } else { Logger.getLogger(this.getClass()).error("Lanzando excepcion de validacion."); if (accion.equals(i18n.getString(COPIAR))) throw new ValidatorException( "{presentacion.archivos.gestor.archivos.error.copiar.noseleccionado}"); else if ((accion.equals(i18n.getString(CORTAR)))) throw new ValidatorException( "{presentacion.archivos.gestor.archivos.error.cortar.noseleccionado}"); else if ((accion.equals(i18n.getString(ELIMINAR)))) throw new ValidatorException( "{presentacion.archivos.gestor.archivos.error.eliminar.noseleccionado}"); } } else if (accion.equals("portal_empaquetado.pegar")) { if (sesArch.getPortapapeles() == null || sesArch.getPortapapeles().size() == 0) { throw new ValidatorException("{presentacion.archivos.gestor.archivos.error.pegar}"); } } }
From source file:es.pode.administracion.presentacion.nodos.modificarNodo.ModificarNodoControllerImpl.java
/** * @see es.pode.administracion.presentacion.nodos.modificarNodo.ModificarNodoController#cargarNodo(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.nodos.modificarNodo.CargarNodoForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *///w ww . j a v a 2s . co m public final void cargarNodo(ActionMapping mapping, es.pode.administracion.presentacion.nodos.modificarNodo.CargarNodoForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { try { //recogemos las ccaa de la bbdd y las internacionalizamos desde el properties Locale locale = new Locale(LdapUserDetailsUtils.getIdioma()); ficheroRecursos = ResourceBundle.getBundle("application-resources", request.getLocale()); List ccaa = Arrays.asList(this.getSrvNodoService().obtenerCCAAs()); CcaaVO[] ccaaVOArray = (CcaaVO[]) ccaa.toArray(); List ccaaList = new ArrayList(); for (int i = 0; i < ccaaVOArray.length; i++) { if (ccaaVOArray[i].getCodigo() != null) { String descripcion = null; try { descripcion = ficheroRecursos.getString(ccaaVOArray[i].getCodigo()); } catch (Exception ex) { log.warn("El codigo de la comunidad " + ccaaVOArray[i].getCodigo() + " no esta en el fichero de internacionalizacion"); descripcion = ccaaVOArray[i].getDescripcion(); } ccaaList.add(descripcion.toLowerCase()); ccaaVOArray[i].setDescripcion(descripcion); } else ccaaVOArray[i].setCodigo(""); } Collections.sort(ccaaList); ccaa = ordenarLista(ccaaList, ccaaVOArray); // Rellena el combo de ccaa ((ModificarNodoFormImpl) form).setCcaaBackingList(ccaa, "id", "descripcion"); Long id = new Long(request.getParameter("id")); if (id == null) { throw new ValidatorException("{errors.modificarnodo.idNulo}"); } NodoVO nodo = this.getSrvNodoService().obtenerNodo(id); form.setId(id); form.setNodo(nodo.getNodo()); form.setUrl(nodo.getUrl()); form.setUrlWS(nodo.getUrlWS()); form.setIdNodo(nodo.getIdNodo()); if (nodo.getCcaa() != null) { form.setCcaa(nodo.getCcaa().getId()); } form.setPuerto(nodo.getPuerto()); } catch (ValidatorException e) { log.equals("Error al recuperar: " + e); throw e; } catch (Exception e) { log.equals("Error al recuperar el nodo: " + e); throw e; } }
From source file:es.pode.catalogadorWeb.presentacion.categoriasAvanzado.clasificacion.ClasificacionControllerImpl.java
public void eliminarClasificacion(ActionMapping mapping, EliminarClasificacionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { boolean esta = false; boolean seleccion = false; Object valor = request.getSession().getAttribute("form"); CatalogadorAvSession catalogadorAvSession = this.getCatalogadorAvSession(request); try {/* w w w . j av a 2s .c o m*/ // 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(); } if (valor instanceof ClasificacionFormImpl) { form.setListadoClasificacionAsArray( ((ClasificacionFormImpl) valor).getListadoClasificacionAsArray()); } else if (valor instanceof es.pode.catalogadorWeb.presentacion.categoriasAvanzado.clasificacion.ConfirmacionEliminarDatosASesionFormImpl) { form.setListadoClasificacionAsArray( ((es.pode.catalogadorWeb.presentacion.categoriasAvanzado.clasificacion.ConfirmacionEliminarDatosASesionFormImpl) valor) .getListadoClasificacionAsArray()); } else if (valor instanceof es.pode.catalogadorWeb.presentacion.categoriasAvanzado.clasificacion.ConfirmacionEliminarCancelarEliminarFormImpl) { form.setListadoClasificacionAsArray( ((es.pode.catalogadorWeb.presentacion.categoriasAvanzado.clasificacion.ConfirmacionEliminarCancelarEliminarFormImpl) valor) .getListadoClasificacionAsArray()); } if ((form.getTituloClasificacionRowSelection() != null) && (form.getListadoClasificacionAsArray() != null) && (form.getListadoClasificacionAsArray().length > 0)) { AvClassificationVO[] clasificaciones = (AvClassificationVO[]) form.getListadoClasificacionAsArray(); ArrayList listaRec = new ArrayList(); for (int indi = 0; indi < clasificaciones.length; indi++) { int indiTitu = 0; while ((indiTitu < form.getTituloClasificacionRowSelection().size() && (!esta))) { int valorTitu = Integer .parseInt(form.getTituloClasificacionRowSelection().get(indiTitu).toString()) - 1; if (valorTitu == indi) { esta = true; seleccion = true; } indiTitu++; } if (!esta) { listaRec.add(clasificaciones[indi]); } esta = false; //Iniciliazamos para la siguiente iteracion } AvClassificationVO[] clasiAux = (AvClassificationVO[]) listaRec .toArray(new AvClassificationVO[listaRec.size()]); form.setListadoClasificacionAsArray(clasiAux); } //fin if } catch (org.acegisecurity.AccessDeniedException ad) { logger.error("Error Acceso Denegado " + ad); throw new java.lang.Exception("clasificacion", ad); } catch (Exception e) { logger.error("Error categoria clasificacion, mtodo eliminarClasificacion " + e); throw new java.lang.Exception("clasificacion", e); } //Cambiamos aqui, para que no sea caputrada por Exception if (!seleccion) throw new ValidatorException("{error.EliminarNoSeleccion}"); }