Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.ItemImage


        break;
      }
    }
   
    if (form.isSiteProfileClassDefault()) {
      ItemImage itemImage = new ItemImage();
      itemImage.setImageName(file.getFileName());
      itemImage.setContentType("image/jpeg");
      itemImage.setImageValue(scaler.getBytes());
      itemImage.setImageHeight(scaler.getHeight());
      itemImage.setImageWidth(scaler.getWidth());
      itemImage.setRecUpdateBy(adminBean.getUser().getUserId());
      itemImage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      itemImage.setRecCreateBy(adminBean.getUser().getUserId());
      itemImage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      em.persist(itemImage);
      if (itemLanguage.getImage() == null) {
        itemLanguage.setImage(itemImage);
      }
      else {
        itemImage.setItemLanguage(itemLanguage);
        itemLanguage.getImages().add(itemImage);
      }
      itemLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
      itemLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      em.persist(itemLanguage);
    }
    else {
      if (itemLanguage == null) {
        itemLanguage = new ItemLanguage();
        itemLanguage.setItem(item);
        itemLanguage.setRecCreateBy(adminBean.getUser().getUserId());
        itemLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
        SiteProfileClass siteProfileClass = SiteProfileClassDAO.load(form.getSiteProfileClassId());
        itemLanguage.setSiteProfileClass(siteProfileClass);
      }
      ItemImage itemImage = new ItemImage();
      itemImage.setImageName(file.getFileName());
      itemImage.setContentType("image/jpeg");
      itemImage.setImageValue(scaler.getBytes());
      itemImage.setImageHeight(scaler.getHeight());
      itemImage.setImageWidth(scaler.getWidth());
      itemImage.setRecUpdateBy(adminBean.getUser().getUserId());
      itemImage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      itemImage.setRecCreateBy(adminBean.getUser().getUserId());
      itemImage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      em.persist(itemImage);
      if (itemLanguage.getImage() == null) {
        itemLanguage.setImage(itemImage);
      }
      else {
        itemImage.setItemLanguage(itemLanguage);
        itemLanguage.getImages().add(itemImage);
      }
      itemLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
      itemLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      em.persist(itemImage);
View Full Code Here


      if (itemLanguage.getItemImageOverride().equals(String.valueOf(Constants.VALUE_YES))) {
        effectiveLanguage = itemLanguage;
      }
    }
   
    ItemImage defaultImage = effectiveLanguage.getImage();
    if (defaultImage != null) {
      JSONEscapeObject jsonDefaultImage = new JSONEscapeObject();
      jsonDefaultImage.put("imageId", defaultImage.getImageId());
      jsonDefaultImage.put("imageName", defaultImage.getImageName());
      jsonDefaultImage.put("isLanguageDefault", true);
      jsonResult.put("defaultImage", jsonDefaultImage);
    }
   
    Iterator<?> iterator = effectiveLanguage.getImages().iterator();
    while (iterator.hasNext()) {
      ItemImage image = (ItemImage) iterator.next();
      JSONEscapeObject jsonImage = new JSONEscapeObject();
      jsonImage.put("imageId", image.getImageId());
      jsonImage.put("imageName", image.getImageName());
      jsonImage.put("isLanguageDefault", true);
      vector.add(jsonImage);
    }
    jsonResult.put("images", vector);
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
View Full Code Here

    }
    if (form.getImagesOverride().equalsIgnoreCase("true")) {
      itemLanguage.setItemImageOverride(String.valueOf(Constants.VALUE_YES));
    }
    else {
      ItemImage itemImage = null;
      if (itemLanguage.getImage() != null) {
        itemImage = itemLanguage.getImage();
        em.remove(itemImage);
        itemLanguage.setImage(null);
      }
View Full Code Here

        itemLanguage = language;
        break;
      }
    }
    if (itemLanguage != null) {
      ItemImage defaultImage = itemLanguage.getImage();
      if (imageIds != null) {
        for (int i = 0; i < imageIds.length; i++) {
          if (defaultImage != null && defaultImage.getImageId().equals(Format.getLong(imageIds[i]))) {
            itemLanguage.setImage(null);
            em.persist(itemLanguage);
            em.remove(defaultImage);
            defaultImage = null;
          }
          else {
            ItemImage itemImage = ItemImageDAO.load(site.getSiteId(), Format.getLong(imageIds[i]));
            em.remove(itemImage);
          }
        }
      }
      itemLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
      itemLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      em.flush();
      em.refresh(itemLanguage);
     
      if (itemLanguage.getImage() == null) {
        Set<?> images = itemLanguage.getImages();
        if (!images.isEmpty()) {
          ItemImage itemImage = (ItemImage) images.iterator().next();
          itemLanguage.setImage(itemImage);
          images.remove(itemImage);
        }
      }
    }
View Full Code Here

        itemLanguage = language;
        break;
      }
    }
    String defaultImageId = form.getCreateDefaultImageId();
    ItemImage itemImage = ItemImageDAO.load(site.getSiteId(), Format.getLong(defaultImageId));
   
    ItemImage currentImage = itemLanguage.getImage();
    currentImage.setItemLanguage(itemLanguage);
    itemLanguage.getImages().add(currentImage);
   
    itemImage.setItemLanguage(null);
    itemLanguage.setImage(itemImage);
    itemLanguage.getImages().remove(itemImage);
View Full Code Here

      if (sourceLanguage.getSiteProfileClass().getSiteProfileClassId().equals(adminBean.getSite().getSiteProfileClassDefault().getSiteProfileClassId())) {
        item.setItemLanguage(itemLanguage);
      }
     
      if (sourceLanguage.getImage() != null) {
        ItemImage sourceImage = sourceLanguage.getImage();
        ItemImage itemImage = new ItemImage();
        itemImage.setSeqNum(sourceImage.getSeqNum());
        itemImage.setContentType(sourceImage.getContentType());
        itemImage.setImageName(sourceImage.getImageName());
        itemImage.setImageValue(sourceImage.getImageValue());
        itemImage.setImageHeight(sourceImage.getImageHeight());
        itemImage.setImageWidth(sourceImage.getImageWidth());
        itemImage.setRecUpdateBy(user.getUserId());
        itemImage.setRecUpdateDatetime(new Date());
        itemImage.setRecCreateBy(user.getUserId());
        itemImage.setRecCreateDatetime(new Date());
        em.persist(itemImage);
        itemLanguage.setImage(itemImage);
      }
     
      for (ItemImage sourceImage : sourceLanguage.getImages()) {
        ItemImage itemImage = new ItemImage();
        itemImage.setSeqNum(sourceImage.getSeqNum());
        itemImage.setContentType(sourceImage.getContentType());
        itemImage.setImageName(sourceImage.getImageName());
        itemImage.setImageValue(sourceImage.getImageValue());
        itemImage.setImageHeight(sourceImage.getImageHeight());
        itemImage.setImageWidth(sourceImage.getImageWidth());
        itemImage.setRecUpdateBy(user.getUserId());
        itemImage.setRecUpdateDatetime(new Date());
        itemImage.setRecCreateBy(user.getUserId());
        itemImage.setRecCreateDatetime(new Date());
        itemLanguage.getImages().add(itemImage);
        em.persist(itemImage);
      }
    }
   
View Full Code Here

  }
 
  static byte[] getItemImage(HttpServletRequest request, String id, int maxsize) throws Exception {
    byte data[] = null;
    String contentType = null;
    ItemImage image = ItemImageDAO.load(Long.valueOf(id));
    if (image != null) {
      data = image.getImageValue();
      contentType = image.getContentType();
    }
    else {
        data = transparent;
        contentType = "jpeg";
    }
View Full Code Here

        Item master = detail.getItem();
        if (item.getItemTypeCd().equals(Constants.ITEM_TYPE_SKU)) {
          master = item.getItemSkuParent();
        }
         
        ItemImage itemImage = master.getItemLanguage().getImage();
        if (itemImage != null) {
          dform.setImageId(itemImage.getImageId().toString());
        }
        dform.setItemShortDesc(master.getItemLanguage().getItemShortDesc());
        if (!contentBean.getContentSessionKey().isSiteProfileClassDefault()) {
          for (ItemLanguage itemLanguage : master.getItemLanguages()) {
            if (itemLanguage.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
View Full Code Here

          itemInfo.setItemDefaultImageUrl(imageUrl);
        }
        Vector<String> itemImages = new Vector<String>();
        Iterator<?> iterator = masterLanguageDefault.getImages().iterator();
        while (iterator.hasNext()) {
          ItemImage image = (ItemImage) iterator.next();
          String imageUrl = imageUrlPrefix + "?type=I&imageId=" + image.getImageId();
          itemImages.add(imageUrl);
        }
        itemInfo.setItemImageUrls(itemImages);
       
        if (!contentBean.getContentSessionKey().isSiteProfileClassDefault()) {
        ItemLanguage masterLanguage = master.getItemLanguage();
        for (ItemLanguage language : master.getItemLanguages()) {
          if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfile.getSiteProfileClass().getSiteProfileClassId())) {
            masterLanguage = language;
            break;
          }
        }
          if (masterLanguage != null) {
        if (masterLanguage.getItemShortDesc() != null) {
          itemInfo.setItemShortDesc(masterLanguage.getItemShortDesc());
        }
        if (masterLanguage.getItemDesc() != null) {
          itemInfo.setItemDesc(masterLanguage.getItemDesc());
        }
        if (masterLanguage.getPageTitle() != null) {
          itemInfo.setPageTitle(masterLanguage.getPageTitle());
        }
        if (masterLanguage.getMetaKeywords() != null) {
          itemInfo.setMetaKeywords(masterLanguage.getMetaKeywords());
        }
        if (masterLanguage.getMetaDescription() != null) {
          itemInfo.setMetaDescription(masterLanguage.getMetaDescription());
        }
        if (masterLanguage.getItemImageOverride().equals(String.valueOf(Constants.VALUE_YES))) {
          String url = null;
              itemInfo.setItemDefaultImageUrl(null);
              if (masterLanguage.getImage() != null) {
                url = "?type=I&imageId=" + masterLanguage.getImage().getImageId();
                itemInfo.setItemDefaultImageUrl(imageUrlPrefix + url);
              }
              itemImages = new Vector<String>();
              Iterator<?> images = masterLanguage.getImages().iterator();
              while (images.hasNext()) {
                ItemImage image = (ItemImage) images.next();
                url = "?type=I&imageId=" + image.getImageId();
                itemImages.add(imageUrlPrefix + url);
              }
              itemInfo.setItemImageUrls(itemImages);
        }
          }
View Full Code Here

        detail.setItemSubTotal(formatter.formatCurrency(orderItemDetail.getItemDetailAmount()));
       
        Item item = orderItemDetail.getItem();
        Vector<com.jada.content.data.ItemAttributeInfo> v = new Vector<com.jada.content.data.ItemAttributeInfo>();
        if (item != null) {
          ItemImage itemImage = item.getItemLanguage().getImage();
          if (itemImage != null) {
            detail.setImageId(itemImage.getImageId().toString());
          }
              if (!siteProfileClassDefault){
                for (ItemLanguage itemLanguage : item.getItemLanguages()) {
                  if (itemLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
                    if (itemLanguage.getItemImageOverride().equals(String.valueOf(Constants.VALUE_YES))) {
View Full Code Here

TOP

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

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.