Examples of Post


Examples of del.icio.us.beans.Post

    Delicious dConn = new Delicious(dUsername, dPassword);
    logger.debug("created an access object to del.icio.us");
    List posts = dConn.getAllPosts();
    if (posts != null && posts.size() > 0) {
      for(Iterator it = posts.iterator(); it.hasNext();) {
        Post aPost = (Post) it.next();
        Bookmark bmark = createBookmark(aPost);
        int bmid = bmarkManager.getBookmarkId(gUser,bmark.getLink().getUrl());
        if(bmid <= 0){
          try {
            bmid = bmarkManager.addBookmark(bmark);
View Full Code Here

Examples of distributedRedditAnalyser.reddit.Post

  }

  @Override
  public void execute(Tuple input) {
    //Get the post
    Post newPost = (Post)input.getValue(0);
    //Turn it into an instance
    Instance inst = new DenseInstance(2);
    inst.setDataset(INST_HEADERS);
    inst.setValue(0, newPost.getTitle());
    inst.setValue(1, newPost.getSubReddit());
    //emit these to a new bolt that collects instances
    _collector.emit(new Values(inst));
    _collector.ack(input);
  }
View Full Code Here

Examples of distributedRedditAnalyser.reddit.Post

  @Override
  public void nextTuple() {
    //Sleep to reduce congestion
    Utils.sleep(50);
    //Try and get the next post
    Post nextPost = getNextPost();
    //If we have gotten a post emit it
    if(nextPost != null)
      collector.emit(new Values(nextPost));
  }
View Full Code Here

Examples of distributedRedditAnalyser.reddit.Post

              break;
           
            //reverse order so printed order is consistent
            for(int c=children.size()-1; c>=0; c--){
              JSONObject childData = (JSONObject) ((JSONObject) children.get(c)).get("data");
              QUEUE.add(new Post((String) childData.get("title"), SUBREDDIT));
            }
           
            lastItemId = (String) wrappingObjectData.get("after");
           
            //If this is the first page, then it's the point we want to store to ensure that we don't get repeated posts
            if(i == 0){
              latestTimestamp = ((Double) ((JSONObject)((JSONObject) children.get(0)).get("data")).get("created")).longValue();
            }
           
            //Rate limit
            if(i != INITIAL_PAGE_COUNT - 1)
              Utils.sleep(1000);
            count += 100;
          }
          initialPull = false;
        }else{
          //Rate limit for the API (pages are cached for 30 seconds)
          Utils.sleep(10000);
          //Get the page
          HttpGet getRequest = new HttpGet(URL);
          ResponseHandler<String> responseHandler = new BasicResponseHandler();
               
          String responseBody = httpClient.execute(getRequest, responseHandler);
         
          //Parse it
          JSONParser parser= new JSONParser();
         
          JSONObject wrappingObject = (JSONObject) parser.parse(responseBody);
         
          JSONObject wrappingObjectData = (JSONObject) wrappingObject.get("data");
         
          JSONArray children = (JSONArray) wrappingObjectData.get("children");
         
          if(children.size() > 0){
            //reverse order so it is an actual stream
            for(int c=children.size()-1; c>=0; c--){
              JSONObject childData = (JSONObject) ((JSONObject) children.get(c)).get("data");
              if(latestTimestamp < ((Double) childData.get("created")).longValue())
                QUEUE.add(new Post((String) childData.get("title"), SUBREDDIT));
            }
            latestTimestamp = ((Double) ((JSONObject)((JSONObject) children.get(0)).get("data")).get("created")).longValue();
          }
        }
      } catch (ClientProtocolException e) {
View Full Code Here

Examples of domain.blog.Post

      config.addMappedStatement(selectPost);
      List<Post> posts = executor.query(selectPost, 5, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
      executor.flushStatements();
      executor.rollback(true);
      assertEquals(1, posts.size());
      Post post = posts.get(0);
      assertNull(post.getBlog());
    } finally {
      executor.rollback(true);
      executor.close(false);
    }
  }
View Full Code Here

Examples of facebook4j.Post

            JSONArray list = json.getJSONArray("data");
            final int size = list.length();
            ResponseList<Post> posts = new ResponseListImpl<Post>(size, json);
            for (int i = 0; i < size; i++) {
                JSONObject postJSONObject = list.getJSONObject(i);
                Post post = new PostJSONImpl(postJSONObject);
                if (conf.isJSONStoreEnabled()) {
                    DataObjectFactoryUtil.registerJSONObject(post, postJSONObject);
                }
                posts.add(post);
            }
View Full Code Here

Examples of fb4java.beans.Post

      if (postListObj != null && postListObj instanceof JSONArray) {
    JSONArray posts = (JSONArray) postListObj;
    int postSize = posts.length();
    for (int a = 0; a < postSize; a++) {
        JSONObject jObj = posts.getJSONObject(a);
        Post p = new Post();
        p.postId = jObj.getString("post_id");
        p.viewerId = jObj.getLong("viewer_id");
        p.sourceId = jObj.getLong("source_id");
        p.type = jObj.getInt("type");
        // jObj.getLong("app_id");
View Full Code Here

Examples of halfpipe.example.model.Post

    }*/

    @POST
    @ApiOperation(value = "create", notes = "create a post", response = Post.class)
    public Post create(@Valid Post post) {
        Post save = posts.save(post);
        return save;
    }
View Full Code Here

Examples of halfpipe.example.model.Post


    @GET
    @Path("/test")
    public Post testPost() {
        Post post = new Post();
        post.setAuthor("myauthor");
        post.setBody("mybody");
        post.setId(1L);
        post.setTitle("mytitle");
        return post;
    }
View Full Code Here

Examples of halfpipe.example.model.Post

    Supplier<List<Post>> postsAsyncFallback() {
        return () -> Lists.newArrayList(getPost());
    }

    private Post getPost() {
        Post post = new Post();
        post.setId(-1L);
        post.setTitle("This is a fallback post for ");
        post.setAuthor("System");
        post.setBody("Hystrix caught an error, this is the fallback");
        return post;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.