Package org.hoteia.qalingo.core.domain

Examples of org.hoteia.qalingo.core.domain.CustomerAddress


        final CustomerAddressListViewBean customerAddressListViewBean = new CustomerAddressListViewBean();
        customerAddressListViewBean.setBackUrl(urlService.generateUrl(FoUrls.HOME, requestData));
        final Set<CustomerAddress> addresses = customer.getAddresses();
        if(Hibernate.isInitialized(addresses) && addresses != null){
            for (Iterator<CustomerAddress> iterator = addresses.iterator(); iterator.hasNext();) {
                CustomerAddress customerAddress = (CustomerAddress) iterator.next();
                customerAddressListViewBean.getCustomerAddressList().add(buildViewBeanCustomeAddress(requestData, customerAddress));
            }
        }
        return customerAddressListViewBean;
    }
View Full Code Here


    String customerAddressId = request.getParameter(RequestConstants.REQUEST_PARAMETER_CUSTOMER_ADDRESS_GUID);
    if(StringUtils.isEmpty(customerAddressId)){
      customerAddressId = customerAddressForm.getIdOrGuid();
    }
   
    CustomerAddress customerAddress = null;
    try {
      customerAddress = reloadedCustomer.getAddress(new Long(customerAddressId));
     
    } catch (Exception e) {
      logger.error("Error with the address to edit, customerAddressId:" + customerAddressId, e);
View Full Code Here

        customer.setLastname(createAccountForm.getLastname());
        customer.setPassword(securityUtil.encodePassword(createAccountForm.getPassword()));
       
        customer.setEmail(createAccountForm.getEmail());

        CustomerAddress defaultAddress = new CustomerAddress();
        if(StringUtils.isNotEmpty(createAccountForm.getAddressName())){
            defaultAddress.setAddressName(createAccountForm.getAddressName());
        } else {
            defaultAddress.setAddressName(createAccountForm.getAddress1() + "(" + createAccountForm.getCity() + ")");
        }
        defaultAddress.setTitle(createAccountForm.getTitle());
        defaultAddress.setLastname(createAccountForm.getLastname());
        defaultAddress.setFirstname(createAccountForm.getFirstname());
        defaultAddress.setAddress1(createAccountForm.getAddress1());
        defaultAddress.setAddress2(createAccountForm.getAddress2());
        defaultAddress.setAddressAdditionalInformation(createAccountForm.getAddressAdditionalInformation());
        defaultAddress.setPostalCode(createAccountForm.getPostalCode());
        defaultAddress.setCity(createAccountForm.getCity());
        defaultAddress.setStateCode(createAccountForm.getStateCode());
        defaultAddress.setCountryCode(createAccountForm.getCountryCode());
        defaultAddress.setDefaultBilling(true);
        defaultAddress.setDefaultShipping(true);
        Set<CustomerAddress> addresses = new HashSet<CustomerAddress>();
        addresses.add(defaultAddress);
        customer.setAddresses(addresses);
       
        return buildAndSaveNewCustomer(requestData, market, marketArea, customer);
View Full Code Here

    public Customer updateOrSaveAddressCustomer(final RequestData requestData, final Market market, final MarketArea marketArea, final CustomerAddressForm customerAddressForm) throws Exception {
        final HttpServletRequest request = requestData.getRequest();
        String customerLogin = requestUtil.getCurrentCustomerLogin(request);
        Customer customer = customerService.getCustomerByLoginOrEmail(customerLogin);
       
        CustomerAddress customerAddress = new CustomerAddress();
        String addressId = customerAddressForm.getIdOrGuid();
        if(StringUtils.isNotEmpty(addressId)){
            customerAddress = customer.getAddress(new Long(addressId));
        }
       
        if(StringUtils.isNotEmpty(customerAddressForm.getAddressName())){
            customerAddress.setAddressName(customerAddressForm.getAddressName());
        } else {
            customerAddress.setAddressName(customerAddressForm.getAddress1() + "(" + customerAddressForm.getCity() + ")");
        }
        customerAddress.setAddressName(customerAddressForm.getAddressName());
        customerAddress.setTitle(customerAddressForm.getTitle());
        customerAddress.setLastname(customerAddressForm.getLastname());
        customerAddress.setFirstname(customerAddressForm.getFirstname());
        customerAddress.setAddress1(customerAddressForm.getAddress1());
        customerAddress.setAddress2(customerAddressForm.getAddress2());
        customerAddress.setAddressAdditionalInformation(customerAddressForm.getAddressAdditionalInformation());
        customerAddress.setPostalCode(customerAddressForm.getPostalCode());
        customerAddress.setCity(customerAddressForm.getCity());
        customerAddress.setStateCode(customerAddressForm.getStateCode());
        customerAddress.setCountryCode(customerAddressForm.getCountryCode());
        customerAddress.setDefaultBilling(true);
        customerAddress.setDefaultShipping(true);
       
        if(StringUtils.isEmpty(addressId)){
            customer.getAddresses().add(customerAddress);
        }
       
View Full Code Here

   
    public Customer deleteAddressCustomer(final RequestData requestData, final String customerAddressId) throws Exception {
        final HttpServletRequest request = requestData.getRequest();
        String customerLogin = requestUtil.getCurrentCustomerLogin(request);
        Customer customer = customerService.getCustomerByLoginOrEmail(customerLogin);
        CustomerAddress customerAddress = customer.getAddress(new Long(customerAddressId));
       
        // SANITY CHECK : wrong address id for this customer
        if(customerAddress == null){
            throw new Exception("");
        }
       
        Set<CustomerAddress> customerAddresses = customer.getAddresses();
       
        // SANITY CHECK : min address equal zero
        if(customerAddresses.size() < 2){
            throw new Exception("");
        }
       
        for (Iterator<CustomerAddress> iterator = customerAddresses.iterator(); iterator.hasNext();) {
            CustomerAddress customerAddressIterator = (CustomerAddress) iterator.next();
            if(customerAddressIterator.getId().equals(new Long(customerAddressId))){
                customerAddress = customerAddressIterator;
            }
        }
        customer.getAddresses().remove(customerAddress);
       
View Full Code Here

    final CartForm cartForm = new CartForm();
    Customer customer = requestData.getCustomer();
    if(customer != null) {
       Set<CustomerAddress> addresses = customer.getAddresses();
       for (Iterator<CustomerAddress> iterator = addresses.iterator(); iterator.hasNext();) {
        CustomerAddress customerAddress = (CustomerAddress) iterator.next();
        if(customerAddress.isDefaultBilling()) {
          cartForm.setBillingAddressId(customerAddress.getId().toString());
        }
        if(customerAddress.isDefaultShipping()) {
          cartForm.setShippingAddressId(customerAddress.getId().toString());
        }
      }
    }
    return cartForm;
  }
View Full Code Here

        try {
            final RequestData requestData = requestUtil.getRequestData(request);
            final Customer customer = requestData.getCustomer();
            Set<CustomerAddress> addresses = customer.getAddresses();
            for (Iterator<CustomerAddress> iterator = addresses.iterator(); iterator.hasNext();) {
                final CustomerAddress customerAddress = (CustomerAddress) iterator.next();
                addressesValues.add(frontofficeViewBeanFactory.buildViewBeanCustomeAddress(requestData, customerAddress));
            }

            Collections.sort(addressesValues, new Comparator<CustomerAddressViewBean>() {
                @Override
View Full Code Here

        try {
            final RequestData requestData = requestUtil.getRequestData(request);
            final Customer customer = requestData.getCustomer();
            Set<CustomerAddress> addresses = customer.getAddresses();
            for (Iterator<CustomerAddress> iterator = addresses.iterator(); iterator.hasNext();) {
                final CustomerAddress customerAddress = (CustomerAddress) iterator.next();
                addressesValues.add(frontofficeViewBeanFactory.buildViewBeanCustomeAddress(requestData, customerAddress));
            }

            Collections.sort(addressesValues, new Comparator<CustomerAddressViewBean>() {
                @Override
View Full Code Here

TOP

Related Classes of org.hoteia.qalingo.core.domain.CustomerAddress

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.