Package de.jetwick.tw

Examples of de.jetwick.tw.Extractor


            int counter = 0;

            @Override
            public String getObject() {
                return new Extractor() {

                    @Override
                    public String createTagMarkup(String tag, String cleanTag) {
//                        String url = Helper.TSURL + cleanTag;
                        return "<a class=\"i-tw-link tw-tag\" "
View Full Code Here


                        final JTweet tweet = (JTweet) item.getModelObject();
                        final Label label = new Label("tweet", new Model<String>() {

                            @Override
                            public String getObject() {
                                return new Extractor().setTweet(tweet).setText(tweet.getText()).run().toString();
//                                return tweet.getText();
                            }
                        });
                        label.setEscapeModelStrings(false);
                        item.add(label);
View Full Code Here

                        tw.getFromUser().getScreenName()));

                item.add(new ExternalLink("statusLink",
                        Helper.toTwitterHref(tw.getFromUser().getScreenName(), tw.getTwitterId())));

                Label label = new Label("tweetText", new Extractor().setTweet(tw).run().toString());
                label.setEscapeModelStrings(false);
                item.add(label);
            }
        });
    }
View Full Code Here

    public Collection<JTweet> findRetweets(Map<Long, JTweet> tweets, final Map<String, JUser> userMap) {
        // 1. check if tweets contains originals which were retweeted -> only done for 'tweets'
        // 2. check if tweets contains retweets -> done for 'tweets' and for tweets in solr

        final Set<JTweet> updatedTweets = new LinkedHashSet<JTweet>();
        Extractor extractor = new Extractor() {

            @Override
            public boolean onNewUser(int index, String user) {
                boolean isRetweet = index >= 3 && text.substring(index - 3, index).equalsIgnoreCase("rt ");
                if (isRetweet) {
                    user = user.toLowerCase();
                    JUser existingUser = userMap.get(user);
                    JTweet resTw = null;

                    // check ifRetweetOf against local tweets
                    if (existingUser != null)
                        for (JTweet tmp : existingUser.getOwnTweets()) {
                            if (tmp.getCreatedAt().getTime() < tweet.getCreatedAt().getTime()
                                    && tweet.isRetweetOf(tmp)) {
                                if (addReplyNoTricks(tmp, tweet)) {
                                    resTw = tmp;
                                    break;
                                }
                            }
                        }

                    // check ifRetweetOf against tweets existing in index
                    if (resTw == null)
                        resTw = connectToOrigTweet(tweet, user);

                    if (resTw != null) {
                        updatedTweets.add(resTw);
                        return false;
                    }
                }

                // break loop of Extractor because we only need the first user!
                return true;
            }
        };

        for (JTweet tw : tweets.values()) {
            if (tw.isRetweet()) {
                extractor.setTweet(tw).run();
            }
        }
        return updatedTweets;
    }
View Full Code Here

TOP

Related Classes of de.jetwick.tw.Extractor

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.