Package com.gnizr.db.dao

Examples of com.gnizr.db.dao.FeedSubscription


              }
            }
          }                   
        }
        if(feedLastUpdated != null){
          FeedSubscription feed = new FeedSubscription(srcFeed);
          feed.setLastSync(feedLastUpdated);
          feed.setPubDate(feedPubDate);
          feedSubscriptionManager.updateSubscription(feed);
          logger.debug("set FeedSubscription lastUpdate to: " + feedLastUpdated);
        }else{
          logger.error("feedLastUpdate is NULL");
        }
View Full Code Here


    return deleted;
  }

  public static FeedSubscription createFeedSubscriptionObject(ResultSet rs) throws SQLException{
    if(rs == null) return null;
    FeedSubscription feed = new FeedSubscription();
    Bookmark bookmark = BookmarkDBDao.createBookmarkObject2(rs);
    feed.setId(rs.getInt(FeedSubscriptionSchema.ID));
    feed.setAutoImport(rs.getBoolean(FeedSubscriptionSchema.AUTO_IMPORT));
    feed.setLastSync(rs.getTimestamp(FeedSubscriptionSchema.LAST_SYNC));
    feed.setMatchText(rs.getString(FeedSubscriptionSchema.MATCH_TEXT));
    feed.setPubDate(rs.getTimestamp(FeedSubscriptionSchema.PUB_DATE));
    feed.setBookmark(bookmark);
   
    List<String> folderList = new ArrayList<String>();
    String folders = rs.getString(FeedSubscriptionSchema.IMPORT_FOLDERS);
    if(folders != null){
      String[] fdrs = folders.split("/");
      if(fdrs != null && fdrs.length > 0){
        folderList = Arrays.asList(fdrs);
      }
    }
    feed.setImportFolders(folderList);   
    return feed;
  }
View Full Code Here

  }
 
 
  public FeedSubscription getSubscription(int id) {
    logger.debug("getSubscription: id="+id);
    FeedSubscription feed = null;
    PreparedStatement stmt = null;
    Connection conn = null;
    try{           
      conn = dataSource.getConnection();
      stmt = conn.prepareStatement("call getSubscriptionById(?);");
View Full Code Here

    return feed;
  }

  public FeedSubscription getSubscription(User owner, String feedUrl) {
    logger.debug("getFolder: owner="+owner + ",feedUrl="+feedUrl);
    FeedSubscription feed = null;
    PreparedStatement stmt = null;
    Connection conn = null;
    try{           
      conn = dataSource.getConnection();
      stmt = conn.prepareStatement("call getSubscriptionByUserIdFeedUrl(?,?);");
View Full Code Here

      cStmt.setInt(2,offset);
      cStmt.setInt(3,count);
      cStmt.registerOutParameter(4,Types.INTEGER);
      ResultSet rs = cStmt.executeQuery();
      while(rs.next()){
        FeedSubscription feed = createFeedSubscriptionObject(rs);       
        feeds.add(feed);
      }
      int size = cStmt.getInt(4);
      if(size < 0){
        size = 0;
View Full Code Here

      cStmt = conn.prepareCall("call findAutoImportSubscription(?);");     
      cStmt.setInt(1,ageHour);
      cStmt.execute();
      ResultSet rs = cStmt.executeQuery();
      while(rs.next()){
        FeedSubscription feed = createFeedSubscriptionObject(rs);       
        feeds.add(feed);
      }   
      logger.debug("DaoResult: feeds="+feeds);
    }catch(Exception e){   
      logger.fatal(e);
View Full Code Here

  private void doSubscribe(Bookmark bookmark)  {
    String feedUrl = bookmark.getLink().getUrl();
    String feedTitle = bookmark.getTitle();   
    User feedOwner = bookmark.getUser();
    try{
      FeedSubscription feedSub = feedManager.createSubscription(feedOwner, feedUrl,feedTitle);
      if(feedSub != null){
        logger.debug("added feed subscription: " + feedSub);
      }else{
        logger.error("unable to add feed subscription: " + feedSub);
      }
View Full Code Here

    if(bmId <= 0){
      logger.error("unable create bookmark: " + feedBmark);
    }else{
      feedBmark.setId(bmId);
    }
    FeedSubscription feedSub = new FeedSubscription();
    feedSub.setBookmark(feedBmark);
    feedSub.setAutoImport(false);
    feedSub.setMatchText("");
    feedSub.setLastSync(null);
    int feedId = feedDao.createSubscription(feedSub);
    if(feedId <= 0){
      logger.error("unable to create feed subscription: " + feedSub);
    }else{
      feedSub = feedDao.getSubscription(feedId);
View Full Code Here

   * @throws RecordAlreadyExistsException
   */
  public int addImportFolders(User feedOwner, String feedUrl, String feedTitle, User folderOwner, List<String> folders) throws NoSuchUserException, NotAuthorizedException, MissingIdException{
    GnizrDaoUtil.fillId(userDao,feedOwner);
    GnizrDaoUtil.fillId(userDao,folderOwner);
    FeedSubscription feedSub = null;
    if(feedTitle == null){
      feedSub = getSubscription(feedOwner, feedUrl);
    }else{
      feedSub = createSubscription(feedOwner, feedUrl, feedTitle);
    }
View Full Code Here

  }
 
  public int removeImportFolders(User feedOwner, String feedUrl, User folderOwner, List<String> folders) throws NoSuchUserException, NoSuchFeedSubscriptionException{
    GnizrDaoUtil.fillId(userDao,feedOwner);
    GnizrDaoUtil.fillId(userDao,folderOwner);
    FeedSubscription feedSub = getSubscription(feedOwner, feedUrl);
    if(feedSub == null){
      throw new NoSuchFeedSubscriptionException("no such feed: " + feedUrl + " for user: " + feedOwner.getUsername());
    }
    List<Folder> folderImport = new ArrayList<Folder>();
    for(String folderName : folders){
View Full Code Here

TOP

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

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.