Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.State


       query = em.createQuery(sql);
      query.setParameter("siteId", form.getSiteId());
       iterator = query.getResultList().iterator();
       vector = new Vector<LabelValueBean>();
       while (iterator.hasNext()) {
         State state = (State) iterator.next();
         LabelValueBean bean = new LabelValueBean(state.getStateName(), state.getStateCode());
         vector.add(bean);
       }
       LabelValueBean states[] = new LabelValueBean[vector.size()];
       vector.copyInto(states);
       form.setStates(states);
View Full Code Here


public class StateDAO extends State {
  private static final long serialVersionUID = -2251330104927315726L;
  public static State load(String siteId, Long stateId) throws SecurityException, Exception {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    State state = (State) em.find(State.class, stateId);
    if (!state.getCountry().getSiteId().equals(siteId)) {
      throw new SecurityException();
    }
    return state;
  }
View Full Code Here

      return country.getCountryName();
    }
   
    static public State getStateByCode(String siteId, String stateCode) throws Exception {
        EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
        State state = null;
      String sql = "select state " +
            "from   State state " +
            "left   join state.country country " +
            "left   join country.site site " +
            "where  site.siteId = :siteId " +
View Full Code Here

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

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

    static public String getStateName(String siteId, String stateCode) throws Exception {
      if (Format.isNullOrEmpty(stateCode)) {
        return "";
      }
      State state = getStateByCode(siteId, stateCode);
      return state.getStateName();
    }
View Full Code Here

       query = em.createQuery(sql);
      query.setParameter("siteId", siteId);
       iterator = query.getResultList().iterator();
       vector = new Vector<LabelValueBean>();
       while (iterator.hasNext()) {
         State state = (State) iterator.next();
         LabelValueBean bean = new LabelValueBean(state.getStateName(), state.getStateCode());
         vector.add(bean);
       }
       LabelValueBean states[] = new LabelValueBean[vector.size()];
       vector.copyInto(states);
       form.setStates(states);
View Full Code Here

        if (shippingAddress.getCustAddressId() == null) {
          em.persist(shippingAddress);
        }
       
        String stateName = Format.getString(payer.getAddress().getStateOrProvince());
        State state = Utility.getStateByNameOrCode(site.getSiteId(), stateName);
        String countryCode = Format.getString(payer.getAddress().getCountry().toString());
        Country country = Utility.getCountryByCode(site.getSiteId(), countryCode);

        customer.setSite(site);
        customer.setCustPublicName("");
        customer.setCustEmail(emailAddress);
        customer.setCustSource(Constants.CUSTOMER_SOURCE_PAYPAL);
        customer.setCustSourceRef(Format.getString(payer.getPayerID()));
        customer.setRecUpdateBy(Constants.USERNAME_CUSTOMER);
        customer.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
//        customer.setCustPublicName(customer.getCustEmail());
        char singleCheckout = contentBean.getSiteDomain().getSite().getSingleCheckout();
        if (singleCheckout == Constants.VALUE_YES) {
          customer.setSiteDomain(contentBean.getSiteDomain().getSite().getSiteDomainDefault());
        }
        else {
          customer.setSiteDomain(contentBean.getSiteDomain());
        }
       
        customerAddress.setCustUseAddress(Constants.CUST_ADDRESS_USE_OWN);
        customerAddress.setCustAddressType(Constants.CUSTOMER_ADDRESS_CUST);
        customerAddress.setCustPrefix(Format.getString(payer.getPayerName().getSalutation()));
        customerAddress.setCustFirstName(Format.getString(payer.getPayerName().getFirstName()));
        customerAddress.setCustMiddleName(Format.getString(payer.getPayerName().getMiddleName()));
        customerAddress.setCustLastName(Format.getString(payer.getPayerName().getLastName()));
        customerAddress.setCustSuffix(Format.getString(payer.getPayerName().getSuffix()));
        customerAddress.setCustAddressLine1(payer.getAddress().getStreet1());
        customerAddress.setCustAddressLine2(payer.getAddress().getStreet2());
        customerAddress.setCustCityName(payer.getAddress().getCityName());
        customerAddress.setCustStateCode(state.getStateCode());
        customerAddress.setCustStateName(state.getStateName());
        customerAddress.setCustCountryName(country.getCountryName());
        customerAddress.setCustCountryCode(country.getCountryCode());
        customerAddress.setCustZipCode("");
        customerAddress.setCustPhoneNum(Format.getString(payer.getContactPhone()));
        customerAddress.setCustFaxNum("");
View Full Code Here

      }
      jsonResult.put("countries", countries);
      Iterator<State> iterator1 = taxRegion.getStates().iterator();
      Vector<JSONEscapeObject> states = new Vector<JSONEscapeObject>();
      while (iterator1.hasNext()) {
        State state = (State) iterator1.next();
        JSONEscapeObject object = new JSONEscapeObject();
        object.put("stateId", state.getStateId());
        object.put("stateCode", state.getStateCode());
        object.put("stateName", state.getStateName());
        states.add(object);
      }
      jsonResult.put("states", states);
      result = jsonResult.toHtmlString();
      return result;
View Full Code Here

     
      String stateIds[] = form.getStateIds();
      if (stateIds != null) {
        for (int i = 0; i < stateIds.length; i++) {
          Long stateId = Format.getLong(stateIds[i]);
              State state = (State) em.find(State.class, stateId);
              Iterator<?> states = taxRegion.getStates().iterator();
              boolean found = false;
              while (states.hasNext()) {
                State s = (State) states.next();
                if (s.getStateId().equals(stateId)) {
                  found = true;
                  break;
                }
              }
              if (!found) {
View Full Code Here

TOP

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

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.