Examples of CommentEntity


Examples of org.vosao.entity.CommentEntity

    }   
  }

  private void clearPageCache(List<Long> commentIds) {
    for(Long id : commentIds) {
      CommentEntity comment = getDao().getCommentDao().getById(id);
      if (comment != null) {
        getBusiness().getSystemService().getPageCache().remove(
            comment.getPageUrl());
      }
    }
  }
View Full Code Here

Examples of org.vosao.entity.CommentEntity

 
  @Override
  public void disable(List<Long> ids) {
    getQueryCache().removeQueries(CommentEntity.class);
    for (Long id : ids) {
      CommentEntity comment = getById(id);
      if (comment != null) {
        comment.setDisabled(true);
        save(comment);
        getEntityCache().removeEntity(CommentEntity.class, id);
      }
    }
  }
View Full Code Here

Examples of org.vosao.entity.CommentEntity

  @Override
  public void enable(List<Long> ids) {
    getQueryCache().removeQueries(CommentEntity.class);
    for (Long id : ids) {
      CommentEntity comment = getById(id);
      if (comment != null) {
        comment.setDisabled(false);
        save(comment);
        getEntityCache().removeEntity(CommentEntity.class, id);
      }
    }
  }
View Full Code Here

Examples of org.vosao.entity.CommentEntity

  }   


  public void testSave() {
    PageEntity page = pageTool.addPage("test");
    CommentEntity comment = commentTool.addComment("alex", "content", page);
    CommentEntity comment2 = getDao().getCommentDao().getById((Long)null);
    assertNull(comment2);
    List<CommentEntity> comments = getDao().getCommentDao().getById((List<Long>)null);
    assertEquals(0, comments.size());
    comment2 = getDao().getCommentDao().getById(0L);
    assertNull(comment2);
    comment2 = getDao().getCommentDao().getById(
        comment.getId());
    assertNotNull(comment2);
    assertEquals("alex", comment2.getName());
    assertEquals("content", comment2.getContent());
 
View Full Code Here

Examples of org.vosao.entity.CommentEntity

    assertEquals("content", comment2.getContent());
 
 
  public void testUpdate() {
    PageEntity page = pageTool.addPage("test");
    CommentEntity comment = commentTool.addComment("alex", "content", page);
    CommentEntity comment2 = getDao().getCommentDao().getById(
        comment.getId());
    assertNotNull(comment2);
    assertEquals("alex", comment2.getName());
    assertEquals("content", comment2.getContent());
    comment2.setName("yuri");
    getDao().getCommentDao().save(comment2);
    CommentEntity comment3 = getDao().getCommentDao().getById(
        comment.getId());
    assertNotNull(comment3);
    assertEquals("yuri", comment3.getName());
  }
View Full Code Here

Examples of org.vosao.entity.CommentEntity

  public void testDelete() {
    PageEntity page = pageTool.addPage("test");
    PageEntity page2 = pageTool.addPage("test2");
    commentTool.addComment("alex", "content1", page);
    commentTool.addComment("yuri", "content2", page2);
    CommentEntity comment = commentTool.addComment("roma", "content3", page);
    getDao().getCommentDao().remove(comment.getId());
    List<CommentEntity> list = getDao().getCommentDao().getByPage(
        page.getFriendlyURL());
    assertEquals(1, list.size());
    assertEquals("alex", list.get(0).getName());
    list = getDao().getCommentDao().getByPage(page2.getFriendlyURL());
View Full Code Here

Examples of org.vosao.entity.CommentEntity

    assertEquals(1, list.size());
 
 
  public void testGetById()  {
    PageEntity page = pageTool.addPage("test");
    CommentEntity c = commentTool.addComment("alex", "content1", page);
    CommentEntity c2 = getDao().getCommentDao().getById((Long)null);
    assertNull(c2);
    c2 = getDao().getCommentDao().getById(c.getId());
    assertNotNull(c2);
    assertEquals(c.getId(), c2.getId());
  }
View Full Code Here

Examples of org.vosao.entity.CommentEntity

    assertEquals(c.getId(), c2.getId());
  }

  public void testDisableEnable() {
    PageEntity page = pageTool.addPage("test");
    CommentEntity alex = commentTool.addComment("alex", "content1", page);
    CommentEntity roma = commentTool.addComment("roma", "content3", page);
    CommentEntity roma1 = commentTool.addComment("roma1", "content4", page);
    CommentEntity roma3 = commentTool.addComment("roma3", "content6", page);
    List<Long> ids = new ArrayList<Long>();
    ids.add(null);
    ids.add(alex.getId());
    ids.add(roma.getId());
    getDao().getCommentDao().disable(ids);
    CommentEntity r = getDao().getCommentDao().getById(alex.getId());
    assertTrue(r.isDisabled());
    r = getDao().getCommentDao().getById(roma.getId());
    assertTrue(r.isDisabled());
    r = getDao().getCommentDao().getById(roma1.getId());
    assertFalse(r.isDisabled());
    r = getDao().getCommentDao().getById(roma3.getId());
    assertFalse(r.isDisabled());
    getDao().getCommentDao().enable(ids);
    r = getDao().getCommentDao().getById(alex.getId());
    assertFalse(r.isDisabled());
    r = getDao().getCommentDao().getById(roma.getId());
    assertFalse(r.isDisabled());
 
View Full Code Here

Examples of org.vosao.entity.CommentEntity

              + element.attributeValue("publishDate"));
        }
        boolean disabled = Boolean.valueOf(element
            .attributeValue("disabled"));
        String content = element.getText();
        CommentEntity comment = new CommentEntity(name, content,
            publishDate, url, disabled);
        getDaoTaskAdapter().commentSave(comment);
      }
    }
  }
View Full Code Here

Examples of org.vosao.entity.CommentEntity

    dao = aDao;
  }
 
  public CommentEntity addComment(final String name, final String content,
      final PageEntity page) {
    CommentEntity comment = new CommentEntity(name, content, new Date(),
        page.getFriendlyURL());
    dao.getCommentDao().save(comment);
    return comment;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.