Examples of CustomerAddress


Examples of com.jada.jpa.entity.CustomerAddress

        Vector<CustomerDisplayForm> vector = new Vector<CustomerDisplayForm>();
        int startRecord = (form.getPageNo() - 1) * adminBean.getListingPageSize();
        int endRecord = startRecord + adminBean.getListingPageSize();
        for (int i = startRecord; i < list.size() && i < endRecord; i++) {
          Customer customer = (Customer) list.get(i);
          CustomerAddress customerAddress = null;
          for (CustomerAddress address : customer.getCustAddresses()) {
            if (address.getCustAddressType().equals(Constants.CUSTOMER_ADDRESS_CUST)) {
              customerAddress = address;
              break;
            }
          }
          CustomerDisplayForm customerDisplay = new CustomerDisplayForm();
          customerDisplay.setSiteName(customer.getSiteDomain().getSiteDomainLanguage().getSiteName());
          customerDisplay.setCustId(Format.getLong(customer.getCustId()));
          customerDisplay.setCustEmail(customer.getCustEmail());
          customerDisplay.setCustFirstName(customerAddress.getCustFirstName());
          customerDisplay.setCustLastName(customerAddress.getCustLastName());
          customerDisplay.setActive(String.valueOf(customer.getActive()));
            vector.add(customerDisplay);
        }
        CustomerDisplayForm customers[] = new CustomerDisplayForm[vector.size()];
        vector.copyInto(customers);
View Full Code Here

Examples of com.jada.jpa.entity.CustomerAddress

    form.setPasswordEmpty(false);
    if (Format.isNullOrEmpty(customer.getCustPassword())) {
      form.setPasswordEmpty(true);
    }
   
    CustomerAddress billingAddress = shoppingCart.getBillingAddress();
    CustomerAddress shippingAddress = shoppingCart.getShippingAddress();

    form.setCustId(Format.getLong(customer.getCustId()));
    form.setNewUser(false);
    if (request.getParameter("new") != null  && request.getParameter("new").equals(String.valueOf(Constants.VALUE_YES))) {
      form.setNewUser(true);
    }
    form.setCustEmail(customer.getCustEmail());
   
    CustomerAddress custAddress = shoppingCart.getCustAddress();
    if (custAddress != null) {
      form.setCustFirstName(custAddress.getCustFirstName());
      form.setCustMiddleName(custAddress.getCustMiddleName());
      form.setCustLastName(custAddress.getCustLastName());
      form.setCustAddressLine1(custAddress.getCustAddressLine1());
      form.setCustAddressLine2(custAddress.getCustAddressLine2());
      form.setCustCityName(custAddress.getCustCityName());
      form.setCustStateCode(custAddress.getCustStateCode());
      form.setCustStateName(custAddress.getCustStateName());
      form.setCustCountryCode(custAddress.getCustCountryCode());
      form.setCustCountryName(custAddress.getCustCountryName());
      form.setCustZipCode(custAddress.getCustZipCode());
      form.setCustPhoneNum(custAddress.getCustPhoneNum());
      form.setCustFaxNum(custAddress.getCustFaxNum());
      if (!Format.isNullOrEmpty(custAddress.getCustStateCode())) {
        form.setCustStateName(Utility.getStateName(site.getSiteId(), custAddress.getCustStateCode()));
      }
      else {
        form.setCustStateName(custAddress.getCustStateName());
      }
      if (!Format.isNullOrEmpty(custAddress.getCustCountryCode())) {
        form.setCustCountryName(Utility.getCountryName(site.getSiteId(), custAddress.getCustCountryCode()));
      }
    }

    if (billingAddress != null) {
      form.setBillingCustAddressId(Format.getLong(billingAddress.getCustAddressId()));
View Full Code Here

Examples of com.jada.jpa.entity.CustomerAddress

    Customer customer = CustomerDAO.load(site.getSiteId(), Format.getLong(form.getCustId()));
    customer.setRecUpdateBy(Constants.USERNAME_SYSTEM);
    customer.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    // em.update(customer);
   
    CustomerAddress shippingAddress = null;
    CustomerAddress billingAddress = null;
    CustomerAddress custAddress = customer.getCustAddress();
    Iterator<?> iterator = customer.getCustAddresses().iterator();
    while (iterator.hasNext()) {
      CustomerAddress address = (CustomerAddress) iterator.next();
      if (address.getCustAddressType().equals(Constants.CUSTOMER_ADDRESS_BILLING)) {
        billingAddress = address;
      }
      if (address.getCustAddressType().equals(Constants.CUSTOMER_ADDRESS_SHIPPING)) {
        shippingAddress = address;
      }
    }
   
    if (custAddress == null) {
      custAddress = new CustomerAddress();
      customer.setCustAddress(custAddress);
      custAddress.setCustAddressType(Constants.CUSTOMER_ADDRESS_CUST);
      customer.getCustAddresses().add(custAddress);
      custAddress.setRecCreateBy(Constants.USERNAME_SYSTEM);
      custAddress.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    custAddress.setCustUseAddress(Constants.CUST_ADDRESS_USE_OWN);
    custAddress.setCustUseAddress(Constants.CUST_ADDRESS_USE_OWN);
    custAddress.setCustFirstName(form.getCustFirstName());
    custAddress.setCustMiddleName(form.getCustMiddleName());
    custAddress.setCustLastName(form.getCustLastName());
    custAddress.setCustSuffix(form.getCustSuffix());
    custAddress.setCustAddressLine1(form.getCustAddressLine1());
    custAddress.setCustAddressLine2(form.getCustAddressLine2());
    custAddress.setCustCityName(form.getCustCityName());
    if (!Format.isNullOrEmpty(form.getCustStateCode())) {
      custAddress.setCustStateCode(form.getCustStateCode());
      custAddress.setCustStateName(Utility.getStateName(site.getSiteId(), form.getCustStateCode()));
    }
    else {
      custAddress.setCustStateCode("");
      custAddress.setCustStateName(form.getCustStateName());
    }
    custAddress.setCustCountryCode(form.getCustCountryCode());
    custAddress.setCustCountryName(Utility.getCountryName(site.getSiteId(), form.getCustCountryCode()));
    custAddress.setCustZipCode(form.getCustZipCode());
    custAddress.setCustPhoneNum(form.getCustPhoneNum());
    custAddress.setCustFaxNum(form.getCustFaxNum());
    custAddress.setRecUpdateBy(Constants.USERNAME_SYSTEM);
    custAddress.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    custAddress.setState(StateDAO.loadByStateCode(site.getSiteId(), form.getCustStateCode()));
    custAddress.setCountry(CountryDAO.loadByCountryCode(site.getSiteId(), form.getCustCountryCode()));
    custAddress.setRecCreateBy(Constants.USERNAME_SYSTEM);
    custAddress.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    if (custAddress.getCustAddressId() == null) {
      em.persist(custAddress);
    }
    shoppingCart.setCustAddress(custAddress);
   
    if (billingAddress == null) {
      billingAddress = new CustomerAddress();
      billingAddress.setCustAddressType(Constants.CUSTOMER_ADDRESS_BILLING);
      customer.getCustAddresses().add(billingAddress);
      billingAddress.setRecCreateBy(Constants.USERNAME_SYSTEM);
      billingAddress.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    billingAddress.setCustUseAddress(form.getBillingUseAddress());
    if (form.billingUseAddress.equals(Constants.CUST_ADDRESS_USE_OWN)) {
      billingAddress.setCustUseAddress(Constants.CUST_ADDRESS_USE_OWN);
      billingAddress.setCustPrefix(form.getBillingCustPrefix());
      billingAddress.setCustFirstName(form.getBillingCustFirstName());
      billingAddress.setCustMiddleName(form.getBillingCustMiddleName());
      billingAddress.setCustLastName(form.getBillingCustLastName());
      billingAddress.setCustSuffix(form.getBillingCustSuffix());
      billingAddress.setCustAddressLine1(form.getBillingCustAddressLine1());
      billingAddress.setCustAddressLine2(form.getBillingCustAddressLine2());
      billingAddress.setCustCityName(form.getBillingCustCityName());
      if (!Format.isNullOrEmpty(form.getBillingCustStateCode())) {
        billingAddress.setCustStateCode(form.getBillingCustStateCode());
        billingAddress.setCustStateName(Utility.getStateName(site.getSiteId(), form.getBillingCustStateCode()));
      }
      else {
        billingAddress.setCustStateCode("");
        billingAddress.setCustStateName(form.getBillingCustStateName());
      }
      billingAddress.setCustCountryCode(form.getBillingCustCountryCode());
      billingAddress.setCustCountryName(Utility.getCountryName(site.getSiteId(), form.getBillingCustCountryCode()));
      billingAddress.setCustZipCode(form.getBillingCustZipCode());
      billingAddress.setCustPhoneNum(form.getBillingCustPhoneNum());
      billingAddress.setCustFaxNum(form.getBillingCustFaxNum());
      billingAddress.setState(StateDAO.loadByStateCode(site.getSiteId(), form.getBillingCustStateCode()));
      billingAddress.setCountry(CountryDAO.loadByCountryCode(site.getSiteId(), form.getBillingCustCountryCode()));
    }
    billingAddress.setRecUpdateBy(Constants.USERNAME_SYSTEM);
    billingAddress.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    if (billingAddress.getCustAddressId() == null) {
      em.persist(billingAddress);
    }
    shoppingCart.setBillingAddress(billingAddress);
   
    if (shippingAddress == null) {
      shippingAddress = new CustomerAddress();
      shippingAddress.setCustAddressType(Constants.CUSTOMER_ADDRESS_SHIPPING);
      customer.getCustAddresses().add(shippingAddress);
      shippingAddress.setRecCreateBy(Constants.USERNAME_SYSTEM);
      shippingAddress.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    shippingAddress.setCustUseAddress(form.getShippingUseAddress());
    if (form.shippingUseAddress.equals(Constants.CUST_ADDRESS_USE_OWN)) {
      if (shippingAddress == null) {
        shippingAddress = new CustomerAddress();
        customer.getCustAddresses().add(shippingAddress);
        shippingAddress.setCustUseAddress(form.getShippingUseAddress());
        shippingAddress.setRecCreateBy(Constants.USERNAME_SYSTEM);
        shippingAddress.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      }
View Full Code Here

Examples of com.jada.jpa.entity.CustomerAddress

  String custZipCode;
  String custPhoneNum;
  String custFaxNum;
  public static CustomerAddress load(String siteId, Long custAddressId) throws SecurityException, Exception {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    CustomerAddress customeraddress = (CustomerAddress) em.find(CustomerAddress.class, custAddressId);
/*
    if (!customeraddress.getgetSiteId().equals(siteId)) {
      throw new SecurityException();
    }
*/
 
View Full Code Here

Examples of com.jada.jpa.entity.CustomerAddress

      else {
        custAddress = new OrderAddress();
        custAddress.setRecCreateBy(Constants.USERNAME_SYSTEM);
        custAddress.setRecCreateDatetime(new Date());
      }
      CustomerAddress adddress = customer.getCustAddress();
      custAddress.setCustUseAddress(Constants.CUST_ADDRESS_USE_OWN);
      custAddress.setCustPrefix(adddress.getCustPrefix());
      custAddress.setCustFirstName(adddress.getCustFirstName());
      custAddress.setCustMiddleName(adddress.getCustMiddleName());
      custAddress.setCustLastName(adddress.getCustLastName());
      custAddress.setCustSuffix(adddress.getCustSuffix());
      custAddress.setCustAddressLine1(adddress.getCustAddressLine1());
      custAddress.setCustAddressLine2(adddress.getCustAddressLine2());
      custAddress.setCustCityName(adddress.getCustCityName());
      custAddress.setCustStateName(adddress.getCustStateName());
      custAddress.setCustStateCode(adddress.getCustStateCode());
      custAddress.setCustCountryName(adddress.getCustCountryName());
      custAddress.setCustCountryCode(adddress.getCustCountryCode());
      custAddress.setCustStateName(adddress.getCustStateName());
      custAddress.setCustZipCode(adddress.getCustZipCode());
      custAddress.setCustPhoneNum(adddress.getCustPhoneNum());
      custAddress.setCustFaxNum(adddress.getCustFaxNum());
      custAddress.setRecUpdateBy(Constants.USERNAME_SYSTEM);
      custAddress.setRecUpdateDatetime(new Date());
      Country country = CountryDAO.loadByCountryCode(siteId, adddress.getCustCountryCode());
      custAddress.setCountry(country);
      if (adddress.getCustStateCode() != null) {
        State state = StateDAO.loadByStateCode(siteId, adddress.getCustStateCode());
        custAddress.setState(state);
      }
      em.persist(custAddress);
      orderHeader.setCustAddress(custAddress);
    }
   
    CustomerAddress billingAddress = shoppingCart.getBillingAddress();
    if (billingAddress != null) {
      OrderAddress address = null;
      if (orderHeader.getBillingAddress() != null) {
        address = orderHeader.getBillingAddress();
      }
      else {
        address = new OrderAddress();
        address.setRecCreateBy(Constants.USERNAME_SYSTEM);
        address.setRecCreateDatetime(new Date());
      }
      address.setCustUseAddress(billingAddress.getCustUseAddress());
      address.setCustPrefix(billingAddress.getCustPrefix());
      address.setCustFirstName(billingAddress.getCustFirstName());
      address.setCustMiddleName(billingAddress.getCustMiddleName());
      address.setCustLastName(billingAddress.getCustLastName());
      address.setCustSuffix(billingAddress.getCustSuffix());
      address.setCustAddressLine1(billingAddress.getCustAddressLine1());
      address.setCustAddressLine2(billingAddress.getCustAddressLine2());
      address.setCustCityName(billingAddress.getCustCityName());
      address.setCustStateName(billingAddress.getCustStateName());
      address.setCustStateCode(billingAddress.getCustStateCode());
      address.setCustCountryName(billingAddress.getCustCountryName());
      address.setCustCountryCode(billingAddress.getCustCountryCode());
      address.setCustStateName(billingAddress.getCustStateName());
      address.setCustZipCode(billingAddress.getCustZipCode());
      address.setCustPhoneNum(billingAddress.getCustPhoneNum());
      address.setCustFaxNum(billingAddress.getCustFaxNum());
      address.setRecUpdateBy(Constants.USERNAME_SYSTEM);
      address.setRecUpdateDatetime(new Date());
      Country country = CountryDAO.loadByCountryCode(siteId, billingAddress.getCustCountryCode());
      address.setCountry(country);
      if (billingAddress.getCustStateCode() != null) {
        State state = StateDAO.loadByStateCode(siteId, billingAddress.getCustStateCode());
        address.setState(state);
      }
      em.persist(address);
      orderHeader.setBillingAddress(address);
    }
    CustomerAddress shippingAddress = shoppingCart.getShippingAddress();
    if (shippingAddress != null) {
      OrderAddress address = null;
      if (orderHeader.getShippingAddress() != null) {
        address = orderHeader.getShippingAddress();
      }
      else {
        address = new OrderAddress();
        address.setRecCreateBy(Constants.USERNAME_SYSTEM);
        address.setRecCreateDatetime(new Date());
      }
      address.setCustUseAddress(shippingAddress.getCustUseAddress());
      address.setCustPrefix(shippingAddress.getCustPrefix());
      address.setCustFirstName(shippingAddress.getCustFirstName());
      address.setCustMiddleName(shippingAddress.getCustMiddleName());
      address.setCustLastName(shippingAddress.getCustLastName());
      address.setCustSuffix(shippingAddress.getCustSuffix());
      address.setCustAddressLine1(shippingAddress.getCustAddressLine1());
      address.setCustAddressLine2(shippingAddress.getCustAddressLine2());
      address.setCustCityName(shippingAddress.getCustCityName());
      address.setCustStateName(shippingAddress.getCustStateName());
      address.setCustStateCode(shippingAddress.getCustStateCode());
      address.setCustCountryName(shippingAddress.getCustCountryName());
      address.setCustCountryCode(shippingAddress.getCustCountryCode());
      address.setCustStateName(shippingAddress.getCustStateName());
      address.setCustZipCode(shippingAddress.getCustZipCode());
      address.setCustPhoneNum(shippingAddress.getCustPhoneNum());
      address.setCustFaxNum(shippingAddress.getCustFaxNum());
      address.setRecUpdateBy(Constants.USERNAME_SYSTEM);
      address.setRecUpdateDatetime(new Date());
      Country country = CountryDAO.loadByCountryCode(siteId, shippingAddress.getCustCountryCode());
      address.setCountry(country);
      if (shippingAddress.getCustStateCode() != null) {
        State state = StateDAO.loadByStateCode(siteId, shippingAddress.getCustStateCode());
        address.setState(state);
      }
      em.persist(address);
      orderHeader.setShippingAddress(address);
    }
View Full Code Here

Examples of com.jada.jpa.entity.CustomerAddress

      ContentBean contentBean = getContentBean(request);
      Site site = contentBean.getContentSessionBean().getSiteDomain().getSite();
    ShoppingCart shoppingCart = ShoppingCart.getSessionInstance(request, true);
    maintainOpenOrder(request, shoppingCart);
      ActionMessages messages = new ActionMessages();
      CustomerAddress customerAddress = shoppingCart.getEstimateAddress();
      if (customerAddress != null) {
        form.setEstimateCountryCode(customerAddress.getCustCountryCode());
        form.setEstimateStateCode(customerAddress.getCustStateCode());
        form.setEstimateZipCode(customerAddress.getCustZipCode());
      }
     
    this.initSearchInfo(form, site.getSiteId(), messages);
    this.initCartInfo(form, site, shoppingCart, request, messages);
    if (customerAddress != null) {
View Full Code Here

Examples of com.jada.jpa.entity.CustomerAddress

  public void initCustomer(Customer customer, ContentBean contentBean) throws Exception {
    this.customer = customer;
    this.customerClass = customer.getCustomerClass();
        Iterator<?> custAddresses = customer.getCustAddresses().iterator();
        while (custAddresses.hasNext()) {
          CustomerAddress customerAddress = (CustomerAddress) custAddresses.next();
      if (customerAddress.getCustAddressType().equals(Constants.CUSTOMER_ADDRESS_CUST)) {
        this.custAddress = customerAddress;
      }
      if (customerAddress.getCustAddressType().equals(Constants.CUSTOMER_ADDRESS_SHIPPING)) {
        this.shippingAddress = customerAddress;
      }
      if (customerAddress.getCustAddressType().equals(Constants.CUSTOMER_ADDRESS_BILLING)) {
        this.billingAddress = customerAddress;
      }
        }
        if (cashPaymentOrder) {
          customerCreditCard = null;
View Full Code Here

Examples of com.jada.jpa.entity.CustomerAddress

    }
    recalculate(contentBean);
  }
 
  public void setEstimateAddress(HttpServletRequest request, String countryCode, String stateCode, String zipCode, boolean pickUp) throws SecurityException, Exception {
    estimateAddress = new CustomerAddress();
    estimateAddress.setCustCountryCode(countryCode);
    estimateAddress.setCountry(CountryDAO.loadByCountryCode(contentSessionKey.getSiteId(), countryCode));
    estimateAddress.setCustStateCode(stateCode);
    estimateAddress.setState(StateDAO.loadByStateCode(contentSessionKey.getSiteId(), stateCode));
    estimateAddress.setCustZipCode(zipCode);
View Full Code Here

Examples of com.jada.jpa.entity.CustomerAddress

   
    if (shippingAddress == null) {
      return null;
    }
   
    CustomerAddress address = shippingAddress;
    if (address.getCustUseAddress().equals(Constants.CUST_ADDRESS_USE_BILL)) {
      address = billingAddress;
    }
    if (address.getCustUseAddress().equals(Constants.CUST_ADDRESS_USE_CUST)) {
      address = custAddress;
    }
    return address;
  }
View Full Code Here

Examples of com.jada.jpa.entity.CustomerAddress

    return address;
  }
 
  public Vector<?> getShippingMethods() throws Exception {
    Vector<ShippingMethod> shippingMethods = new Vector<ShippingMethod>();
    CustomerAddress address = getEffectiveShippingAddress();
    if (address == null) {
      return shippingMethods;
    }
   
    Long countryId = null;
    if (address.getCountry() != null) {
      countryId = address.getCountry().getCountryId();
    }
    Long stateId = null;
    if (address.getState() != null) {
      stateId = address.getState().getStateId();
    }
   
    Vector<ShippingRegion> matchedRegion = new Vector<ShippingRegion>();
   
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Query query = em.createQuery("from   ShippingRegion " +
                      "where  siteId = :siteId ");
    query.setParameter("siteId", contentSessionKey.getSiteId());
        Iterator<?> iterator = query.getResultList().iterator();
        ShippingRegion defaultRegion = null;
        while (iterator.hasNext()) {
          ShippingRegion shippingRegion = (ShippingRegion) iterator.next();
          if (shippingRegion.getPublished() == Constants.VALUE_NO) {
            continue;
          }
          if (shippingRegion.getSystemRecord() == Constants.VALUE_YES) {
          if (shippingRegion.getPublished() == Constants.VALUE_YES) {
            defaultRegion = shippingRegion;
            continue;
          }
        }
         
          boolean isFound = false;
        Iterator<?> countries = shippingRegion.getCountries().iterator();
        while (countries.hasNext()) {
          Country country = (Country) countries.next();
          if (country.getCountryId().equals(countryId)) {
            isFound = true;
          }
        }
        if (!isFound) {
            Iterator<?> states = shippingRegion.getStates().iterator();
            while (states.hasNext()) {
              State state = (State) states.next();
              if (state.getStateId().equals(stateId)) {
                isFound = true;
              }
            }
        }
          String zipCode = address.getCustZipCode();
          if (!isFound && !Format.isNullOrEmpty(zipCode)) {
            for (ShippingRegionZip shippingRegionZip : shippingRegion.getZipCodes()) {
              if (shippingRegionZip.getZipCodeExpression() == Constants.VALUE_YES) {
                if (zipCode.matches(shippingRegionZip.getZipCodeStart())) {
                  isFound = true;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.