Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.Folder


   
    user = new User(1);
    url = "http://www.cnn3.com/";
    result = folderManager.pageContainedInFolder(user, url, 0, 10);
    assertEquals(1,result.getSize());
    Folder f = result.getResult().get(0);
    assertEquals(2,f.getUser().getId());
    assertEquals(3,f.getSize());
  }
View Full Code Here


    assertEquals(3,result.getSize());
    assertEquals(3,result.getResult().size());
  }
 
  public void testGetTagsSortByAlpha() throws Exception{
    Folder f = folderManager.getUserFolder(new User("jsmith"),"my folder1");
    assertNotNull(f);
    List<FolderTag> ftags = folderManager.getTagsSortByAlpha(f,2,FolderManager.ASCENDING_ORDER);
    assertEquals(2,ftags.size());
    assertEquals("cnn",ftags.get(0).getTag().getLabel());
    assertEquals("news",ftags.get(1).getTag().getLabel());
View Full Code Here

    assertEquals("news",ftags.get(0).getTag().getLabel());
    assertEquals("cnn",ftags.get(1).getTag().getLabel())
  }
 
  public void testGetTagsSortByFreq() throws Exception{
    Folder f = folderManager.getUserFolder(new User("jsmith"),"my folder1");
    assertNotNull(f);
    List<FolderTag> ftags = folderManager.getTagsSortByFreq(f,1,FolderManager.DESCENDING_ORDER);
    assertEquals(3,ftags.size());
    assertEquals(3,ftags.get(0).getCount());
    assertEquals(3,ftags.get(1).getCount());
View Full Code Here

    assertEquals(3,ftags.get(1).getCount());
    assertEquals(1,ftags.get(2).getCount());
  }

  public void testPageBookmarkHasGeomMarker() throws Exception{
    DaoResult<Bookmark> result = folderManager.pageBookmarkHasGeomMarker(new Folder(1), 0, 10);
    assertEquals(0,result.getSize());     
  }
View Full Code Here

      conn = dataSource.getConnection();
      stmt = conn.prepareStatement("call findImportFolders(?)");
      stmt.setLong(1,subscription.getId());
      ResultSet rs = stmt.executeQuery();
      while(rs.next()){
        Folder folder = FolderDBDao.createFolderObject(rs);
        logger.debug("found folder="+folder);
        folders.add(folder);
      }
    } catch (SQLException e) {
      logger.fatal(e);
View Full Code Here

    DaoResult<Folder> result = folderDao.pageFolders(user, 0, 0);
    return result.getSize();
  }
 
  public Folder createFolder(User user, String folderName, String description) throws NoSuchUserException{
    Folder folder = new Folder();   
    GnizrDaoUtil.fillId(userDao, user);   
    folder.setUser(user);
    if(folderName == null || folderName.length()==0){
      throw new IllegalArgumentException("Defined folder name string is NULL or its length() is 0");
    }else{
      folder.setName(folderName);
    }
    if(description == null){
      folder.setDescription("");
    }else{
      folder.setDescription(description);
    }
    folder.setLastUpdated(GnizrDaoUtil.getNow());
   
    int fid = folderDao.createFolder(folder);
    folder = folderDao.getFolder(fid);
    return folder;
  }
View Full Code Here

    DaoResult<Bookmark> result = null;   
    GnizrDaoUtil.fillId(userDao, user);
    if(folderName == null){
      throw new NullPointerException("folder name is NULL");
    }
    Folder folder = folderDao.getFolder(user, folderName);
    if(folder != null){
      result = folderDao.pageBookmarks(folder, offset, count);
    }
    return result;   
  }
View Full Code Here

    DaoResult<Bookmark> result = null;   
    GnizrDaoUtil.fillId(userDao, user);
    if(folderName == null){
      throw new NullPointerException("folder name is NULL");
    }
    Folder folder = folderDao.getFolder(user, folderName);
    Tag tagObj = new Tag(tag);
    GnizrDaoUtil.fillId(tagDao, tagObj);
    if(folder != null){     
      result = folderDao.pageBookmarks(folder, tagObj, offset, count);
    }
View Full Code Here

  public boolean[] addBookmarks(User user, String folderName, List<Bookmark> bookmarks2add) throws NoSuchUserException{     
    GnizrDaoUtil.fillId(userDao, user);
    if(folderName == null){
      throw new NullPointerException("folder name is NULL");
    }
    Folder folder = folderDao.getFolder(user, folderName);
    if(folder == null){
      folder = createFolder(user, folderName, "");
    }
    if(bookmarks2add == null){
      logger.warn("request to add bookmarks, but input bookmark list is NULL");
View Full Code Here

  public boolean[] removeBookmarks(User user, String folderName, List<Bookmark> bookmarks2remove) throws NoSuchFolderException, NoSuchUserException{
    GnizrDaoUtil.fillId(userDao, user);
    if(folderName == null){
      throw new NullPointerException("folder name is NULL");
    }
    Folder folder = folderDao.getFolder(user, folderName);
    if(folder == null){
      throw new NoSuchFolderException("no such folder: "+ folderName);
    }
    if(bookmarks2remove == null){
      logger.warn("request to add bookmarks, but input bookmark list is NULL");
View Full Code Here

TOP

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

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.