Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.Folder


      int size = cStmt.getInt(4);
      if(size < 0){
        size = 0;
     
      while(rs.next()){
        Folder aFolder = createFolderObject(rs);       
        folders.add(aFolder);
      }
      result = new DaoResult<Folder>(folders,size);
      logger.debug("DaoResult: folders="+folders+",size="+size);
    }catch(Exception e){   
View Full Code Here


    return folderTags;
  }
 
  private void setFolderOnFolderTags(List<FolderTag> folderTags, Folder f){
    logger.debug("setFolderOnFolderTags: folderTags=" + folderTags + ",folder="+f);
    Folder folder = getFolder(f.getId());
    if(folder != null){
      for(FolderTag ft : folderTags){
        ft.setFolder(new Folder(folder));
      }
    }
  }
View Full Code Here

    assertEquals(1,result.getResult().size());
    assertEquals(202,result.getResult().get(0).getLink().getId());
  }
 
  public void testDeleteBookmark() throws Exception{
    Folder f1 = folderManager.createFolder(new User("jsmith"), "my folder1", "");
    assertEquals(3,f1.getSize());
   
    boolean isOkay = bookmarkManager.deleteBookmark(new Bookmark(300));
    assertTrue(isOkay);
   
    bookmarkManager.shutdown();
   
    f1 = folderManager.createFolder(new User("jsmith"), "my folder1", "");
    assertEquals(2,f1.getSize());
  }
View Full Code Here

    f1 = folderManager.createFolder(new User("jsmith"), "my folder1", "");
    assertEquals(2,f1.getSize());
  }
 
  public void testUpdateBookmark() throws Exception{
    Folder f1 = folderManager.createFolder(new User("jsmith"), "my folder1", "");
    assertEquals(3,f1.getSize());
   
    Bookmark bm300 = bookmarkManager.getBookmark(300);
    bm300.setTags("folder:xyz gn:folder=my_folder2");
   
    boolean isOkay = bookmarkManager.updateBookmark(bm300)
    assertTrue(isOkay);
     
    bookmarkManager.shutdown();
    f1 = folderManager.createFolder(new User("jsmith"), "my folder1", "");
    assertEquals(2,f1.getSize());

    Folder f2 = folderManager.createFolder(new User("jsmith"), "my folder2", "");
    assertEquals(1,f2.getSize());
   
    Folder f4 = folderManager.createFolder(new User("jsmith"), "xyz", "");
    assertEquals(1,f4.getSize());   
 
View Full Code Here

    bm300 = manager.getBookmark(300);
    assertTrue(bm300.getTagList().contains("tag1"));
    assertTrue(bm300.getTagList().contains("tag2"));
    assertTrue(bm300.getTagList().contains("tag3"));
   
    List<FolderTag> fTags = folderDao.findTagsInFolder(new Folder(1), 0, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(0,fTags.size());
   
   
    List<Bookmark> bmarks = new ArrayList<Bookmark>();
    bmarks.add(bm300);
    boolean[] opOkay = folderDao.addBookmarks(new Folder(1), bmarks,GregorianCalendar.getInstance().getTime());
    assertEquals(true,opOkay[0]);
   
    fTags = folderDao.findTagsInFolder(new Folder(1), 1, FolderDao.SORT_BY_ALPHA, FolderDao.ASCENDING);
    assertEquals(3,fTags.size());
   
    boolean okay = manager.renameTag(new User(1), "tag1", new String[]{"tag0"});
    assertTrue(okay);
   
    okay = manager.renameTag(new User(1), "tag2", new String[]{"tag0"});
    assertTrue(okay);
   
    okay = manager.renameTag(new User(1), "tag3", new String[]{"tag3","web"});
    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);
View Full Code Here

    setFolderName(FolderManager.MY_BOOKMARKS_LABEL);
    return go();
  }
 
  public String doUpdateFolder() {
    Folder existingFolder = null;
    if(folderName != null && folderName.length() > 0){
      try{
        existingFolder = folderManager.getUserFolder(loggedInUser,folderName);
      }catch(Exception e){     
        logger.debug("no exisitng folder="+folderName+",loggedInUser="+loggedInUser);
        return ERROR;
      }
    }
    boolean isOkay = false;
    if(existingFolder != null && folder != null){
      String fname = folder.getName().trim();
      if(fname.length() > 0){
        if(GnizrDaoUtil.isLegalFolderName(fname)){
          existingFolder.setName(folder.getName());
        }else{
          addActionMessage(CHAR_NOT_ALLOWED);
          return INPUT;
        }
      }
      if(folder != null && folder.getDescription() != null){
        String tmpStr = folder.getDescription();
        tmpStr = FormatUtil.tidyAndExtractTextFromHtml(tmpStr);     
        folder.setDescription(tmpStr);
      }     
      existingFolder.setDescription(folder.getDescription());
      try{
        isOkay = folderManager.updateFolder(loggedInUser,existingFolder);
      }catch(Exception e){
        logger.debug("unable to update folder:" + existingFolder);
        return ERROR;
View Full Code Here

    if(editUser != null){
      try{
        editUser.setCreatedOn(GnizrDaoUtil.getNow());
        boolean isOkay = userManager.createUser(editUser);
        if(isOkay == true){
          Folder myf = folderManager.createFolder(editUser,FolderManager.MY_BOOKMARKS_LABEL,"");
          if(myf == null){
            logger.error("Unable to create My Bookmarks folder");
            return ERROR;
          }
          op = SUCCESS;
View Full Code Here

    }
  }
 
  public String doListBookmarksInFolder() throws Exception{
    try{
      Folder f = folderManager.getUserFolder(getUser(),getFolder());
      if(f == null){
        addActionError("no such folder: " + getFolder());
        return ERROR;
      }else{
        int offset = computeOffset();
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.