List of usage examples for java.util Locale GERMAN
Locale GERMAN
To view the source code for java.util Locale GERMAN.
Click Source Link
From source file:org.projectforge.business.fibu.datev.BuchungssatzExcelImporter.java
private ImportedSheet<BuchungssatzDO> importBuchungssaetze(final ExcelImport<BuchungssatzImportRow> imp, final HSSFSheet sheet, final int month) throws Exception { final ImportedSheet<BuchungssatzDO> importedSheet = new ImportedSheet<BuchungssatzDO>(); imp.setNameRowIndex(ROW_COLUMNNAMES); imp.setStartingRowIndex(ROW_COLUMNNAMES + 1); imp.setRowClass(BuchungssatzImportRow.class); final Map<String, String> map = new HashMap<String, String>(); map.put("SatzNr.", "satzNr"); map.put("Satz-Nr.", "satzNr"); map.put("Betrag", "betrag"); map.put("SH", "sh"); // Nicht eindeutig! map.put("Konto", "konto"); map.put("Kostenstelle/-trger", "kost2"); map.put("Kost2", "kost2"); map.put("Menge", "menge"); map.put("SH2", "sh2"); map.put("Beleg", "beleg"); map.put("Datum", "datum"); map.put("Gegenkonto", "gegenkonto"); map.put("Text", "text"); map.put("Alt.-Kst.", "kost1"); map.put("Kost1", "kost1"); map.put("Beleg 2", "beleg2"); map.put("KR-BSNr.", "kr_bsnr"); map.put("ZI", "zi"); map.put("Kommentar", "comment"); map.put("Bemerkung", "comment"); imp.setColumnMapping(map);/*from w w w . j ava 2s . c o m*/ BuchungssatzImportRow[] rows = new BuchungssatzImportRow[0]; rename2ndSH(sheet); rows = imp.convertToRows(BuchungssatzImportRow.class); if (rows == null || rows.length == 0) { return null; } int year = 0; for (int i = 0; i < rows.length; i++) { ImportedElement<BuchungssatzDO> element; try { element = convertBuchungssatz(rows[i]); } catch (final RuntimeException ex) { throw new RuntimeException( "Im Blatt '" + sheet.getSheetName() + "', in Zeile " + (i + 2) + ": " + ex.getMessage(), ex); } if (element == null) { // Empty row: continue; } final BuchungssatzDO satz = element.getValue(); final DateHolder date = new DateHolder(satz.getDatum(), DatePrecision.DAY, Locale.GERMAN); if (year == 0) { year = date.getYear(); } else if (year != date.getYear()) { final String msg = "Not supported: Buchungsstze innerhalb eines Excel-Sheets liegen in verschiedenen Jahren: Im Blatt '" + sheet.getSheetName() + "', in Zeile " + (i + 2); actionLog.logError(msg); throw new UserException(msg); } if (date.getMonth() > month) { final String msg = "Buchungsstze knnen nicht in die Zukunft fr den aktuellen Monat '" + KostFormatter.formatBuchungsmonat(year, date.getMonth()) + " gebucht werden! " + satz; actionLog.logError(msg); throw new RuntimeException(msg); } else if (date.getMonth() < month) { final String msg = "Buchungssatz liegt vor Monat '" + KostFormatter.formatBuchungsmonat(year, month) + "' (OK): " + satz; actionLog.logInfo(msg); } satz.setYear(year); satz.setMonth(month); importedSheet.addElement(element); log.debug(satz); } importedSheet.setName(KostFormatter.formatBuchungsmonat(year, month)); importedSheet.setProperty("year", year); importedSheet.setProperty("month", month); return importedSheet; }
From source file:com.example.phonetic.KoelnerPhonetik.java
private String substitute(String str) { String s = expandUmlauts(str.toUpperCase(Locale.GERMAN)); s = removeSequences(s);/*from w ww .j av a 2 s .c om*/ StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length(); i++) { char current = s.charAt(i); char next = i + 1 < s.length() ? s.charAt(i + 1) : '_'; char prev = i > 0 ? s.charAt(i - 1) : '_'; switch (current) { case 'A': case 'E': case 'I': case 'J': case 'Y': case 'O': case 'U': if (i == 0 || ((i == 1) && prev == 'H')) { sb.append(getCode()); } break; case 'P': sb.append(next == 'H' ? "33" : '1'); break; case 'B': sb.append('1'); break; case 'D': case 'T': sb.append(csz.contains(next) ? '8' : '2'); break; case 'F': case 'V': case 'W': sb.append('3'); break; case 'G': case 'K': case 'Q': sb.append('4'); break; case 'C': if (i == 0) { sb.append(ahkloqrux.contains(next) ? '4' : '8'); } else { sb.append(aouhkxq.contains(next) ? '4' : '8'); } if (sb.length() >= 2 && sb.charAt(sb.length() - 2) == '8') { sb.setCharAt(sb.length() - 1, '8'); } break; case 'X': sb.append(i < 1 || !ckq.contains(prev) ? "48" : '8'); break; case 'L': sb.append('5'); break; case 'M': case 'N': sb.append('6'); break; case 'R': sb.append('7'); break; case 'S': case 'Z': sb.append('8'); break; case 'H': break; } } s = sb.toString(); s = removeSequences(s); return s; }
From source file:de.hybris.platform.servicelayer.model.ModelEntityContextTest.java
private ItemModelInternalContext createItemContext(final PK pk, final String itemType) { final ItemContextBuilder builder = new ItemContextBuilder(); builder.setPk(pk);//from w ww. j a va 2s .c o m builder.setItemType(itemType); builder.setTenantID(TENANT_ID); builder.setValueHistory(new ModelValueHistory()); builder.setFetchStrategy(new DefaultFetchStrategy()); builder.setLocaleProvider(new MockLocaleProvider(Locale.GERMAN, null, null)); builder.setDynamicAttributesProvider( new MockDynamicAttributesProvider(dynamicAttributes, dynamicLocAttributes)); builder.setAttributeProvider(new MockAttributeProvider(attributes, locAttributes)); return builder.build(); }
From source file:com.flexive.tests.shared.FxSharedUtilTest.java
@Test public void messageKeyNullTest() { // check null-safeness of message key (avoid throwing exceptions in exception message loaders) final FxSharedUtils.MessageKey key1 = new FxSharedUtils.MessageKey(Locale.GERMAN, null); final FxSharedUtils.MessageKey key2 = new FxSharedUtils.MessageKey(null, "a.b.c"); Assert.assertFalse(key1.equals(key2)); Assert.assertFalse(key2.equals(key1)); Assert.assertTrue(key1.hashCode() != 0); Assert.assertTrue(key2.hashCode() != 0); }
From source file:test.unit.be.fedict.eid.tsl.EtsiTslLifecycleTest.java
@Test public void testLC002() throws Exception { // setup/*from w w w .ja v a 2s.c om*/ TrustServiceList trustServiceList = TrustServiceListFactory.newInstance(); // scheme operator name trustServiceList.setSchemeOperatorName("BE:Fedict", Locale.ENGLISH); trustServiceList.setSchemeOperatorName("BE:Fedict", new Locale("nl")); trustServiceList.setSchemeOperatorName("BE:Fedict", Locale.FRENCH); trustServiceList.setSchemeOperatorName("BE:Fedict", Locale.GERMAN); // scheme operator postal address PostalAddressType schemeOperatorPostalAddress = new PostalAddressType(); schemeOperatorPostalAddress.setStreetAddress("Maria-Theresiastraat 1/3"); schemeOperatorPostalAddress.setLocality("Brussels"); schemeOperatorPostalAddress.setStateOrProvince("Brussels"); schemeOperatorPostalAddress.setPostalCode("1000"); schemeOperatorPostalAddress.setCountryName("Belgium"); trustServiceList.setSchemeOperatorPostalAddress(schemeOperatorPostalAddress, Locale.ENGLISH); schemeOperatorPostalAddress.setStreetAddress("Maria-Theresiastraat 1/3"); schemeOperatorPostalAddress.setLocality("Brussel"); schemeOperatorPostalAddress.setStateOrProvince("Brussel"); schemeOperatorPostalAddress.setPostalCode("1000"); schemeOperatorPostalAddress.setCountryName("Belgi"); trustServiceList.setSchemeOperatorPostalAddress(schemeOperatorPostalAddress, new Locale("nl")); // scheme operator electronic address /* List<String> electronicAddresses = new LinkedList<String>(); electronicAddresses.add("http://www.fedict.belgium.be/"); electronicAddresses.add("mailto://eid@belgium.be"); trustServiceList .setSchemeOperatorElectronicAddresses(electronicAddresses); */ trustServiceList.setSchemeOperatorElectronicAddresses(Locale.ENGLISH, "http://www.fedict.belgium.be/"); trustServiceList.setSchemeOperatorElectronicAddresses(Locale.ENGLISH, "mailto://eid@belgium.be"); // scheme name trustServiceList.setSchemeName( "BE:Supervision/Accreditation Status List of certification services from Certification Service Providers, which are supervised/accredited by the referenced Scheme Operator Member State for compliance with the relevant provisions laid down in Directive 1999/93/EC of the European Parliament and of the Council of 13 December 1999 on a Community framework for electronic signatures", Locale.ENGLISH); // scheme information URIs trustServiceList.addSchemeInformationUri("https://www.e-contract.be/tsl/", Locale.ENGLISH); // status determination approach trustServiceList.setStatusDeterminationApproach(TrustServiceList.STATUS_DETERMINATION_APPROPRIATE); // scheme type /* * The Scheme Type URIs can actually be visited. We should provide some * information to ETSI for the BE schemerules. */ trustServiceList.addSchemeType(TrustServiceList.SCHEME_RULE_COMMON, Locale.ENGLISH); /* * The BE schemerules MUSH be provided. We can add extra paths for * language. For example: http:// * uri.etsi.org/TrstSvc/eSigDir-1999-93-EC-TrustedList/schemerules/BE/nl */ trustServiceList.addSchemeType("http://uri.etsi.org/TrstSvc/eSigDir-1999-93-EC-TrustedList/schemerules/BE", Locale.ENGLISH); // scheme territory trustServiceList.setSchemeTerritory("BE"); // legal notice trustServiceList.addLegalNotice( "The applicable legal framework for the present TSL implementation of the Trusted List of supervised/accredited Certification Service Providers for Belgium is the Directive 1999/93/EC of the European Parliament and of the Council of 13 December 1999 on a Community framework for electronic signatures and its implementation in Belgian laws.", Locale.ENGLISH); // historical information period /* * Volgens de wet van 9 JULI 2001. Wet houdende vaststelling van * bepaalde regels in verband met het juridisch kader voor elektronische * handtekeningen en certificatiediensten: Bijlage II - punt i) alle * relevante informatie over een gekwalificeerd certificaat te * registreren gedurende de nuttige termijn van dertig jaar, in het * bijzonder om een certificatiebewijs te kunnen voorleggen bij * gerechtelijke procedures. */ trustServiceList.setHistoricalInformationPeriod(3653 * 3); // list issue date time DateTime listIssueDateTime = new DateTime(); trustServiceList.setListIssueDateTime(listIssueDateTime); // next update DateTime nextUpdateDateTime = listIssueDateTime.plusMonths(6); trustServiceList.setNextUpdate(nextUpdateDateTime); // distribution point File tslFile = File.createTempFile("tsl-LC002-", ".xml"); trustServiceList.addDistributionPoint("https://www.e-contract.be/tsl/" + tslFile.getName()); // sign TSL KeyPair keyPair = TrustTestUtils.generateKeyPair(2048); PrivateKey privateKey = keyPair.getPrivate(); DateTime notBefore = new DateTime(); DateTime notAfter = notBefore.plusYears(1); X509Certificate certificate = TrustTestUtils.generateSelfSignedCertificate(keyPair, "C=BE, CN=Belgium Trust List Scheme Operator", notBefore, notAfter); trustServiceList.sign(privateKey, certificate); // save TSL trustServiceList.saveAs(tslFile); LOG.debug("TSL file: " + tslFile.getAbsolutePath()); }
From source file:org.dspace.content.LicenseUtilsTest.java
/** * Test of getLicenseText method, of class LicenseUtils. *///from w w w . j a v a 2 s.co m @Test public void testGetLicenseText_4args() throws SQLException, AuthorizeException { //parameters for the test Locale locale = null; Collection collection = null; Item item = null; EPerson person = null; String template = "Template license: %1$s %2$s %3$s %5$s %6$s"; String templateResult = "Template license: first name last name test@email.com "; String defaultLicense = ConfigurationManager.getDefaultSubmissionLicense(); context.turnOffAuthorisationSystem(); //TODO: the tested method doesn't verify the input, will throw NPE if any parameter is null //testing for default license locale = Locale.ENGLISH; collection = Collection.create(context); item = Item.create(context); person = EPerson.create(context); person.setFirstName("first name"); person.setLastName("last name"); person.setEmail("test@email.com"); assertThat("testGetLicenseText_5args 0", LicenseUtils.getLicenseText(locale, collection, item, person), equalTo(defaultLicense)); locale = Locale.GERMAN; collection = Collection.create(context); item = Item.create(context); person = EPerson.create(context); person.setFirstName("first name"); person.setLastName("last name"); person.setEmail("test@email.com"); assertThat("testGetLicenseText_5args 1", LicenseUtils.getLicenseText(locale, collection, item, person), equalTo(defaultLicense)); //test collection template locale = Locale.ENGLISH; collection = Collection.create(context); collection.setLicense(template); item = Item.create(context); person = EPerson.create(context); person.setFirstName("first name"); person.setLastName("last name"); person.setEmail("test@email.com"); assertThat("testGetLicenseText_5args 3", LicenseUtils.getLicenseText(locale, collection, item, person), equalTo(templateResult)); locale = Locale.GERMAN; collection = Collection.create(context); collection.setLicense(template); item = Item.create(context); person = EPerson.create(context); person.setFirstName("first name"); person.setLastName("last name"); person.setEmail("test@email.com"); assertThat("testGetLicenseText_5args 4", LicenseUtils.getLicenseText(locale, collection, item, person), equalTo(templateResult)); context.restoreAuthSystemState(); }
From source file:test.be.fedict.eid.applet.PcscTest.java
@Test public void createPSSSignature() throws Exception { this.messages = new Messages(Locale.GERMAN); PcscEid pcscEid = new PcscEid(new TestView(), this.messages); if (false == pcscEid.isEidPresent()) { LOG.debug("insert eID card"); pcscEid.waitForEidPresent();/*from www . j av a 2s. com*/ } CardChannel cardChannel = pcscEid.getCardChannel(); byte[] message = "hello world".getBytes(); MessageDigest messageDigest = MessageDigest.getInstance("SHA1"); byte[] digest = messageDigest.digest(message); try { CommandAPDU setApdu = new CommandAPDU(0x00, 0x22, 0x41, 0xB6, new byte[] { 0x04, // length of following data (byte) 0x80, // algo ref 0x10, // PKCS1-PSS-SHA1 (byte) 0x84, // tag for private key ref PcscEid.AUTHN_KEY_ID }); ResponseAPDU responseAPDU = cardChannel.transmit(setApdu); assertEquals(0x9000, responseAPDU.getSW()); pcscEid.verifyPin(); CommandAPDU computeDigitalSignatureApdu = new CommandAPDU(0x00, 0x2A, 0x9E, 0x9A, digest); responseAPDU = cardChannel.transmit(computeDigitalSignatureApdu); assertEquals(0x9000, responseAPDU.getSW()); byte[] signatureValue = responseAPDU.getData(); LOG.debug("signature value length: " + signatureValue.length); List<X509Certificate> authnCertificateChain = pcscEid.getAuthnCertificateChain(); Signature signature = Signature.getInstance("SHA1withRSA/PSS", "BC"); signature.initVerify(authnCertificateChain.get(0).getPublicKey()); signature.update(message); boolean result = signature.verify(signatureValue); assertTrue(result); } finally { pcscEid.close(); } }
From source file:org.olat.user.restapi.UserVOFactory.java
/** * Allow the date to be in the raw form (yyyyMMdd) or translated * to be translated/*from w w w. java2 s .c om*/ * @param value * @param handler * @param locale * @return */ public static final String parseDate(String value, Locale locale) { if (!StringHelper.containsNonWhitespace(value)) { return value; } boolean raw = true; for (int i = 0; i < value.length(); i++) { if (!Character.isDigit(value.charAt(i))) { raw = false; break; } } if (raw) { try { DateFormat formater = new SimpleDateFormat("yyyyMMdd", Locale.GERMAN); Date date = formater.parse(value); value = Formatter.getInstance(locale).formatDate(date); } catch (ParseException e) { /* silently failed */ } } return value; }
From source file:org.kalypso.wspwin.core.WspCfg.java
private IStatus readWspCfg(final File profDir, final Collection<ZustandBean> zustandBeans) { final File wspCfgFile = new File(profDir, WspWinFiles.WSP_CFG); try (LineNumberReader reader = new LineNumberReader(new FileReader(wspCfgFile))) { final String firstLine = reader.readLine(); if (firstLine == null || firstLine.length() == 0) return new Status(IStatus.ERROR, KalypsoWspWinCorePlugin.PLUGIN_ID, Messages.getString("org.kalypso.wspwin.core.WspCfg.1")); //$NON-NLS-1$ // ignore the values, we read the count from the linecount // just parse the type final char type = firstLine.charAt(firstLine.length() - 1); setType(type);//w ww. j a v a2s.com while (reader.ready()) { final String line = reader.readLine(); if (line == null) break; final String trimmedLine = line.trim(); if (trimmedLine.length() == 0 || trimmedLine.length() < 85) continue; try { final String waterName = trimmedLine.substring(0, 15).trim(); final String name = trimmedLine.substring(15, 30).trim(); // normally it should always be german, but it depends on the wspwin installation final DateFormat dateInstance = SimpleDateFormat.getDateInstance(SimpleDateFormat.SHORT, Locale.GERMAN); final String dateString = trimmedLine.substring(30, 41).trim(); final Date date = dateInstance.parse(dateString); final BigDecimal start = new BigDecimal(trimmedLine.substring(41, 56).trim()); final BigDecimal end = new BigDecimal(trimmedLine.substring(56, 71).trim()); final String fileName = trimmedLine.substring(71).trim(); final ZustandBean zustandBean = new ZustandBean(name, waterName, fileName, start, end, date); zustandBeans.add(zustandBean); } catch (final NumberFormatException e) { e.printStackTrace(); throw new ParseException( Messages.getString("org.kalypso.wspwin.core.WspCfg.3", reader.getLineNumber()), //$NON-NLS-1$ reader.getLineNumber()); } } return Status.OK_STATUS; } catch (final ParseException | IOException e) { return new Status(IStatus.ERROR, KalypsoWspWinCorePlugin.PLUGIN_ID, e.getLocalizedMessage(), e); } }
From source file:hk.idv.kenson.jrconsole.Console.java
/** * /*from www. j a v a 2s . c om*/ * @param localeString * @return */ private static Locale getLocale(String localeString) { if ("default".equals(localeString)) return Locale.getDefault(); if ("canada".equals(localeString)) return Locale.CANADA; if ("canada_french".equals(localeString)) return Locale.CANADA_FRENCH; if ("china".equals(localeString)) return Locale.CHINA; if ("chinese".equals(localeString)) return Locale.CHINESE; if ("english".equals(localeString)) return Locale.ENGLISH; if ("franch".equals(localeString)) return Locale.FRANCE; if ("german".equals(localeString)) return Locale.GERMAN; if ("germany".equals(localeString)) return Locale.GERMANY; if ("italian".equals(localeString)) return Locale.ITALIAN; if ("italy".equals(localeString)) return Locale.ITALY; if ("japan".equals(localeString)) return Locale.JAPAN; if ("japanese".equals(localeString)) return Locale.JAPANESE; if ("korea".equals(localeString)) return Locale.KOREA; if ("korean".equals(localeString)) return Locale.KOREAN; if ("prc".equals(localeString)) return Locale.PRC; if ("simplified_chinese".equals(localeString)) return Locale.SIMPLIFIED_CHINESE; if ("taiwan".equals(localeString)) return Locale.TAIWAN; if ("traditional_chinese".equals(localeString)) return Locale.TRADITIONAL_CHINESE; if ("uk".equals(localeString)) return Locale.UK; if ("us".equals(localeString)) return Locale.US; String parts[] = localeString.split("_", -1); if (parts.length == 1) return new Locale(parts[0]); else if (parts.length == 2) return new Locale(parts[0], parts[1]); else return new Locale(parts[0], parts[1], parts[2]); }