Search in sources :

Example 1 with UserAlreadyExistException

use of com.salesmanager.shop.model.customer.UserAlreadyExistException in project shopizer by shopizer-ecommerce.

the class CustomerFacadeImpl method registerCustomer.

@Override
public PersistableCustomer registerCustomer(final PersistableCustomer customer, final MerchantStore merchantStore, Language language) throws Exception {
    LOG.info("Starting customer registration process..");
    if (userExist(customer.getUserName())) {
        throw new UserAlreadyExistException("User already exist");
    }
    Customer customerModel = getCustomerModel(customer, merchantStore, language);
    if (customerModel == null) {
        LOG.equals("Unable to create customer in system");
        // throw new CustomerRegistrationException( "Unable to register customer" );
        throw new Exception("Unable to register customer");
    }
    LOG.info("About to persist customer to database.");
    customerService.saveOrUpdate(customerModel);
    LOG.info("Returning customer data to controller..");
    // return customerEntityPoulator(customerModel,merchantStore);
    customer.setId(customerModel.getId());
    return customer;
}
Also used : UserAlreadyExistException(com.salesmanager.shop.model.customer.UserAlreadyExistException) ReadableCustomer(com.salesmanager.shop.model.customer.ReadableCustomer) Customer(com.salesmanager.core.model.customer.Customer) PersistableCustomer(com.salesmanager.shop.model.customer.PersistableCustomer) ServiceException(com.salesmanager.core.business.exception.ServiceException) UserAlreadyExistException(com.salesmanager.shop.model.customer.UserAlreadyExistException) ServiceRuntimeException(com.salesmanager.shop.store.api.exception.ServiceRuntimeException) ConversionRuntimeException(com.salesmanager.shop.store.api.exception.ConversionRuntimeException) ResourceNotFoundException(com.salesmanager.shop.store.api.exception.ResourceNotFoundException) ConversionException(com.salesmanager.core.business.exception.ConversionException)

Aggregations

ConversionException (com.salesmanager.core.business.exception.ConversionException)1 ServiceException (com.salesmanager.core.business.exception.ServiceException)1 Customer (com.salesmanager.core.model.customer.Customer)1 PersistableCustomer (com.salesmanager.shop.model.customer.PersistableCustomer)1 ReadableCustomer (com.salesmanager.shop.model.customer.ReadableCustomer)1 UserAlreadyExistException (com.salesmanager.shop.model.customer.UserAlreadyExistException)1 ConversionRuntimeException (com.salesmanager.shop.store.api.exception.ConversionRuntimeException)1 ResourceNotFoundException (com.salesmanager.shop.store.api.exception.ResourceNotFoundException)1 ServiceRuntimeException (com.salesmanager.shop.store.api.exception.ServiceRuntimeException)1