Package org.vosao.entity

Examples of org.vosao.entity.PageEntity


    assertEquals(1, getDao().getPageDao().selectByStructure(3L).size());
  }
 
  private void addPageStructureTemplate(String title, String url,
      Long structureTemplateId) {
    PageEntity page = new PageEntity(title, url);
    page.setStructureTemplateId(structureTemplateId);
    getDao().getPageDao().save(page);
  }
View Full Code Here


    assertEquals(2, getDao().getPageDao().selectByStructureTemplate(1L).size());
    assertEquals(1, getDao().getPageDao().selectByStructureTemplate(3L).size());
  }

  private PageEntity addPage(String title, Date publishDate) {
    PageEntity page = new PageEntity(title, "/" + title);
    page.setPublishDate(publishDate);
    page.setParentUrl("/");
    page.setState(PageState.APPROVED);
    return getDao().getPageDao().save(page);
  }
View Full Code Here

    return getDao().getPageDao().save(page);
  }
 
  public void testGetByParentApprovedDate() {
    try {
      PageEntity page1 = addPage("test1", DateUtil.toDate("01.01.2010"));
      PageEntity page2 = addPage("test2", DateUtil.toDate("10.01.2010"));
      PageEntity page3 = addPage("test3", DateUtil.toDate("01.03.2010"));
      Date start = DateUtil.toDate("01.01.2010");
      Date end = DateUtil.toDate("01.02.2010");
      List<PageEntity> list = getDao().getPageDao().getByParentApproved(
          "/", start, end);
      assertEquals(2, list.size());
View Full Code Here

 
  public void testGetCurrentHourPublishedPages() throws ParseException {
    Date dt = DateUtils.addMinutes(new Date(), -15);
    Date dt2 = DateUtils.addHours(new Date(), 1);
    Date dt3 = DateUtils.addMinutes(new Date(), -30);
    PageEntity page1 = addPage("test1", dt);
    PageEntity page2 = addPage("test2", dt2);
    PageEntity page3 = addPage("test3", dt3);
    List<PageEntity> list = getDao().getPageDao().getCurrentHourPublishedPages();
    assertEquals(2, list.size());
  }
View Full Code Here

  public void pageSave(PageEntity entity) throws DaoTaskException {
    if (isSkip()) {
      //logger.info("skip " + entity.getFriendlyURL()  + " version="
      //    + entity.getVersion() + " current " + current);
      if (entity.getId() == null) {
        PageEntity found = getDao().getPageDao().getByUrlVersion(
            entity.getFriendlyURL(), entity.getVersion());
        if (found == null) {
          throw new DaoTaskException("Page not found while "
            + "skipping save operation. " + entity.getFriendlyURL()
            + " version=" + entity.getVersion());
        }
        entity.setId(found.getId());
      }
    }
    else {
      //logger.info("import " + entity.getFriendlyURL()  + " version="
      //    + entity.getVersion() + " current " + current);
View Full Code Here

        name = encodedtopic;
      } else {
        name = fExternalWikiBaseURL.replace("${title}", encodedtopic);
      }

      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();
        }
      }
    }
View Full Code Here

        }
  }
 
  private void addComment(String name, String content, String pageUrl)
      throws ServiceException {
    PageEntity page = getDao().getPageDao().getByUrl(pageUrl);
    if (page == null) {
      throw new ServiceException(Messages.get("page_not_found", pageUrl));
    }
    getBusiness().getCommentBusiness().addComment(name, content, page);
  }
View Full Code Here

    loadIndex();
  }
 
  @Override
  public void updateIndex(Long pageId) {
    PageEntity page = getDao().getPageDao().getById(pageId);
    if (page == null) {
      return;
    }
    refreshIndex();
    List<PageEntity> versions = getDao().getPageDao().selectByUrl(
        page.getFriendlyURL());
    for (PageEntity version : versions) {
      removeFromIndex(version.getId());
    }
    page = getDao().getPageDao().getByUrl(page.getFriendlyURL());
    if (page == null) {
      return;
    }
    if (!page.isSearchable()) {
      return;
    }
    String content = getDao().getPageDao().getContent(page.getId(),
        getLanguage());
    if (content == null) {
      return;
    }
    String data = StrUtil.extractSearchTextFromHTML(content.toLowerCase());
    String[] words = StrUtil.splitByWord(data);
    //logger.info(Arrays.asList(words));
    for (String word : words) {
      if (word.length() < 3) {
        continue;
      }
      if (!getIndex().containsKey(word)) {
        getIndex().put(word, new HashSet<Long>());
      }
      if (!getIndex().get(word).contains(page.getId())) {
        getIndex().get(word).add(page.getId());
      }
    }
  }
View Full Code Here

   
    refreshIndex();
    List<Hit> result = new ArrayList<Hit>();
    List<Long> pages = new ArrayList<Long>(getPageIds(query));
    for (Long pageId : pages) {
      PageEntity page = getDao().getPageDao().getById(pageId);
      if (page != null) {
        if (filter != null && !filter.check(page)) {
          continue;
        }
        ContentEntity content = getBusiness().getPageBusiness()
View Full Code Here

   * @return Status string.
   */
  private String processResourceFileCKeditor(FileItemStream imageItem,
      byte[] data, Long pageId) {
    try {
      PageEntity page = getDao().getPageDao().getById(pageId);
      if (page == null) {
        throw new UploadException(Messages.get(
            "page.not_found", pageId));
      }
      FolderEntity folder;
      String folderPath = "/page" + page.getFriendlyURL();
      folder = getBusiness().getFolderBusiness().createFolder(folderPath);
      FileEntity file = processResourceFile(imageItem, data, folder);
      return "<script type=\"text/javascript\">"
        + " window.parent.CKEDITOR.tools.callFunction("
        + ckeditorFuncNum + ",'/file"
View Full Code Here

TOP

Related Classes of org.vosao.entity.PageEntity

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.