Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.ContentLanguage


      jsonResult.put("contentTitle", contentTitle);
      int counter = 0;
      Vector<JSONEscapeObject> vector = new Vector<JSONEscapeObject>();
        while (iterator.hasNext()) {
          Content content = (Content) iterator.next();
      ContentLanguage contentLanguage = null;
      for (ContentLanguage language : content.getContentLanguages()) {
        if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassDefaultId)) {
          contentLanguage = language;
        }
      }
          JSONEscapeObject jsonContent = new JSONEscapeObject();
          jsonContent.put("contentId", content.getContentId());
          jsonContent.put("contentTitle", contentLanguage.getContentTitle());
          vector.add(jsonContent);
          counter++;
          if (counter == Constants.ADMIN_SEARCH_MAXCOUNT) {
              MessageResources resources = this.getResources(request);
            jsonResult.put("message", resources.getMessage("error.lookup.tooManyRecord"));
View Full Code Here


 
  public ContentInfo formatContent(Content content) throws Exception {
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();

    ContentInfo contentInfo = new ContentInfo();
    ContentLanguage contentLanguageDefault = content.getContentLanguage();
        contentInfo.setContentTitle(contentLanguageDefault.getContentTitle());
        contentInfo.setContentShortDesc(contentLanguageDefault.getContentShortDesc());
        contentInfo.setContentDesc(contentLanguageDefault.getContentDesc());
        if (Format.isNullOrEmpty(contentLanguageDefault.getPageTitle())) {
          contentInfo.setPageTitle(contentLanguageDefault.getContentTitle());
        }
        else {
          contentInfo.setPageTitle(contentLanguageDefault.getPageTitle());
        }
        if (Format.isNullOrEmpty(contentLanguageDefault.getMetaKeywords())) {
          contentInfo.setMetaKeywords(contentLanguageDefault.getContentTitle());
        }
        else {
          contentInfo.setMetaKeywords(contentLanguageDefault.getMetaKeywords());
        }
        if (Format.isNullOrEmpty(contentLanguageDefault.getMetaDescription())) {
          contentInfo.setMetaDescription(contentLanguageDefault.getContentTitle());
        }
        else {
          contentInfo.setMetaDescription(contentLanguageDefault.getMetaDescription());
        }
        contentInfo.setContentDefaultImageUrl(null);
        if (contentLanguageDefault.getImage() != null) {
          String imageUrl = imageUrlPrefix +
                    "?type=C" +
                    "&imageId=" + contentLanguageDefault.getImage().getImageId();
          contentInfo.setContentDefaultImageUrl(imageUrl);
        }
        Vector<String> contentImages = new Vector<String>();
        Iterator<?> iterator = contentLanguageDefault.getImages().iterator();
        while (iterator.hasNext()) {
          ContentImage image = (ContentImage) iterator.next();
          String imageUrl = imageUrlPrefix +
                    "?type=C" +
                    "&imageId=" + image.getImageId();
          contentImages.add(imageUrl);
        }
        contentInfo.setContentImageUrls(contentImages);
        if (!contentBean.getContentSessionBean().isSiteProfileClassDefault()) {
        ContentLanguage contentLanguage = null;
        for (ContentLanguage language : content.getContentLanguages()) {
          if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfile.getSiteProfileClass().getSiteProfileClassId())) {
            contentLanguage = language;
            break;
          }
        }
        if (contentLanguage != null) {
         if (contentLanguage.getContentTitle() != null) {
          contentInfo.setContentTitle(contentLanguage.getContentTitle());
        }
        if (contentLanguage.getContentShortDesc() != null) {
          contentInfo.setContentShortDesc(contentLanguage.getContentShortDesc());
        }
        if (contentLanguage.getContentDesc() != null) {
          contentInfo.setContentDesc(contentLanguage.getContentDesc());
        }
        if (Format.isNullOrEmpty(contentLanguageDefault.getPageTitle())) {
          if (contentLanguage.getContentTitle() != null) {
            contentInfo.setPageTitle(contentLanguage.getContentTitle());
          }
        }
        else {
          if (contentLanguage.getPageTitle() != null) {
            contentInfo.setPageTitle(contentLanguage.getPageTitle());
          }
        }
        if (Format.isNullOrEmpty(contentLanguageDefault.getMetaKeywords())) {
          if (contentLanguage.getContentTitle() != null) {
            contentInfo.setMetaKeywords(contentLanguage.getContentTitle());
          }
        }
        else {
          if (contentLanguage.getMetaKeywords() != null) {
            contentInfo.setMetaKeywords(contentLanguage.getMetaKeywords());
          }
        }
        if (Format.isNullOrEmpty(contentLanguageDefault.getMetaDescription())) {
          if (contentLanguage.getContentTitle() != null) {
            contentInfo.setMetaDescription(contentLanguage.getContentTitle());
          }
        }
        else {
          if (contentLanguage.getMetaKeywords() != null) {
            contentInfo.setMetaDescription(contentLanguage.getMetaDescription());
          }
        }
        if (contentLanguage.getContentImageOverride().equals(String.valueOf(Constants.VALUE_YES))) {
            if (contentLanguage.getContentImageOverride().equals(String.valueOf(Constants.VALUE_YES))) {
              String url = null;
                  contentInfo.setContentDefaultImageUrl(null);
                  if (contentLanguage.getImage() != null) {
                    url = "?type=C&" +
                        "&imageId=" + contentLanguage.getImage().getImageId();
                    contentInfo.setContentDefaultImageUrl(imageUrlPrefix + url);
                  }
                  contentImages = new Vector<String>();
                  Iterator<?> images = contentLanguage.getImages().iterator();
                  while (images.hasNext()) {
                    ContentImage image = (ContentImage) images.next();
                    url = "?type=C" +
                        "&imageId=" + image.getImageId();
                    contentImages.add(imageUrlPrefix + url);
View Full Code Here

        }
        jsonDetail.put("type", "Item");
        jsonDetail.put("homePageDesc", itemLanguage.getItemShortDesc() + " - " + item.getItemSkuCd());
      }
      if (content != null) {
        ContentLanguage contentLanguage = null;
        for (ContentLanguage language : content.getContentLanguages()) {
          if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassDefaultId())) {
            contentLanguage = language;
          }
        }
        jsonDetail.put("type", "Content");
        jsonDetail.put("homePageDesc", contentLanguage.getContentTitle());
      }
      if (feature != null) {
        if (feature.getHomePageDetailId().equals(homePageDetail.getHomePageDetailId())) {
          jsonDetail.put("feature", true);
        }
View Full Code Here

        displayForm.setHomePageDetailId(homePageDetail.getHomePageDetailId().toString());
        displayForm.setSeqNum(Format.getInt(homePageDetail.getSeqNum()));
        displayForm.setFeatureData("N");
        if (homePageDetail.getContent() != null) {
            Content content = homePageDetail.getContent();
        ContentLanguage contentLanguage = null;
        for (ContentLanguage language : content.getContentLanguages()) {
          if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassDefaultId())) {
            contentLanguage = language;
          }
        }
            displayForm.setDataType("Content");
            displayForm.setDescription(contentLanguage.getContentTitle());
              displayForm.setPublished(String.valueOf(content.getPublished()));
              displayForm.setDataPublishOn(Format.getFullDate(content.getContentPublishOn()));
              displayForm.setDataExpireOn(Format.getFullDate(content.getContentExpireOn()));
        }
        if (homePageDetail.getItem() != null) {
View Full Code Here

      ModerationMaintActionForm form = (ModerationMaintActionForm) actionForm;
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
        JSONEscapeObject json = new JSONEscapeObject();
        Iterator<?> iterator = null;
      Content content = (Content) em.find(Content.class, Format.getLong(form.getContentId()));
    ContentLanguage contentLanguage = null;
    for (ContentLanguage language : content.getContentLanguages()) {
      if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassDefaultId())) {
        contentLanguage = language;
      }
    }
        json.put("contentTitle", contentLanguage.getContentTitle());
        json.put("contentShortDesc", contentLanguage.getContentShortDesc());
        json.put("contentDesc", contentLanguage.getContentDesc());
        iterator = content.getComments().iterator();
     
         Vector<JSONEscapeObject> comments = new Vector<JSONEscapeObject>();
         while (iterator.hasNext()) {
           Comment comment = (Comment) iterator.next();
View Full Code Here

      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Long siteProfileClassId = form.getSiteProfileClassId();
      User user = adminBean.getUser();
      Iterator<?> iterator = content.getContentLanguages().iterator();
      boolean found = false;
      ContentLanguage contentLanguage = null;
      while (iterator.hasNext()) {
        contentLanguage = (ContentLanguage) iterator.next();
        if (contentLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
          found = true;
          break;
        }
      }
      if (!found) {
        contentLanguage = new ContentLanguage();
        contentLanguage.setRecCreateBy(user.getUserId());
        contentLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
        contentLanguage.setContentImageOverride(String.valueOf(Constants.VALUE_NO));
        SiteProfileClass siteProfileClass = (SiteProfileClass) em.find(SiteProfileClass.class, siteProfileClassId);
        contentLanguage.setSiteProfileClass(siteProfileClass);
        contentLanguage.setContent(content);
        content.getContentLanguages().add(contentLanguage);
      }
      if (form.isContentTitleLangFlag()) {
        contentLanguage.setContentTitle(form.getContentTitleLang());
      }
      else {
        contentLanguage.setContentTitle(null);
      }
      if (form.isContentShortDescLangFlag()) {
        contentLanguage.setContentShortDesc(form.getContentShortDescLang());
      }
      else {
        contentLanguage.setContentShortDesc(null);
      }
      if (form.isContentDescLangFlag()) {
        contentLanguage.setContentDesc(form.getContentDescLang());
      }
      else {
        contentLanguage.setContentDesc(null);
      }
      if (form.isPageTitleLangFlag()) {
        contentLanguage.setPageTitle(form.getPageTitleLang());
      }
      else {
        contentLanguage.setPageTitle(null);
      }
      if (form.isMetaKeywordsLangFlag()) {
        contentLanguage.setMetaKeywords(form.getMetaKeywordsLang());
      }
      else {
        contentLanguage.setMetaKeywords(null);
      }
      if (form.isMetaDescriptionLangFlag()) {
        contentLanguage.setMetaDescription(form.getMetaDescriptionLang());
      }
      else {
        contentLanguage.setMetaDescription(null);
      }
      contentLanguage.setRecUpdateBy(user.getUserId());
      contentLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      em.persist(contentLanguage);
  }
View Full Code Here

      em.persist(contentLanguage);
  }
 
  public void saveDefault(Content content, ContentMaintActionForm form, AdminBean adminBean) throws Exception {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      ContentLanguage contentLanguage = content.getContentLanguage();
      if (contentLanguage == null) {
        contentLanguage = new ContentLanguage();
        contentLanguage.setContentImageOverride(String.valueOf(Constants.VALUE_NO));
        contentLanguage.setRecCreateBy(adminBean.getUser().getUserId());
        contentLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
        SiteProfileClass siteProfileClass = SiteProfileClassDAO.load(form.getSiteProfileClassDefaultId());
        contentLanguage.setSiteProfileClass(siteProfileClass);
        content.getContentLanguages().add(contentLanguage);
        content.setContentLanguage(contentLanguage);
      }
     
    contentLanguage.setContentTitle(form.getContentTitle());
    contentLanguage.setContentShortDesc(form.getContentShortDesc());
    contentLanguage.setContentDesc(form.getContentDesc());
    contentLanguage.setPageTitle(form.getPageTitle());
    contentLanguage.setMetaKeywords(form.getMetaKeywords());
    contentLanguage.setMetaDescription(form.getMetaDescription());
    contentLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
    contentLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));

    content.setContentNaturalKey(Utility.encode(form.getContentTitle()));
    content.setContentPublishOn(Format.getDate(form.getContentPublishOn()));
    content.setContentExpireOn(Format.getDate(form.getContentExpireOn()));
    content.setRecUpdateBy(adminBean.getUser().getUserId());
View Full Code Here

      jsonResult.put("message", resources.getMessage("error.image.invalid"));
      streamWebService(response, jsonResult.toHtmlString());
          return null;
    }
   
    ContentLanguage contentLanguage = null;
    for (ContentLanguage language : content.getContentLanguages()) {
      if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassId())) {
        contentLanguage = language;
        break;
      }
    }
   
    if (form.isSiteProfileClassDefault()) {
      ContentImage contentImage = new ContentImage();
      contentImage.setImageName(file.getFileName());
      contentImage.setContentType("image/jpeg");
      contentImage.setImageValue(scaler.getBytes());
      contentImage.setImageHeight(scaler.getHeight());
      contentImage.setImageWidth(scaler.getWidth());
      contentImage.setRecUpdateBy(adminBean.getUser().getUserId());
      contentImage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      contentImage.setRecCreateBy(adminBean.getUser().getUserId());
      contentImage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      em.persist(contentImage);
      if (contentLanguage.getImage() == null) {
        contentLanguage.setImage(contentImage);
      }
      else {
        contentImage.setContentLanguage(contentLanguage);
        contentLanguage.getImages().add(contentImage);
      }
      contentLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
      contentLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      em.persist(contentLanguage);
    }
    else {
      if (contentLanguage == null) {
        contentLanguage = new ContentLanguage();
        contentLanguage.setContent(content);
        contentLanguage.setRecCreateBy(adminBean.getUser().getUserId());
        contentLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
        SiteProfileClass siteProfileClass = SiteProfileClassDAO.load(form.getSiteProfileClassId());
        contentLanguage.setSiteProfileClass(siteProfileClass);
        em.persist(contentLanguage);
      }
      ContentImage contentImage = new ContentImage();
      contentImage.setImageName(file.getFileName());
      contentImage.setContentType("image/jpeg");
      contentImage.setImageValue(scaler.getBytes());
      contentImage.setImageHeight(scaler.getHeight());
      contentImage.setImageWidth(scaler.getWidth());
      contentImage.setRecUpdateBy(adminBean.getUser().getUserId());
      contentImage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      contentImage.setRecCreateBy(adminBean.getUser().getUserId());
      contentImage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      em.persist(contentImage);
      if (contentLanguage.getImage() == null) {
        contentLanguage.setImage(contentImage);
      }
      else {
        contentImage.setContentLanguage(contentLanguage);
        contentLanguage.getImages().add(contentImage);
      }
      contentLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
      contentLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      em.persist(contentImage);
    }
   
    jsonResult = createJsonImages(site.getSiteId(), content, form);
    jsonResult.put("recUpdateBy", content.getRecUpdateBy());
View Full Code Here

  public JSONEscapeObject createJsonImages(String siteId, Content content, ContentMaintActionForm form) throws Exception {
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("isSiteProfileClassDefault", form.isSiteProfileClassDefault());
   
    Vector<JSONEscapeObject> vector = new Vector<JSONEscapeObject>();
    ContentLanguage contentLanguageDefault = null;
    ContentLanguage contentLanguage = null;
    for (ContentLanguage language : content.getContentLanguages()) {
      if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassDefaultId())) {
        contentLanguageDefault = language;
      }
      if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassId())) {
        contentLanguage = language;
      }
    }
   
    ContentLanguage effectiveLanguage = contentLanguageDefault;
    if (!form.isSiteProfileClassDefault() && contentLanguage != null) {
      if (contentLanguage.getContentImageOverride().equals(String.valueOf(Constants.VALUE_YES))) {
        effectiveLanguage = contentLanguage;
      }
    }
   
    ContentImage 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()) {
      ContentImage image = (ContentImage) iterator.next();
      JSONEscapeObject jsonImage = new JSONEscapeObject();
      jsonImage.put("imageId", image.getImageId());
      jsonImage.put("imageName", image.getImageName());
View Full Code Here

    initSiteProfiles(form, adminBean.getSite());
   
    Content content = ContentDAO.load(adminBean.getSite().getSiteId(), Format.getLong(form.getContentId()));
      boolean found = false;
      Iterator<?> iterator = content.getContentLanguages().iterator();
      ContentLanguage contentLanguage = null;
    while (iterator.hasNext()) {
      contentLanguage = (ContentLanguage) iterator.next();
      if (contentLanguage.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassId())) {
        found = true;
        break;
      }
    }
    if (!found) {
      SiteProfileClass siteProfileClass = (SiteProfileClass) em.find(SiteProfileClass.class, form.getSiteProfileClassId());
      contentLanguage = new ContentLanguage();
      contentLanguage.setContent(content);
      contentLanguage.setRecCreateBy(adminBean.getUser().getUserId());
      contentLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      contentLanguage.setSiteProfileClass(siteProfileClass);
    }
    if (form.getImagesOverride().equalsIgnoreCase("true")) {
      contentLanguage.setContentImageOverride(String.valueOf(Constants.VALUE_YES));
    }
    else {
      ContentImage contentImage = null;
      if (contentLanguage.getImage() != null) {
        contentImage = contentLanguage.getImage();
        em.remove(contentImage);
        contentLanguage.setImage(null);
      }
      iterator = contentLanguage.getImages().iterator();
      while (iterator.hasNext()) {
        contentImage = (ContentImage) iterator.next();
        em.remove(contentImage);
      }
      contentLanguage.setContentImageOverride(String.valueOf(Constants.VALUE_NO));
    }
    contentLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
    contentLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    em.persist(contentLanguage);
   
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
    String jsonString = jsonResult.toHtmlString();
View Full Code Here

TOP

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

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.