List of usage examples for twitter4j UserMentionEntity getName
String getName();
From source file:com.freshdigitable.udonroad.module.realm.UserMentionEntityRealm.java
License:Apache License
UserMentionEntityRealm(UserMentionEntity u) { this.id = u.getId(); this.screenName = u.getScreenName(); this.name = u.getName(); }
From source file:com.freshdigitable.udonroad.module.realm.UserRealm.java
License:Apache License
UserRealm(UserMentionEntity mentionEntity) { this.id = mentionEntity.getId(); this.name = mentionEntity.getName(); this.screenName = mentionEntity.getScreenName(); }
From source file:com.github.jcustenborder.kafka.connect.twitter.StatusConverter.java
License:Apache License
static Struct convertUserMentionEntity(UserMentionEntity userMentionEntity) { return new Struct(SCHEMA_USER_MENTION_ENTITY).put("Name", userMentionEntity.getName()) .put("Id", userMentionEntity.getId()).put("Text", userMentionEntity.getText()) .put("ScreenName", userMentionEntity.getScreenName()).put("Start", userMentionEntity.getStart()) .put("End", userMentionEntity.getEnd()); }
From source file:com.mothsoft.alexis.engine.retrieval.TwitterRetrievalTaskImpl.java
License:Apache License
private List<TweetMention> readMentions(Status status) { final List<TweetMention> mentions = new ArrayList<TweetMention>(); if (status.getUserMentionEntities() != null) { for (final UserMentionEntity entity : status.getUserMentionEntities()) { final Long userId = entity.getId(); final String name = entity.getName(); final String screenName = entity.getScreenName(); final TweetMention mention = new TweetMention((short) entity.getStart(), (short) entity.getEnd(), userId, name, screenName); mentions.add(mention);//from w w w .j a v a2 s .c om } } return mentions; }
From source file:DataCollections.UserHelper.java
public User_dbo convertMentionedUserToUser_dbo(UserMentionEntity user) { User_dbo u = new User_dbo(); u.values[User_dbo.map.get("user_id")].setValue(String.valueOf(user.getId())); u.values[User_dbo.map.get("name")].setValue(removeEscapeCharacters(user.getName())); u.values[User_dbo.map.get("screename")].setValue(removeEscapeCharacters(user.getScreenName())); return u;//from w w w .ja va 2 s . c o m }
From source file:de.vanita5.twittnuker.model.ParcelableUserMention.java
License:Open Source License
public ParcelableUserMention(final UserMentionEntity entity) { id = entity.getId(); name = entity.getName(); screen_name = entity.getScreenName(); }
From source file:de.vanita5.twittnuker.util.TwitterContentUtils.java
License:Open Source License
@NonNull public static String getInReplyToName(@NonNull final Status status) { final Status orig = status.isRetweet() ? status.getRetweetedStatus() : status; final long inReplyToUserId = status.getInReplyToUserId(); final UserMentionEntity[] entities = status.getUserMentionEntities(); if (entities == null) return orig.getInReplyToScreenName(); for (final UserMentionEntity entity : entities) { if (inReplyToUserId == entity.getId()) return entity.getName(); }/* ww w. j av a 2 s.c om*/ return orig.getInReplyToScreenName(); }
From source file:org.nsoft.openbus.model.Mensagem.java
License:Open Source License
private static JSONObject createAddtions(Status s) throws JSONException { JSONObject json = new JSONObject(); Vector<String> metions = new Vector<String>(); UserMentionEntity[] in_metions = s.getUserMentionEntities(); if (in_metions != null) { for (UserMentionEntity metion : in_metions) { metions.add(metion.getName()); }//from w w w .ja va 2s.c o m } URLEntity[] urls = s.getURLEntities(); Vector<String> image_files = new Vector<String>(); MediaEntity[] in_medias = s.getMediaEntities(); if (in_medias != null) { for (MediaEntity media : in_medias) { image_files.add(media.getMediaURL().toString()); } } json.put("metions", metions); json.put("image_files", metions); json.put("inReplyId", s.getInReplyToStatusId()); return json; }
From source file:org.tweetalib.android.model.TwitterStatus.java
License:Apache License
public TwitterStatus(Status status) { User statusUser = status.getUser();//w w w . j a v a2 s. co m mCreatedAt = status.getCreatedAt(); mId = status.getId(); if (status.getInReplyToStatusId() != -1) { mInReplyToStatusId = status.getInReplyToStatusId(); } if (status.getInReplyToUserId() != -1) { mInReplyToUserId = status.getInReplyToUserId(); } mInReplyToUserScreenName = status.getInReplyToScreenName(); mIsFavorited = status.isFavorited(); mIsRetweet = status.isRetweet(); mIsRetweetedByMe = status.isRetweetedByMe(); mSource = TwitterUtil.stripMarkup(status.getSource()); if (statusUser != null) { mUserId = statusUser.getId(); mUserName = statusUser.getName(); mUserScreenName = statusUser.getScreenName(); } mMediaEntity = TwitterMediaEntity.createMediaEntity(status); boolean useDefaultAuthor = true; if (mIsRetweet) { if (status.getRetweetedStatus() != null && status.getRetweetedStatus().getUser() != null) { SetProfileImagesFromUser(new TwitterUser(status.getRetweetedStatus().getUser())); } mOriginalRetweetId = status.getRetweetedStatus().getId(); // You'd think this check wasn't necessary, but apparently not... UserMentionEntity[] userMentions = status.getUserMentionEntities(); if (userMentions != null && userMentions.length > 0) { useDefaultAuthor = false; UserMentionEntity authorMentionEntity = status.getUserMentionEntities()[0]; mAuthorId = authorMentionEntity.getId(); mAuthorName = authorMentionEntity.getName(); mAuthorScreenName = authorMentionEntity.getScreenName(); Status retweetedStatus = status.getRetweetedStatus(); mStatus = retweetedStatus.getText(); setStatusMarkup(retweetedStatus); mRetweetCount = retweetedStatus.getRetweetCount(); mUserMentions = TwitterUtil.getUserMentions(retweetedStatus.getUserMentionEntities()); mIsRetweetedByMe = retweetedStatus.isRetweetedByMe(); } } else { if (statusUser != null) { SetProfileImagesFromUser(new TwitterUser(statusUser)); } } if (useDefaultAuthor) { if (statusUser != null) { mAuthorId = statusUser.getId(); } mStatus = status.getText(); setStatusMarkup(status); mRetweetCount = status.getRetweetCount(); mUserMentions = TwitterUtil.getUserMentions(status.getUserMentionEntities()); } /* * if (status.getId() == 171546910249852928L) { mStatus = * "<a href=\"http://a.com\">@chrismlacy</a> You've been working on Tweet Lanes for ages. Is it done yet?" * ; mStatusMarkup = * "<a href=\"http://a.com\">@chrismlacy</a> You've been working on Tweet Lanes for ages. Is it done yet?" * ; mAuthorScreenName = "emmarclarke"; mStatusMarkup = mStatus; } else * if (status.getId() == 171444098698457089L) { mStatus = * "<a href=\"http://a.com\">@chrismlacy</a> How's that app of yours coming along?" * ; mStatusMarkup = * "<a href=\"http://a.com\">@chrismlacy</a> How's that app of yours coming along?" * ; mStatusMarkup = mStatus; } */ }
From source file:uk.co.flax.ukmp.twitter.TweetUpdateThread.java
License:Apache License
private Tweet buildTweetFromStatus(Status status) { String text = status.getText(); Tweet tweet = new Tweet(); tweet.setId("" + status.getId()); tweet.setText(text);/* w w w .ja va2 s.c o m*/ tweet.setUserScreenName(status.getUser().getScreenName()); tweet.setUserName(status.getUser().getName()); tweet.setCreated(status.getCreatedAt()); if (status.getPlace() != null) { tweet.setPlaceName(status.getPlace().getFullName()); tweet.setCountry(status.getPlace().getCountry()); } tweet.setRetweetCount(status.getRetweetCount()); tweet.setFavouriteCount(status.getFavoriteCount()); tweet.setParty(partyListIds.get(status.getUser().getId())); if (status.getUserMentionEntities() != null) { List<String> screenNames = new ArrayList<>(status.getUserMentionEntities().length); List<String> fullNames = new ArrayList<>(status.getUserMentionEntities().length); for (UserMentionEntity ent : status.getUserMentionEntities()) { screenNames.add(ent.getScreenName()); if (StringUtils.isNotBlank(ent.getName())) { fullNames.add(ent.getName()); } } tweet.setMentionScreenNames(screenNames); tweet.setMentionFullNames(fullNames); } if (status.getHashtagEntities().length > 0) { List<String> hashtags = new ArrayList<>(status.getHashtagEntities().length); for (HashtagEntity ht : status.getHashtagEntities()) { hashtags.add(ht.getText()); } tweet.setHashtags(hashtags); } // Call the entity extraction service Map<String, List<String>> entities = entityExtraction.getEntities(text); if (entities != null && !entities.isEmpty()) { Map<String, Object> tweetEntities = new HashMap<String, Object>(); entities.keySet().forEach(type -> tweetEntities.put(type, entities.get(type))); tweet.setEntities(tweetEntities); } return tweet; }