Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.ContentLanguage


   
    Content content = new Content();
    content = ContentDAO.load(site.getSiteId(), Format.getLong(form.getContentId()));
    String imageIds[] = form.getRemoveImages();
   
    ContentLanguage contentLanguage = null;
    for (ContentLanguage language : content.getContentLanguages()) {
      if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassId())) {
        contentLanguage = language;
        break;
      }
    }
    if (contentLanguage != null) {
      ContentImage defaultImage = contentLanguage.getImage();
      if (imageIds != null) {
        for (int i = 0; i < imageIds.length; i++) {
          if (defaultImage != null && defaultImage.getImageId().equals(Format.getLong(imageIds[i]))) {
            contentLanguage.setImage(null);
            em.persist(contentLanguage);
            em.remove(defaultImage);
            defaultImage = null;
          }
          else {
            ContentImage contentImage = ContentImageDAO.load(site.getSiteId(), Format.getLong(imageIds[i]));
            contentLanguage.getImages().remove(contentImage);
            em.remove(contentImage);
          }
        }
      }
      contentLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
      contentLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
     
      if (contentLanguage.getImage() == null) {
        Set<?> images = contentLanguage.getImages();
        if (!images.isEmpty()) {
          ContentImage contentImage = (ContentImage) images.iterator().next();
          contentLanguage.setImage(contentImage);
          contentImage.setContentLanguage(null);
          images.remove(contentImage);
        }
      }
    }
View Full Code Here


    Site site = adminBean.getSite();
    initSiteProfiles(form, site);
   
    Content content = ContentDAO.load(site.getSiteId(), Format.getLong(form.getContentId()));
   
    ContentLanguage contentLanguage = null;
    for (ContentLanguage language : content.getContentLanguages()) {
      if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassId())) {
        contentLanguage = language;
        break;
      }
    }
    String defaultImageId = form.getCreateDefaultImageId();
    ContentImage contentImage = ContentImageDAO.load(site.getSiteId(), Format.getLong(defaultImageId));
   
    ContentImage currentImage = contentLanguage.getImage();
    currentImage.setContentLanguage(contentLanguage);
    contentLanguage.getImages().add(currentImage);
   
    contentImage.setContentLanguage(contentLanguage);
    contentImage.setContentLanguage(null);
    contentLanguage.setImage(contentImage);
    contentLanguage.getImages().remove(contentImage);
   
    contentLanguage.setRecUpdateBy(adminBean.getUser().getUserId());
    contentLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    em.persist(contentLanguage);
   
    JSONEscapeObject jsonResult = createJsonImages(site.getSiteId(), content, form);
    jsonResult.put("recUpdateBy", content.getRecUpdateBy());
    jsonResult.put("recUpdateDatetime", Format.getFullDatetime(content.getRecUpdateDatetime()));
View Full Code Here

    JSONEscapeObject jsonResult = new JSONEscapeObject();
    Iterator<?> iterator = content.getContentsRelated().iterator();
    Vector<JSONEscapeObject> contents = new Vector<JSONEscapeObject>();
    while (iterator.hasNext()) {
      Content contentRelated = (Content) iterator.next();
      ContentLanguage contentLanguage = null;
      for (ContentLanguage language : contentRelated.getContentLanguages()) {
        if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassDefaultId())) {
          contentLanguage = language;
          break;
        }
      }
      JSONEscapeObject contentObject = new JSONEscapeObject();
      contentObject.put("contentId", contentRelated.getContentId());
      contentObject.put("contentTitle", contentLanguage.getContentTitle());
      contents.add(contentObject);
    }
    jsonResult.put("contents", contents);
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
View Full Code Here

    return null;
  }
 
  private void copyProperties(ContentMaintActionForm form, Content content) throws Exception {
      ContentLanguage defaultContentLanguage = null;
      for (ContentLanguage language : content.getContentLanguages()) {
        if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassDefaultId())) {
          defaultContentLanguage = language;
        }
      }
     
    form.setContentId(Format.getLong(content.getContentId()));
    form.setContentTitle(defaultContentLanguage.getContentTitle());
    form.setContentShortDesc(defaultContentLanguage.getContentShortDesc());
    form.setContentDesc(defaultContentLanguage.getContentDesc());
    form.setPageTitle(defaultContentLanguage.getPageTitle());
    form.setMetaKeywords(defaultContentLanguage.getMetaKeywords());
    form.setMetaDescription(defaultContentLanguage.getMetaDescription());
    form.setContentHitCounter(Format.getIntObj(content.getContentHitCounter()));
    form.setContentRating(Format.getFloatObj(content.getContentRating()));
    form.setContentRatingCount(Format.getIntObj(content.getContentRatingCount()));
    form.setPublished(content.getPublished() == 'Y' ? true : false);
    form.setContentPublishOn(Format.getDate(content.getContentPublishOn()));
    form.setContentExpireOn(Format.getDate(content.getContentExpireOn()));
    form.setRemoveImages(null);
    form.setRemoveMenus(null);
    form.setMenuWindowMode("");
   
    ContentImage contentImage = defaultContentLanguage.getImage();
    if (contentImage != null) {
      LabelValueBean bean = new LabelValueBean();
      bean.setLabel(contentImage.getImageName());
      bean.setValue(Format.getLong(contentImage.getImageId()));
      form.setDefaultImageId(bean);
    }
    else {
      form.setDefaultImageId(null);
    }
   
    form.setRecUpdateBy(content.getRecUpdateBy());
    form.setRecUpdateDatetime(Format.getFullDatetime(content.getRecUpdateDatetime()));
    form.setRecCreateBy(content.getRecCreateBy());
    form.setRecCreateDatetime(Format.getFullDatetime(content.getRecCreateDatetime()));
   
    if (!form.isSiteProfileClassDefault()) {
      form.setContentImageOverride(false);
      form.setContentTitleLangFlag(false);
      form.setContentDescLangFlag(false);
      form.setContentShortDescLangFlag(false);
      form.setPageTitleLangFlag(false);
      form.setMetaKeywordsLangFlag(false);
      form.setMetaDescriptionLangFlag(false);
      form.setContentTitleLang(defaultContentLanguage.getContentTitle());
      form.setContentDescLang(defaultContentLanguage.getContentDesc());
      form.setContentShortDescLang(defaultContentLanguage.getContentShortDesc());
      form.setPageTitleLang(defaultContentLanguage.getPageTitle());
      form.setMetaKeywordsLang(defaultContentLanguage.getMetaKeywords());
      form.setMetaDescriptionLang(defaultContentLanguage.getMetaDescription());
        Iterator<?> iterator = content.getContentLanguages().iterator();
        boolean found = false;
        ContentLanguage contentLanguage = null;
        Long siteProfileClassId = form.getSiteProfileClassId();
        while (iterator.hasNext()) {
          contentLanguage = (ContentLanguage) iterator.next();
          if (contentLanguage.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
            found = true;
            break;
          }
        }
        if (found) {
          if (contentLanguage.getContentTitle() != null) {
            form.setContentTitleLangFlag(true);
            form.setContentTitleLang(contentLanguage.getContentTitle());
          }
          if (contentLanguage.getContentDesc() != null) {
            form.setContentDescLangFlag(true);
            form.setContentDescLang(contentLanguage.getContentDesc());
          }
          if (contentLanguage.getContentShortDesc() != null) {
            form.setContentShortDescLangFlag(true);
            form.setContentShortDescLang(contentLanguage.getContentShortDesc());
          }
          if (contentLanguage.getPageTitle() != null) {
            form.setPageTitleLangFlag(true);
            form.setPageTitleLang(contentLanguage.getPageTitle());
          }
          if (contentLanguage.getMetaKeywords() != null) {
            form.setMetaKeywordsLangFlag(true);
            form.setMetaKeywordsLang(contentLanguage.getPageTitle());
          }
          if (contentLanguage.getMetaDescription() != null) {
            form.setMetaDescriptionLangFlag(true);
            form.setMetaDescriptionLang(contentLanguage.getMetaDescription());
          }
          if (contentLanguage.getContentImageOverride().equalsIgnoreCase(String.valueOf(Constants.VALUE_YES))) {
            form.setContentImageOverride(true);
          }
        }
    }
  }
View Full Code Here

    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    for (ContentDescSearch contentDescSearch : content.getContentDescSearches()) {
      em.remove(contentDescSearch);
    }
    content.getContentDescSearches().clear();
    ContentLanguage contentLanguageDefault = content.getContentLanguage();
    Query query = em.createQuery("from SiteProfileClass siteProfileClass where siteProfileClass.site.siteId = :siteId");
    query.setParameter("siteId", site.getSiteId());
    Iterator<?> iterator = query.getResultList().iterator();
    while (iterator.hasNext()) {
      SiteProfileClass siteProfileClass = (SiteProfileClass) iterator.next();
      ContentLanguage contentLanguage = null;
      for (ContentLanguage language : content.getContentLanguages()) {
        if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClass.getSiteProfileClassId())) {
          contentLanguage = language;
          break;
        }
      }
      ContentDescSearch contentDescSearch = new ContentDescSearch();
      if (contentLanguage == null || contentLanguage.getContentTitle() == null) {
        contentDescSearch.setContentTitle(contentLanguageDefault.getContentTitle());
      }
      else {
        contentDescSearch.setContentTitle(contentLanguage.getContentTitle());
      }
      contentDescSearch.setRecUpdateBy(adminBean.getUser().getUserId());
      contentDescSearch.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      contentDescSearch.setRecCreateBy(adminBean.getUser().getUserId());
      contentDescSearch.setRecCreateDatetime(new Date(System.currentTimeMillis()));
View Full Code Here

    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    for (ContentDescSearch contentDescSearch : content.getContentDescSearches()) {
      em.remove(contentDescSearch);
    }
    content.getContentDescSearches().clear();
    ContentLanguage contentLanguageDefault = content.getContentLanguage();
    Query query = em.createQuery("from SiteProfileClass siteProfileClass where siteProfileClass.site.siteId = :siteId");
    query.setParameter("siteId", site.getSiteId());
    Iterator<?> iterator = query.getResultList().iterator();
    while (iterator.hasNext()) {
      SiteProfileClass siteProfileClass = (SiteProfileClass) iterator.next();
      ContentLanguage contentLanguage = null;
      for (ContentLanguage language : content.getContentLanguages()) {
        if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClass.getSiteProfileClassId())) {
          contentLanguage = language;
          break;
        }
      }
      ContentDescSearch contentDescSearch = new ContentDescSearch();
      if (contentLanguage == null || contentLanguage.getContentTitle() == null) {
        contentDescSearch.setContentTitle(contentLanguageDefault.getContentTitle());
      }
      else {
        contentDescSearch.setContentTitle(contentLanguage.getContentTitle());
      }
      contentDescSearch.setRecUpdateBy(adminBean.getUser().getUserId());
      contentDescSearch.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      contentDescSearch.setRecCreateBy(adminBean.getUser().getUserId());
      contentDescSearch.setRecCreateDatetime(new Date(System.currentTimeMillis()));
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.