List of usage examples for org.apache.commons.validator ValidatorException ValidatorException
public ValidatorException(String message)
From source file:es.pode.gestorFlujo.presentacion.objetosPendientes.Publicar.PublicarControllerImpl.java
/** * @see es.pode.gestorFlujo.presentacion.objetosPendientes.Publicar.PublicarController#cargaFormularoLicencias(org.apache.struts.action.ActionMapping, * es.pode.gestorFlujo.presentacion.objetosPendientes.Publicar.CargaFormularoLicenciasForm, * javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse) *//*from ww w. j a va 2s . c om*/ public final void cargaFormularoLicencias(ActionMapping mapping, es.pode.gestorFlujo.presentacion.objetosPendientes.Publicar.CargaFormularoLicenciasForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { boolean disponible = true; try { if (logger.isDebugEnabled()) logger.debug("Cargando formulario licencias"); // Los idiomas del buscador // el combo lo mostramos en el idioma de navegacin, pero en la // consolidacin habr que guardarlo en ingls String[] menCombos = new String[] { getPropertyValue("combo.tipoLicencias") }; TerminoVO[] licencias = this.getSrvVocabulariosControladosService().obtenerCombos(menCombos, LdapUserDetailsUtils.getIdioma())[0].getTerminos(); licencias = ordena(licencias, LdapUserDetailsUtils.getIdioma()); if (logger.isDebugEnabled()) logger.debug("vocabularios obtenidos, idioma: " + request.getLocale().getLanguage()); form.setLicenciasAsArray(licencias); // la licencia seleccionada form.setTipo_licencia(this.getPublicarSession(request).getTipoLicencia()); if ((this.getPublicarSession(request).getUniversal() .compareTo(getPropertyValue("licencia.acceso.universal"))) == 0) form.setAmbito_todas("1"); else form.setAmbito_todas("0"); SrvNodoService nodos = this.getSrvNodoService(); // Cargamos la lista de NODOS con los nodos dados de alta. // Hay que tener en cuenta los nodos que ya tenga el propio ODE, // para que aparezcan seleccionados. No va a aparecer el nodo local if (nodos != null) { // Ahora llamamos al mapero que me dice cuantos de los nodos de // la lista estan licenciados if (logger.isDebugEnabled()) logger.debug("Vamos a listar los nodos con las licencias impresas"); form.setComunidadesAsArray(mapeaArrayNodoVOToNodoVOODE(nodos.listarNodos(), this.getPublicarSession(request).getComunidades())); } else { if (logger.isDebugEnabled()) logger.error("No hay servicio de nodos cargando licencias"); disponible = false; } } catch (Exception ex) { logger.error("Error cargando licencias. ", ex); if (disponible) throw new ValidatorException("{gestorFlujo.error.inesperado}"); else throw new ValidatorException("{gestorFlujo.agregarLicencia.noDisponible}"); } }
From source file:es.pode.administracion.presentacion.planificador.modificarTarea.ObtenerTareaControllerImpl.java
/** * Metodo que obtiene los datos de la tarea de informeFechaRango que se selecciona *//*from w ww . ja v a 2s .c om*/ public void obtenerTareaInformeFechaRango(org.apache.struts.action.ActionMapping mapping, es.pode.administracion.presentacion.planificador.modificarTarea.ObtenerTareaInformeFechaRangoForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.lang.Exception { if (tz == null) tz = utilidades.asignarZonaHoraria(); TareaInformesVO tarea = new TareaInformesVO(); try { //cargamos la tarea con lo valores esenciales para recuperar los demas valores de esta misma tarea tarea.setTrabajo(((ObtenerTCargaODEsFormImpl) form).getTrabajo()); tarea.setGrupoTrabajo(((ObtenerTCargaODEsFormImpl) form).getGrupoTrabajo()); tarea.setTrigger(((ObtenerTCargaODEsFormImpl) form).getTrigger()); tarea.setGrupoTrigger(((ObtenerTCargaODEsFormImpl) form).getGrupoTrigger()); tarea.setPeriodicidad(((ObtenerTCargaODEsFormImpl) form).getPeriodicidad()); //llamamos al servicio para que carge los valores en la tarea del tipo correspondiente TareaInformesVO tareaInformes = this.getSrvPlanificadorService().obtenerTareaInformes(tarea); //Si tiene periodicidad no se obtienen las fechas Desde y Hasta if (tareaInformes.getPeriodicidad().equalsIgnoreCase("N")) { if (log.isDebugEnabled()) log.debug(tareaInformes + "No es periodica"); //asignamos a la fecha Desde y Hasta la franja horaria correspondiente tareaInformes.getFechaDesde().setTimeZone(tz); tareaInformes.getFechaHasta().setTimeZone(tz); ((ObtenerTCargaODEsFormImpl) form).setDiaDesde( (new Integer(tareaInformes.getFechaDesde().get(Calendar.DAY_OF_MONTH))).toString()); ((ObtenerTCargaODEsFormImpl) form).setMesDesde( (new Integer(tareaInformes.getFechaDesde().get(Calendar.MONTH) + 1)).toString()); ((ObtenerTCargaODEsFormImpl) form) .setAnioDesde((new Integer(tareaInformes.getFechaDesde().get(Calendar.YEAR))).toString()); ((ObtenerTCargaODEsFormImpl) form).setDiaHasta( (new Integer(tareaInformes.getFechaHasta().get(Calendar.DAY_OF_MONTH))).toString()); ((ObtenerTCargaODEsFormImpl) form).setMesHasta( (new Integer(tareaInformes.getFechaHasta().get(Calendar.MONTH) + 1)).toString()); ((ObtenerTCargaODEsFormImpl) form) .setAnioHasta((new Integer(tareaInformes.getFechaHasta().get(Calendar.YEAR))).toString()); } else { if (log.isDebugEnabled()) log.debug(tareaInformes + "Es periodica"); } //asignamos a las fechas la franja horaria correspondiente tareaInformes.getFechaInicio().setTimeZone(tz); //rellenamos los datos especificos de este tipo de tarea ((ObtenerTCargaODEsFormImpl) form).setPeriodicidad(tareaInformes.getPeriodicidad()); ((ObtenerTCargaODEsFormImpl) form).setTipoTarea(tareaInformes.getInforme()); ((ObtenerTCargaODEsFormImpl) form).setFormato(tareaInformes.getFormato()); ((ObtenerTCargaODEsFormImpl) form).setInforme(tareaInformes.getInforme()); ((ObtenerTCargaODEsFormImpl) form).setRango(tareaInformes.getRango()); ((ObtenerTCargaODEsFormImpl) form) .setAnio((new Integer(tareaInformes.getFechaInicio().get(Calendar.YEAR))).toString()); ((ObtenerTCargaODEsFormImpl) form) .setMes((new Integer(tareaInformes.getFechaInicio().get(Calendar.MONTH) + 1)).toString()); ((ObtenerTCargaODEsFormImpl) form) .setDia((new Integer(tareaInformes.getFechaInicio().get(Calendar.DAY_OF_MONTH))).toString()); ((ObtenerTCargaODEsFormImpl) form) .setHora((new Integer(tareaInformes.getFechaInicio().get(Calendar.HOUR_OF_DAY))).toString()); ((ObtenerTCargaODEsFormImpl) form) .setMinutos((new Integer(tareaInformes.getFechaInicio().get(Calendar.MINUTE))).toString()); ((ObtenerTCargaODEsFormImpl) form).setMsgReindexado(tareaInformes.getMsgInforme()); ((ObtenerTCargaODEsFormImpl) form).setMsgNoReindexado(tareaInformes.getMsgNoInforme()); ((ObtenerTCargaODEsFormImpl) form).setMsgDescReindexado(tareaInformes.getMsgDescripcionTrabajo()); } catch (Exception e) { log.error("Error: " + e); throw new ValidatorException("{tareas.error}"); } }
From source file:es.pode.administracion.presentacion.planificador.descripcionTarea.DescripcionTareaControllerImpl.java
/** * /* ww w . j a va 2s . c o m*/ */ public void obtenerTareaInformeFechaUsuario(org.apache.struts.action.ActionMapping mapping, es.pode.administracion.presentacion.planificador.descripcionTarea.ObtenerTareaInformeFechaUsuarioForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.lang.Exception { if (tz == null) tz = utilidades.asignarZonaHoraria(); TareaInformesVO tarea = new TareaInformesVO(); try { //cargamos la tarea con lo valores esenciales para recuperar los demas valores de esta misma tarea 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()); //llamamos al servicio para que carge los valores en la tarea del tipo correspondiente TareaInformesVO tareaInformes = this.getSrvPlanificadorService().obtenerTareaInformes(tarea); //asignamos a las fechas la franja horaria correspondiente tareaInformes.getFechaInicio().setTimeZone(tz); if (tareaInformes.getPeriodicidad().equalsIgnoreCase("N")) { if (log.isDebugEnabled()) log.debug("No es periodica"); tareaInformes.getFechaDesde().setTimeZone(tz); tareaInformes.getFechaHasta().setTimeZone(tz); ((DescripcionTareaFormImpl) form) .setDiaDesde(new Integer(tareaInformes.getFechaDesde().get(Calendar.DAY_OF_MONTH))); ((DescripcionTareaFormImpl) form) .setMesDesde(new Integer(tareaInformes.getFechaDesde().get(Calendar.MONTH) + 1)); ((DescripcionTareaFormImpl) form) .setAnioDesde(new Integer(tareaInformes.getFechaDesde().get(Calendar.YEAR))); ((DescripcionTareaFormImpl) form) .setDiaHasta(new Integer(tareaInformes.getFechaHasta().get(Calendar.DAY_OF_MONTH))); ((DescripcionTareaFormImpl) form) .setMesHasta(new Integer(tareaInformes.getFechaHasta().get(Calendar.MONTH) + 1)); ((DescripcionTareaFormImpl) form) .setAnioHasta(new Integer(tareaInformes.getFechaHasta().get(Calendar.YEAR))); } else { if (log.isDebugEnabled()) log.debug("es periodica"); } //rellenamos los datos especificos de este tipo de tarea ((DescripcionTareaFormImpl) form).setPeriodicidad(tareaInformes.getPeriodicidad()); ((DescripcionTareaFormImpl) form).setTipoTarea(tareaInformes.getInforme()); ((DescripcionTareaFormImpl) form).setFormato(tareaInformes.getFormato()); ((DescripcionTareaFormImpl) form).setInforme(tareaInformes.getInforme()); ((DescripcionTareaFormImpl) form).setUsuario(tareaInformes.getUsuarioInforme()); ((DescripcionTareaFormImpl) form) .setAnio(new Integer(tareaInformes.getFechaInicio().get(Calendar.YEAR))); ((DescripcionTareaFormImpl) form) .setMes(new Integer(tareaInformes.getFechaInicio().get(Calendar.MONTH) + 1)); ((DescripcionTareaFormImpl) form) .setDia(new Integer(tareaInformes.getFechaInicio().get(Calendar.DAY_OF_MONTH))); ((DescripcionTareaFormImpl) form) .setHora(new Integer(tareaInformes.getFechaInicio().get(Calendar.HOUR_OF_DAY))); ((DescripcionTareaFormImpl) form) .setMinutos(new Integer(tareaInformes.getFechaInicio().get(Calendar.MINUTE))); ((DescripcionTareaFormImpl) form).setMsgInforme(tareaInformes.getMsgInforme()); ((DescripcionTareaFormImpl) form).setMsgNoInforme(tareaInformes.getMsgNoInforme()); ((DescripcionTareaFormImpl) form).setMsgDescTrabajo(tareaInformes.getMsgDescripcionTrabajo()); } catch (Exception e) { log.error("Error: " + e); throw new ValidatorException("{tareas.error}"); } }
From source file:es.pode.empaquetador.presentacion.avanzado.recursos.crear.elementos.CrearRecursoAvanzadoElementosControllerImpl.java
@Override public final void seleccionarPrincipal(ActionMapping mapping, es.pode.empaquetador.presentacion.avanzado.recursos.crear.elementos.SeleccionarPrincipalForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String principal = form.getPrincipal(); java.util.Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE); ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale); CrearRecursoAvanzadoSession sesRecurs = this.getCrearRecursoAvanzadoSession(request); String Action = form.getAction(); if (Action.equals(i18n.getString("portalempaquetado.avanzado.recursos.crear.archivo.principal.aceptar"))) { if (principal == null || principal.equals("")) { logger.error("No se ha seleccionado ningun archivo principal"); throw new ValidatorException( "{portalempaquetado.avanzado.recursos.crear.archivo.principal.error.archivonoseleccionado}"); }/*w ww. jav a 2 s. c o m*/ if (sesRecurs.getArchivos().size() == 1) { if (logger.isDebugEnabled()) logger.debug("Se ha seleccionado el unico archivo como principal"); sesRecurs.setPrincipal((String) sesRecurs.getArchivos().get(0)); saveSuccessMessage(request, "{portal_empaquetado.recursos.avanzado.principal.unico}"); } if (principal != null) { sesRecurs.setPrincipal(principal); } } }
From source file:jp.terasoluna.fw.validation.FieldChecks.java
/** * ????//from w w w .j a va2 s . c om * * <p>field?datePattern??????? * <code>java.text.SimpleDateFormat</code> * ?????</p> * * <p>field?datePatternStrict??????? * <code>java.text.SimpleDateFormat</code>??? * ???? * ???'2/12/1999'?'MM/dd/yyyy'????? * Month)??????????</p> * * <p>datePattern???datePatternStrict????? * ??datePattern????? * datePattern???datePatternStrict???????? * ?????????????? * ???</p> * * <p>???setLenient=false?????? * 2000/02/31???????????????</p> * * ???yyyy/MM/dd?????? * ????? * * <h5>validation.xml?</h5> * <code><pre> * <form name="sample"> * * <field property="dateField" * depends="date"> * <arg key="sample.dateField" position="0"/> * <var> * <var-name>datePattern</var-name> * <var-value>yyyy/MM/dd</var-value> * </var> * </field> * * </form> * </pre></code> * * <h5>validation.xml???<var>?</h5> * <table border="1"> * <tr> * <td><center><b><code>var-name</code></b></center></td> * <td><center><b><code>var-value</code></b></center></td> * <td><center><b></b></center></td> * <td><center><b>?</b></center></td> * </tr> * <tr> * <td> datePattern </td> * <td></td> * <td>false</td> * <td>???????? * ??????yyyy/MM/dd???2001/1/1????? * datePattern?datePatternStrict??????? * datePattern???? * </td> * </tr> * <tr> * <td> datePatternStrict </td> * <td></td> * <td>false</td> * <td>????? * ??????????? * ??????yyyy/MM/dd???2001/1/1??? * datePattern?datePatternStrict??????? * datePattern???? * </td> * </tr> * </table> * * @param bean ?JavaBean * @param va ?<code>ValidatorAction</code> * @param field ?<code>Field</code> * @param errors ????? * ?? * @return ??????<code>true</code>? * ????<code>false</code>? * @throws ValidatorException validation?????? * ? */ public boolean validateDate(Object bean, ValidatorAction va, Field field, ValidationErrors errors) throws ValidatorException { // String value = extractValue(bean, field); if (StringUtils.isEmpty(value)) { return true; } // ? String datePattern = field.getVarValue("datePattern"); String datePatternStrict = field.getVarValue("datePatternStrict"); // Date result = null; try { result = ValidationUtil.toDate(value, datePattern, datePatternStrict); } catch (IllegalArgumentException e) { // ???? String message = "Mistake on validation definition file. " + "- datePattern or datePatternStrict is invalid. " + "You'll have to check it over. "; log.error(message, e); throw new ValidatorException(message); } if (result == null) { rejectValue(errors, field, va, bean); return false; } return true; }
From source file:es.pode.administracion.presentacion.planificador.descripcionTarea.DescripcionTareaControllerImpl.java
public void obternerTareaInformeFederado(org.apache.struts.action.ActionMapping mapping, es.pode.administracion.presentacion.planificador.descripcionTarea.ObternerTareaInformeFederadoForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.lang.Exception { if (tz == null) tz = utilidades.asignarZonaHoraria(); TareaInformesVO tarea = new TareaInformesVO(); try {/* ww w .j ava2s . co m*/ //cargamos la tarea con lo valores esenciales para recuperar los demas valores de esta misma tarea 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()); //llamamos al servicio para que carge los valores en la tarea del tipo correspondiente TareaInformesVO tareaInformes = this.getSrvPlanificadorService().obtenerTareaInformes(tarea); //asignamos a las fechas la franja horaria correspondiente tareaInformes.getFechaInicio().setTimeZone(tz); //rellenamos los datos especificos de este tipo de tarea ((DescripcionTareaFormImpl) form).setPeriodicidad(tareaInformes.getPeriodicidad()); ((DescripcionTareaFormImpl) form).setTipoTarea(tareaInformes.getInforme()); ((DescripcionTareaFormImpl) form).setFormato(tareaInformes.getFormato()); ((DescripcionTareaFormImpl) form).setInforme(tareaInformes.getInforme()); ((DescripcionTareaFormImpl) form) .setAnio(new Integer(tareaInformes.getFechaInicio().get(Calendar.YEAR))); ((DescripcionTareaFormImpl) form) .setMes(new Integer(tareaInformes.getFechaInicio().get(Calendar.MONTH) + 1)); ((DescripcionTareaFormImpl) form) .setDia(new Integer(tareaInformes.getFechaInicio().get(Calendar.DAY_OF_MONTH))); ((DescripcionTareaFormImpl) form) .setHora(new Integer(tareaInformes.getFechaInicio().get(Calendar.HOUR_OF_DAY))); ((DescripcionTareaFormImpl) form) .setMinutos(new Integer(tareaInformes.getFechaInicio().get(Calendar.MINUTE))); ((DescripcionTareaFormImpl) form).setMsgInforme(tareaInformes.getMsgInforme()); ((DescripcionTareaFormImpl) form).setMsgNoInforme(tareaInformes.getMsgNoInforme()); ((DescripcionTareaFormImpl) form).setMsgDescTrabajo(tareaInformes.getMsgDescripcionTrabajo()); } catch (Exception e) { log.error("Error: " + e); throw new ValidatorException("{tareas.error}"); } }
From source file:es.pode.gestorFlujo.presentacion.objetosPendientes.Publicar.PublicarControllerImpl.java
/** * @see es.pode.gestorFlujo.presentacion.objetosPendientes.Publicar.PublicarController#consolidaLicencias(org.apache.struts.action.ActionMapping, * es.pode.gestorFlujo.presentacion.objetosPendientes.Publicar.ConsolidaLicenciasForm, * javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse) *//* ww w .j av a 2s .c o m*/ public final void consolidaLicencias(ActionMapping mapping, es.pode.gestorFlujo.presentacion.objetosPendientes.Publicar.ConsolidaLicenciasForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { try { PublicarSession publiSes = this.getPublicarSession(request); //Nos olvidamos del nodo local, al cargar la pagina de publicar se lo meteremos siempre // if (form.getUniversal() == null && !form.getUniversal().equals("")) { //si hemos seleccionado todos los nodos entendemos que es universal if (form.getComunidadesSeleccionadasAsArray() != null && form .getComunidadesSeleccionadasAsArray().length == (this.getSrvNodoService().listarNodos().length) + 1) { publiSes.setUniversal(getPropertyValue("licencia.acceso.universal")); } else { publiSes.setUniversal(getPropertyValue("licencia.acceso.non-universal")); if (form.getComunidadesSeleccionadasAsArray() != null && form.getComunidadesSeleccionadasAsArray().length > 0) {//Si hemos chequeado algn nodo lo recogemos String[] comunidadesMostrar = new String[form.getComunidadesSeleccionadasAsArray().length]; String comunidadesDesc = ""; NodoVO[] nodos = this.getSrvNodoService().listarNodos(); for (int i = 0; i < form.getComunidadesSeleccionadasAsArray().length; i++) { comunidadesDesc = comunidadesDesc + (form.getComunidadesSeleccionadasAsArray()[i]).toString() + ","; // TODO manera transitoria de recuperar el nombre de los // nodos for (int j = 0; j < nodos.length; j++) {//Los nombres de los nodos if (nodos[j].getIdNodo() .equalsIgnoreCase(form.getComunidadesSeleccionadasAsArray()[i].toString())) { comunidadesMostrar[i] = nodos[j].getUrlWS(); break; } } } if (logger.isDebugEnabled()) logger.debug("ComunidadesMostrar:" + comunidadesDesc); comunidadesDesc = comunidadesDesc.substring(0, comunidadesDesc.length() - 1); publiSes.setComunidades(comunidadesDesc); publiSes.setComunidadesMostrar(comunidadesMostrar); if (publiSes .getComunidadesMostrar().length == (this.getSrvNodoService().listarNodos().length)) { publiSes.setUniversal(getPropertyValue("licencia.acceso.universal")); logger.debug("Hemos seleccionado todos los nodos, por lo que ser universal"); } if (logger.isDebugEnabled()) logger.debug("Consolidando licencias: tipo= " + form.getTipoLicenciaSeleccionada() + " Nmero de comunidades = " + form.getComunidadesSeleccionadasAsArray().length + " comunidades: " + publiSes.getComunidades() + " Universal= " + publiSes.getUniversal() + "."); } else {//Si no se ha chequeado ningn nodo, le pasamos un String vaco y comunidades para mostrar vaco String[] comunidadesMostrar = new String[0]; publiSes.setComunidadesMostrar(comunidadesMostrar); publiSes.setComunidades(""); } } // }else{ // publiSes.setUniversal(getPropertyValue("licencia.acceso.universal")); // logger.debug("licencia del ode universal"); // } // hay que mostrar el tipo de licencia en el idioma de la sesin publiSes.setTipoLicencia(form.getTipoLicenciaSeleccionada()); logger.info("Licencia consolidada correctamente en la session [" + form.getTipoLicenciaSeleccionada()); logger.info("Ambito consolidado correctamente en la session"); } catch (ValidatorException ex) { logger.error("Excepcion consolidando licencias:", ex); throw ex; } catch (Exception ex) { logger.error("Excepcion consolidando licencias:", ex); throw new ValidatorException("{gestorFlujo.error.inesperado}"); } }
From source file:es.pode.administracion.presentacion.planificador.modificarTarea.ObtenerTareaControllerImpl.java
/** * Metodo que obtiene los datos de la tarea de informeFechaUsuario que se selecciona *//*from w w w . jav a 2 s . c o m*/ public void obtenerTareaInformeFechaUsuario(org.apache.struts.action.ActionMapping mapping, es.pode.administracion.presentacion.planificador.modificarTarea.ObtenerTareaInformeFechaUsuarioForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.lang.Exception { if (tz == null) tz = utilidades.asignarZonaHoraria(); TareaInformesVO tarea = new TareaInformesVO(); try { //cargamos la tarea con lo valores esenciales para recuperar los demas valores de esta misma tarea tarea.setTrabajo(((ObtenerTCargaODEsFormImpl) form).getTrabajo()); tarea.setGrupoTrabajo(((ObtenerTCargaODEsFormImpl) form).getGrupoTrabajo()); tarea.setTrigger(((ObtenerTCargaODEsFormImpl) form).getTrigger()); tarea.setGrupoTrigger(((ObtenerTCargaODEsFormImpl) form).getGrupoTrigger()); tarea.setPeriodicidad(((ObtenerTCargaODEsFormImpl) form).getPeriodicidad()); //llamamos al servicio para que carge los valores en la tarea del tipo correspondiente TareaInformesVO tareaInformes = this.getSrvPlanificadorService().obtenerTareaInformes(tarea); //Si tiene periodicidad no se obtienen las fechas Desde y Hasta if (tareaInformes.getPeriodicidad().equalsIgnoreCase("N")) { if (log.isDebugEnabled()) log.debug(tareaInformes + "No es periodica"); //asignamos a la fecha Desde y Hasta la franja horaria correspondiente tareaInformes.getFechaDesde().setTimeZone(tz); tareaInformes.getFechaHasta().setTimeZone(tz); ((ObtenerTCargaODEsFormImpl) form).setDiaDesde( (new Integer(tareaInformes.getFechaDesde().get(Calendar.DAY_OF_MONTH))).toString()); ((ObtenerTCargaODEsFormImpl) form).setMesDesde( (new Integer(tareaInformes.getFechaDesde().get(Calendar.MONTH) + 1)).toString()); ((ObtenerTCargaODEsFormImpl) form) .setAnioDesde((new Integer(tareaInformes.getFechaDesde().get(Calendar.YEAR))).toString()); ((ObtenerTCargaODEsFormImpl) form).setDiaHasta( (new Integer(tareaInformes.getFechaHasta().get(Calendar.DAY_OF_MONTH))).toString()); ((ObtenerTCargaODEsFormImpl) form).setMesHasta( (new Integer(tareaInformes.getFechaHasta().get(Calendar.MONTH) + 1)).toString()); ((ObtenerTCargaODEsFormImpl) form) .setAnioHasta((new Integer(tareaInformes.getFechaHasta().get(Calendar.YEAR))).toString()); } else { if (log.isDebugEnabled()) log.debug(tareaInformes + "Es periodica"); } //asignamos a las fechas la franja horaria correspondiente tareaInformes.getFechaInicio().setTimeZone(tz); //rellenamos los datos especificos de este tipo de tarea ((ObtenerTCargaODEsFormImpl) form).setPeriodicidad(tareaInformes.getPeriodicidad()); ((ObtenerTCargaODEsFormImpl) form).setTipoTarea(tareaInformes.getInforme()); ((ObtenerTCargaODEsFormImpl) form).setFormato(tareaInformes.getFormato()); ((ObtenerTCargaODEsFormImpl) form).setInforme(tareaInformes.getInforme()); ((ObtenerTCargaODEsFormImpl) form).setUsuario(tareaInformes.getUsuarioInforme()); ((ObtenerTCargaODEsFormImpl) form) .setAnio((new Integer(tareaInformes.getFechaInicio().get(Calendar.YEAR))).toString()); ((ObtenerTCargaODEsFormImpl) form) .setMes((new Integer(tareaInformes.getFechaInicio().get(Calendar.MONTH) + 1)).toString()); ((ObtenerTCargaODEsFormImpl) form) .setDia((new Integer(tareaInformes.getFechaInicio().get(Calendar.DAY_OF_MONTH))).toString()); ((ObtenerTCargaODEsFormImpl) form) .setHora((new Integer(tareaInformes.getFechaInicio().get(Calendar.HOUR_OF_DAY))).toString()); ((ObtenerTCargaODEsFormImpl) form) .setMinutos((new Integer(tareaInformes.getFechaInicio().get(Calendar.MINUTE))).toString()); ((ObtenerTCargaODEsFormImpl) form).setMsgInforme(tareaInformes.getMsgInforme()); ((ObtenerTCargaODEsFormImpl) form).setMsgNoInforme(tareaInformes.getMsgNoInforme()); ((ObtenerTCargaODEsFormImpl) form).setMsgDescTrabajo(tareaInformes.getMsgDescripcionTrabajo()); } catch (Exception e) { log.error("Error: " + e); throw new ValidatorException("{tareas.error}"); } }
From source file:jp.terasoluna.fw.validation.FieldChecks.java
/** * ???int??????/* ww w .j av a 2s . co m*/ * ?????? * * <p>???10?100??????????? * true????? * * <h5>validation.xml?</h5> * <code><pre> * <form name="sample"> * * <field property="intField" * depends="intRange"> * <arg key="sample.intField" position="0"/> * <var> * <var-name>intRangeMin</var-name> * <var-value>10</var-value> * </var> * <var> * <var-name>intRangeMax</var-name> * <var-value>100</var-value> * </var> * </field> * * </form> * </pre></code> * * <h5>validation.xml???<var>?</h5> * <table border="1"> * <tr> * <td><center><b><code>var-name</code></b></center></td> * <td><center><b><code>var-value</code></b></center></td> * <td><center><b></b></center></td> * <td><center><b>?</b></center></td> * </tr> * <tr> * <td> intRangeMin </td> * <td>?</td> * <td>false</td> * <td>????????Integer??? * ? * ????????</td> * </tr> * <tr> * <td> intRangeMax </td> * <td></td> * <td>false</td> * <td>???????Integer?? * ? * ????????</td> * </tr> * </table> * * @param bean ?JavaBean * @param va ?<code>ValidatorAction</code> * @param field ?<code>Field</code> * @param errors ????? * ?? * @return ??????<code>true</code>? * ????<code>false</code>? * @throws ValidatorException validation?????? * ? */ public boolean validateIntRange(Object bean, ValidatorAction va, Field field, ValidationErrors errors) throws ValidatorException { // String value = extractValue(bean, field); if (StringUtils.isEmpty(value)) { return true; } // int?? --- Integer?????? int intValue = 0; try { intValue = Integer.parseInt(value); } catch (NumberFormatException e) { rejectValue(errors, field, va, bean); return false; } // --- ?Integer?????? // ???? String strMin = field.getVarValue("intRangeMin"); int min = Integer.MIN_VALUE; if (!GenericValidator.isBlankOrNull(strMin)) { try { min = Integer.parseInt(strMin); } catch (NumberFormatException e) { String message = "Mistake on validation definition file. " + "- intRangeMin is not number. " + "You'll have to check it over. "; log.error(message, e); throw new ValidatorException(message); } } String strMax = field.getVarValue("intRangeMax"); int max = Integer.MAX_VALUE; if (!GenericValidator.isBlankOrNull(strMax)) { try { max = Integer.parseInt(strMax); } catch (NumberFormatException e) { String message = "Mistake on validation definition file. " + "- intRangeMax is not number. " + "You'll have to check it over. "; log.error(message, e); throw new ValidatorException(message); } } // if (!GenericValidator.isInRange(intValue, min, max)) { rejectValue(errors, field, va, bean); return false; } return true; }
From source file:es.pode.empaquetador.presentacion.avanzado.recursos.crear.elementos.CrearRecursoAvanzadoElementosControllerImpl.java
@Override public String submitArchivoPrincipal(ActionMapping mapping, SubmitArchivoPrincipalForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String action = form.getAction(); Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE); ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale); String result = null;//from w ww. j a va2 s.co m if (logger.isDebugEnabled()) logger.debug("submitArchivoPrincipal con parametros : action=" + action); if (i18n.getString("presentacion.avanzado.recursos.crear.elementos.principal.elegir").equals(action)) { // Seleccionar archivo if ((getCrearRecursoAvanzadoSession(request).getArchivos() != null) && (getCrearRecursoAvanzadoSession(request).getArchivos().size() == 0)) { throw new ValidatorException("{portal_empaquetado.exception.archivoPrincipalVacio}"); } result = "Principal"; } else { // Editar result = "Editar"; } return result; }