List of usage examples for java.util ResourceBundle getString
public final String getString(String key)
From source file:hudson.Util.java
/** * Extracts the Win32 error message from {@link Throwable} if possible. * * @return//from w ww . j a v a 2s. co m * null if there seems to be no error code or if the platform is not Win32. */ public static String getWin32ErrorMessage(Throwable e) { String msg = e.getMessage(); if (msg != null) { Matcher m = errorCodeParser.matcher(msg); if (m.matches()) { try { ResourceBundle rb = ResourceBundle.getBundle("/hudson/win32errors"); return rb.getString("error" + m.group(1)); } catch (Exception _) { // silently recover from resource related failures } } } if (e.getCause() != null) { return getWin32ErrorMessage(e.getCause()); } return null; // no message }
From source file:com.inkubator.hrm.web.payroll.PayTempOvertimeFormController.java
public void handingFileUpload(FileUploadEvent fileUploadEvent) { Map<String, String> results = uploadFilesUtil.checkUploadFileSizeLimit(fileUploadEvent.getFile()); if (StringUtils.equals(results.get("result"), "true")) { file = fileUploadEvent.getFile(); fileName = file.getFileName();// w w w. j a v a 2 s. c om } else { ResourceBundle messages = ResourceBundle.getBundle("Messages", new Locale(FacesUtil.getSessionAttribute(HRMConstant.BAHASA_ACTIVE).toString())); String errorMsg = messages.getString("global.file_size_should_not_bigger_than") + " " + results.get("sizeMax"); MessagesResourceUtil.setMessagesFromException(FacesMessage.SEVERITY_ERROR, "global.error", errorMsg, FacesUtil.getSessionAttribute(HRMConstant.BAHASA_ACTIVE).toString()); } }
From source file:org.skyinn.quasar.struts.action.BaseAction.java
/** * @see org.apache.struts.actions.LookupDispatchAction#getKeyMethodMap() *//*from w w w. jav a2 s . c om*/ protected Map getKeyMethodMap() { Map map = new HashMap(); String pkg = this.getClass().getPackage().getName(); ResourceBundle methods = ResourceBundle.getBundle(pkg + ".LookupMethods"); Enumeration keys = methods.getKeys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); map.put(key, methods.getString(key)); } return map; }
From source file:org.tonguetied.web.servlet.ServletContextInitializer.java
/** * Create an instance of a {@link ServerData} object instantiating it from * the system properties.// w w w . ja va2 s . c o m * * @param servletContext * @return an instantiated {@link ServerData} object */ private ServerData createServerData(ServletContext servletContext) { ServerData serverData; try { final ResourceBundle bundle = ResourceBundle.getBundle("buildNumber"); serverData = new ServerData(bundle.getString("version"), bundle.getString("build.number"), DATE_FORMAT.parse(bundle.getString("build.date"))); } catch (ParseException pe) { logger.error("failed to parse date", pe); throw new IllegalStateException("failed to parse date", pe); } return serverData; }
From source file:com.inkubator.hrm.web.converter.PaySalaryComponentFormulaConverter.java
@Override public String getAsString(FacesContext context, UIComponent component, Object value) { ResourceBundle resourceBundle = ResourceBundle.getBundle("Messages", new Locale(FacesUtil.getSessionAttribute(HRMConstant.BAHASA_ACTIVE).toString())); String messages = StringUtils.EMPTY; Integer data = (Integer) value; if (Objects.equals(data, 1)) { messages = resourceBundle.getString("paySalaryComponent.paySalaryComponent_tunjangan"); } else if (Objects.equals(data, -1)) { messages = resourceBundle.getString("paySalaryComponent.paySalaryComponent_potongan"); } else if (Objects.equals(data, 0)) { messages = resourceBundle.getString("paySalaryComponent.paySalaryComponent_subsidi"); }//from ww w.ja v a2s .c o m return messages; }
From source file:com.sfs.beans.SQLBean.java
/** * Instantiates a new sQL bean.// w ww .ja va 2s . c o m * * @param sqlPropertiesName the sql properties name */ public SQLBean(final String sqlPropertiesName) { /** * Loads SQL commands into memory from properties file **/ if (sqlPropertiesName != null) { ResourceBundle sqlBundle = ResourceBundle.getBundle(sqlPropertiesName); Enumeration<String> keySet = sqlBundle.getKeys(); while (keySet.hasMoreElements()) { String sqlKey = keySet.nextElement(); String sqlValue = sqlBundle.getString(sqlKey); sqlKey = StringUtils.replace(sqlKey, ".", "/"); if (sqlValue == null) { sqlValue = ""; } this.setValue(sqlKey, sqlValue); } } }
From source file:es.pode.administracion.presentacion.descargas.activas.ActivasControllerImpl.java
/** * @see es.pode.administracion.presentacion.descargas.activas.ActivasController#selectOption(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.descargas.activas.SelectOptionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *//*from w w w . j a v a2 s .co m*/ public final java.lang.String selectOption(ActionMapping mapping, es.pode.administracion.presentacion.descargas.activas.SelectOptionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String result; ResourceBundle resources = ResourceBundle.getBundle("application-resources", (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE)); String action = form.getAction(); if (resources.getString("descargasActivas.crear").equals(action)) { result = "Crear"; } else { result = "Eliminar"; } return result; }
From source file:es.pode.empaquetador.presentacion.avanzado.submanifiestos.desagregar.DesagregarSubmanifiestoControllerImpl.java
public void submit(ActionMapping mapping, SubmitForm 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 identificador = form.getDestino(); if (accion.equals(i18n.getString("portal_empaquetado_desagregarSubmanifiestos.continuar"))) { if ((identificador == null) || (identificador.equals(""))) { throw new ValidatorException("{exportar.subirArchivo}"); }//w w w .j a v a 2 s . co m } }
From source file:ai.grakn.factory.OrientDBInternalFactory.java
private OrientGraph createIndicesVertex(OrientGraph graph) { ResourceBundle keys = ResourceBundle.getBundle("indices-vertices"); Set<String> labels = keys.keySet(); for (String label : labels) { String[] configs = keys.getString(label).split(","); for (String propertyConfig : configs) { String[] propertyConfigs = propertyConfig.split(":"); Schema.VertexProperty property = Schema.VertexProperty.valueOf(propertyConfigs[0]); boolean isUnique = Boolean.parseBoolean(propertyConfigs[1]); OType orientDataType = getOrientDataType(property); BaseConfiguration indexConfig = new BaseConfiguration(); indexConfig.setProperty("keytype", orientDataType); //TODO: Figure out why this is not working when the Orient Guys say it should //indexConfig.setProperty("metadata.ignoreNullValues", true); if (isUnique) { indexConfig.setProperty("type", "UNIQUE"); }//from w w w . j a va 2 s . c om if (!graph.getVertexIndexedKeys(label).contains(property.name())) { graph.createVertexIndex(property.name(), label, indexConfig); } } } return graph; }
From source file:es.pode.empaquetador.presentacion.avanzado.recursos.crear.tipo.CrearRecursoAvanzadoTipoControllerImpl.java
public final void submit(ActionMapping mapping, es.pode.empaquetador.presentacion.avanzado.recursos.crear.tipo.SubmitForm 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(); String tipo = form.getTipo(); // continuar/*from w ww .j a va 2 s . co m*/ if (accion.equals(i18n.getString("portalempaquetado.avanzado.recursos.crear.paso1.continuar"))) { if ((tipo != null) && (tipo.equals("asset") || tipo.equals("sco"))) { sesRecurs.setTipo(tipo); } } }