Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.ForUser


  /* (non-Javadoc)
   * @see com.gnizr.db.dao.foruser.ForUserDao#getForUser(int)
   */
  public ForUser getForUser(int id) {
    logger.debug("input: id="+id);
    ForUser forUser = null;
    PreparedStatement stmt = null;
    Connection conn = null;
    try{           
      conn = dataSource.getConnection();
      stmt = conn.prepareStatement("call getForUser(?);");
View Full Code Here


      stmt.setInt(1,user.getId());
      stmt.setInt(2,offset);
      stmt.setInt(3,count);
      ResultSet rs = stmt.executeQuery();
      while(rs.next()){
        ForUser forUser = createForUserObject (rs);
        logger.debug("found forUser="+forUser);
        linksForUser.add(forUser);
      }
    } catch (SQLException e) {
      logger.fatal(e);
View Full Code Here

      conn = dataSource.getConnection();
      stmt = conn.prepareStatement("call listForUserFromBookmark(?)");
      stmt.setInt(1,bookmark.getId());
      ResultSet rs = stmt.executeQuery();
      while(rs.next()){
        ForUser forUser = createForUserObject (rs);
        logger.debug("found forUser="+forUser);
        linksForUser.add(forUser);
      }
    } catch (SQLException e) {
      logger.fatal(e);
View Full Code Here

    return linksForUser;
  }

  private ForUser createForUserObject (ResultSet rs) throws SQLException
  {
    ForUser forUser = new ForUser();
   
    forUser.setId (rs.getInt(ForUserSchema.ID));
    forUser.setMessage(rs.getString(ForUserSchema.MESSAGE));
    forUser.setCreatedOn(rs.getTimestamp(ForUserSchema.CREATED_ON));
   
    Bookmark bm = BookmarkDBDao.createBookmarkObject(rs);
    Link bmLink = LinkDBDao.createLinkObject(rs);
    User buser = UserDBDao.createUserObject("buser", rs);
    bm.setLink(bmLink);
    bm.setUser(buser);
 
    User fuser = UserDBDao.createUserObject("fuser", rs);
   
    forUser.setBookmark(bm);
    forUser.setForUser(fuser);
   
    return forUser;
  }
View Full Code Here

      stmt.setTimestamp(3,new Timestamp(end.getTime()));
      stmt.setInt(4,offset);
      stmt.setInt(5,count);
      ResultSet rs = stmt.executeQuery();
      while(rs.next()){
        ForUser forUser = createForUserObject (rs);
        logger.debug("found forUser="+forUser);
        linksForUser.add(forUser);
      }
    } catch (SQLException e) {
      logger.fatal(e);
View Full Code Here

      int size = cStmt.getInt(5);
      if(size < 0){
        size = 0;
     
      while(rs.next()){
        ForUser forUser = createForUserObject(rs);
        forUsers.add(forUser);
      }
      result = new DaoResult<ForUser>(forUsers,size);
      logger.debug("DaoResult: forUsers="+forUsers+",size="+size);
    }catch(Exception e){   
View Full Code Here

    }
  }
 
  private void addForUserEntry(Bookmark bm, User u) throws NoSuchUserException, NoSuchLinkException, MissingIdException, NoSuchBookmarkException {
    if(forUserManager.hasForUser(bm, u) == false){
      ForUser forUserEntry = new ForUser(u,bm,"");
      forUserEntry.setCreatedOn(GnizrDaoUtil.getNow());
      int id = forUserManager.addForUser(forUserEntry);
      if(id <= 0){
        logger.error("db error. unable to create forUser: forUser="+forUserEntry);
      }
    }
View Full Code Here

    cal.add(Calendar.MONTH,-1);
    Date d3 = cal.getTime();
   
    User user = new User(3);
    // created on "today"
    ForUser f1 = new ForUser(user,new Bookmark(300),"",d1);
    // created on "1 day ago"
    ForUser f2 = new ForUser(user,new Bookmark(301),"",d2);
    // created on "last month today"
    ForUser f3 = new ForUser(user,new Bookmark(302),"",d3);
   
    int id = -1;
    id = forUserManager.addForUser(f1);
    assertTrue((id >0));
    id = forUserManager.addForUser(f2);
View Full Code Here

TOP

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

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.