Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.FolderTag


  }
 
  public void testAddTagCountOne() throws Exception{
    List<FolderTag> folderTags = folderDao.findTagsInFolder(new Folder(2), 0, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(2,folderTags.size());
    FolderTag t1 = folderTags.get(0);
    FolderTag t2 = folderTags.get(1);
   
    assertEquals("cnn",t1.getTag().getLabel());
    assertEquals("news",t2.getTag().getLabel());
    assertEquals(1,t1.getCount());
    assertEquals(1,t1.getCount());
   
    tagDao.addTagCountOne(new Tag[]{new Tag(100)}, new User(1), new Link(202), new Bookmark(1));
    folderTags = folderDao.findTagsInFolder(new Folder(2), 0, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(3,folderTags.size());
    t1 = folderTags.get(0);
    t2 = folderTags.get(1);
    assertEquals(1,t1.getCount());
    assertEquals(1,t1.getCount());
   
    FolderTag t3 = folderTags.get(2);
    assertEquals(1,t3.getCount());
    assertEquals("newsnews",t3.getTag().getLabel());
  }
View Full Code Here


  }

  public void testSubTagCountOne() throws Exception{
    List<FolderTag> folderTags = folderDao.findTagsInFolder(new Folder(2), 1, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(2,folderTags.size());
    FolderTag t1 = folderTags.get(0);
    FolderTag t2 = folderTags.get(1);
   
    assertEquals("cnn",t1.getTag().getLabel());
    assertEquals("news",t2.getTag().getLabel());
    assertEquals(1,t1.getCount());
    assertEquals(1,t1.getCount());
   
    tagDao.subtractTagCountOne(new Tag[]{new Tag(1)}, new User(1), new Link(202), new Bookmark(1));
    folderTags = folderDao.findTagsInFolder(new Folder(2), 1, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
View Full Code Here

    assertEquals("news",t1.getTag().getLabel());
  }
 
  public void testExpandTag() throws Exception{
    List<FolderTag> folderTags = null;
    FolderTag t1, t2, t3;
   
    BookmarkDao bmarkDao = new BookmarkDBDao(getDataSource());
    Bookmark bm = bmarkDao.getBookmark(1);
    List<String> tags = bm.getTagList();
    assertTrue(tags.contains("cnn"));
    assertTrue(tags.contains("news"));
   
    Tag cnnTag = tagDao.getTag(1);
    assertEquals(1,cnnTag.getCount());
   
    Tag newsTag = tagDao.getTag(2);
    assertEquals(1,newsTag.getCount());
   
    LinkTag ltag1 = tagDao.getLinkTag(1);
    assertEquals(1,ltag1.getCount());
   
    LinkTag ltag2 = tagDao.getLinkTag(2);
    assertEquals(1,ltag2.getCount());
   
    BookmarkTag bmtag10 = tagDao.getBookmarkTag(10);
    assertEquals(1,bmtag10.getCount());
   
    BookmarkTag bmtag11 = tagDao.getBookmarkTag(11);
    assertEquals(1,bmtag11.getCount());
   
    BookmarkTag bmtagQ = tagDao.getBookmarkTag(12);
    assertEquals(0,bmtagQ.getCount());
   
    folderTags = folderDao.findTagsInFolder(new Folder(2), 0, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(2,folderTags.size());
   
    t1 = folderTags.get(0);
    assertEquals("cnn",t1.getTag().getLabel());
    assertEquals(1,t1.getCount());
    t2 = folderTags.get(1);
    assertEquals("news",t2.getTag().getLabel());
    assertEquals(1,t2.getTag().getCount());
   
    List<Bookmark> chngBmarks = tagDao.expandTag(new User(1), new Tag(1), new Tag[]{new Tag(4)});
    assertEquals(1,chngBmarks.size());
    for(Bookmark c : chngBmarks){
      assertTrue(c.getTagList().contains("questions"));
      assertTrue(c.getTagList().contains("cnn"));
    }
       
    cnnTag = tagDao.getTag(1);
    assertEquals(1,cnnTag.getCount());
   
    newsTag = tagDao.getTag(2);
    assertEquals(1,newsTag.getCount());
   
    ltag1 = tagDao.getLinkTag(1);
    assertEquals(1,ltag1.getCount());
   
    ltag2 = tagDao.getLinkTag(2);
    assertEquals(1,ltag2.getCount());
   
    bmtag10 = tagDao.getBookmarkTag(10);
    assertEquals(1,bmtag10.getCount());
   
    bmtag11 = tagDao.getBookmarkTag(11);
    assertEquals(1,bmtag11.getCount());
 
    bmtagQ = tagDao.getBookmarkTag(12);
    assertEquals(1,bmtagQ.getCount());
   
    folderTags = folderDao.findTagsInFolder(new Folder(2), 0, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(3,folderTags.size());
   
    t1 = folderTags.get(0);
    assertEquals("cnn",t1.getTag().getLabel());
    assertEquals(1,t1.getCount());
    t2 = folderTags.get(1);
    assertEquals("news",t2.getTag().getLabel());
    assertEquals(1,t2.getTag().getCount());
    t3 = folderTags.get(2);
    assertEquals("questions",t3.getTag().getLabel());
View Full Code Here

  }
 
 
  public void testReduceTag() throws Exception{
    List<FolderTag> folderTags = null;
    FolderTag t1, t2;
   
    folderTags = folderDao.findTagsInFolder(new Folder(2), 1, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(2,folderTags.size());
   
    t1 = folderTags.get(0);
    assertEquals("cnn",t1.getTag().getLabel());
    assertEquals(1,t1.getCount());
    t2 = folderTags.get(1);
    assertEquals("news",t2.getTag().getLabel());
    assertEquals(1,t2.getTag().getCount());
   
    List<Bookmark> changeBookmarks= tagDao.reduceTag(new User(1), new Tag[]{new Tag(1)});
    assertEquals(1,changeBookmarks.size());
    for(Bookmark c : changeBookmarks){
      assertFalse(c.getTagList().contains("cnn"));
    }
   
    BookmarkTag bm11 = tagDao.getBookmarkTag(11);
    assertEquals("cnn",bm11.getTag().getLabel());
    assertEquals(0,bm11.getCount());
    assertEquals(0,bm11.getTag().getCount());
 
    LinkTag ln1 = tagDao.getLinkTag(1);
    assertEquals(202,ln1.getLink().getId());
    assertEquals(0,ln1.getCount());
    assertEquals(0,ln1.getTag().getCount());
   
    folderTags = folderDao.findTagsInFolder(new Folder(2), 1, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(1,folderTags.size());
   
    t1 = folderTags.get(0);
    assertEquals("news",t1.getTag().getLabel());
    assertEquals(1,t1.getCount());
 
  }
View Full Code Here

      cStmt.setInt(2,minFreq);
      cStmt.setInt(3,sortBy);
      cStmt.setInt(4,order);     
      ResultSet rs = cStmt.executeQuery();
      while(rs.next()){
        FolderTag ft = new FolderTag();
        Tag t = TagDBDao.createTagObject(rs);
        ft.setTag(t);
        ft.setCount(rs.getInt(FolderTagSchema.COUNT));
        folderTags.add(ft);
      }
      if(folderTags.isEmpty() == false){
        setFolderOnFolderTags(folderTags,folder);
      }     
View Full Code Here

      cStmt.setInt(2,minFreq);
      cStmt.setInt(3,sortBy);
      cStmt.setInt(4,order);     
      ResultSet rs = cStmt.executeQuery();
      while(rs.next()){
        FolderTag ft = new FolderTag();
        Tag memTag = TagDBDao.createNamedTagObject(MEMBER_TAG_COL, rs, true);
        Tag grpTag = TagDBDao.createNamedTagObject(GROUP_TAG_COL, rs, true);
        ft.setTag(memTag);
        ft.setCount(rs.getInt(FOLDER_TAG_IDX_COL+"_count"));
        List<FolderTag> folderTags = tagGroups.get(grpTag.getLabel());
        if(folderTags == null){
          folderTags = new ArrayList<FolderTag>();
          tagGroups.put(grpTag.getLabel(),folderTags);
        }
View Full Code Here

    assertTrue(okay);
   
    fTags = folderDao.findTagsInFolder(new Folder(1), 1, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(3,fTags.size());

    FolderTag t1 = fTags.get(0);
    FolderTag t2 = fTags.get(1);
    FolderTag t3 = fTags.get(2);
    assertEquals("tag0",t1.getTag().getLabel());
    assertEquals("tag3",t2.getTag().getLabel());
    assertEquals("web",t3.getTag().getLabel());
    assertEquals(1,t1.getCount());
    assertEquals(1,t2.getCount());
    assertEquals(1,t3.getCount());
  }
View Full Code Here

TOP

Related Classes of com.gnizr.db.dao.FolderTag

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.