Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Country


            HttpServletResponse response)
        throws Throwable {
      ContentBean contentBean = getContentBean(request);
      Site site = contentBean.getContentSessionBean().getSiteDomain().getSite();
     
      Country country = CountryDAO.loadByCountryCode(site.getSiteId(), request.getParameter("countryCode"));
      Vector<JSONEscapeObject> jsonStates = new Vector<JSONEscapeObject>();
     
      if (country != null) {
        for (State state : country.getStates()) {
          JSONEscapeObject jsonState = new JSONEscapeObject();
          jsonState.put("stateCode", state.getStateCode());
          jsonState.put("stateName", state.getStateName());
          jsonStates.add(jsonState);
        }
View Full Code Here


        calcPage(adminBean, form, list, pageNo);
        Vector<CountryDisplayForm> vector = new Vector<CountryDisplayForm>();
        int startRecord = (form.getPageNo() - 1) * adminBean.getListingPageSize();
        int endRecord = startRecord + adminBean.getListingPageSize();
        for (int i = startRecord; i < list.size() && i < endRecord; i++) {
          Country country = (Country) list.get(i);
          CountryDisplayForm countryDisplay = new CountryDisplayForm();
          countryDisplay.setCountryId(Format.getLong(country.getCountryId()));
          countryDisplay.setCountryCode(country.getCountryCode());
          countryDisplay.setCountryName(country.getCountryName());
            vector.add(countryDisplay);
        }
        CountryDisplayForm countries[] = new CountryDisplayForm[vector.size()];
        vector.copyInto(countries);
        form.setCountries(countries);
View Full Code Here

                continue;
              }
              if (!countries[i].getRemove().equals("Y")) {
                continue;
              }
                Country country = new Country();
                country = CountryDAO.load(site.getSiteId(), Format.getLong(countries[i].getCountryId()));
                em.remove(country);
            }
            em.getTransaction().commit();
          }
View Full Code Here

        CountryMaintActionForm form = (CountryMaintActionForm) actionForm;
        if (form == null) {
            form = new CountryMaintActionForm();
        }
    String countryId = request.getParameter("countryId");
        Country country = new Country();
        country = CountryDAO.load(site.getSiteId(), Format.getLong(countryId));
        form.setMode("U");
    form.setCountryId(Format.getLong(country.getCountryId()));
    form.setCountryCode(country.getCountryCode());
    form.setCountryName(country.getCountryName());
   
    createAdditionalInfo(form, country);

        FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
        ActionForward actionForward = actionMapping.findForward("success");
View Full Code Here

    throws Throwable {
   
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Site site = getAdminBean(request).getSite();
    CountryMaintActionForm form = (CountryMaintActionForm) actionForm;
    Country country = CountryDAO.load(site.getSiteId(), Format.getLong(form.getCountryId()));
    try {
      em.remove(country);
      em.getTransaction().commit();
    }
    catch (Exception e) {
View Full Code Here

    }
 
    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
 
    Country country = new Country();
    if (!insertMode) {
      country = CountryDAO.load(site.getSiteId(), Format.getLong(form.getCountryId()));
    }
 
    ActionMessages errors = validate(form);
    if (errors.size() != 0) {
      saveMessages(request, errors);
      return mapping.findForward("error");
    }
 
    String sql = "from    Country country " +
              "where   country.site.siteId = :siteId " +
              "and     countryCode = :countryCode ";
    if (!Format.isNullOrEmpty(form.getCountryId())) {
      sql += "and    countryId != :countryId";
    }
    Query query = em.createQuery(sql);
    query.setParameter("siteId", site.getSiteId());
    query.setParameter("countryCode", form.getCountryCode());
    if (!Format.isNullOrEmpty(form.getCountryId())) {
      query.setParameter("countryId", Long.valueOf(form.getCountryId()));
    }
    if (query.getResultList().iterator().hasNext()) {
      errors.add("countryCode", new ActionMessage("error.countryCode.duplicate"));
      saveMessages(request, errors);
      return mapping.findForward("error");
    }
 
    if (insertMode) {
      country.setRecCreateBy(adminBean.getUser().getUserId());
      country.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    country.setSite(site);
    country.setCountryCode(form.getCountryCode());
    country.setCountryName(form.getCountryName());
    country.setRecUpdateBy(adminBean.getUser().getUserId());
    country.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    if (insertMode) {
      em.persist(country);
    }
    else {
    // em.update(country);
    }
    form.setCountryId(Format.getLong(country.getCountryId()));
    form.setMode("U");
 
    FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
    return mapping.findForward("success");
  }
View Full Code Here

    throws Throwable {
   
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Site site = getAdminBean(request).getSite();
    CountryMaintActionForm form = (CountryMaintActionForm) actionForm;
    Country country = CountryDAO.load(site.getSiteId(), Format.getLong(form.getCountryId()));
   
    StateDisplayForm states[] = form.getStates();
    for (int i = 0; i < states.length; i++) {
      StateDisplayForm stateForm = states[i];
      if (stateForm.getRemove() == null) {
        continue;
      }
      if (stateForm.getRemove().equals(String.valueOf(Constants.VALUE_YES))) {
        State state = StateDAO.load(site.getSiteId(), Format.getLong(stateForm.getStateId()));
        country.getStates().remove(state);
        em.remove(state);
      }
    }
   
    createAdditionalInfo(form, country);
View Full Code Here

        state.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      }
      state.setStateCode(stateCode);
      state.setStateName(stateName);
     
      Country country = CountryDAO.load( site.getSiteId(), Format.getLong(countryId));
      state.setCountry(country);
      state.setRecUpdateBy(adminBean.getUser().getUserId());
      state.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      if (!exist) {
        em.persist(state);
View Full Code Here

        }
       
        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("");
        // TODO what if state and country and null
        customerAddress.setState(state);
View Full Code Here

      Vector<JSONEscapeObject> countries = new Vector<JSONEscapeObject>();
        Query query = em.createQuery("from Country country where siteId = :siteId order by countryName");
    query.setParameter("siteId", site.getSiteId());
    Iterator<?> iterator = query.getResultList().iterator();
    while (iterator.hasNext()) {
      Country country = (Country) iterator.next();
      JSONEscapeObject jsonCountry = new JSONEscapeObject();
      jsonCountry.put("countryId", country.getCountryId());
      jsonCountry.put("countryCode", country.getCountryCode());
      jsonCountry.put("countryName", country.getCountryName());
      Iterator<?> iterator1 = country.getStates().iterator();
      Vector<JSONEscapeObject> states = new Vector<JSONEscapeObject>();
      while (iterator1.hasNext()) {
        State state = (State) iterator1.next();
        JSONEscapeObject jsonState = new JSONEscapeObject();
        jsonState.put("stateId", state.getStateId());
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.