Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Site


        HttpServletRequest request,
        HttpServletResponse response)
    throws Throwable {
    ItemMaintActionForm form = (ItemMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    initSiteProfiles(form, site);
 
    Item item = ItemDAO.load(site.getSiteId(), Format.getLong(form.getItemId()));
    String jsonString = createJsonItemSkus(item).toHtmlString();
    streamWebService(response, jsonString);
    return null;
  }
View Full Code Here


    throws Throwable {
         EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    MessageResources resources = this.getResources(request);
    ItemMaintActionForm form = (ItemMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    initSiteProfiles(form, site);
   
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    Item item = ItemDAO.load(site.getSiteId(), Format.getLong(form.getItemId()));
      String sql = "from  Item " +
           "where siteId = :siteId " +
           "and   itemNum = :itemNum " +
           "and   itemId != :itemId";

      Query query = em.createQuery(sql);
      query.setParameter("siteId", site.getSiteId());
      query.setParameter("itemNum",  form.getItemNum());
      query.setParameter("itemId", Format.getLong(form.getItemId()));
    Iterator<?> iterator = query.getResultList().iterator();
    if (iterator.hasNext()) {
      jsonResult.put("status", Constants.WEBSERVICE_STATUS_FAILED);
View Full Code Here

    if (customer == null) {
      return null;
    }
   
    ContentSessionBean contentSessionBean = getContentBean(request).getContentSessionBean();
    Site site = contentSessionBean.getSiteDomain().getSite();
    String commentTitle = request.getParameter("commentTitle");
    commentTitle = Utility.escapeStrictHTML(commentTitle);
    String commentLine = request.getParameter("comment");
    commentLine = Utility.escapeStrictHTML(commentLine);
    if (!Format.isNullOrEmpty(commentTitle) ||  !Format.isNullOrEmpty(commentLine)) {   
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Content content = ContentDAO.loadNatural(site.getSiteId(), Utility.encode(contentNaturalKey));
      Comment comment = new Comment();
      comment.setCommentTitle(commentTitle);
      comment.setComment(commentLine);
      comment.setActive(Constants.VALUE_YES);
      String custName = customer.getCustEmail();
View Full Code Here

        throws Throwable {
     
    String contentNaturalKey = (String) request.getParameter("contentNaturalKey");
    String value = (String) request.getParameter("rate");
    ContentSessionBean contentSessionBean = getContentBean(request).getContentSessionBean();
    Site site = contentSessionBean.getSiteDomain().getSite();
    String siteId = site.getSiteId();
    if (value != null) {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Content content = ContentDAO.loadNatural(siteId, contentNaturalKey);
      int contentRatingCount = content.getContentRatingCount().intValue();
      float contentRating = content.getContentRating().floatValue();
View Full Code Here

            ActionForm actionForm,
            HttpServletRequest request,
            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();
View Full Code Here

            ActionForm actionForm,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
      init(request);
      ContentBean contentBean = getContentBean(request);
      Site site = contentBean.getSiteDomain().getSite();
    ShoppingCart shoppingCart = ShoppingCart.getSessionInstance(request, true);
      EntityManager em = null;
    em = JpaConnection.getInstance().getCurrentEntityManager();
   
    Customer customer = getCustomer(request);
    if (customer.getCustPassword() == null) {
        ShoppingCartActionForm form = (ShoppingCartActionForm) actionForm;
      ActionMessages errors = validate(form, site.getSiteId());
      if (errors.size() != 0) {
        saveMessages(request, errors);
        form.setCustPassword(null);
        form.setCustVerifyPassword(null);
        this.initAddressInfo(form, site, shoppingCart, request, errors);
        this.initSearchInfo(form, site.getSiteId(), errors);
        this.initCartInfo(form, site, shoppingCart, request, errors);
            createEmptySecureTemplateInfo(request);
        return actionMapping.findForward("error");
      }
      Customer c = (Customer) em.find(Customer.class, customer.getCustId());
View Full Code Here

        if (form == null) {
            form = new ItemMaintActionForm();
        }
        Item item = new Item();
    AdminBean adminBean = getAdminBean(httpServletRequest);
    Site site = adminBean.getSite();
        initSiteProfiles(form, site);
       
        form.setShippingTypeId("");
        form.setItemHitCounter("0");
        form.setItemRating(Format.getFloat(0));
View Full Code Here

    ItemMaintActionForm form = (ItemMaintActionForm) actionForm;
    if (form == null) {
      form = new ItemMaintActionForm();
    }
   
    Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
    Item item = (Item) em.find(Item.class, Format.getLong(form.getItemId()));
   
    copyProperties(request, form, item);
        createAdditionalInfo(getAdminBean(request), form, item);
View Full Code Here

    throws Throwable {
 
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    ItemMaintActionForm form = (ItemMaintActionForm) actionForm;
   
    Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
    Item item = (Item) em.find(Item.class, Format.getLong(form.getItemId()));
        createAdditionalInfo(getAdminBean(request), form, item);       

        GoogleTranslate translator = new GoogleTranslate(form.getFromLocale(), form.getToLocale());
   
    if (!form.isSiteProfileClassDefault()) {
      copyProperties(request, form, item);
    }
   
    try {
      form.setItemShortDescLangFlag(true);
      form.setItemDescLangFlag(true);
      form.setPageTitleLangFlag(true);
      form.setMetaKeywordsLangFlag(true);
      form.setMetaDescriptionLangFlag(true);
      form.setItemShortDescLang(translator.translate(item.getItemLanguage().getItemShortDesc()));
      form.setItemDescLang(translator.translate(item.getItemLanguage().getItemDesc()));
      form.setPageTitleLang(translator.translate(item.getItemLanguage().getPageTitle()));
      form.setMetaKeywordsLang(translator.translate(item.getItemLanguage().getMetaKeywords()));
      form.setMetaDescriptionLang(translator.translate(item.getItemLanguage().getMetaDescription()));
     
      form.setItemAttribDetailValueLangFlag(true);
      ItemAttributeDetailDisplayForm attributeDetailDisplayForm[] = form.getItemAttributeDetails();
      for (int i = 0; i < attributeDetailDisplayForm.length; i++) {
        attributeDetailDisplayForm[i].setItemAttribDetailValueLangFlag(true);
        CustomAttribute customAttribute = CustomAttributeDAO.load(site.getSiteId(), Format.getLong(attributeDetailDisplayForm[i].getCustomAttribId()));
        if (customAttribute.getCustomAttribTypeCode() != Constants.CUSTOM_ATTRIBUTE_TYPE_USER_INPUT) {
          continue;
        }
        attributeDetailDisplayForm[i].setItemAttribDetailValueLang(translator.translate(attributeDetailDisplayForm[i].getItemAttribDetailValue()));
      }
View Full Code Here

    }
    form.setItemShortDesc(form.getItemShortDesc());
    form.setItemShortDescLang(form.getItemShortDescLang());

    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    initSiteProfiles(form, site);

    Item item = new Item();
    if (!insertMode) {
      item = ItemDAO.load(site.getSiteId(), Format.getLong(form.getItemId()));
    }

    ActionMessages errors = validate(request, form, site.getSiteId(), insertMode, item);
    if (errors.size() != 0) {
      saveMessages(request, errors);
      createAdditionalInfo(adminBean, form, item);
      return mapping.findForward("error");
    }

    if (insertMode) {
      item.setSite(site);
      item.setItemTypeCd(form.getItemTypeCd());
      item.setItemHitCounter(new Integer(0));
      item.setItemRating(new Float(0));
      item.setItemRatingCount(new Integer(0));
      item.setItemQty(new Integer(0));
      item.setItemBookedQty(new Integer(0));
      item.setRecCreateBy(adminBean.getUser().getUserId());
      item.setRecCreateDatetime(new Date(System.currentTimeMillis()));
     
      if (!Format.isNullOrEmpty(form.getCustomAttribGroupId())) {
        Long customAttribGroupId = Format.getLong(form.getCustomAttribGroupId());
        CustomAttributeGroup customAttributeGroup = CustomAttributeGroupDAO.load(site.getSiteId(), customAttribGroupId);
        item.setCustomAttributeGroup(customAttributeGroup);
        form.setCustomAttribGroupName(customAttributeGroup.getCustomAttribGroupName());

        String sql = "select   customAttributeDetail " +
                   "from     CustomAttributeGroup customAttributeGroup " +
                   "join   customAttributeGroup.customAttributeDetails customAttributeDetail  " +
                   "where    customAttributeGroup.customAttribGroupId = :customAttribGroupId " +
                   "order    by customAttributeDetail.seqNum ";
        Query query = em.createQuery(sql);
        query.setParameter("customAttribGroupId", Format.getLong(form.getCustomAttribGroupId()));
        Iterator<?> iterator = query.getResultList().iterator();
        Vector<ItemAttributeDetailDisplayForm> itemAttributeDetails = new Vector<ItemAttributeDetailDisplayForm>();
        boolean itemAttributeLangFlag = false;
        while (iterator.hasNext()) {
          CustomAttributeDetail customAttributeDetail = (CustomAttributeDetail) iterator.next();
/*
          ItemAttributeDetail itemAttributeDetail = new ItemAttributeDetail();
          itemAttributeDetail.setItem(item);
          itemAttributeDetail.setCustomAttributeDetail(customAttributeDetail);
          itemAttributeDetail.setRecUpdateBy(adminBean.getUser().getUserId());
          itemAttributeDetail.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
          itemAttributeDetail.setRecCreateBy(adminBean.getUser().getUserId());
          itemAttributeDetail.setRecCreateDatetime(new Date(System.currentTimeMillis()));
         
          ItemAttributeDetailLanguage itemAttributeDetailLanguage = new ItemAttributeDetailLanguage();
          itemAttributeDetailLanguage.setItemAttribDetailValue("");
          itemAttributeDetailLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
          itemAttributeDetailLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
          itemAttributeDetailLanguage.setRecCreateBy(adminBean.getUser().getUserId());
          itemAttributeDetailLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
          SiteProfileClass siteProfileClass = SiteProfileClassDAO.load(form.getSiteProfileClassDefaultId());
          itemAttributeDetailLanguage.setSiteProfileClass(siteProfileClass);
          if (customAttributeDetail.getCustomAttribute().getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_USER_SELECT_DROPDOWN) {
            CustomAttributeOption customAttributeOption = null;
            for (CustomAttributeOption option : customAttributeDetail.getCustomAttribute().getCustomAttributeOptions()) {
              customAttributeOption = option;
              break;
            }
            itemAttributeDetail.setCustomAttributeOption(customAttributeOption);
          }
          em.persist(itemAttributeDetailLanguage);
         
          itemAttributeDetail.setItemAttributeDetailLanguage(itemAttributeDetailLanguage);
          em.persist(itemAttributeDetail);
*/
          ItemAttributeDetailDisplayForm displayForm = new ItemAttributeDetailDisplayForm();
          displayForm.setCustomAttribId(customAttributeDetail.getCustomAttribute().getCustomAttribId().toString());
          displayForm.setCustomAttribTypeCode(String.valueOf(customAttributeDetail.getCustomAttribute().getCustomAttribTypeCode()));
          displayForm.setCustomAttribDetailId(customAttributeDetail.getCustomAttribDetailId().toString());
          displayForm.setCustomAttribName(customAttributeDetail.getCustomAttribute().getCustomAttribName());
          displayForm.setCustomAttribTypeCode(String.valueOf(customAttributeDetail.getCustomAttribute().getCustomAttribTypeCode()));
          displayForm.setItemAttribDetailValue("");
          itemAttributeDetails.add(displayForm);
        }
        form.setItemAttribDetailValueLangFlag(itemAttributeLangFlag);
        ItemAttributeDetailDisplayForm[] itemAttributeDetailDisplayForms = new ItemAttributeDetailDisplayForm[itemAttributeDetails.size()];
        itemAttributeDetails.copyInto(itemAttributeDetailDisplayForms);
        form.setItemAttributeDetails(itemAttributeDetailDisplayForms);
      }
      form.setItemTypeDesc(resources.getMessage("item.typeCode." + form.getItemTypeCd()));
    }
   
    if (form.isSiteProfileClassDefault() && form.isSiteCurrencyClassDefault()) {
      saveDefault(item, form, adminBean, insertMode);
      form.setRecUpdateBy(item.getRecUpdateBy());
      form.setRecUpdateDatetime(Format.getFullDatetime(item.getRecUpdateDatetime()));
      User user = adminBean.getUser();
      item.setUser(user);
      if (insertMode) {
        em.persist(item);
        form.setItemId(Format.getLong(item.getItemId()));
      }
      else {
        // em.update(item);
      }
    }
    else {
      if (!form.isSiteProfileClassDefault()) {
        saveLanguage(item, form, adminBean);
      }
      if (!form.isSiteCurrencyClassDefault()) {
        saveCurrency(item, form, adminBean);
      }     
    }
   
    if (!Format.isNullOrEmpty(form.getShippingTypeId())) {
      ShippingType shippingType = (ShippingType) em.find(ShippingType.class, Format.getLong(form.getShippingTypeId()));
      if (shippingType != null) {
        item.setShippingType(shippingType);
      }
    }
    else {
      item.setShippingType(null);
    }
   
    if (!Format.isNullOrEmpty(form.getProductClassId())) {
      ProductClass productClass = (ProductClass) em.find(ProductClass.class, Format.getLong(form.getProductClassId()));
      if (productClass != null) {
        item.setProductClass(productClass);
      }
    }
    else {
      item.setShippingType(null);
    }
   
    CategorySearchUtil.itemPriceSearchUpdate(item, site, adminBean);
    CategorySearchUtil.itemDescSearchUpdate(item, site, adminBean);
    if (insertMode) {
      em.persist(item);
      form.setItemId(Format.getLong(item.getItemId()));
    }
    else {
      // em.update(item);
    }
   
    Iterator<?> iterator = item.getMenus().iterator();
    while (iterator.hasNext()) {
      Menu menu = (Menu) iterator.next();
      CacheDAO.removeByKeyPrefix(site.getSiteId(), Constants.CACHE_MENU + "." + menu.getMenuSetName());
    }
   
    Indexer.getInstance(site.getSiteId()).updateItem(item);

    createAdditionalInfo(adminBean, form, item);

        form.setMode("U");
        FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
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.