Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Content


            form = new ContentMaintActionForm();
        }
    AdminBean adminBean = getAdminBean(httpServletRequest);
        initSiteProfiles(form, adminBean.getSite());

        Content content = new Content();
        createAdditionalInfo(adminBean, content, form);
       
        form.setContentRating(Format.getFloat(0));
        form.setContentRatingCount("0");
        form.setPublished(true);
View Full Code Here


      form = new ContentMaintActionForm();
    }
   
    Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
    Content content = (Content) em.find(Content.class, Format.getLong(form.getContentId()));
        createAdditionalInfo(getAdminBean(request), content, form);
    copyProperties(form, content);
   
    FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
    ActionForward actionForward = actionMapping.findForward("success");
View Full Code Here

    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    ContentMaintActionForm form = (ContentMaintActionForm) actionForm;
   
    Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
    Content content = (Content) em.find(Content.class, Format.getLong(form.getContentId()));
        createAdditionalInfo(getAdminBean(request), content, form);
       

        GoogleTranslate translator = new GoogleTranslate(form.getFromLocale(), form.getToLocale());
   
    if (!form.isSiteProfileClassDefault()) {
      copyProperties(form, content);
    }
   
    try {
      form.setContentTitleLangFlag(true);
      form.setContentShortDescLangFlag(true);
      form.setContentDescLangFlag(true);
      form.setPageTitleLangFlag(true);
      form.setMetaKeywordsLangFlag(true);
      form.setMetaDescriptionLangFlag(true);
      form.setContentTitleLang(translator.translate(content.getContentLanguage().getContentTitle()));
      form.setContentShortDescLang(translator.translate(content.getContentLanguage().getContentShortDesc()));
      form.setContentDescLang(translator.translate(content.getContentLanguage().getContentDesc()));
      form.setPageTitleLang(translator.translate(content.getContentLanguage().getPageTitle()));
      form.setMetaKeywordsLang(translator.translate(content.getContentLanguage().getMetaKeywords()));
      form.setMetaDescriptionLang(translator.translate(content.getContentLanguage().getMetaDescription()));
    }
    catch (Exception e) {
      logger.error(e);
        ActionMessages errors = new ActionMessages();
        errors.add("error", new ActionMessage("error.google.translate"));
View Full Code Here

    }
    else {
      contentId = Format.getLong(form.getContentId());
    }

        Content content = new Content();
        content = ContentDAO.load(site.getSiteId(), contentId);
        copyProperties(form, content);
        form.setMode("U");
        FormUtils.setFormDisplayMode(httpServletRequest, form, FormUtils.EDIT_MODE);
       
View Full Code Here

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

    Content content = new Content();
    if (!insertMode) {
      content = ContentDAO.load(site.getSiteId(), Format.getLong(form.getContentId()));
    }

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

    if (insertMode) {
      content.setSite(site);
      content.setContentRating(new Float(0));
      content.setContentRatingCount(new Integer(0));
      content.setContentHitCounter(new Integer(0));
      content.setRecCreateBy(adminBean.getUser().getUserId());
      content.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
   
    if (form.isSiteProfileClassDefault()) {
      saveDefault(content, form, adminBean);
      form.setRecUpdateBy(content.getRecUpdateBy());
      form.setRecUpdateDatetime(Format.getFullDatetime(content.getRecUpdateDatetime()));
      User user = adminBean.getUser();
      content.setUser(user);
      if (insertMode) {
        em.persist(content);
        form.setContentId(Format.getLong(content.getContentId()));
      }
      else {
        // em.update(content);
      }
    }
    else {
      saveLanguage(content, form, adminBean);
    }
    CategorySearchUtil.contentDescSearchUpdate(content, site, adminBean);

    Iterator<?> iterator = content.getMenus().iterator();
    while (iterator.hasNext()) {
      Menu menu = (Menu) iterator.next();
      CacheDAO.removeByKeyPrefix(site.getSiteId(), Constants.CACHE_MENU + "." + menu.getMenuSetName());
    }
    Indexer.getInstance(site.getSiteId()).updateContent(content);
View Full Code Here

    AdminBean adminBean = getAdminBean(httpServletRequest);
        initSiteProfiles(form, adminBean.getSite());
    Site site = adminBean.getSite();
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
   
    Content content = ContentDAO.load(site.getSiteId(), Format.getLong(form.getContentId()));
    // in case problem is encountered
    createAdditionalInfo(adminBean, content, form);
   
    try {
      em.remove(content);
      for (ContentLanguage contentLanguage : content.getContentLanguages()) {
        if (contentLanguage.getImage() != null) {
          em.remove(contentLanguage.getImage());
        }
        for (ContentImage image : contentLanguage.getImages()) {
          em.remove(image);
        }
        em.remove(contentLanguage);
      }
      Iterator<?> iterator = content.getMenus().iterator();
      while (iterator.hasNext()) {
        Menu menu = (Menu) iterator.next();
        menu.setContent(null);
        CacheDAO.removeByKeyPrefix(site.getSiteId(), Constants.CACHE_MENU + "." + menu.getMenuSetName());
      }
      content.setContentLanguage(null);
      em.getTransaction().commit();
    }
    catch (Exception e) {
      if (Utility.isConstraintViolation(e)) {
        ActionMessages errors = new ActionMessages();
View Full Code Here

      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    ContentMaintActionForm form = (ContentMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();

    Content content = new Content();
    content = ContentDAO.load(site.getSiteId(), Format.getLong(form.getContentId()));
    content.setContentHitCounter(new Integer(0));
    content.setRecUpdateBy(adminBean.getUser().getUserId());
    content.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
   
      JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
    jsonResult.put("recUpdateBy", content.getRecUpdateBy());
    jsonResult.put("recUpdateDatetime", Format.getFullDatetime(content.getRecUpdateDatetime()));
    String jsonString = jsonResult.toHtmlString();
    this.streamWebService(response, jsonString);
    em.getTransaction().commit();
      return null;
  }
View Full Code Here

    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    ContentMaintActionForm form = (ContentMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();

    Content content = new Content();
    content = ContentDAO.load(site.getSiteId(), Format.getLong(form.getContentId()));
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
    Iterator<?> iterator = content.getComments().iterator();
    Vector<JSONEscapeObject> comments = new Vector<JSONEscapeObject>();
    while (iterator.hasNext()) {
      Comment comment = (Comment) iterator.next();
      JSONEscapeObject jsonComment = new JSONEscapeObject();
      jsonComment.put("commentId", comment.getCommentId());
View Full Code Here

      throws Throwable {
    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    ContentMaintActionForm form = (ContentMaintActionForm) actionForm;
    initSiteProfiles(form, adminBean.getSite());
    Content content = new Content();
    content = ContentDAO.load(site.getSiteId(), Format.getLong(form.getContentId()));
    JSONEscapeObject jsonResult = createJsonSelectedCategories(site.getSiteId(), content);
    String jsonString = jsonResult.toHtmlString();
    this.streamWebService(response, jsonString);
    return null;
View Full Code Here

    ContentMaintActionForm form = (ContentMaintActionForm) actionForm;
        initSiteProfiles(form, adminBean.getSite());
    String contentId = request.getParameter("contentId");
   
       EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Content content = new Content();
    content = ContentDAO.load(site.getSiteId(), Format.getLong(contentId));
    String catIds[] = form.getAddCategories();
    if (catIds != null) {
      for (String catId : catIds) {
        Category category = CategoryDAO.load(site.getSiteId(), Format.getLong(catId));
        content.getCategories().add(category);
        content.setRecUpdateBy(adminBean.getUser().getUserId());
        content.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      }
    }
      JSONEscapeObject jsonResult = createJsonSelectedCategories(site.getSiteId(), content);
    jsonResult.put("status", Constants.WEBSERVICE_STATUS_SUCCESS);
    jsonResult.put("recUpdateBy", content.getRecUpdateBy());
    jsonResult.put("recUpdateDatetime", Format.getFullDatetime(content.getRecUpdateDatetime()));
    String jsonString = jsonResult.toHtmlString();
    streamWebService(response, jsonString);
    em.getTransaction().commit();
      return null;
  }
View Full Code Here

TOP

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

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.