@Override public Phone getPhoneSecondary() { Phone legacyPhone = new PhoneImpl(); legacyPhone.setPhoneNumber(this.secondaryPhone); return (phoneSecondary == null && this.secondaryPhone !=null)? legacyPhone : phoneSecondary; }
@Override public Phone getPhoneFax() { Phone legacyPhone = new PhoneImpl(); legacyPhone.setPhoneNumber(this.fax); return (phoneFax == null && this.fax != null)? legacyPhone : phoneFax; }
@Override public Phone getPhonePrimary() { Phone legacyPhone = new PhoneImpl(); legacyPhone.setPhoneNumber(this.primaryPhone); return (phonePrimary == null && this.primaryPhone !=null)? legacyPhone : phonePrimary; }
@Override public void setAsText(String text) { Phone phone = new PhoneImpl(); phone.setPhoneNumber(text); setValue(phone); }
@Override public void setAsText(String text) { Phone phone = new PhoneImpl(); phone.setPhoneNumber(text); setValue(phone); }
@Override public void setAsText(String text) { Phone phone = new PhoneImpl(); phone.setPhoneNumber(text); setValue(phone); }
public void formatPhoneNumber(Phone phone) { if(phone != null && !StringUtils.isEmpty(phone.getPhoneNumber())){ phone.setPhoneNumber(formatTelephoneNumber(phone.getPhoneNumber())); } }
@DataProvider(name = "setupPhone") public static Object[][] createPhone() { Phone phone = new PhoneImpl(); phone.setPhoneNumber("999-999-9999"); return new Object[][] { new Object[] { phone } }; } }
@Override public Phone copyPhone(Phone dest, Phone orig) { if (dest == null) { dest = create(); } if (orig != null) { dest.setPhoneNumber(orig.getPhoneNumber()); dest.setCountryCode(orig.getCountryCode()); dest.setExtension(orig.getExtension()); return dest; } return null; }
@DataProvider(name = "setupCustomerPhone") public static Object[][] createCustomerPhone() { CustomerPhone cp1 = new CustomerPhoneImpl(); Phone phone1 = new PhoneImpl(); phone1.setPhoneNumber("111-111-1111"); cp1.setPhone(phone1); cp1.setPhoneName("phone1"); CustomerPhone cp2 = new CustomerPhoneImpl(); Phone phone2 = new PhoneImpl(); phone1.setPhoneNumber("222-222-2222"); cp2.setPhone(phone2); cp2.setPhoneName("phone2"); return new Object[][] { new Object[] { cp1 }, new Object[] { cp2 } }; } }
@DataProvider(name = "setupCustomerPhoneControllerData") public static Object[][] createCustomerPhone() { PhoneNameForm pnf1 = new PhoneNameForm(); Phone phone1 = new PhoneImpl(); phone1.setPhoneNumber("111-222-3333"); pnf1.setPhone(phone1); pnf1.setPhoneName("phone_1"); PhoneNameForm pnf2 = new PhoneNameForm(); Phone phone2 = new PhoneImpl(); phone2.setPhoneNumber("222-333-4444"); pnf2.setPhone(phone2); pnf2.setPhoneName("phone_2"); return new Object[][] { new Object[] { pnf1 }, new Object[] { pnf2 } }; } }
@Test(groups = "createCustomerPhone", dataProvider = "setupCustomerPhone", dataProviderClass = CustomerPhoneDataProvider.class, dependsOnGroups = "readCustomer") @Transactional @Rollback(false) public void createCustomerPhone(CustomerPhone customerPhone) { userName = "customer1"; Customer customer = customerService.readCustomerByUsername(userName); assert customerPhone.getId() == null; customerPhone.setCustomer(customer); Phone phone = new PhoneImpl(); phone.setPhoneNumber("214-214-2134"); customerPhone.setPhone(phone); customerPhone = customerPhoneService.saveCustomerPhone(customerPhone); assert customer.equals(customerPhone.getCustomer()); userId = customerPhone.getCustomer().getId(); }
billingPhone.setPhoneNumber(dto.getAddressPhone()); address.setPhonePrimary(billingPhone);
primary.setPhoneNumber("972-976-1234"); address1.setPhonePrimary(primary); primary2.setPhoneNumber("972-976-1234"); address2.setPhonePrimary(primary2);
primary.setPhoneNumber("972-976-1234"); address1.setPhonePrimary(primary); primary2.setPhoneNumber("972-976-1234"); address2.setPhonePrimary(primary2);
@Override public Phone parseObject(String source, ParsePosition pos) { Pattern pattern = Pattern.compile("^(?:\\+([0-9]{1,3}))?\\.?([0-9]{4,14})x?(.+)?$"); Matcher matcher = pattern.matcher(source); if (matcher.find(pos.getIndex())) { Phone phone = new PhoneImpl(); phone.setCountryCode(matcher.group(1)); phone.setPhoneNumber(matcher.group(2)); phone.setExtension(matcher.group(3)); pos.setIndex(matcher.end()); return phone; } else { return null; } }
public void formatPhoneNumber(Phone phone) { if(phone != null && !StringUtils.isEmpty(phone.getPhoneNumber())){ phone.setPhoneNumber(formatTelephoneNumber(phone.getPhoneNumber())); } }