List of usage examples for java.util Locale ROOT
Locale ROOT
To view the source code for java.util Locale ROOT.
Click Source Link
From source file:io.crate.metadata.PartitionName.java
@Nullable public static String encodeIdent(Collection<? extends BytesRef> values) { if (values.size() == 0) { return null; }//from www . j ava2s . c om BytesStreamOutput streamOutput = new BytesStreamOutput(estimateSize(values)); try { streamOutput.writeVInt(values.size()); for (BytesRef value : values) { StringType.INSTANCE.streamer().writeValueTo(streamOutput, value); } } catch (IOException e) { throw Throwables.propagate(e); } String identBase32 = BASE32.encodeAsString(streamOutput.bytes().toBytes()).toLowerCase(Locale.ROOT); // decode doesn't need padding, remove it int idx = identBase32.indexOf('='); if (idx > -1) { return identBase32.substring(0, idx); } return identBase32; }
From source file:com.appsimobile.appsii.module.weather.loader.YahooWeatherApiClient.java
private static String buildWeatherQueryUrl(CircularArray<String> woeids, String unit) { // http://developer.yahoo.com/weather/ String endPoint = "https://query.yahooapis.com/v1/public/yql?format=json&q="; String query = "select * from weather.forecast where woeid in (%s) and u=\"%s\""; String param = ArrayUtils.join(", ", woeids); String queryString = String.format(Locale.ROOT, query, param, unit); if (BuildConfig.DEBUG) Log.d("YahooWeatherApiClient", "yql query: " + queryString); try {//from w w w .j a va 2s . c o m queryString = URLEncoder.encode(queryString, "UTF-8"); } catch (UnsupportedEncodingException e) { Log.wtf("YahooWeatherApiClient", "error encoding url", e); } return endPoint + queryString; }
From source file:com.xpn.xwiki.plugin.packaging.ImportTest.java
@Override protected void setUp() throws Exception { super.setUp(); this.pack = new Package(); this.xwiki = new XWiki(); getContext().setWiki(this.xwiki); this.xwiki.setConfig(new XWikiConfig()); Mock mockLocalizationContext = registerMockComponent(LocalizationContext.class); mockLocalizationContext.stubs().method("getCurrentLocale").will(returnValue(Locale.ROOT)); // mock a store that would also handle translations this.mockXWikiStore = mock(XWikiHibernateStore.class, new Class[] { XWiki.class, XWikiContext.class }, new Object[] { this.xwiki, getContext() }); this.mockXWikiStore.stubs().method("loadXWikiDoc") .will(new CustomStub("Implements XWikiStoreInterface.loadXWikiDoc") { @Override//w w w .j av a 2 s .c om public Object invoke(Invocation invocation) throws Throwable { XWikiDocument shallowDoc = (XWikiDocument) invocation.parameterValues.get(0); String documentKey = shallowDoc.getFullName(); if (!shallowDoc.getLanguage().equals("")) { documentKey += "." + shallowDoc.getLanguage(); } if (docs.containsKey(documentKey)) { return docs.get(documentKey); } else { return shallowDoc; } } }); this.mockXWikiStore.stubs().method("saveXWikiDoc") .will(new CustomStub("Implements XWikiStoreInterface.saveXWikiDoc") { @Override public Object invoke(Invocation invocation) throws Throwable { XWikiDocument document = (XWikiDocument) invocation.parameterValues.get(0); document.setNew(false); document.setStore((XWikiStoreInterface) mockXWikiStore.proxy()); // if this is a translated document, append a language prefix String documentKey = document.getFullName(); if (!document.getLanguage().equals("")) { documentKey += "." + document.getLanguage(); } docs.put(documentKey, document); return null; } }); this.mockXWikiStore.stubs().method("deleteXWikiDoc") .will(new CustomStub("Implements XWikiStoreInterface.deleteXWikiDoc") { @Override public Object invoke(Invocation invocation) throws Throwable { XWikiDocument document = (XWikiDocument) invocation.parameterValues.get(0); // delete the document from the map String documentKey = document.getFullName(); if (!document.getLanguage().equals("")) { documentKey += "." + document.getLanguage(); } docs.remove(documentKey); return null; } }); this.mockXWikiStore.stubs().method("getTranslationList") .will(new CustomStub("Implements XWikiStoreInterface.getTranslationList") { @Override public Object invoke(Invocation invocation) throws Throwable { XWikiDocument document = (XWikiDocument) invocation.parameterValues.get(0); // search for this document in the map and return it's translations List translationList = new ArrayList(); for (Iterator pairsIt = docs.entrySet().iterator(); pairsIt.hasNext();) { Map.Entry currentEntry = (Map.Entry) pairsIt.next(); if (((String) currentEntry.getKey()).startsWith(document.getFullName()) && !((XWikiDocument) currentEntry.getValue()).getLanguage().equals("")) { // yeeey, it's a translation translationList.add(((XWikiDocument) currentEntry.getValue()).getLanguage()); } } return translationList; } }); this.mockXWikiStore.stubs().method("injectCustomMapping").will(returnValue(false)); this.mockRecycleBinStore = mock(XWikiHibernateRecycleBinStore.class, new Class[] { XWikiContext.class }, new Object[] { getContext() }); this.mockRecycleBinStore.stubs().method("saveToRecycleBin").will(VoidStub.INSTANCE); this.mockXWikiVersioningStore = mock(XWikiHibernateVersioningStore.class, new Class[] { XWiki.class, XWikiContext.class }, new Object[] { this.xwiki, getContext() }); this.mockXWikiVersioningStore.stubs().method("getXWikiDocumentArchive").will(returnValue(null)); this.mockXWikiVersioningStore.stubs().method("resetRCSArchive").will(returnValue(null)); this.xwiki.setStore((XWikiStoreInterface) mockXWikiStore.proxy()); this.xwiki.setRecycleBinStore((XWikiHibernateRecycleBinStore) this.mockRecycleBinStore.proxy()); this.xwiki.setVersioningStore((XWikiVersioningStoreInterface) mockXWikiVersioningStore.proxy()); // mock the right service this.mockRightService = mock(XWikiRightService.class); this.mockRightService.stubs().method("checkAccess").will(returnValue(true)); this.mockRightService.stubs().method("hasWikiAdminRights").will(returnValue(true)); this.mockRightService.stubs().method("hasProgrammingRights").will(returnValue(true)); this.xwiki.setRightService((XWikiRightService) this.mockRightService.proxy()); }
From source file:fr.lepellerin.ecole.web.controller.LoginController.java
/** * reset le mot de passe.//from w ww.ja v a2 s.co m * * @return nom de la vue */ @RequestMapping(value = "/forgottenPassword", method = RequestMethod.POST) public String resetPwdPage(@RequestParam final String email, final Model model) { // find family by email. final List<ForgottenPwdDto> pwds = this.utilisateurService.resetPasswordForFamille(email); pwds.forEach(pwd -> { final Context ctx = new Context(Locale.ROOT); ctx.setVariable("name", pwd.getAccount()); ctx.setVariable("pwd", pwd.getPassword()); try { this.emailService.sendSimpleMail("[Ecole notre dame] - Changement du mot de passe", pwd.getEmails(), "no-reply@ecole-lepellerin.com", "forgottenEmail", ctx); } catch (final MessagingException e) { LOGGER.error("ERROR sending email", e); } model.addAttribute("confirm", "Email avec nouveau mot de passe envoy."); }); return "accueil/forgottenPwd"; }
From source file:ch.algotrader.adapter.fix.FixMultiApplicationSessionFactory.java
@Override public Session create(final SessionID sessionID, final SessionSettings settings) throws ConfigError { FixApplicationFactory applicationFactory = this.applicationFactoryMap.get(sessionID.getSessionQualifier()); if (applicationFactory == null) { throw new BrokerAdapterException( "Could not find FixApplicationFactory for session " + sessionID.getSessionQualifier()); }/*from ww w.jav a2 s . co m*/ String logImpl = ""; try { logImpl = settings.getString(sessionID, "LogImpl"); } catch (ConfigError | FieldConvertError ignore) { } if (logImpl != null) { logImpl = logImpl.toLowerCase(Locale.ROOT); } else { logImpl = ""; } LogFactory logFactory; switch (logImpl) { case "slf4j": logFactory = new SLF4JLogFactory(settings); break; case "file": logFactory = new FileLogFactory(settings); break; case "screen": logFactory = new ScreenLogFactory(settings); break; case "none": logFactory = null; break; default: logFactory = new FileLogFactory(settings); } Application application = applicationFactory.create(sessionID, settings); DefaultSessionFactory sessionFactory = new DefaultSessionFactory(application, this.messageStoreFactory, logFactory, this.messageFactory); return sessionFactory.create(sessionID, settings); }
From source file:de.ks.text.AsciiDocParser.java
public OptionsBuilder getDefaultOptions(AttributesBuilder attributes) { return OptionsBuilder.options().headerFooter(true) .backend(AsciiDocBackend.HTML5.name().toLowerCase(Locale.ROOT)).attributes(attributes.get()); }
From source file:fr.lepellerin.ecole.web.controller.cantine.DetaillerReservationRepasController.java
@RequestMapping(value = "/reserver") @ResponseBody/* www.j a va 2s . c o m*/ public ResponseEntity<String> reserver(@RequestParam final String date, @RequestParam final int individuId) throws TechnicalException { final CurrentUser user = (CurrentUser) SecurityContextHolder.getContext().getAuthentication() .getPrincipal(); final LocalDate localDate = LocalDate.parse(date, DateTimeFormatter.ofPattern(GeDateUtils.DATE_FORMAT_YYYYMMDD, Locale.ROOT)); String result; try { result = this.cantineService.reserver(localDate, individuId, user.getUser().getFamille(), null); return ResponseEntity.ok(result); } catch (FunctionalException e) { LOGGER.error("Une erreur fonctionnelle s'est produite : " + e.getMessage(), e); return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); } }
From source file:br.com.OCTur.view.GraficoController.java
@Override public void initialize(URL url, ResourceBundle rb) { fornecedor = new FornecedorDAO().pegarPorEmpresa(Sessao.pessoa.getEmpresa()); snCategoriasMaisVendida = new SwingNode(); snInteressePorArtesanato = new SwingNode(); snProdutosMaisAntigos = new SwingNode(); spCategoriaMaisVendida.setContent(snCategoriasMaisVendida); spInteressePorArtesanato.setContent(snInteressePorArtesanato); spProdutosMaisAntigos.setContent(snProdutosMaisAntigos); DefaultPieDataset dpdDados = new DefaultPieDataset(); for (CategoriaProduto categoriaProduto : new CategoriaProdutoDAO().pegarTodos()) { List<CompraItem> compraitem = new CompraItemDAO().pegarPorFonecedorCategoria(fornecedor, categoriaProduto);// ww w .ja v a 2s . c o m dpdDados.setValue(categoriaProduto.toString(), compraitem.size()); } JFreeChart jFreeChart = ChartFactory.createPieChart3D( ControlTranducao.traduzirPalavra("CATEGORIASMAISVENDIDAS"), dpdDados, false, false, Locale.ROOT); PiePlot3D piePlot3D = (PiePlot3D) jFreeChart.getPlot(); piePlot3D.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}\n{2}")); ChartPanel categoriaMaisVendida = new ChartPanel(jFreeChart); Platform.runLater(() -> { snCategoriasMaisVendida.setContent(categoriaMaisVendida); }); DefaultCategoryDataset dcdDados = new DefaultCategoryDataset(); for (int i = Calendar.getInstance().get(Calendar.YEAR) - 10; i < Calendar.getInstance() .get(Calendar.YEAR); i++) { dcdDados.addValue(new Random().nextDouble() * 100000, "Interesse", String.valueOf(i)); } jFreeChart = ChartFactory.createLineChart( ControlTranducao.traduzirPalavra("interesse") + " " + ControlTranducao.traduzirPalavra("artesanato"), "", "", dcdDados, PlotOrientation.VERTICAL, false, false, false); ChartPanel interesseArtesanato = new ChartPanel(jFreeChart); Platform.runLater(() -> { snInteressePorArtesanato.setContent(interesseArtesanato); }); produto = new ArrayList<>(); for (Produto produto : new ProdutoDAO().pegarPorFornecedor(fornecedor)) { if (new CompraItemDAO().pegarPorProduto(produto).isEmpty()) { List<Item> itens = new ItemDAO().pegarPorProduto(produto); if (!itens.isEmpty()) { Item item = itens.get(0); long quantidade = (new Date().getTime() - item.getDatacadastro().getTime()) / 1000 / 60 / 60 / 24; this.produto.add(new EntidadeGrafico<>(produto, quantidade)); } } } slMeta.setMax(produto.stream().mapToDouble(EntidadeGrafico::getValue).max().orElse(0)); slMeta.valueProperty() .addListener((ObservableValue<? extends Number> observable, Number oldValue, Number newValue) -> { produtosMaisAntigos(); }); Platform.runLater(() -> { produtosMaisAntigos(); }); }
From source file:com.puppycrawl.tools.checkstyle.checks.header.RegexpHeaderCheckTest.java
/** * Test of setHeader method, of class RegexpHeaderCheck. *//*from w w w. j av a 2 s .c om*/ @Test public void testSetHeader() { // check invalid header passes RegexpHeaderCheck instance = new RegexpHeaderCheck(); try { String header = "^/**\\n * Licensed to the Apache Software Foundation (ASF)"; instance.setHeader(header); fail(String.format(Locale.ROOT, "%s should have been thrown", ConversionException.class)); } catch (ConversionException ex) { assertEquals("Unable to parse format: ^/**\\n *" + " Licensed to the Apache Software Foundation (ASF)", ex.getMessage()); } }