Example usage for twitter4j User getScreenName

List of usage examples for twitter4j User getScreenName

Introduction

In this page you can find the example usage for twitter4j User getScreenName.

Prototype

String getScreenName();

Source Link

Document

Returns the screen name of the user

Usage

From source file:com.tuncaysenturk.jira.plugins.jtp.twitter.JiraTwitterUserStreamListener.java

public void onUserListUnsubscription(User subscriber, User listOwner, UserList list) {
    logger.info(JTPConstants.LOG_PRE + "just logging, onUserListUnsubscribed subscriber:@"
            + subscriber.getScreenName() + " listOwner:@" + listOwner.getScreenName() + " list:"
            + list.getName());//from w  ww .ja va  2s  . c o m
}

From source file:com.tuncaysenturk.jira.plugins.jtp.twitter.JiraTwitterUserStreamListener.java

public void onUserListCreation(User listOwner, UserList list) {
    logger.info(JTPConstants.LOG_PRE + "just loggimng, onUserListCreated  listOwner:@"
            + listOwner.getScreenName() + " list:" + list.getName());
}

From source file:com.tuncaysenturk.jira.plugins.jtp.twitter.JiraTwitterUserStreamListener.java

public void onUserListUpdate(User listOwner, UserList list) {
    logger.info(JTPConstants.LOG_PRE + "just logging, onUserListUpdated  listOwner:@"
            + listOwner.getScreenName() + " list:" + list.getName());
}

From source file:com.tuncaysenturk.jira.plugins.jtp.twitter.JiraTwitterUserStreamListener.java

public void onUserListDeletion(User listOwner, UserList list) {
    logger.info(JTPConstants.LOG_PRE + "just logging, onUserListDestroyed  listOwner:@"
            + listOwner.getScreenName() + " list:" + list.getName());
}

From source file:com.tuncaysenturk.jira.plugins.jtp.twitter.JiraTwitterUserStreamListener.java

public void onUserProfileUpdate(User updatedUser) {
    logger.info(/*from   w  w  w  .  j  a va2  s .co m*/
            JTPConstants.LOG_PRE + "just logging, onUserProfileUpdated user:@" + updatedUser.getScreenName());
}

From source file:com.tuncaysenturk.jira.plugins.jtp.twitter.JiraTwitterUserStreamListener.java

public void onBlock(User source, User blockedUser) {
    logger.info(JTPConstants.LOG_PRE + "just logging, onBlock source:@" + source.getScreenName() + " target:@"
            + blockedUser.getScreenName());
}

From source file:com.tuncaysenturk.jira.plugins.jtp.twitter.JiraTwitterUserStreamListener.java

public void onUnblock(User source, User unblockedUser) {
    logger.info(JTPConstants.LOG_PRE + "just logging, onUnblock source:@" + source.getScreenName() + " target:@"
            + unblockedUser.getScreenName());
}

From source file:com.tweetmyhome.TweetMyHome.java

private void analyzeAndRespond(User user, TweetStringAnalizer tsa, boolean directMessage)
        throws TwitterException, TweetMyHomeException {
    String _user = "@" + user.getScreenName();
    TweetFlag.Flag flag = tsa.getFlagTweetFlag().getFlag();
    TweetFlag.Value value = tsa.getFlagTweetFlag().getValue();
    StringBuilder finalTweetStringResponse = new StringBuilder();
    boolean error = false;
    boolean private_message = false;
    boolean informar_admins = false;//************************************************
    switch (flag) {
    case ALARM:/* ww  w  .j ava  2s  .c  om*/
        if (value.equals(TweetFlag.Value.ON)) {
            if (!sec.isEnabled()) { // activo la alarma
                finalTweetStringResponse.append(_user).append(" Alarma Activada! ").append(TENDENCE);
                sec.enable();
                db.add(new HistorySecurity(sec.isEnabled(), Calendar.getInstance().getTimeInMillis(),
                        user.getId()));
            } else { // la alarma ya esta activada. envio mensaje de error privado al usuario
                private_message = true;
                finalTweetStringResponse.append("Error,la alarma ya esta activa");
            }
        } else if (value.equals(TweetFlag.Value.OFF)) {
            if (sec.isEnabled()) { // desactivo la alarma
                finalTweetStringResponse.append(_user).append(" Alarma Desactivada! ").append(TENDENCE);
                sec.disable();
                db.add(new HistorySecurity(sec.isEnabled(), Calendar.getInstance().getTimeInMillis(),
                        user.getId()));
            } else { // alarma ya desactivada. envio mensaje de error privado al usuario
                private_message = true;
                finalTweetStringResponse.append("Error,la alarma ya esta desactivada");
            }
        } else if (value.equals(TweetFlag.Value.STATUS)) {
            private_message = true;
            if (sec.isEnabled()) {
                finalTweetStringResponse.append("Alarma activa ");
            } else {
                finalTweetStringResponse.append("Alarma desactivada ");
            }
            finalTweetStringResponse.append(TENDENCE);

        } else {
            error = true;
            warn("Alarm value does't founded");
        }
        break;
    case COMUNITY:
        if (value.equals(TweetFlag.Value.ON)) {
            if (!com.isActivated()) { //activo modo comunitario
                finalTweetStringResponse.append(_user).append(" Modo comunitario activado! ")
                        .append(TENDENCE);
                com.activateComunityMode();
                db.add(new HistoryComunityMode(com.isActivated(), Calendar.getInstance().getTimeInMillis(),
                        user.getId()));
            } else {
                private_message = true;
                finalTweetStringResponse.append("Error, el modo comunitario ya esta activado");
            }
        } else if (value.equals(TweetFlag.Value.OFF)) {
            if (com.isActivated()) {
                finalTweetStringResponse.append(_user).append(" Modo comunitario desactivado! ")
                        .append(TENDENCE);
                com.desactivateComunityMode();
                db.add(new HistoryComunityMode(com.isActivated(), Calendar.getInstance().getTimeInMillis(),
                        user.getId()));
            } else {
                private_message = true;
                finalTweetStringResponse.append("Error, el modo comunitario ya esta desactivado");
            }
        } else {
            error = true;
            warn("Comunity value does't founded");
        }
        break;
    case USER:
        private_message = true;
        if (value.equals(TweetFlag.Value.ADD)) { // verificar si usuario existe*****************************
            tsa.getTweetVariableList().forEach(v -> {
                debug("  Tweet Variables founded");
                debug("\t" + "[" + v.getVaribleIdentifier() + "]" + v.getVariable());
            });
            String newAddUserName = tsa.getTweetVariableList().get(0).getVariable();
            User twitterUser = tw.showUser(newAddUserName);
            db.add(new TwitterUser(twitterUser.getId(), TwitterUserUtil.getTwitterUser(newAddUserName),
                    UserRol.user, true));
            finalTweetStringResponse.append(_user).append(" Usuario Aadido! ").append(TENDENCE);
        } else if (value.equals(TweetFlag.Value.DEL)) {
            String newDelUser = tsa.getTweetVariableList().get(0).getVariable(); // solo deberia existir 1 elemento
            User twitterUser = tw.showUser(newDelUser);
            db.desactivateUserById(twitterUser.getId());
            tw.destroyFriendship(twitterUser.getId()); // ver este metodo en accion.. la idea es dejar de seguir*************
            finalTweetStringResponse.append(_user).append(" Usuario Eliminado! ").append(TENDENCE);
        } else if (value.equals(TweetFlag.Value.MOD)) { // farta*******************************************
            //diferente
            finalTweetStringResponse.append(_user).append(" Usuario Modificado! ").append(TENDENCE);

        } else {
            error = true;
            warn("User value does't founded");
        }
        break;
    case NULL:
    default:
        error = true;
        warn("Flag value does't founded");
    }
    debug("analizeAndRespond[finalTweetStringResponse]=" + finalTweetStringResponse.toString());
    if (!error) { // el usuario es la casa misma plix
        finalTweetStringResponse.append(" ").append(tweetCount.getHexHashTagCount());
        if (directMessage) { // respondo  solo al usuario ya que es un mensaje directo
            sendDm(user.getId(), finalTweetStringResponse.toString());
        } else if (private_message) { // es de el tipo privado ej:usuario modificado
            sendDm(user.getId(), finalTweetStringResponse.toString());
        } else if (com.isActivated()) { // en caso de estar modo comunitario lo envio a todos
            sendT(finalTweetStringResponse.toString());
        } else {// Esto solo acurre cuand otengo que informar algo importante pero no esta el modo comunitario activado 
            // envio mensajes privados a todos los usuarios "amigos". a partir de la bd para menor conjestion
            for (TwitterUser u : db.getAllUsers()) { // a que tipo de usuario se lo envio !?!?!??!---------
                if (u.isActivado()) {
                    sendDm(u.getIdTwitterUser(), finalTweetStringResponse.toString());
                }
            }
        }
    } else {
        throw new TweetMyHomeException("Error Flag or Values does not match or are invalid");
    }

}

From source file:com.tweetmyhome.TweetMyHome.java

@Override
public void onFavorite(User source, User target, Status favoritedStatus) {
    debug("onFavorite source:@" + source.getScreenName() + " target:@" + target.getScreenName() + " @"
            + favoritedStatus.getUser().getScreenName() + " - " + favoritedStatus.getText());
}

From source file:com.tweetmyhome.TweetMyHome.java

@Override
public void onUnfavorite(User source, User target, Status unfavoritedStatus) {
    debug("onUnFavorite source:@" + source.getScreenName() + " target:@" + target.getScreenName() + " @"
            + unfavoritedStatus.getUser().getScreenName() + " - " + unfavoritedStatus.getText());
}