Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Country


        vector = new Vector<LabelValueBean>();
        query = em.createQuery("from Country where siteId = :siteId order by countryName");
        query.setParameter("siteId", form.getSiteId());
        iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
          Country country = (Country) iterator.next();
          LabelValueBean bean = new LabelValueBean();
          bean.setLabel(country.getCountryName());
          bean.setValue(country.getCountryCode());
          vector.add(bean);
        }
        LabelValueBean countries[] = new LabelValueBean[vector.size()];
        vector.copyInto(countries);
        form.setCountries(countries);
View Full Code Here


      JSONEscapeObject jsonResult = new JSONEscapeObject();
      jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
      Iterator<Country> iterator = shippingRegion.getCountries().iterator();
      Vector<JSONEscapeObject> countries = new Vector<JSONEscapeObject>();
      while (iterator.hasNext()) {
        Country country = (Country) iterator.next();
        JSONEscapeObject object = new JSONEscapeObject();
        object.put("countryId", country.getCountryId());
        object.put("countryCode", country.getCountryCode());
        object.put("countryName", country.getCountryName());
        countries.add(object);
      }
      jsonResult.put("countries", countries);
      Iterator<State> iterator1 = shippingRegion.getStates().iterator();
      Vector<JSONEscapeObject> states = new Vector<JSONEscapeObject>();
View Full Code Here

      String countryIds[] = form.getCountryIds();
      if (countryIds != null) {
        for (int i = 0; i < countryIds.length; i++) {
          Long countryId = Format.getLong(countryIds[i]);
              Country country = (Country) em.find(Country.class, countryId);
              Iterator<?> countries = shippingRegion.getCountries().iterator();
              boolean found = false;
              while (countries.hasNext()) {
                Country c = (Country) countries.next();
                if (c.getCountryId().equals(countryId)) {
                  found = true;
                  break;
                }
              }
              if (!found) {
View Full Code Here

      if (countryIds != null) {
        for (int i = 0; i < countryIds.length; i++) {
          Long countryId = Format.getLong(countryIds[i]);
              Iterator<?> countries = shippingRegion.getCountries().iterator();
              while (countries.hasNext()) {
                Country c = (Country) countries.next();
                if (c.getCountryId().equals(countryId)) {
                  countries.remove();
                  modified = true;
                  break;
                }
              }
View Full Code Here

        Query query = em.createQuery("from Country country where siteId = :siteId order by countryName");
    query.setParameter("siteId", adminBean.getSite().getSiteId());
    Iterator<?> iterator = query.getResultList().iterator();
    Vector<CountryStateTableBean> vector = new Vector<CountryStateTableBean>();
    while (iterator.hasNext()) {
      Country country = (Country) iterator.next();
      String prefix = "";
      if (country.getCountryName().length() > 0) {
        prefix = country.getCountryName().substring(0,1).toUpperCase();
      }
      if (!isRootExist(vector, prefix)) {
        CountryStateTableBean bean = new CountryStateTableBean();
        bean.setType("R");
        bean.setLabel(prefix);
        bean.setValue(prefix);
        bean.setParentValue("root");
        vector.add(bean);
      }
     
      CountryStateTableBean bean = new CountryStateTableBean();
      bean.setType("C");
      bean.setLabel(country.getCountryName());
      bean.setValue(country.getCountryId().toString());
      bean.setParentValue(prefix);
      vector.add(bean);
     
      Iterator<?> stateIterator = country.getStates().iterator();
      while (stateIterator.hasNext()) {
        State state = (State) stateIterator.next();
        bean = new CountryStateTableBean();
        bean.setType("S");
        bean.setLabel(state.getStateName());
        bean.setValue(state.getStateId().toString());
        bean.setParentValue(country.getCountryId().toString());
        vector.add(bean);
      }
    }
    CountryStateTableBean countryStateTable[] = new CountryStateTableBean[vector.size()];
        vector.copyInto(countryStateTable);
View Full Code Here

      form.setRemoveStates(null);
     
        Iterator<?> iterator = shippingRegion.getCountries().iterator();
        Vector<CountryStateTableBean> vector = new Vector<CountryStateTableBean>();
        while (iterator.hasNext()) {
          Country country = (Country) iterator.next();
          CountryStateTableBean bean = new CountryStateTableBean();
          bean.setType("C");
          bean.setLabel(country.getCountryName());
          bean.setValue(country.getCountryId().toString());
           vector.add(bean);

        }
        iterator = shippingRegion.getStates().iterator();
View Full Code Here

        return langName;
    }
   
    static public Country getCountryByCode(String siteId, String countryCode) throws Exception {
        EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
        Country country = null;
      String sql = "select country " +
            "from   Country country " +
            "left   join country.site site " +
            "where  site.siteId = :siteId " +
            "and    country.countryCode = :countryCode ";
View Full Code Here

        }
        return country;
    }
   
    static public String getCountryName(String siteId, String countryCode) throws Exception {
      Country country = getCountryByCode(siteId, countryCode);
      return country.getCountryName();
    }
View Full Code Here

      Query query = em.createQuery("from country in class Country where country.siteId = :siteId order by countryName");
      query.setParameter("siteId", siteId);
       Iterator<?> iterator = query.getResultList().iterator();
       Vector<LabelValueBean> vector = new Vector<LabelValueBean>();
       while (iterator.hasNext()) {
         Country country = (Country) iterator.next();
         LabelValueBean bean = new LabelValueBean(country.getCountryName(), country.getCountryCode());
         vector.add(bean);
       }
       LabelValueBean countries[] = new LabelValueBean[vector.size()];
       vector.copyInto(countries);
       form.setCountries(countries);
View Full Code Here

      Query query = em.createQuery("from country in class Country where country.siteId = :siteId order by country.countryName");
      query.setParameter("siteId", siteId);
       Iterator<?> iterator = query.getResultList().iterator();
       Vector<LabelValueBean> vector = new Vector<LabelValueBean>();
       while (iterator.hasNext()) {
         Country country = (Country) iterator.next();
         LabelValueBean bean = new LabelValueBean(country.getCountryName(), country.getCountryCode());
         vector.add(bean);
       }
       LabelValueBean countries[] = new LabelValueBean[vector.size()];
       vector.copyInto(countries);
       form.setCountries(countries);
      
    Country custCountry = CountryDAO.loadByCountryCode(siteId, form.getCustCountryCode());
    Vector<LabelValueBean> stateVector = new Vector<LabelValueBean>();
    if (custCountry != null) {
      for (State state : custCountry.getStates()) {
        LabelValueBean bean = new LabelValueBean(state.getStateName(), state.getStateCode());
        stateVector.add(bean);
      }
      LabelValueBean states[] = new LabelValueBean[stateVector.size()];
      stateVector.copyInto(states);
         form.setCustStates(states);
    }
    else {
      LabelValueBean states[] = {};
         form.setCustStates(states);
    }
   
    custCountry = CountryDAO.loadByCountryCode(siteId, form.getBillingCustCountryCode());
    stateVector = new Vector<LabelValueBean>();
    if (custCountry != null) {
      for (State state : custCountry.getStates()) {
        LabelValueBean bean = new LabelValueBean(state.getStateName(), state.getStateCode());
        stateVector.add(bean);
      }
      LabelValueBean states[] = new LabelValueBean[stateVector.size()];
      stateVector.copyInto(states);
         form.setBillingCustStates(states);
    }
    else {
      LabelValueBean states[] = {};
         form.setBillingCustStates(states);
    }
   
    custCountry = CountryDAO.loadByCountryCode(siteId, form.getShippingCustCountryCode());
    stateVector = new Vector<LabelValueBean>();
    if (custCountry != null) {
      for (State state : custCountry.getStates()) {
        LabelValueBean bean = new LabelValueBean(state.getStateName(), state.getStateCode());
        stateVector.add(bean);
      }
      LabelValueBean states[] = new LabelValueBean[stateVector.size()];
      stateVector.copyInto(states);
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.