@GET @Path(PhoneNumber.FORMAT_E123_INTERNATIONAL) public String formatE123International(@QueryParam(Parameters.LANGUAGE) final String planguage, @QueryParam(Parameters.COUNTRY) final String pcountry, @QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber) { return phoneNumberUtil.formatE123International(pphoneNumber, pcountry); }
@RequestMapping(value = PhoneNumber.FORMAT_E123_INTERNATIONAL, method = RequestMethod.GET) @PermitAll public String formatE123International( @RequestParam(value = Parameters.LANGUAGE, required = true) final String planguage, @RequestParam(value = Parameters.COUNTRY, required = true) final String pcountry, @RequestParam(value = Parameters.PHONE_NUMBER, required = true) final String pphoneNumber) { return phoneNumberUtil.formatE123International(pphoneNumber, pcountry); }
/** * format phone number in E123 international format. * * @param pphoneNumber phone number as String to format * @return formated phone number as String */ public final String formatE123International(final String pphoneNumber) { return this.formatE123International(this.parsePhoneNumber(pphoneNumber)); }
/** * format phone number in E123 international format. * * @param pphoneNumber phone number to format * @param pcountryCode iso code of country * @return formated phone number as String */ public final String formatE123International(final String pphoneNumber, final String pcountryCode) { return this.formatE123International(this.parsePhoneNumber(pphoneNumber, pcountryCode)); }
@RequestMapping(value = PhoneNumber.FORMAT_E123_INTERNATIONAL, method = RequestMethod.GET) @PermitAll public String formatE123International( @RequestParam(value = Parameters.LANGUAGE, required = true) final String planguage, @RequestParam(value = Parameters.COUNTRY, required = true) final String pcountry, @RequestParam(value = Parameters.PHONE_NUMBER, required = true) final String pphoneNumber) { return phoneNumberUtil.formatE123International(pphoneNumber, pcountry); }
/** * format phone number in E123 international format. * * @param pphoneNumber phone number as String to format * @return formated phone number as String */ public final String formatE123International(final String pphoneNumber) { return this.formatE123International(this.parsePhoneNumber(pphoneNumber)); }
/** * format phone number in E123 international format. * * @param pphoneNumber phone number to format * @param pcountryCode iso code of country * @return formated phone number as String */ public final String formatE123International(final String pphoneNumber, final String pcountryCode) { return this.formatE123International(this.parsePhoneNumber(pphoneNumber, pcountryCode)); }
@Override public String formatValueSynchron(final String pvalue) { final String formatedNumber = phoneNumberUtil.formatE123International(pvalue, StringUtils.upperCase(Objects.toString(countryCodeField.getValue(), null))); if (StringUtils.startsWith(pvalue, formatedNumber)) { return pvalue; } return StringUtils.defaultString(formatedNumber, pvalue); }
/** * format phone number in E123 format. * * @param pphoneNumberData phone number to format * @param pcountryData country data * @return formated phone number as String */ public final String formatE123(final PhoneNumberInterface pphoneNumberData, final PhoneCountryData pcountryData) { if (pphoneNumberData != null && pcountryData != null && StringUtils.equals( pcountryData.getCountryCodeData().getCountryCode(), pphoneNumberData.getCountryCode())) { return this.formatE123National(pphoneNumberData); } else { return this.formatE123International(pphoneNumberData); } }
/** * format phone number in E123 format. * * @param pphoneNumberData phone number to format * @param pcountryData country data * @return formated phone number as String */ public final String formatE123(final PhoneNumberInterface pphoneNumberData, final PhoneCountryData pcountryData) { if (pphoneNumberData != null && pcountryData != null && StringUtils.equals( pcountryData.getCountryCodeData().getCountryCode(), pphoneNumberData.getCountryCode())) { return this.formatE123National(pphoneNumberData); } else { return this.formatE123International(pphoneNumberData); } }
return this.formatE123International(pphoneNumberData);
return this.formatE123International(pphoneNumberData);
/** * test formating phone number in E123 international format. */ @Test public void testFormatE123International() { Assert.assertNull("Should be null", this.phoneNumberUtil.formatE123International((PhoneNumberData) null)); for (final Entry<PhoneNumberInterface, String> testCase : PhoneNumberUtilTestCases .getFormatE123InternationalCases().entrySet()) { final String formatedNumber = this.phoneNumberUtil.formatE123International(testCase.getKey()); Assert.assertEquals("Formating E123 international " + testCase.getKey().toString(), testCase.getValue(), formatedNumber); } }
/** * test formating phone number in E123 international format. */ @Test public void testFormatE123International() { Assert.assertNull("Should be null", this.phoneNumberUtil.formatE123International((PhoneNumberData) null)); for (final Entry<PhoneNumberInterface, String> testCase : PhoneNumberUtilTestCases .getFormatE123InternationalCases().entrySet()) { final String formatedNumber = this.phoneNumberUtil.formatE123International(testCase.getKey()); Assert.assertEquals("Formating E123 international " + testCase.getKey().toString(), testCase.getValue(), formatedNumber); } }
&& (StringUtils.equals(pphoneNumber, phoneNumberUtil.formatE123National(parsedNumber)) || StringUtils.equals(pphoneNumber, phoneNumberUtil.formatE123International(parsedNumber)))) { return Boolean.TRUE;
/** * test formating phone number in E123 international format with cursor position. */ @Test public void testFormatE123InternationalWithPos() { Assert.assertNull("Should be null", this.phoneNumberUtil.formatE123International((ValueWithPos<String>) null)); for (final Entry<ValueWithPos<String>, ValueWithPos<String>> testCase : PhoneNumberUtilTestCases .getFormatE123InternationalpCases().entrySet()) { final ValueWithPos<String> formatedNumber = this.phoneNumberUtil.formatE123International(testCase.getKey()); Assert.assertEquals("Formating E123 international " + testCase.getKey().toString(), testCase.getValue(), formatedNumber); } }
/** * test formating phone number in E123 international format with cursor position. */ @Test public void testFormatE123InternationalWithPos() { Assert.assertNull("Should be null", this.phoneNumberUtil.formatE123International((ValueWithPos<String>) null)); for (final Entry<ValueWithPos<String>, ValueWithPos<String>> testCase : PhoneNumberUtilTestCases .getFormatE123InternationalpCases().entrySet()) { final ValueWithPos<String> formatedNumber = this.phoneNumberUtil.formatE123International(testCase.getKey()); Assert.assertEquals("Formating E123 international " + testCase.getKey().toString(), testCase.getValue(), formatedNumber); } }
/** * parse and reformat the phone number in all available formats. * * @param planguage language to use * @param pcountry default country * @param pphoneNumber phone number to format * @return PhoneNumberDataWithFormats */ @GET @Path(PhoneNumber.PARSE_AND_FORMAT) public PhoneNumberDataWithFormats parseAndFormatPhoneNumber( @QueryParam(Parameters.LANGUAGE) final String planguage, @QueryParam(Parameters.COUNTRY) final String pcountry, @QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber) { final PhoneNumberDataWithFormats result = new PhoneNumberDataWithFormats(phoneNumberUtil .parsePhoneNumber(pphoneNumber, pcountry, LocaleUtil.convertLanguageToLocale(planguage))); result.setCommonInternational(phoneNumberUtil.formatCommonInternational(result)); result.setCommonNational(phoneNumberUtil.formatCommonNational(result)); result.setDin5008International(phoneNumberUtil.formatDin5008International(result)); result.setDin5008National(phoneNumberUtil.formatDin5008National(result)); result.setE123International(phoneNumberUtil.formatE123International(result)); result.setE123National(phoneNumberUtil.formatE123National(result)); result.setMs(phoneNumberUtil.formatMs(result)); result.setUrl(phoneNumberUtil.formatUrl(result)); return result; }
/** * parse and reformat the phone number in all available formats. * * @param planguage language to use * @param pcountry default country * @param pphoneNumber phone number to format * @return PhoneNumberDataWithFormats */ @RequestMapping(value = PhoneNumber.PARSE_AND_FORMAT, method = RequestMethod.GET) @PermitAll public PhoneNumberDataWithFormats parseAndFormatPhoneNumber( @RequestParam(value = Parameters.LANGUAGE, required = true) final String planguage, @RequestParam(value = Parameters.COUNTRY, required = true) final String pcountry, @RequestParam(value = Parameters.PHONE_NUMBER, required = true) final String pphoneNumber) { final PhoneNumberDataWithFormats result = new PhoneNumberDataWithFormats(phoneNumberUtil .parsePhoneNumber(pphoneNumber, pcountry, LocaleUtil.convertLanguageToLocale(planguage))); result.setCommonInternational(phoneNumberUtil.formatCommonInternational(result)); result.setCommonNational(phoneNumberUtil.formatCommonNational(result)); result.setDin5008International(phoneNumberUtil.formatDin5008International(result)); result.setDin5008National(phoneNumberUtil.formatDin5008National(result)); result.setE123International(phoneNumberUtil.formatE123International(result)); result.setE123National(phoneNumberUtil.formatE123National(result)); result.setMs(phoneNumberUtil.formatMs(result)); result.setUrl(phoneNumberUtil.formatUrl(result)); return result; }
/** * parse and reformat the phone number in all available formats. * * @param planguage language to use * @param pcountry default country * @param pphoneNumber phone number to format * @return PhoneNumberDataWithFormats */ @RequestMapping(value = PhoneNumber.PARSE_AND_FORMAT, method = RequestMethod.GET) @PermitAll public PhoneNumberDataWithFormats parseAndFormatPhoneNumber( @RequestParam(value = Parameters.LANGUAGE, required = true) final String planguage, @RequestParam(value = Parameters.COUNTRY, required = true) final String pcountry, @RequestParam(value = Parameters.PHONE_NUMBER, required = true) final String pphoneNumber) { final PhoneNumberDataWithFormats result = new PhoneNumberDataWithFormats(phoneNumberUtil .parsePhoneNumber(pphoneNumber, pcountry, LocaleUtil.convertLanguageToLocale(planguage))); result.setCommonInternational(phoneNumberUtil.formatCommonInternational(result)); result.setCommonNational(phoneNumberUtil.formatCommonNational(result)); result.setDin5008International(phoneNumberUtil.formatDin5008International(result)); result.setDin5008National(phoneNumberUtil.formatDin5008National(result)); result.setE123International(phoneNumberUtil.formatE123International(result)); result.setE123National(phoneNumberUtil.formatE123National(result)); result.setMs(phoneNumberUtil.formatMs(result)); result.setUrl(phoneNumberUtil.formatUrl(result)); return result; }