Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Item


      attributes.put("commentRatingMessage", getLanguage("content.error.string.required"));
    }

    if (attributes.size() == 0) {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Item item = (Item) ItemDAO.loadNatural(siteDomain.getSite().getSiteId(), itemNaturalKey);
      Comment comment = new Comment();
      comment.setCommentTitle(commentTitle);
      comment.setComment(commentLine);
      comment.setCommentRating(Integer.valueOf(commentRating));
      comment.setActive(Constants.VALUE_YES);
      String custName = customer.getCustEmail();
      if (custName.length() > 20) {
        custName = custName.substring(0, 19);
      }
      comment.setRecCreateBy(custName);
      comment.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      comment.setRecUpdateBy(custName);
      comment.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      comment.setCustomer(customer);
      comment.setItem(item);
      item.getComments().add(comment);
      em.persist(comment);
     
      attributes.put("commentTitle", "");
      attributes.put("comment", "");
      attributes.put("commentRating", "");
View Full Code Here


    Iterator<?> iterator = shipHeader.getShipDetails().iterator();
    while (iterator.hasNext()) {
      ShipDetail shipDetail = (ShipDetail) iterator.next();
      int shipQty = shipDetail.getItemShipQty();
     
      Item item = shipDetail.getOrderItemDetail().getItem();
      if (item != null) {
        item = (Item) em.find(Item.class, item.getItemId());
        em.lock(item, LockModeType.WRITE);
     
        InventoryEngine engine = new InventoryEngine(item);
        engine.adjustQty(shipQty * -1);
        engine.adjustBookedQty(shipQty * -1);
 
View Full Code Here

      Vector<ShoppingCartItemBean> vector = new Vector<ShoppingCartItemBean>();
      Iterator<?> iterator = shoppingCart.getShoppingCartItems().iterator();
      while (iterator.hasNext()) {
        ShoppingCartItem shoppingCartItem = (ShoppingCartItem) iterator.next();
        ShoppingCartItemBean bean = new ShoppingCartItemBean();
        Item item = shoppingCartItem.getItem();
        Item master = item;
        if (item.getItemTypeCd().equals(Constants.ITEM_TYPE_SKU)) {
          master = item.getItemSkuParent();
        }
       
        bean.setItemId(item.getItemId().toString());
        bean.setItemNum(item.getItemNum());
        bean.setItemNaturalKey(item.getItemNaturalKey());
        bean.setItemQty(Format.getInt(shoppingCartItem.getItemQty()));
        int tierQty = shoppingCartItem.getTierPrice().getItemTierQty();
        float tierPrice = shoppingCartItem.getTierPrice().getItemTierPrice();
        bean.setItemPrice(formatItemPrice(contentBean, tierQty, tierPrice));
        bean.setItemSubTotal(formatter.formatCurrency(shoppingCartItem.getItemPriceTotal()));
        bean.setItemQtyError("");
       
       
        bean.setItemShortDesc(master.getItemLanguage().getItemShortDesc());
        ItemImage itemImage = master.getItemLanguage().getImage();
        if (itemImage != null) {
          bean.setImageId(itemImage.getImageId().toString());
        }
            if (!contentBean.getContentSessionBean().isSiteProfileClassDefault()){
              for (ItemLanguage itemLanguage : master.getItemLanguages()) {
                if (itemLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
                  if (itemLanguage.getItemShortDesc() != null) {
                    bean.setItemShortDesc(itemLanguage.getItemShortDesc());
                  }
                  if (itemLanguage.getItemImageOverride().equals(String.valueOf(Constants.VALUE_YES))) {
                    bean.setImageId(itemLanguage.getImage().getImageId().toString());
                  }
                  break;
                }
              }
            }
           
            Vector<ShoppingCartItemAttributeBean> shoppingCartItemAttributes = new Vector<ShoppingCartItemAttributeBean>();
            Iterator<?> itemAttributeInfoIterator = shoppingCartItem.getItemAttributeInfos().iterator();
            while (itemAttributeInfoIterator.hasNext()) {
              ItemAttributeInfo itemAttributeInfo = (ItemAttributeInfo) itemAttributeInfoIterator.next();
              ShoppingCartItemAttributeBean attributeBean = new ShoppingCartItemAttributeBean();
             
              ItemAttributeDetail itemAttributeDetail = (ItemAttributeDetail) em.find(ItemAttributeDetail.class, itemAttributeInfo.getItemAttribDetailId());
              CustomAttribute customAttribute = itemAttributeDetail.getCustomAttributeDetail().getCustomAttribute();
              if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_USER_INPUT) {
                continue;
              }
              if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_USER_SELECT_DROPDOWN) {
                continue;
              }
             
              attributeBean.setCustomAttribDesc(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
              if (!contentBean.getContentSessionBean().isSiteProfileClassDefault()) {
                for (CustomAttributeLanguage language : customAttribute.getCustomAttributeLanguages()) {
                  if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
                    if (language.getCustomAttribDesc() != null) {
                      attributeBean.setCustomAttribDesc(language.getCustomAttribDesc());
                    }
                      break;
                  }
                }
              }
             
              if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_CUST_INPUT) {
                attributeBean.setCustomAttribValue(itemAttributeInfo.getItemAttribDetailValue());
              }
              else {
                CustomAttributeOption customAttribOption = CustomAttributeOptionDAO.load(site.getSiteId(), itemAttributeInfo.getCustomAttribOptionId());
                attributeBean.setCustomAttribValue(customAttribOption.getCustomAttributeOptionLanguage().getCustomAttribValue());
                if (!contentBean.getContentSessionBean().isSiteProfileClassDefault()) {
                  for (CustomAttributeOptionLanguage language : customAttribOption.getCustomAttributeOptionLanguages()) {
                    if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
                      if (language.getCustomAttribValue() != null) {
                        attributeBean.setCustomAttribValue(language.getCustomAttribValue());
                      }
                      break;
                    }
                  }
                }
              }
              shoppingCartItemAttributes.add(attributeBean);
            }
            bean.setShoppingCartItemAttributes(shoppingCartItemAttributes);
        vector.add(bean);
      }
      form.setShoppingCartItemInfos(vector);
     
      Vector<ShoppingCartCouponBean> couponVector = new Vector<ShoppingCartCouponBean>();
      iterator = shoppingCart.getShoppingCartCoupons().iterator();
      while (iterator.hasNext()) {
        ShoppingCartCoupon shoppingCartCoupon = (ShoppingCartCoupon) iterator.next();
        Coupon coupon = shoppingCartCoupon.getCoupon();
        ShoppingCartCouponBean bean = new ShoppingCartCouponBean();
        bean.setCouponId(Format.getLong(coupon.getCouponId()));
        bean.setCouponCode(coupon.getCouponCode());
        bean.setCouponName(coupon.getCouponLanguage().getCouponName());
        if (!contentBean.getContentSessionBean().isSiteProfileClassDefault()) {
          for (CouponLanguage language : coupon.getCouponLanguages()) {
            if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
              if (language.getCouponName() != null) {
                bean.setCouponName(language.getCouponName());
              }
              break;
            }
          }
        }
        bean.setCouponAmount(formatter.formatCurrency(shoppingCartCoupon.getCouponAmount()));
        couponVector.add(bean);
      }
      form.setShoppingCartCouponInfos(couponVector);
     
      ItemTax taxes[] = shoppingCart.getTaxes();
       Vector<ShoppingCartTaxInfo> taxVector = new Vector<ShoppingCartTaxInfo>();
      if (taxes != null) {
        for (int i = 0; i < taxes.length; i++) {
          ShoppingCartTaxInfo taxInfo = new ShoppingCartTaxInfo();
          Tax tax = taxes[i].getTax();
          taxInfo.setTaxName(tax.getTaxLanguage().getTaxName());
          if (!contentBean.getContentSessionBean().isSiteProfileClassDefault()) {
            for (TaxLanguage language : tax.getTaxLanguages()) {
              if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
                if (language.getTaxName() != null) {
                  taxInfo.setTaxName(language.getTaxName());
                }
                break;
              }
            }
          }
          taxInfo.setTaxAmount(formatter.formatCurrency(taxes[i].getTaxAmount()));
          taxVector.add(taxInfo);
        }
      }
      Collections.sort(taxVector);
      form.setShoppingCartTaxInfos(taxVector);
     
      form.setPriceTotal(formatter.formatCurrency(shoppingCart.getShoppingCartSubTotal()));
      form.setTaxTotal(formatter.formatCurrency(shoppingCart.getTaxTotal()));
      form.setShippingTotal(formatter.formatCurrency(shoppingCart.getShippingTotal()));
      form.setShippingDiscountTotal(formatter.formatCurrency(shoppingCart.getShippingDiscountTotal()));
      form.setShippingOrderTotal(formatter.formatCurrency(shoppingCart.getShippingOrderTotal()));
      form.setOrderTotal(formatter.formatCurrency(shoppingCart.getOrderTotal()));
     
      Vector<?> shippingMethodVector = shoppingCart.getShippingMethods();
      Vector<LabelValueBean> smVector = new Vector<LabelValueBean>();
      iterator = shippingMethodVector.iterator();
      while (iterator.hasNext()) {
        ShippingMethod shippingMethod = (ShippingMethod) iterator.next();
        LabelValueBean bean = new LabelValueBean();
        bean.setLabel(shippingMethod.getShippingMethodLanguage().getShippingMethodName());
        bean.setValue(shippingMethod.getShippingMethodId().toString());
            if (!contentBean.getContentSessionBean().isSiteProfileClassDefault()) {
          for (ShippingMethodLanguage language : shippingMethod.getShippingMethodLanguages()) {
            if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
              if (language.getShippingMethodName() != null) {
                bean.setLabel(language.getShippingMethodName());
              }
              break;
            }
          }
            }
        smVector.add(bean);
      }
      LabelValueBean shippingMethods[] = new LabelValueBean[smVector.size()];
      smVector.copyInto(shippingMethods);
      form.setShippingMethods(shippingMethods);
     
      SiteDomainLanguage siteDomainLanguage = contentBean.getContentSessionBean().getSiteDomain().getSiteDomainLanguage();
      for (SiteDomainLanguage language : contentBean.getContentSessionBean().getSiteDomain().getSiteDomainLanguages()) {
        if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
          siteDomainLanguage = language;
          break;
        }
      }
     
      SiteDomainParamBean siteDomainParamBean = SiteDomainDAO.getSiteDomainParamBean(contentBean.getContentSessionBean().getSiteDomain().getSiteDomainLanguage(), siteDomainLanguage);
      form.setShoppingCartMessage(siteDomainParamBean.getCheckoutShoppingCartMessage());
      PaymentEngine paymentEngine = shoppingCart.getPaymentEngine();
      if (paymentEngine != null) {
        form.setPaymentGatewayProvider(paymentEngine.getClass().getSimpleName());
      }
      form.setCashPaymentOrder(shoppingCart.isCashPaymentOrder());
      form.setPayPal(shoppingCart.isPayPal());
      form.setCreditCard(shoppingCart.isCreditCard());
      form.setCashPayment(shoppingCart.isCashPayment());
     
      boolean includeShippingPickUp = false;
      if (siteDomainParamBean.getCheckoutIncludeShippingPickup() != null) {
        includeShippingPickUp = siteDomainParamBean.getCheckoutIncludeShippingPickup().equals(String.valueOf(Constants.VALUE_YES));
      }
      form.setIncludeShippingPickUp(includeShippingPickUp);
      shoppingCart.setIncludeShippingPickUp(includeShippingPickUp);
     
        form.setShippingValid(shoppingCart.isShippingValid());
        if (!shoppingCart.isShippingValid()) {
          messages.add("shippingLocation", new ActionMessage("content.error.shippingLocation.unsupported"));
          form.setAllowShippingQuote(false);
          if (siteDomainParamBean.getCheckoutAllowsShippingQuote() != null && siteDomainParamBean.getCheckoutAllowsShippingQuote().equals(String.valueOf(Constants.VALUE_YES))) {
            form.setAllowShippingQuote(true);
          }
        }
     
      ContentApi contentApi = new ContentApi(request);
     
      Vector<ItemInfo> crossSellItems = new Vector<ItemInfo>();
      iterator = shoppingCart.getShoppingCartItems().iterator();
      while (iterator.hasNext()) {
        ShoppingCartItem shoppingCartItem = (ShoppingCartItem) iterator.next();
        Item item = shoppingCartItem.getItem();
        if (item.getItemTypeCd().equals(Constants.ITEM_TYPE_SKU)) {
          item = item.getItemSkuParent();
        }
        Iterator<?> itemsCrossSell = item.getItemsCrossSell().iterator();
        while (itemsCrossSell.hasNext()) {
          Item upSellItem = (Item) itemsCrossSell.next();
          if (isExist(crossSellItems, upSellItem)) {
            continue;
          }
          ItemInfo itemInfo = contentApi.formatItem(upSellItem);
            crossSellItems.add(itemInfo);
View Full Code Here

        Iterator<?> iterator = orderHeader.getOrderItemDetails().iterator();
      Vector<ShoppingCartItemBean> vector = new Vector<ShoppingCartItemBean>();
        while (iterator.hasNext()) {
          OrderItemDetail orderItemDetail = (OrderItemDetail) iterator.next();
          ShoppingCartItemBean bean = new ShoppingCartItemBean();
          Item item = orderItemDetail.getItem();
          Item master = item;
          if (item != null) {
            if (item.getItemTypeCd().equals(Constants.ITEM_TYPE_SKU)) {
              master = item.getItemSkuParent();
            }
          }
         
          bean.setItemId("");
          if (item != null) {
            bean.setItemId(item.getItemId().toString());
          }
         
        bean.setItemNum(orderItemDetail.getItemNum());
        bean.setItemShortDesc(orderItemDetail.getItemShortDesc());
        bean.setItemQty(formatter.formatNumber(orderItemDetail.getItemOrderQty()));
        bean.setItemPrice(formatItemPrice(contentBean, orderItemDetail.getItemTierQty(), orderItemDetail.getItemTierPrice()));
        bean.setItemSubTotal(formatter.formatCurrency(orderItemDetail.getItemDetailAmount()));
        bean.setItemQtyError("");
      bean.setImageId(null);
      bean.setItemShortDesc(orderItemDetail.getItemShortDesc());
        if (item != null) {
          ItemImage itemImage = orderItemDetail.getItem().getItemLanguage().getImage();
          if (itemImage != null) {
            bean.setImageId(itemImage.getImageId().toString());
          }
          if (!contentBean.getContentSessionKey().isSiteProfileClassDefault()) {
            for (ItemLanguage language : master.getItemLanguages()) {
              if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
                if (language.getItemImageOverride().equals(String.valueOf(Constants.VALUE_YES))) {
                  bean.setImageId("");
                  if (language.getImage() != null) {
                    bean.setImageId(language.getImage().getImageId().toString());
View Full Code Here

    ContentSessionBean contentSessionBean = getContentBean(request).getContentSessionBean();
    Site site = contentSessionBean.getSiteDomain().getSite();
    String siteId = site.getSiteId();
    if (value != null) {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Item item = ItemDAO.loadNatural(siteId, itemNaturalKey);
      int itemRatingCount = item.getItemRatingCount().intValue();
      float itemRating = item.getItemRating().floatValue();
     
      int rate = Integer.parseInt(value);
      if (itemRatingCount != 0) {
        itemRating = ((itemRating * itemRatingCount) + rate) / (itemRatingCount + 1);
        itemRatingCount += 1;
      }
      else {
        itemRatingCount = 1;
        itemRating = rate;
      }
      item.setItemRating(new Float(itemRating));
      item.setItemRatingCount(new Integer(itemRatingCount));
      em.persist(item);
    }
        ActionForward forward = actionMapping.findForward("success") ;
        forward = new ActionForward(forward.getPath() +
                  contentSessionBean.getSiteDomain().getSiteDomainPrefix() +
View Full Code Here

              "where  child.itemId = :itemId";
      Query query = em.createQuery(sql);
      query.setParameter("itemId", item.getItemId());
      Iterator<?> iterator = query.getResultList().iterator();
      while (iterator.hasNext()) {
        Item i = (Item) iterator.next();
        if (!i.getItemTypeCd().equals(Constants.ITEM_TYPE_RECOMMAND_BUNDLE)) {
          continue;
        }
        itemPriceSearchUpdate(i, site, adminBean);
      }
    }
View Full Code Here

    Iterator<?> shoppingCartItems = shoppingCart.getShoppingCartItems().iterator();
    int seqNum = 0;
    while (shoppingCartItems.hasNext()) {
      ShoppingCartItem shoppingCartItem = (ShoppingCartItem) shoppingCartItems.next();
      OrderItemDetail orderItemDetail = new OrderItemDetail();
      Item item = shoppingCartItem.getItem();
      Item master = item;
      if (item.getItemTypeCd().equals(Constants.ITEM_TYPE_SKU)) {
        master = item.getItemSkuParent();
      }
      orderItemDetail.setSeqNum(Integer.valueOf(seqNum++));
      orderItemDetail.setItemNum(item.getItemNum());
      orderItemDetail.setItemUpcCd(item.getItemUpcCd());
orderItemDetail.setItemSkuCd(item.getItemSkuCd());
      orderItemDetail.setItemShortDesc(master.getItemLanguage().getItemShortDesc());
      if (master.getItemLanguage().getItemShortDesc().length() > 128) {
        orderItemDetail.setItemShortDesc(master.getItemLanguage().getItemShortDesc().substring(0, 127));
      }
      if (!contentSessionKey.isSiteProfileClassDefault()) {
        for (ItemLanguage language : master.getItemLanguages()) {
          if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentSessionKey.getSiteProfileClassId())) {
            if (language.getItemShortDesc() != null) {
              orderItemDetail.setItemShortDesc(language.getItemShortDesc());
            }
            break;
View Full Code Here

     
        Language language = contentBean.getContentSessionBean().getSiteProfile().getSiteProfileClass().getLanguage();
          String itemNauralKeys[] = form.getItemNaturalKeys();
          if (itemNauralKeys != null) {
            for (int i = 0; i < itemNauralKeys.length; i++) {
              Item item = DataApi.getInstance().getItem(site.getSiteId(), itemNauralKeys[i]);
              try {
              if (item.getItemTypeCd().equals(Constants.ITEM_TYPE_RECOMMAND_BUNDLE)) {
                for (Item child : item.getChildren()) {
                  shoppingCart.setItemQty(child, 1, itemAttributeInfos, contentBean, false);
                }
              }
              else if (item.getItemTypeCd().equals(Constants.ITEM_TYPE_TEMPLATE)) {
                item = getItem(form, site.getSiteId());
                shoppingCart.setItemQty(item, 1, itemAttributeInfos, contentBean, false);
              }
              else {
                shoppingCart.setItemQty(item, 1, itemAttributeInfos, contentBean, false);
              }
              } catch (ItemNotAvailiableException itemNotAvailiableException) {
                String value = Languages.getLangTranValue(language.getLangId(), "content.text.itemQuatityNotAvailable");
              ShoppingCartItemBean itemInfo = (ShoppingCartItemBean) form.getShoppingCartItemInfos().elementAt(i);
              itemInfo.setItemQtyError(value);
              }
            }
          }
          else {
            /*
             * Only intended to be used with older version of templates.
             */
            String itemIds[] = form.getItemIds();
            if (itemIds != null) {
              for (int i = 0; i < itemIds.length; i++) {
                Item item = DataApi.getInstance().getItem(site.getSiteId(), Format.getLong(itemIds[i]));
              if (item.getItemTypeCd().equals(Constants.ITEM_TYPE_RECOMMAND_BUNDLE)) {
                for (Item child : item.getChildren()) {
                  shoppingCart.setItemQty(child, 1, itemAttributeInfos, contentBean, false);
                }
              }
              else if (item.getItemTypeCd().equals(Constants.ITEM_TYPE_TEMPLATE)) {
                item = getItem(form, site.getSiteId());
                shoppingCart.setItemQty(item, 1, itemAttributeInfos, contentBean, false);
              }
              else {
                shoppingCart.setItemQty(item, 1, itemAttributeInfos, contentBean, false);
View Full Code Here

            for (int i = 0; i < itemNaturalKeys.length; i++) {
              int qty = 0;
              if (itemQtys[i].trim().length() != 0) {
                qty = Format.getInt(itemQtys[i]);
              }
              Item item = DataApi.getInstance().getItem(site.getSiteId(), itemNaturalKeys[i]);
          try {
            shoppingCart.setItemQty(item, qty, null, getContentBean(request), true);
          }
          catch (ItemNotAvailiableException e) {
               messages.add("message", new ActionMessage("content.text.itemQuatityNotAvailable"));
View Full Code Here

      String itemNaturalKeys[] = form.getItemNaturalKeys();
      if (itemNaturalKeys.length != 1) {
        return null;
      }
     
      Item item = DataApi.getInstance().getItem(siteId, itemNaturalKeys[0]);
      String customAttribValues[] = form.getCustomAttribValues();
     
      for (Item child : item.getItemSkus()) {
        boolean found = true;
        for (ItemAttributeDetail itemAttributeDetail : child.getItemAttributeDetails()) {
          if (itemAttributeDetail.getCustomAttributeDetail().getCustomAttribute().getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_SKU_MAKEUP) {
            String optionId = itemAttributeDetail.getCustomAttributeOption().getCustomAttribOptionId().toString();
            boolean exist = false;
View Full Code Here

TOP

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

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.