Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Site


            ActionForm actionForm,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
     
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
        Site site = getAdminBean(request).getSite();

      JSONEscapeObject jsonResult = new JSONEscapeObject();
      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());
View Full Code Here


  public void extract(AdminListingActionForm actionForm, HttpServletRequest request) throws Throwable {

      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
        SiteCurrencyClassListingActionForm form = (SiteCurrencyClassListingActionForm) actionForm;
        Site site = getAdminBean(request).getSite();

        Query query = null;
        String sql = "select  siteCurrencyClass " +
               "from     SiteCurrencyClass siteCurrencyClass " +
               "where   siteCurrencyClass.site.siteId = :siteId ";
        if (!Format.isNullOrEmpty(form.getSrSiteCurrencyClassName())) {
          sql += "and siteCurrencyClassName like :siteCurrencyClassName ";
        }
        query = em.createQuery(sql);
        query.setParameter("siteId", site.getSiteId());
        if (!Format.isNullOrEmpty(form.getSrSiteCurrencyClassName())) {
          query.setParameter("siteCurrencyClassName", form.getSrSiteCurrencyClassName());
        }
        Iterator<?> iterator = query.getResultList().iterator();
        Vector<SiteCurrencyClassDisplayForm> vector = new Vector<SiteCurrencyClassDisplayForm>();
View Full Code Here

                             HttpServletRequest request,
                             HttpServletResponse response)
        throws Throwable {

    SiteMaintActionForm form = (SiteMaintActionForm) actionForm;
    Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
        form.setSiteId("");
        form.setActive(true);
        form.setShareInventory(false);
        form.setManageInventory(true);
View Full Code Here

                              HttpServletRequest request,
                              HttpServletResponse response)
        throws Throwable {

        SiteMaintActionForm form = (SiteMaintActionForm) actionForm;
        Site site = SiteDAO.load(form.getSiteId());
        form.setMode("U");
        copyProperties(form, site);
        initListInfo(form);
        FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
        ActionForward actionForward = actionMapping.findForward("success");
View Full Code Here

            HttpServletResponse response)
    throws Throwable {
   
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    SiteMaintActionForm form = (SiteMaintActionForm) actionForm;
        Site site = SiteDAO.load(form.getSiteId());

    try {
      em.remove(site);
      em.getTransaction().commit();
    }
View Full Code Here

        HttpServletRequest request,
        HttpServletResponse response)
      throws Throwable {
    AdminBean adminBean = getAdminBean(request);
    SiteMaintActionForm form = (SiteMaintActionForm) actionForm;
        Site site = SiteDAO.load(form.getSiteId());
      JSONEscapeObject jsonResult = new JSONEscapeObject();
      jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
      Vector<JSONEscapeObject> siteDomains = new Vector<JSONEscapeObject>();
      SiteDomain siteDomainDefault = site.getSiteDomainDefault();
    JSONEscapeObject object = new JSONEscapeObject();
    Long siteDomainDefaultId = siteDomainDefault.getSiteDomainId();
    object.put("siteDomainId", siteDomainDefault.getSiteDomainId());
    object.put("siteName", siteDomainDefault.getSiteDomainLanguage().getSiteName());
    object.put("siteDomainPrefix", siteDomainDefault.getSiteDomainPrefix());
    object.put("sitePublicPortNum", siteDomainDefault.getSitePublicPortNum());
    object.put("siteDomainPrefix", siteDomainDefault.getSiteDomainPrefix());
    object.put("siteDomainUrl", Utility.formatDomainURL(siteDomainDefault, adminBean.getContextPath()));
    object.put("master", true);
    object.put("active", siteDomainDefault.getActive());
    siteDomains.add(object);

      java.util.Iterator<SiteDomain> iterator = site.getSiteDomains().iterator();
      while (iterator.hasNext()) {
        SiteDomain siteDomain = (SiteDomain) iterator.next();
        if (siteDomain.getSiteDomainId().equals(siteDomainDefaultId)) {
          continue;
        }
View Full Code Here

      insertMode = true;
    }

    AdminBean adminBean = getAdminBean(request);

    Site site = new Site();
    if (!insertMode) {
          site = SiteDAO.load(form.getSiteId());
    }
    SiteParamBean siteParamBean = new SiteParamBean();
    if (!Format.isNullOrEmpty(site.getSiteParam())) {
      siteParamBean = (SiteParamBean) Utility.joxUnMarshall(SiteParamBean.class, site.getSiteParam());
    }

    form.setMailSmtpPort(form.getMailSmtpPort().trim());
    ActionMessages errors = validate(form, siteParamBean);
    if (errors.size() != 0) {
      form.setMailSmtpPassword("");
      form.setCaptchaPrivateKey("");
      form.setCaptchaPublicKey("");
          initListInfo(form);
      saveMessages(request, errors);
      return mapping.findForward("error");
    }

    site.setSiteDesc(form.getSiteDesc());
    if (!insertMode) {
      site.setShareInventory(form.isShareInventory() ? Constants.VALUE_YES : Constants.VALUE_NO);
      site.setManageInventory(form.isManageInventory() ? Constants.VALUE_YES : Constants.VALUE_NO);
      site.setSingleCheckout(form.isSingleCheckout() ? Constants.VALUE_YES : Constants.VALUE_NO);
      site.setListingPageSize(Format.getInt(form.getListingPageSize()));
      site.setMailSmtpHost(form.getMailSmtpHost());
      site.setMailSmtpPort(form.getMailSmtpPort());
      site.setMailSmtpAccount(form.getMailSmtpAccount());
      if (!Format.isNullOrEmpty(form.getMailSmtpPassword())) {
        site.setMailSmtpPassword(AESEncoder.getInstance().encode(form.getMailSmtpPassword()));
      }
      if (form.getMailSmtpPassword().equals(" ")) {
        site.setMailSmtpPassword(AESEncoder.getInstance().encode(""));
      }
    }
    site.setActive(form.isActive() ? Constants.VALUE_YES : Constants.VALUE_NO);
    siteParamBean.setEnableCaptcha(form.isEnableCaptcha() ? String.valueOf(Constants.VALUE_YES) : String.valueOf(Constants.VALUE_NO));
    if (!Format.isNullOrEmpty(form.getCaptchaPrivateKey())) {
      siteParamBean.setCaptchaPrivateKey(AESEncoder.getInstance().encode(form.getCaptchaPrivateKey()));
    }
    if (!Format.isNullOrEmpty(form.getCaptchaPublicKey())) {
      siteParamBean.setCaptchaPublicKey(AESEncoder.getInstance().encode(form.getCaptchaPublicKey()));
    }
    if (!form.isEnableCaptcha()) {
      siteParamBean.setCaptchaPrivateKey("");
      siteParamBean.setCaptchaPublicKey("");
    }
    site.setSiteParam(Utility.joxMarshall("SiteParamBean", siteParamBean));
    site.setRecUpdateBy(adminBean.getUser().getUserId());
    site.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    if (insertMode) {
      boolean checked = false;
      String siteDomainPrefix = "localhost";
      int count = 0;
      while (!checked) {
        String sql = "from  Site";
        Query query = em.createQuery(sql);
        Iterator<?> iterator = query.getResultList().iterator();
        boolean found = false;
        if (count > 0) {
          siteDomainPrefix = "localhost" + count;
        }
        while (iterator.hasNext()) {
          Site otherSite = (Site) iterator.next();
          for (SiteDomain otherSiteDomain : otherSite.getSiteDomains()) {
            if (otherSiteDomain.getSiteDomainPrefix().equals(siteDomainPrefix)) {
              found = true;
              break;
            }
          }
View Full Code Here

    if (form == null) {
      form = new ShippingMethodMaintActionForm();
    }
    initSiteProfiles(form, getAdminBean(request).getSite());
   
    Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
    ShippingMethod shippingMethod = (ShippingMethod) em.find(ShippingMethod.class, Format.getLong(form.getShippingMethodId()));
   
        GoogleTranslate translator = new GoogleTranslate(form.getFromLocale(), form.getToLocale());
    form.setShippingMethodNameLangFlag(true);
    form.setShippingMethodNameLang(translator.translate(shippingMethod.getShippingMethodLanguage().getShippingMethodName()));
   
    initJsonSmRegions(form, shippingMethod, site.getSiteId(), adminBean.getUser());
   
    FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
    ActionForward actionForward = actionMapping.findForward("success");
    return actionForward;
  }
View Full Code Here

    if (form == null) {
      form = new ShippingMethodMaintActionForm();
    }
    initSiteProfiles(form, getAdminBean(request).getSite());
   
    Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
    ShippingMethod shippingMethod = (ShippingMethod) em.find(ShippingMethod.class, Format.getLong(form.getShippingMethodId()));
   
    if (!form.isSiteProfileClassDefault()) {
      form.setShippingMethodNameLangFlag(false);
      form.setShippingMethodNameLang(shippingMethod.getShippingMethodLanguage().getShippingMethodName());
        boolean found = false;
        ShippingMethodLanguage shippingMethodLanguage = null;
        Long siteProfileClassId = form.getSiteProfileClassId();
        Iterator<?> iterator = shippingMethod.getShippingMethodLanguages().iterator();
        while (iterator.hasNext()) {
          shippingMethodLanguage = (ShippingMethodLanguage) iterator.next();
          if (shippingMethodLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
            found = true;
            break;
          }
        }
        if (found) {
          if (shippingMethodLanguage.getShippingMethodName() != null) {
            form.setShippingMethodNameLangFlag(true);
            form.setShippingMethodNameLang(shippingMethodLanguage.getShippingMethodName());
          }
        }
    }
    initJsonSmRegions(form, shippingMethod, site.getSiteId(), adminBean.getUser());
   
    FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
    ActionForward actionForward = actionMapping.findForward("success");
    return actionForward;
  }
View Full Code Here

                              HttpServletRequest request,
                              HttpServletResponse response)
        throws Throwable {

        AdminBean adminBean = getAdminBean(request);
        Site site = adminBean.getSite();
        ShippingMethodMaintActionForm form = (ShippingMethodMaintActionForm) actionForm;
        if (form == null) {
            form = new ShippingMethodMaintActionForm();
        }
    initSiteProfiles(form, site);
    String shippingMethodId = request.getParameter("shippingMethodId");
        ShippingMethod shippingMethod = new ShippingMethod();
        shippingMethod = ShippingMethodDAO.load(site.getSiteId(), Format.getLong(shippingMethodId));
        form.setMode("U");
    form.setShippingMethodId(Format.getLong(shippingMethod.getShippingMethodId()));
    form.setShippingMethodName(shippingMethod.getShippingMethodLanguage().getShippingMethodName());
    form.setPublished(shippingMethod.getPublished() == Constants.PUBLISHED_YES);
   
    if (!form.isSiteProfileClassDefault()) {
      form.setShippingMethodNameLang(shippingMethod.getShippingMethodLanguage().getShippingMethodName());
        boolean found = false;
        ShippingMethodLanguage shippingMethodLanguage = null;
        Long siteProfileClassId = form.getSiteProfileClassId();
        Iterator<?> iterator = shippingMethod.getShippingMethodLanguages().iterator();
        while (iterator.hasNext()) {
          shippingMethodLanguage = (ShippingMethodLanguage) iterator.next();
          if (shippingMethodLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
            found = true;
            break;
          }
        }
        if (found) {
          if (shippingMethodLanguage.getShippingMethodName() != null) {
            form.setShippingMethodNameLangFlag(true);
            form.setShippingMethodNameLang(shippingMethodLanguage.getShippingMethodName());
          }
        }
    }

    initJsonSmRegions(form, shippingMethod, site.getSiteId(), adminBean.getUser());

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

TOP

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

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.