Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Country


    protected boolean isStateCodeRequired(String siteId, String countryCode) throws SecurityException, Exception {
      if (Format.isNullOrEmpty(countryCode)) {
        return false;
      }
     
      Country country = CountryDAO.loadByCountryCode(siteId, countryCode);
      if (country.getStates().size() > 0) {
        return true;
      }
      return false;
    }
View Full Code Here


      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);
      }
View Full Code Here

        }
         
          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();
View Full Code Here

        if (smRegion.getShippingRegion().getSystemRecord() == Constants.VALUE_YES) {
          shippingMethodRegion = smRegion;
        }
        Iterator<?> countries = smRegion.getShippingRegion().getCountries().iterator();
        while (countries.hasNext()) {
          Country country = (Country) countries.next();
          if (country.getCountryId().equals(address.getCountry().getCountryId())) {
            shippingMethodRegion = smRegion;
            found = true;
            break;
          }
        }
View Full Code Here

        continue;
      }
          Iterator<?> iteratorCountry = null;
          iteratorCountry = tr.getCountries().iterator();
          while (iteratorCountry.hasNext()) {
            Country country = (Country) iteratorCountry.next();
            if (country.getCountryId().equals(shippingAddress.getCountry().getCountryId())) {
              vector.add(tr);
              break;
            }
          }
         
View Full Code Here

public class CountryDAO extends Country {
  private static final long serialVersionUID = -8827430679330867335L;
  public static Country load(String siteId, Long countryId) throws SecurityException, Exception {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Country country = (Country) em.find(Country.class, countryId);
    if (!country.getSiteId().equals(siteId)) {
      throw new SecurityException();
    }
    return country;
  }
View Full Code Here

TOP

Related Classes of com.jada.jpa.entity.Country

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.