List of usage examples for twitter4j User getId
long getId();
From source file:kr.debop4j.search.twitter.Twitters.java
License:Apache License
protected static String getUserAsString(User user) { StringBuilder sb = new StringBuilder(); return sb.append("id=").append(user.getId()).append(",").append("name=").append(user.getName()).append(",") .append("screenName=").append(user.getScreenName()).append(",").append("description=") .append(user.getDescription()).toString(); }
From source file:Logic.mongoC.java
public void IngresarUsuario(String name) { String[] buscarUs = new String[1]; buscarUs[0] = name;//from w w w. ja v a 2 s .c om try { ResponseList<twitter4j.User> use = twitter.lookupUsers(buscarUs); twitter4j.User u = use.get(0); System.out.println(u.getStatus()); usuario nuevoS = new usuario(); nuevoS.setId(Long.toString(u.getId())); nuevoS.setNombre(u.getName()); nuevoS.setLocation(u.getLocation()); nuevoS.setNumFol(u.getFollowersCount()); nuevoS.setNumeroDeT(u.getStatusesCount()); List<Status> twitts = twitter.getUserTimeline(u.getId(), new Paging(1, 200)); ArrayList<twitt> timeL = new ArrayList(); for (Status s : twitts) { twitt tw = new twitt(); tw.setTexto(s.getText()); tw.setRetwett(s.getRetweetCount()); //tw.setFecha((java.util.Date) s.getCreatedAt()); tw.setFav(s.getFavoriteCount()); tw.setCreador(s.getUser().getScreenName()); UserMentionEntity[] userMentionEntities = s.getUserMentionEntities(); ArrayList<String> inter = new ArrayList(); for (UserMentionEntity uh : userMentionEntities) { inter.add(uh.getScreenName()); } tw.setPersonas(inter); timeL.add(tw); } nuevoS.setTimeline(timeL); final String fIns = gson.toJson(nuevoS); Document dt; dt = new Document("ScreenName", u.getScreenName()); dt.append("todo", fIns); conect(); coll.insertOne(dt); JOptionPane.showMessageDialog(null, "Usuario Ingresado"); } catch (TwitterException ex) { System.out.println("No se pudo conectar el usuario deseado"); } }
From source file:me.chester.myretweetedtweets.TwitterCallbackServlet.java
License:Apache License
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { try {//from w w w.ja v a 2s . co m HttpSession session = request.getSession(); String token = (String) session.getAttribute("token"); String tokenSecret = (String) session.getAttribute("tokenSecret"); if (token == null || tokenSecret == null || !token.equals(request.getParameter("oauth_token"))) { response.setStatus(HttpServletResponse.SC_FORBIDDEN); return; } User user = new User(); user.finishAuthorization(token, tokenSecret); user.persist(); response.sendRedirect("/instructions.jsp?id=" + user.getId()); } catch (TwitterException te) { throw new ServletException(te); } }
From source file:net.archenemy.archenemyapp.presenter.BackgroundWorkerFragment.java
License:Apache License
@Override public void onUserRequestCompleted(User twitterUser) { if ((context != null) && (users != null) && (users.size() > 0)) { Long userId = twitterUser.getId(); for (SocialMediaUser user : users) { if (user.getTwitterUserId().equals(userId)) { user.setTwitterUser(twitterUser); TwitterAdapter.getInstance().makeFeedRequest(userId, this, context); twitterCallbackTotal++;/* w ww . j a v a 2 s . co m*/ break; } } } }
From source file:net.lacolaco.smileessence.command.CommandOpenUserDetail.java
License:Open Source License
@Override public boolean execute() { new ShowUserTask(new TwitterApi(account).getTwitter(), screenName) { @Override/*from w w w. ja va2 s .c o m*/ protected void onPostExecute(User user) { super.onPostExecute(user); if (user != null) { UserDetailDialogFragment fragment = new UserDetailDialogFragment(); fragment.setUserID(user.getId()); DialogHelper.showDialog(getActivity(), fragment); } else { Notificator.publish(getActivity(), R.string.notice_error_show_user, NotificationType.ALERT); } } }.execute(); return false; }
From source file:net.lacolaco.smileessence.command.status.StatusCommandFavAndRT.java
License:Open Source License
@Override public boolean isEnabled() { User user = getOriginalStatus().getUser(); return !user.isProtected() && user.getId() != account.userID; }
From source file:net.lacolaco.smileessence.data.UserCache.java
License:Open Source License
/** * Put user into cache//from ww w .j av a 2 s. c om * * @param user * @return the previous value associated with key, or null if there was no mapping for key */ public User put(User user) { return cache.put(user.getId(), user); }
From source file:net.lacolaco.smileessence.twitter.UserStreamListener.java
License:Open Source License
private boolean isMe(User user) { return user.getId() == getMyID(); }
From source file:net.lacolaco.smileessence.view.dialog.StatusDetailDialogFragment.java
License:Open Source License
private boolean isNotRetweetable(Account account, Status status) { User user = TwitterUtils.getOriginalStatus(status).getUser(); return user.isProtected() || user.getId() == account.userID; }
From source file:net.lacolaco.smileessence.view.dialog.UserDetailDialogFragment.java
License:Open Source License
private void executeUserTimelineTask(final User user, final Account account, final StatusListAdapter adapter) { tabHost.getTabWidget().getChildTabViewAt(1).setVisibility(View.GONE); Twitter twitter = TwitterApi.getTwitter(account); new UserTimelineTask(twitter, user.getId()) { @Override//from w w w . j a v a 2 s . co m protected void onPostExecute(twitter4j.Status[] statuses) { super.onPostExecute(statuses); for (twitter4j.Status status : statuses) { adapter.addToBottom(new StatusViewModel(status, account)); } adapter.updateForce(); tabHost.getTabWidget().getChildTabViewAt(1).setVisibility(View.VISIBLE); } }.execute(); }