@GET @Path(PhoneNumber.FORMAT_URL) public String formatUrl(@QueryParam(Parameters.LANGUAGE) final String planguage, @QueryParam(Parameters.COUNTRY) final String pcountry, @QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber) { return phoneNumberUtil.formatUrl(pphoneNumber, pcountry); }
/** * format phone number in URL format. * * @param pphoneNumber phone number to format * @param pcountryCode iso code of country * @return formated phone number as String */ public final String formatUrl(final String pphoneNumber, final String pcountryCode) { return this.formatUrl(this.parsePhoneNumber(pphoneNumber, pcountryCode)); }
/** * format phone number in URL format. * * @param pphoneNumber phone number to format * @param pcountryCode iso code of country * @return formated phone number as String */ public final String formatUrl(final String pphoneNumber, final String pcountryCode) { return this.formatUrl(this.parsePhoneNumber(pphoneNumber, pcountryCode)); }
/** * format phone number in URL format. * * @param pphoneNumber phone number as String to format * @return formated phone number as String */ public final String formatUrl(final String pphoneNumber) { return this.formatUrl(this.parsePhoneNumber(pphoneNumber)); }
@RequestMapping(value = PhoneNumber.FORMAT_URL, method = RequestMethod.GET) @PermitAll public String formatUrl( @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.formatUrl(pphoneNumber, pcountry); }
@RequestMapping(value = PhoneNumber.FORMAT_URL, method = RequestMethod.GET) @PermitAll public String formatUrl( @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.formatUrl(pphoneNumber, pcountry); }
/** * format phone number in URL format. * * @param pphoneNumber phone number as String to format * @return formated phone number as String */ public final String formatUrl(final String pphoneNumber) { return this.formatUrl(this.parsePhoneNumber(pphoneNumber)); }
@Override public String formatValueSynchron(final String pvalue) { final String formatedNumber = phoneNumberUtil.formatUrl(pvalue, StringUtils.upperCase(Objects.toString(countryCodeField.getValue(), null))); if (StringUtils.startsWith(pvalue, formatedNumber)) { return pvalue; } return StringUtils.defaultString(formatedNumber, pvalue); }
/** * test formating phone number in Url format. */ @Test public void testFormatUrl() { Assert.assertNull("Should be null", this.phoneNumberUtil.formatUrl((PhoneNumberData) null)); for (final Entry<PhoneNumberInterface, String> testCase : PhoneNumberUtilTestCases .getFormatUrlCases().entrySet()) { final String formatedNumber = this.phoneNumberUtil.formatUrl(testCase.getKey()); Assert.assertEquals("Formating URL " + testCase.getKey().toString(), testCase.getValue(), formatedNumber); } }
/** * test formating phone number in Url format. */ @Test public void testFormatUrl() { Assert.assertNull("Should be null", this.phoneNumberUtil.formatUrl((PhoneNumberData) null)); for (final Entry<PhoneNumberInterface, String> testCase : PhoneNumberUtilTestCases .getFormatUrlCases().entrySet()) { final String formatedNumber = this.phoneNumberUtil.formatUrl(testCase.getKey()); Assert.assertEquals("Formating URL " + testCase.getKey().toString(), testCase.getValue(), formatedNumber); } }
&& StringUtils.equals(pphoneNumber, phoneNumberUtil.formatUrl(parsedNumber))) { return Boolean.TRUE;
&& StringUtils.equals(pphoneNumber, phoneNumberUtil.formatUrl(parsedNumber))) { return Boolean.TRUE;
&& StringUtils.equals(pphoneNumber, phoneNumberUtil.formatUrl(parsedNumber))) { return Boolean.TRUE;
/** * test formating phone number in URL format with cursor position. */ @Test public void testFormatUrlWithPos() { Assert.assertNull("Should be null", this.phoneNumberUtil.formatUrl((ValueWithPos<String>) null)); for (final Entry<ValueWithPos<String>, ValueWithPos<String>> testCase : PhoneNumberUtilTestCases .getFormatUrlWithPosCases().entrySet()) { final ValueWithPos<String> formatedNumber = this.phoneNumberUtil.formatUrl(testCase.getKey()); Assert.assertEquals("Formating Url " + testCase.getKey().toString(), testCase.getValue(), formatedNumber); } }
/** * test formating phone number in URL format with cursor position. */ @Test public void testFormatUrlWithPos() { Assert.assertNull("Should be null", this.phoneNumberUtil.formatUrl((ValueWithPos<String>) null)); for (final Entry<ValueWithPos<String>, ValueWithPos<String>> testCase : PhoneNumberUtilTestCases .getFormatUrlWithPosCases().entrySet()) { final ValueWithPos<String> formatedNumber = this.phoneNumberUtil.formatUrl(testCase.getKey()); Assert.assertEquals("Formating Url " + testCase.getKey().toString(), testCase.getValue(), formatedNumber); } }
&& StringUtils.equals(phoneNumber, this.phoneNumberUtil.formatUrl(parsedNumber))) { return true;
&& StringUtils.equals(phoneNumber, this.phoneNumberUtil.formatUrl(parsedNumber))) { return true;
/** * 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; }