use of org.broadleafcommerce.profile.core.domain.PhoneImpl in project BroadleafCommerce by BroadleafCommerce.
the class CustomerPhoneControllerTestDataProvider method createCustomerPhone.
@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 } };
}
use of org.broadleafcommerce.profile.core.domain.PhoneImpl in project BroadleafCommerce by BroadleafCommerce.
the class CustomerPhoneDataProvider method createCustomerPhone.
@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 } };
}
use of org.broadleafcommerce.profile.core.domain.PhoneImpl in project BroadleafCommerce by BroadleafCommerce.
the class InitBinderServiceImpl method configAddressInitBinder.
@Override
public void configAddressInitBinder(ServletRequestDataBinder binder) {
/**
* @deprecated - address.setState() is deprecated in favor of ISO standardization
* This is here for legacy compatibility
*/
binder.registerCustomEditor(State.class, "address.state", new PropertyEditorSupport() {
@Override
public void setAsText(String text) {
if (StringUtils.isNotEmpty(text)) {
State state = stateService.findStateByAbbreviation(text);
setValue(state);
} else {
setValue(null);
}
}
});
/**
* @deprecated - address.setCountry() is deprecated in favor of ISO standardization
* This is here for legacy compatibility
*/
binder.registerCustomEditor(Country.class, "address.country", new PropertyEditorSupport() {
@Override
public void setAsText(String text) {
if (StringUtils.isNotEmpty(text)) {
Country country = countryService.findCountryByAbbreviation(text);
setValue(country);
} else {
setValue(null);
}
}
});
binder.registerCustomEditor(ISOCountry.class, "address.isoCountryAlpha2", new PropertyEditorSupport() {
@Override
public void setAsText(String text) {
if (StringUtils.isNotEmpty(text)) {
ISOCountry isoCountry = isoService.findISOCountryByAlpha2Code(text);
setValue(isoCountry);
} else {
setValue(null);
}
}
});
binder.registerCustomEditor(Phone.class, "address.phonePrimary", new PropertyEditorSupport() {
@Override
public void setAsText(String text) {
Phone phone = new PhoneImpl();
phone.setPhoneNumber(text);
setValue(phone);
}
});
binder.registerCustomEditor(Phone.class, "address.phoneSecondary", new PropertyEditorSupport() {
@Override
public void setAsText(String text) {
Phone phone = new PhoneImpl();
phone.setPhoneNumber(text);
setValue(phone);
}
});
binder.registerCustomEditor(Phone.class, "address.phoneFax", new PropertyEditorSupport() {
@Override
public void setAsText(String text) {
Phone phone = new PhoneImpl();
phone.setPhoneNumber(text);
setValue(phone);
}
});
}
use of org.broadleafcommerce.profile.core.domain.PhoneImpl in project BroadleafCommerce by BroadleafCommerce.
the class PhoneDataProvider method createPhone.
@DataProvider(name = "setupPhone")
public static Object[][] createPhone() {
Phone phone = new PhoneImpl();
phone.setPhoneNumber("999-999-9999");
return new Object[][] { new Object[] { phone } };
}
use of org.broadleafcommerce.profile.core.domain.PhoneImpl in project BroadleafCommerce by BroadleafCommerce.
the class CustomerPhoneTest method createCustomerPhone.
@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();
}
Aggregations