Package net.fortytwo.twitlogic.model

Examples of net.fortytwo.twitlogic.model.Tweet


        this.twitterClient = twitterClient;
        bitlyClient = new BitlyClient();
    }

    public void interpretCommand(final Tweet request) throws TwitterClientException {
        Tweet response;

        String text = request.getText().trim();

        // TODO: a space character is not the only possibility for terminating the @username
        text = text.substring(text.indexOf(" ") + 1);
View Full Code Here


                + BitlyClient.percentEncode(resourceURL);
    }
    private Tweet createReply(final Tweet request,
                              final String message) {
        String text = "@" + request.getUser().getScreenName() + " " + message;
        Tweet reply = new Tweet();
        reply.setText(text);

        reply.setInReplyToTweet(request);

        return reply;
    }
View Full Code Here

        for (Status status : statuses) {
            if (!handler.isOpen()) {
                break;
            }

            handler.handle(new Tweet(status));
        }
    }
View Full Code Here

                if (!handler.isOpen()) {
                    LOGGER.info("handler closed");
                    return;
                }

                handler.handle(new Tweet(status));
            }
            if (result.hasNext()) {
                System.out.println("there are more results!");
            } else {
                System.out.println("no more results");
View Full Code Here

        //System.out.println(r);

        try {
            JSONArray results = r.getJSONArray("results");
            for (int i = 0; i < results.length(); i++) {
                Tweet t;
                try {
                    t = new Tweet(results.getJSONObject(i));
                } catch (TweetParseException e) {
                    throw new TwitterClientException(e);
                }
                try {
                    if (!handler.isOpen()) {
View Full Code Here

                + "?page=" + page + "&count=" + limits.getTimelinePageCountLimit());

        JSONArray array = requestJSONArray(request);
        //System.out.println(array);
        for (int i = 0; i < array.length(); i++) {
            Tweet t;
            try {
                t = new Tweet(array.getJSONObject(i));
            } catch (TweetParseException e) {
                throw new TwitterClientException(e);
            } catch (JSONException e) {
                throw new TwitterClientException(e);
            }
View Full Code Here

                try {
                    JSONObject obj = (JSONObject) array.get(i);
                    if (!handler.isOpen()) {
                        break;
                    }
                    handler.handle(new Tweet(obj));
                } catch (Exception e) {
                    throw new TwitterClientException(e);
                }
            }
        }
View Full Code Here

                stream.shutdown();
                return;
            }

            try {
                addHandler.handle(new Tweet(status));
            } catch (HandlerException e) {
                LOGGER.severe("exception in tweet handling: " + e.getMessage());
                e.printStackTrace(System.err);
            }
        }
View Full Code Here

            if (!deleteHandler.isOpen()) {
                stream.shutdown();
                return;
            }

            Tweet d = new Tweet("" + notice.getStatusId());
            try {
                deleteHandler.handle(d);
            } catch (HandlerException e) {
                LOGGER.severe("exception in tweet deletion: " + e.getMessage());
                e.printStackTrace(System.err);
View Full Code Here

    private boolean handleDeleteStatusElement(final JSONObject el) throws TweetParseException, HandlerException {
        if (null == deleteHandler) {
            LOGGER.info("skipping 'delete' status element");
            return true;
        } else {
            Tweet status;
            try {
                status = new Tweet(el
                        .getJSONObject(TwitterAPI.Field.DELETE.toString())
                        .getJSONObject(TwitterAPI.Field.STATUS.toString())
                        .getString(TwitterAPI.Field.ID.toString()));
            } catch (JSONException e) {
                throw new TweetParseException(e);
View Full Code Here

TOP

Related Classes of net.fortytwo.twitlogic.model.Tweet

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.