Package de.jetwick.ese.domain

Examples of de.jetwick.ese.domain.MyTweet


    try {
        id = Long.parseLong(idAsStr);
    } catch (Exception ex) {
        logger.error("Couldn't parse id:" + idAsStr);
    }
    MyTweet tweet = new MyTweet(id, name);
    tweet.setText((String) source.get(TWEET_TXT));
    tweet.setCreatedAt(Helper.toDateNoNPE((String) source.get(CREATED_AT)));
    tweet.setFromUserId((Integer) source.get("fromUserId"));

    return tweet;
}
View Full Code Here


    public SearchResponse search(Collection<MyTweet> tweets, MyQuery request) {
        SearchResponse rsp = query(request);
        SearchHit[] docs = rsp.getHits().getHits();
        for (SearchHit sd : docs) {
//            System.out.println(sd.getExplanation().toString());
            MyTweet tw = readDoc(sd.getSource(), sd.getId());
            tweets.add(tw);
        }

        return rsp;
    }
View Full Code Here

        userView = new ListView("users", tweets) {

            @Override
            public void populateItem(final ListItem item) {
                final MyTweet tweet = (MyTweet) item.getModelObject();
                String twitterUrl = Helper.TURL + "/" + tweet.getUserName();
               
                ExternalLink userNameLink = new ExternalLink("userNameLink", twitterUrl, tweet.getUserName());
                item.add(userNameLink);
                item.add(new Label("tweetText", tweet.getText()));
                item.add(new Label("createdAt", Helper.toLocalDateTime(tweet.getCreatedAt())));
            }
        };

        add(userView);
    }
View Full Code Here

    public Collection<MyTweet> createFake() {
        List<MyTweet> tweets = new ArrayList<MyTweet>();
        int MAX = 20000;
        for (int i = 0; i < MAX; i++) {
            MyTweet tweet = new MyTweet(i, "peter " + i);
            tweet.setFromUserId(i % 100);
            tweet.setCreatedAt(new Date(i));
            tweet.setText(createRandomWord(4) + " test " + createRandomWord(10));
            tweets.add(tweet);
        }
        return tweets;
    }
View Full Code Here

            Twitter twitter4j = new TwitterFactory().getInstance();
            for (int i = 0; i < 3; i++) {
                Query q = new Query("java");
                q.setRpp(100);
                for (Tweet tw : twitter4j.search(q).getTweets()) {
                    MyTweet myTw = new MyTweet(tw.getId(), tw.getFromUser());
                    myTw.setText(tw.getText());
                    myTw.setCreatedAt(tw.getCreatedAt());
                    myTw.setFromUserId(tw.getFromUserId());
                    tweets.add(myTw);
                }
                Thread.sleep(1000);
            }
        } catch (Exception ex) {
View Full Code Here

TOP

Related Classes of de.jetwick.ese.domain.MyTweet

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.