List of usage examples for java.util ResourceBundle getString
public final String getString(String key)
From source file:by.logscanner.LogScanner.java
public void init() throws IOException { ResourceBundle resBundle = ResourceBundle.getBundle("config"); resPath = resBundle.getString("resPath"); destPath = resBundle.getString("destPath"); FileUtils.cleanDirectory(new File(destPath)); if (!isGateway()) { walk(resPath);/*from ww w . jav a 2 s . c o m*/ fileData.add(new FileData(getDestFileName(), toBytes())); } else { walkGateway(resPath); } write(); }
From source file:org.openehealth.coala.converter.PXSDateConverterTest.java
/** * @throws java.lang.Exception/* w w w . j av a 2 s. c o m*/ */ @Before public void setUp() throws Exception { ResourceBundle properties = ResourceBundle.getBundle("coala-document"); longPattern = properties.getString("coala.consent.longdatepattern"); shortPattern = properties.getString("coala.consent.shortdatepattern"); GregorianCalendar cal = new GregorianCalendar(); cal.set(Calendar.YEAR, 2011); cal.set(Calendar.MONTH, Calendar.JANUARY); cal.set(Calendar.DAY_OF_MONTH, 15); cal.set(Calendar.HOUR, 3); cal.set(Calendar.MINUTE, 36); cal.set(Calendar.SECOND, 50); cal.set(Calendar.MILLISECOND, 0); referenceDateLong = cal.getTime(); cal = new GregorianCalendar(); cal.set(Calendar.YEAR, 2011); cal.set(Calendar.MONTH, Calendar.JANUARY); cal.set(Calendar.DAY_OF_MONTH, 15); cal.set(Calendar.HOUR, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); referenceDateShort = cal.getTime(); }
From source file:es.pode.administracion.presentacion.noticias.crear.CrearControllerImpl.java
public static String getResource(String key, String baseName, Locale locale) { String recurso = ""; try {//from w ww .ja v a 2 s. c om ResourceBundle theResourceBundle = ResourceBundle.getBundle(baseName, locale); if (theResourceBundle != null) { recurso = theResourceBundle.getString(key); } } catch (MissingResourceException mre) { try { ResourceBundle theResourceBundle = ResourceBundle.getBundle(baseName); if (theResourceBundle != null) { recurso = theResourceBundle.getString(key); } } catch (MissingResourceException m) { recurso = key; } } return recurso; }
From source file:es.pode.modificador.presentacion.configurar.objetos.ruta.IndicarRutaControllerImpl.java
/** * @see es.pode.modificador.presentacion.configurar.objetos.ruta.IndicarRutaController#selectAction(org.apache.struts.action.ActionMapping, es.pode.modificador.presentacion.configurar.objetos.ruta.SelectActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *///from www . jav a 2s.co m public final java.lang.String selectAction(ActionMapping mapping, es.pode.modificador.presentacion.configurar.objetos.ruta.SelectActionForm 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 botonCancelar = i18n.getString("comun.cancelar"); // El punto de retorno es distinto para la version offline String cancelar = DecisorOffline.esOffline() ? "CancelarOffline" : "Cancelar"; String continuar = i18n.getString("comun.aceptar"); String action = form.getAction(); if (action == null) { return cancelar; } // if(action.equals(cancelar)) return cancelar; // else if (action.equals(continuar)) return "Aceptar"; return cancelar; }
From source file:de.hska.ld.core.service.impl.MailServiceImpl.java
@Override public void sendMail(String fullName, String email, String templateFileName, Map<String, Object> model) { ;//from www. j av a2 s . c o m if (Boolean.parseBoolean(env.getProperty("email.enabled"))) { Locale locale = LocaleContextHolder.getLocale(); ResourceBundle bundle = ResourceBundle.getBundle("messages", locale); model.put("dear", bundle.getString("email.dear")); model.put("fullName", fullName); model.put("greeting", bundle.getString("email.greeting")); String text = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "templates/mail/" + templateFileName, "UTF-8", model); Properties properties = getMailProperties(); Session session = Session.getInstance(properties, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(MAIL_PROPERTIES.getProperty("email.username"), MAIL_PROPERTIES.getProperty("email.password")); } }); try { MimeMessage message = new MimeMessage(session); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setFrom(MAIL_PROPERTIES.getProperty("email.from.system")); helper.setTo(email); helper.setSubject(model.containsKey("subject") ? (String) model.get("subject") : ""); helper.setText(text, true); Transport.send(message); } catch (MessagingException e) { e.printStackTrace(); } } }
From source file:es.pode.modificador.presentacion.configurar.cambios.navegarLom.NavegarLomControllerImpl.java
/** * @see es.pode.modificador.presentacion.configurar.cambios.navegarLom.NavegarLomController#guardarTermino(org.apache.struts.action.ActionMapping, es.pode.modificador.presentacion.configurar.cambios.navegarLom.GuardarTerminoForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *//*from ww w .j a va 2 s . c o m*/ public final void guardarTermino(ActionMapping mapping, es.pode.modificador.presentacion.configurar.cambios.navegarLom.GuardarTerminoForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String actionSubmit = form.getAction(); java.util.Locale locale = (java.util.Locale) request.getSession() .getAttribute(ConstantesAgrega.DEFAULT_LOCALE); ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale); if (!actionSubmit.equals(i18n.getString("comun.cancelar"))) { String idTermino = form.getIdTermino(); String terminoLom = form.getTerminoLom(); if (logger.isDebugEnabled()) logger.debug("guardarTermino() : idTermino = " + idTermino + " : terminoLom = " + terminoLom + " : action = " + form.getAction()); if (idTermino == null || terminoLom == null) { logger.error("Error en guardarTermino"); throw new ValidatorException("{navegarLom.error}"); } this.getCambioSession(request).setIdLomTerm(idTermino); this.getCambioSession(request).setLomTerm(terminoLom); } }
From source file:org.codehaus.mojo.chronos.chart.ResponseChartGenerator.java
protected final JFreeChart createResponseChart(String datasetName, ResponsetimeSamples samples, ResourceBundle bundle, ReportConfig config) { XYDataset dataset = createResponseDataset(datasetName, samples, bundle, config); String title = bundle.getString("chronos.label.responsetimes"); String timeAxisLabel = bundle.getString("chronos.label.responsetimes.time"); String valueAxisLabel = bundle.getString("chronos.label.responsetimes.responsetime"); JFreeChart chart = ChartFactory.createTimeSeriesChart(title, timeAxisLabel, valueAxisLabel, dataset, true, true, false);//from w w w . j ava 2 s . c o m ChartUtil.setupXYPlot(chart, new SimpleDateFormat("HH:mm:ss")); // change rendering order - so average is in front chart.getXYPlot().setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); if (config.isShowpercentile()) { String text = bundle.getString("chronos.label.percentile95.arrow"); ChartUtil.addRangeMarker(chart.getXYPlot(), text, samples.getPercentile95(config.getResponsetimedivider())); } if (config.isShowaverage()) { String text = bundle.getString("chronos.label.average.arrow"); ChartUtil.addRangeMarker(chart.getXYPlot(), text, samples.getAverage(config.getResponsetimedivider())); } return chart; }
From source file:org.shredzone.cilla.admin.ListBean.java
/** * Returns a list of section types./* w w w .j a v a 2 s . co m*/ */ public List<SelectItem> getSectionList() { ResourceBundle msg = getResourceBundle(); return pageWs.getSectionTypes().stream().map(type -> { String label = msg.getString("select.sectiontype." + type); String description = msg.getString("select.sectiontype.tt." + type); return new SelectItem(type, label, description); }).collect(toList()); }
From source file:com.prowidesoftware.swift.model.field.Field.java
/** * Helper implementation of getString from bundle without throwing exception * @param labels/*from w ww . j a v a 2 s .c o m*/ * @param key * @return the found resource or <code>null</code> if not found for the given key */ private static String getString(final ResourceBundle labels, final String key) { try { return labels.getString(key); } catch (final MissingResourceException e) { return null; } }
From source file:fr.certu.chouette.plugin.report.ReportItem.java
/** * @param locale/* www. j a v a 2 s. com*/ * @return */ public String getLocalizedMessage(Locale locale) { String format = ""; String message = ""; try { ResourceBundle bundle = ResourceBundle.getBundle(this.getClass().getName(), locale); format = bundle.getString(getMessageKey()); message = MessageFormat.format(format, messageArgs.toArray()); } catch (MissingResourceException e1) { try { ResourceBundle bundle = ResourceBundle.getBundle(this.getClass().getName()); format = bundle.getString(getMessageKey()); message = MessageFormat.format(format, messageArgs.toArray()); } catch (MissingResourceException e2) { message = getMessageKey(); if (messageArgs != null) message += " : " + Arrays.toString(messageArgs.toArray()); } } return message; }