List of usage examples for org.apache.commons.validator ValidatorException ValidatorException
public ValidatorException(String message)
From source file:es.pode.administracion.presentacion.faqs.faqs.FaqsControllerImpl.java
public void getIds(ActionMapping mapping, GetIdsForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { /**// w w w. ja va 2 s .c om * ************************************************************************************************************************************** * **************************** SE RECUPERAN LOS IDENTIFICADORES DE LA FAQ A ELIMINAR ********************************************* * ************************************************************************************************************************************** * */ List lista = ((FaqsEliminarFormImpl) form).getIdRowSelection(); if (lista == null) { logger.error("Debe seleccionar al menos una faq a eliminar"); throw new ValidatorException("{errors.borrarFaq.idNulo}"); } else { form.setIds(lista); } }
From source file:es.pode.empaquetador.presentacion.avanzado.organizaciones.elementos.crearelemento.CrearElementoControllerImpl.java
public final java.lang.String selectAction01(ActionMapping mapping, es.pode.empaquetador.presentacion.avanzado.organizaciones.elementos.crearelemento.SelectAction01Form form, HttpServletRequest request, HttpServletResponse response) throws Exception { /*/* w w w . j a va2s.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("{portal_empaquetado.exception}"); } else if (actionSubmit.equals(i18n.getString("portal_empaquetado_crearElemento.cancelar"))) { result = "Cancelar"; } else if (actionSubmit.equals(i18n.getString("portal_empaquetado_crearElemento.continuar"))) { result = "Continuar"; } else if (actionSubmit.equals(i18n.getString("portal_empaquetado_crearElemento.metadatos"))) { result = "Metadatos"; } else { logger.error("El valor del submit no es correcto (actionSubmit = " + actionSubmit + ";"); } return result; }
From source file:es.pode.empaquetador.presentacion.salir.SalirControllerImpl.java
public final void guardar(ActionMapping mapping, es.pode.empaquetador.presentacion.salir.GuardarForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // if(validacion.getEsValidoManifest().booleanValue()) // {/*from w w w . j ava 2 s . co m*/ String identificador = this.getEmpaquetadorSession(request).getIdLocalizador(); if (logger.isDebugEnabled()) logger.debug("Guardando el ODE " + identificador); if (DecisorOffline.esOffline()) { this.getSrvGestorManifestService().guardarManifiesto(identificador); } else { String sEspacioLibre = this.getEmpaquetadorSession(request).getEspacioLibre(); String sEspacioOdeInicio = this.getEmpaquetadorSession(request).getEspacioOde(); if (logger.isDebugEnabled()) logger.debug("Espacio libre: " + sEspacioLibre + "Espacio ODE inicialmente:" + sEspacioOdeInicio); if (org.apache.commons.lang.StringUtils.isNumeric(sEspacioLibre) && org.apache.commons.lang.StringUtils.isNumeric(sEspacioOdeInicio)) { Long espacioLibre = new Long(sEspacioLibre); Long espacioOdeInicio = new Long(sEspacioOdeInicio); Boolean hayEspacio = this.getSrvGestorArchivosService().consultaCuota(identificador, espacioLibre, espacioOdeInicio); if (hayEspacio.booleanValue()) { this.getSrvGestorManifestService().guardarManifiesto(identificador); } else { throw new ValidatorException("{gestor.avanzado.guardar.noEspacioEnCuota}"); } } else { this.getSrvGestorManifestService().guardarManifiesto(identificador); } } // this.getSrvGestorManifestService().guardarManifiesto(identificador); if (!this.getEmpaquetadorSession(request).isGuardadoPrimeraVez()) { this.getEmpaquetadorSession(request).setGuardadoPrimeraVez(true); if (logger.isDebugEnabled()) logger.debug("Cambiado flag guardadoPrimeraVez"); } // } // this.getEmpaquetadorSession(request).setValidacion(validacion); form.setGuardar(String.valueOf(true)); }
From source file:es.pode.administracion.presentacion.noticias.verNoticia.VerNoticiaControllerImpl.java
/** * @see es.pode.administracion.presentacion.noticias.verNoticia.VerNoticiaController#verPasoDos(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.noticias.verNoticia.VerPasoDosForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *//*from w ww.ja v a 2s.c o m*/ public final void verPasoDos(ActionMapping mapping, es.pode.administracion.presentacion.noticias.verNoticia.VerPasoDosForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { try { logger.debug("Se recupera el vo de la noticia de la request"); NoticiaVO noticia = (NoticiaVO) request.getSession().getAttribute(VERNOTICIAVO); ArrayList nombreCategoria = new ArrayList(); ArrayList idiomas = new ArrayList(); ArrayList idiomasAlta = new ArrayList(); ArrayList titulo = new ArrayList(); ArrayList resumen = new ArrayList(); ArrayList cuerpo = new ArrayList(); CategoriaNoticiaVO categoria = noticia.getCategoria(); DescripcionNoticiaVO[] descripcionesNoticia = noticia.getDescripcionNoticia(); for (int j = 0; descripcionesNoticia != null && j < descripcionesNoticia.length; j++) { if (descripcionesNoticia[j].getCuerpo() != null && !("").equals(descripcionesNoticia[j].getCuerpo())) { titulo.add(descripcionesNoticia[j].getTitulo()); resumen.add(descripcionesNoticia[j].getResumen()); cuerpo.add(descripcionesNoticia[j].getCuerpo()); idiomasAlta.add(descripcionesNoticia[j].getIdioma()); } } form.setTitulo(titulo); form.setResumen(resumen); form.setCuerpo(cuerpo); form.setIdiomasAlta(idiomasAlta); // Se almacena los datos if (categoria != null) { CategoriaIdiomaNoticiaVO[] categoriasIdiomas = categoria.getCategoriaIdioma(); for (int i = 0; categoriasIdiomas != null && i < categoriasIdiomas.length; i++) { if (categoriasIdiomas[i].getNombreCategoria() != null && !("").equals(categoriasIdiomas[i].getNombreCategoria())) { nombreCategoria.add(categoriasIdiomas[i].getNombreCategoria()); idiomas.add(categoriasIdiomas[i].getIdioma()); } } } form.setIdiomas(idiomas); form.setNombreCategoria(nombreCategoria); request.getSession().setAttribute(VERNOTICIAVO, null); } catch (Exception e) { logger.error("Error obteniendo la noticia a ver"); throw new ValidatorException("{error.obteniendo.noticia.ver}"); } }
From source file:es.pode.administracion.presentacion.faqs.crear.CrearControllerImpl.java
/** * @see es.pode.administracion.presentacion.faqs.crear.CrearController#crearFaqUno(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.faqs.crear.CrearFaqUnoForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *//*from ww w. j a va2 s . c o m*/ public final void crearFaqUno(ActionMapping mapping, es.pode.administracion.presentacion.faqs.crear.CrearFaqUnoForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { /** * ************************************************************************************************************************************** * ********************************************** SE COMPRUEBA LA CATEGORIA ************************************************************* * ************************************************************************************************************************************** * */ if (form.getCategoria() == null) { logger.error("Categoria es un campo obligatorio"); throw new ValidatorException("{errors.noticia.categoria}"); } FaqTraducidaIdiomaVO[] faqs = null; CategoriaFaqVO categoria = this.getSrvFaqService().obtenerCategoria(form.getCategoria()); 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])); 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); } // Se comprueba la posicion en todos los idiomas if (logger.isDebugEnabled()) logger.debug("Gestin de la posicion de los faqs en cada idioma"); // Castellano String[] faqsEs = dameFaqsIdiomaPosicion(faqs, this.getPropertyValue("castellano")); form.setPosicionesCastellanoAsArray(faqsEs); //Ingles String[] faqsEn = dameFaqsIdiomaPosicion(faqs, this.getPropertyValue("ingles")); form.setPosicionesInglesAsArray(faqsEn); //Catalan String[] faqsCa = dameFaqsIdiomaPosicion(faqs, this.getPropertyValue("catalan")); form.setPosicionesCatalanAsArray(faqsCa); //Valenciano String[] faqsVa = dameFaqsIdiomaPosicion(faqs, this.getPropertyValue("valenciano")); form.setPosicionesValencianoAsArray(faqsVa); //Gallego String[] faqsGl = dameFaqsIdiomaPosicion(faqs, this.getPropertyValue("gallego")); form.setPosicionesGallegoAsArray(faqsGl); //Euskera String[] faqsEu = dameFaqsIdiomaPosicion(faqs, this.getPropertyValue("euskera")); form.setPosicionesEuskeraAsArray(faqsEu); // Se comprueba si el formulario fue invalido pero se recuperan los valores introducidos 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(dameValuePosiciones(castellano, catalan, ingles, euskera, gallego, valenciano)); form.setIdiomas(dameIdiomas(castellano, catalan, ingles, euskera, gallego, valenciano)); form.setIdiomasAlta(dameIdiomas(castellano, catalan, ingles, euskera, gallego, valenciano)); form.setTitulo(dameTitulos(castellano, catalan, ingles, euskera, gallego, valenciano)); form.setDescripcion(dameDescripciones(castellano, catalan, ingles, euskera, gallego, valenciano)); form.setNombreCategoria(dameCategorias(castellano, catalan, ingles, euskera, gallego, valenciano)); } else { ArrayList nombreCategoria = new ArrayList(); ArrayList idiomas = new ArrayList(); if (logger.isDebugEnabled()) logger.debug("Se obtiene la categoria con identificador [" + form.getCategoria() + "]"); try { /** * ************************************************************************************************************************************** * ********************************************** SE ALMACENA LOS DATOS ***************************************************************** * ************************************************************************************************************************************** * */ // 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()); } } } request.getSession().setAttribute(CATEGORIAVO, categoria); } catch (Exception e) { logger.error("Error obteniendo la categoria"); throw new ValidatorException("{errors.categoria.ver}"); } form.setIdiomas(idiomas); form.setNombreCategoria(nombreCategoria); } }
From source file:es.pode.empaquetador.presentacion.avanzado.recursos.crear.elementos.CrearRecursoAvanzadoElementosControllerImpl.java
@Override public final java.lang.String selectActionDependencias(ActionMapping mapping, es.pode.empaquetador.presentacion.avanzado.recursos.crear.elementos.SelectActionDependenciasForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { /*/*w ww . j av a 2s . 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("{portal_empaquetado.exception}"); } else if (actionSubmit .equals(i18n.getString("portalempaquetado.avanzado.recursos.crear.paso2.dependencias.eliminar"))) { if (logger.isDebugEnabled()) logger.debug("actionSubmit vale [" + actionSubmit + "]"); if (logger.isDebugEnabled()) logger.debug("result va a valer Eliminar"); result = "Eliminar"; } else if (actionSubmit .equals(i18n.getString("portalempaquetado.avanzado.recursos.crear.paso2.dependencias.anadir"))) { if (logger.isDebugEnabled()) logger.debug("actionSubmit vale [" + actionSubmit + "]"); if (logger.isDebugEnabled()) logger.debug("result va a valer Crear"); result = "Crear"; } else { logger.error("El valor del submit no es correcto (actionSubmit = " + actionSubmit + ";"); } return result; }
From source file:es.pode.administracion.presentacion.nodos.altaNodo.AltaNodoControllerImpl.java
public void obtenerCCAA(ActionMapping mapping, ObtenerCCAAForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { try {/*from w ww . j av a 2 s .co m*/ //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 ((AltaNodoFormImpl) form).setCcaaBackingList(ccaa, "id", "descripcion"); } catch (Exception e) { log.error("Error: " + e); throw new ValidatorException("{errors.altanodo}"); } }
From source file:es.pode.empaquetador.presentacion.avanzado.recursos.crear.archivos.CrearRecursoAvanzadoArchivosControllerImpl.java
public final java.lang.String selectAction(ActionMapping mapping, es.pode.empaquetador.presentacion.avanzado.recursos.crear.archivos.SelectActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { /*//from w w w . j a v 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("{comunes.error.generico}"); } else if (actionSubmit .equals(i18n.getString("presentacion.avanzado.recursos.crear.archivos.submit.seleccionar"))) { result = "Seleccionar"; } else if (actionSubmit .equals(i18n.getString("presentacion.avanzado.recursos.crear.archivos.submit.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.planificador.descripcionTarea.DescripcionTareaControllerImpl.java
public final void obtenerTareaModificarCargaODEs(ActionMapping mapping, ObtenerTareaModificarCargaODEsForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { if (tz == null) tz = utilidades.asignarZonaHoraria(); TareaVO tarea = new TareaVO(); try {/* w w w . ja v a 2 s .c o m*/ tarea.setTrabajo(((DescripcionTareaFormImpl) form).getTrabajo()); tarea.setGrupoTrabajo(((DescripcionTareaFormImpl) form).getGrupoTrabajo()); tarea.setTrigger(((DescripcionTareaFormImpl) form).getTrigger()); tarea.setGrupoTrigger(((DescripcionTareaFormImpl) form).getGrupoTrigger()); tarea.setPeriodicidad(((DescripcionTareaFormImpl) form).getPeriodicidad()); TareaCargaODEsVO tareaCargaODEs = this.getSrvPlanificadorService() .obtenerTareaModificarCargaODEs(tarea); tareaCargaODEs.getFechaInicio().setTimeZone(tz); ((DescripcionTareaFormImpl) form).setPeriodicidad(tareaCargaODEs.getPeriodicidad()); ((DescripcionTareaFormImpl) form).setPathODEs(tareaCargaODEs.getPathODE()); ((DescripcionTareaFormImpl) form).setPathODEsCargados(tareaCargaODEs.getPathODEsCargados()); ((DescripcionTareaFormImpl) form).setPathODEsNoCargados(tareaCargaODEs.getPathODEsNoCargados()); ((DescripcionTareaFormImpl) form).setTipoTarea(tareaCargaODEs.getTipoTarea()); ((DescripcionTareaFormImpl) form) .setAnio(new Integer(tareaCargaODEs.getFechaInicio().get(Calendar.YEAR))); ((DescripcionTareaFormImpl) form) .setMes(new Integer(tareaCargaODEs.getFechaInicio().get(Calendar.MONTH) + 1)); ((DescripcionTareaFormImpl) form) .setDia(new Integer(tareaCargaODEs.getFechaInicio().get(Calendar.DAY_OF_MONTH))); ((DescripcionTareaFormImpl) form) .setHora(new Integer(tareaCargaODEs.getFechaInicio().get(Calendar.HOUR_OF_DAY))); ((DescripcionTareaFormImpl) form) .setMinutos(new Integer(tareaCargaODEs.getFechaInicio().get(Calendar.MINUTE))); ((DescripcionTareaFormImpl) form).setMsgPublicado(tareaCargaODEs.getMsgPublicado()); ((DescripcionTareaFormImpl) form).setMsgNoPublicado(tareaCargaODEs.getMsgNoPublicado()); ((DescripcionTareaFormImpl) form).setMsgDescCargaODEs(tareaCargaODEs.getMsgDescripcionTrabajo()); ((DescripcionTareaFormImpl) form).setSobrescribir(tareaCargaODEs.getSobrescribir()); } catch (Exception e) { log.error("Error: " + e); throw new ValidatorException("{tareas.error}"); } }
From source file:es.pode.empaquetador.presentacion.avanzado.organizaciones.elementos.gestor.GestorElementosControllerImpl.java
public final void submit(ActionMapping mapping, es.pode.empaquetador.presentacion.avanzado.organizaciones.elementos.gestor.SubmitForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { EmpaquetadorSession sesEmpaq = this.getEmpaquetadorSession(request); List identificadores = form.getIdentifierRowSelection(); 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(ELIMINAR_ACTION))) || (accion.equals(i18n.getString(COPIAR_ACTION))) || (accion.equals(i18n.getString(CORTAR_ACTION)))) { if ((identificadores == null) || (identificadores.size() == 0)) { throw new ValidatorException(PORTAL_EMPAQUETADO_EXCEPTION); } else {/*from w ww . j a v a 2 s. c om*/ form.setIdentificadores(identificadores); } } else if ((accion.equals(i18n.getString(PEGAR_ACTION)))) { if ((sesEmpaq.getPortapapeles() == null) || (sesEmpaq.getPortapapeles().size() == 0)) { throw new ValidatorException(PORTAL_EMPAQUETADO_EXCEPTION); } } }