Package org.vosao.entity

Examples of org.vosao.entity.ContentEntity


    return null;
  }

  @Override
  public String getContent(Long pageId, String languageCode) {
    ContentEntity content = getContentDao().getByLanguage(
        PAGE_CLASS_NAME, pageId, languageCode);
    if (content != null) {
      return content.getContent();
    }
    return null;
  }
View Full Code Here


  }

  @Override
  public ContentEntity setContent(Long pageId, String languageCode,
        String content) {
    ContentEntity contentEntity = getContentDao().getByLanguage(
        PAGE_CLASS_NAME, pageId, languageCode);
    if (contentEntity == null) {
      contentEntity = new ContentEntity(PAGE_CLASS_NAME, pageId,
          languageCode, content);
    }
    else {
      contentEntity.setContent(content);
    }
    return getContentDao().save(contentEntity);
  }
View Full Code Here

 

  public void testContent() {
    PageEntity root = pageTool.addPage("root", "/");
    getDao().getPageDao().setContent(root.getId(), "en", "english");
    ContentEntity ruContent = getDao().getPageDao().setContent(
        root.getId(), "ru", "russian");
    getDao().getPageDao().setContent(root.getId(), "uk", "ukranian");
    String c = getDao().getPageDao().getContent(root.getId(), "en");
    assertEquals("english", c);
    c = getDao().getPageDao().getContent(root.getId(), "ru");
    assertEquals("russian", c);
    c = getDao().getPageDao().getContent(root.getId(), "uk");
    assertEquals("ukranian", c);
    List<ContentEntity> list = getDao().getContentDao().select(
        PageEntity.class.getName(), root.getId());
    assertEquals(3, list.size());
    getDao().getContentDao().removeById(ruContent.getParentClass(),
        root.getId());
    list = getDao().getContentDao().select(
        PageEntity.class.getName(), root.getId());
    assertEquals(0, list.size());
  }
View Full Code Here

      }

      PageEntity page = getDao().getPageDao().getByUrl(name);
      if (page != null) {
        String languageCode = LanguageEntity.ENGLISH_CODE;
        ContentEntity content = getDao().getContentDao().getByLanguage(
            PageEntity.class.getName(), page.getId(), languageCode);
        if (content != null) {
          return content.getContent();
        }
      }
    }
    return null;
  }
View Full Code Here

      PageEntity page = getDao().getPageDao().getById(pageId);
      if (page != null) {
        if (filter != null && !filter.check(page)) {
          continue;
        }
        ContentEntity content = getBusiness().getPageBusiness()
            .getPageContent(page, language);
        if (content != null) {
          String text = StrUtil.extractSearchTextFromHTML(
              content.getContent());
          if (text.length() > textSize) {
            text = text.substring(0, textSize);
          }
          result.add(new Hit(page, text, language));
        }
View Full Code Here

    setSystemService(systemService);
    prepareContent();
  }

  private void prepareContent() {
    ContentEntity contentEntity = getPageBusiness().getPageContent(
        getPage(), getLanguageCode());
    if (contentEntity == null) {
      String msg = Messages.get("content_not_found") + " "
          + getFriendlyURL() + " " + getLanguageCode();
      logger.error(msg);
      setContent(msg);
      return;
    }
    String resultContent = contentEntity.getContent();
    if (isVelocityProcessing()) {
      VelocityContext context = getPageBusiness().createContext(
          getLanguageCode(), getPage());
      context.put("page", getPage());
      resultContent = getSystemService().render(resultContent, context);
View Full Code Here

      TemplateEntity template = getDao().getTemplateDao().getById(
          page.getTemplate());
      return render(page, template.getContent(), languageCode);
    }
    else {
      ContentEntity content = getPageContent(page, languageCode);
      return pagePostProcess(content.getContent(), page);
    }
  }
View Full Code Here

    return velocityPluginService;
  }

  @Override
  public ContentEntity getPageContent(PageEntity page, String languageCode) {
    ContentEntity content = getDao().getContentDao().getByLanguage(
        PageEntity.class.getName(), page.getId(), languageCode);
    if (content == null || content.getContent().isEmpty()) {
      content = getDao().getContentDao().getByLanguage(
          PageEntity.class.getName(), page.getId(),
          getBusiness().getDefaultLanguage());
    }
    if (content == null) {
      logger.error("No content found for page " + page.getTitle());
      content = new ContentEntity();
      content.setParentClass(PageEntity.class.getName());
      content.setParentKey(page.getId());
      content.setLanguageCode(languageCode);
    }
    return content;
  }
View Full Code Here

        languageCode);
  }

  @Override
  public void saveContent(PageEntity page, String language, String content) {
    ContentEntity contentEntity = getDao().getPageDao().setContent(
        page.getId(), language, content);
    getSystemService().getPageCache().remove(page.getFriendlyURL());
    PageMessage message = new PageMessage(Topic.PAGES_CHANGED,
        page.getFriendlyURL(), page.getId());
    getBusiness().getMessageQueue().publish(message);
View Full Code Here

  private void copyContent(PageEntity src, PageEntity dst) {
    List<ContentEntity> contents = getDao().getPageDao().getContents(
        src.getId());
    for (ContentEntity content : contents) {
      ContentEntity newContent = new ContentEntity();
      newContent.copy(content);
      newContent.setId(null);
      newContent.setParentKey(dst.getId());
      getDao().getContentDao().save(newContent);
      getBusiness().getSystemService().getPageCache().remove(
          dst.getFriendlyURL());
    }
  }
View Full Code Here

TOP

Related Classes of org.vosao.entity.ContentEntity

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.