List of usage examples for twitter4j User getFriendsCount
int getFriendsCount();
From source file:tweetcrawling.TweetCrawler.java
public ArrayList<String> getValueToWrite(Status status) { // Getting the value to be written Long tid = status.getId();//w ww . ja v a 2 s.co m String tweetid = tid.toString(); ArrayList<String> valueToWrite = new ArrayList<String>(); User user = status.getUser(); String screenname = user.getScreenName(); String name = user.getName(); String url = getTweetUrl(screenname, tweetid); String body = status.getText().replace("\n", " "); valueToWrite.add(body.replace(",", " ")); // element: body valueToWrite.add(url); // element: id valueToWrite.add(screenname); // element: userid valueToWrite.add(name); // element: user // element: gender if (name != null && !name.isEmpty()) { valueToWrite.add(getUserGender(name)); } else if (screenname != null && !screenname.isEmpty()) { valueToWrite.add(getUserGender(screenname)); } else { valueToWrite.add(""); } valueToWrite.add(user.getLocation()); // element: location valueToWrite.add("" + user.getFollowersCount()); // element: followercount valueToWrite.add("" + user.getFriendsCount()); // element: friendscount valueToWrite.add("" + user.getStatusesCount()); // element: statuscount try { List<String> coor = new ArrayList<String>(); String latitude = "" + status.getGeoLocation().getLatitude(); String longitude = "" + status.getGeoLocation().getLongitude(); coor.add(latitude); coor.add(longitude); if (coor != null && !coor.isEmpty() && coor.size() > 0) { valueToWrite.add(coor.get(0)); // element: latitude valueToWrite.add(coor.get(1)); // element: longitude valueToWrite.add(coor.get(0) + "," + coor.get(1)); } else { valueToWrite.add(null); valueToWrite.add(null); valueToWrite.add(null); } } catch (Exception e) { valueToWrite.add(null); valueToWrite.add(null); valueToWrite.add(null); } try { String geoname = status.getPlace().getName(); String country = status.getPlace().getCountry(); if (geoname != null) { valueToWrite.add(geoname); } else { valueToWrite.add(null); } if (country != null) { valueToWrite.add(country); } else { valueToWrite.add(null); } } catch (Exception e) { valueToWrite.add(null); valueToWrite.add(null); } DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); Date date = status.getCreatedAt(); valueToWrite.add(dateFormat.format(date)); // element: date valueToWrite.add(getDateCrawler()); // element: datecrawler valueToWrite.add(status.getInReplyToScreenName()); // element: replyto String tooltip = ""; try { String geoname = status.getPlace().getName(); if (geoname != null) { tooltip = "user = " + name + ", geoname = " + geoname; } } catch (Exception e) { tooltip = ""; } valueToWrite.add(tooltip.trim()); // element: tooltip valueToWrite.add(SOURCE); // element: source return valueToWrite; }
From source file:tweetcrawling.TweetCrawler.java
public void printTweets(String csvOut) throws IOException, TwitterException { for (Status status : getStatuses()) { // Getting the value to be written Long tid = status.getId(); String tweetid = tid.toString(); ArrayList<String> valueToWrite = new ArrayList<String>(); User user = status.getUser(); String screenname = user.getScreenName(); String name = user.getName(); String url = getTweetUrl(screenname, tweetid); valueToWrite.add(url); // element: id valueToWrite.add(screenname); // element: userid valueToWrite.add(name); // element: user // element: gender if (name != null && !name.isEmpty()) { valueToWrite.add(getUserGender(name)); } else if (screenname != null && !screenname.isEmpty()) { valueToWrite.add(getUserGender(screenname)); } else {/*from w w w . j ava2 s .co m*/ valueToWrite.add(""); } valueToWrite.add(user.getLocation()); // element: location valueToWrite.add("" + user.getFollowersCount()); // element: followercount valueToWrite.add("" + user.getFriendsCount()); // element: friendscount valueToWrite.add("" + user.getStatusesCount()); // element: statuscount try { List<String> coor = new ArrayList<String>(); String latitude = "" + status.getGeoLocation().getLatitude(); String longitude = "" + status.getGeoLocation().getLongitude(); coor.add(latitude); coor.add(longitude); if (coor != null && !coor.isEmpty() && coor.size() > 0) { valueToWrite.add(coor.get(0)); // element: latitude valueToWrite.add(coor.get(1)); // element: longitude valueToWrite.add(coor.get(0) + "," + coor.get(1)); } else { valueToWrite.add(null); valueToWrite.add(null); valueToWrite.add(null); } } catch (Exception e) { valueToWrite.add(null); valueToWrite.add(null); valueToWrite.add(null); } try { String geoname = status.getPlace().getName(); String country = status.getPlace().getCountry(); if (geoname != null) { valueToWrite.add(geoname); } else { valueToWrite.add(null); } if (country != null) { valueToWrite.add(country); } else { valueToWrite.add(null); } } catch (Exception e) { valueToWrite.add(null); valueToWrite.add(null); } DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); Date date = status.getCreatedAt(); valueToWrite.add(dateFormat.format(date)); // element: date valueToWrite.add(getDateCrawler()); // element: datecrawler valueToWrite.add(status.getText()); // element: body valueToWrite.add(status.getInReplyToScreenName()); // element: replyto String tooltip = ""; try { String geoname = status.getPlace().getName(); if (geoname != null) { tooltip = "user = " + name + ", geoname = " + geoname; } } catch (Exception e) { tooltip = ""; } valueToWrite.add(tooltip.trim()); // element: tooltip valueToWrite.add(SOURCE); // element: source // Write valueToWrite to csv external file FileWriter fw = new FileWriter(csvOut, true); PrintWriter pw = new PrintWriter(fw); String content = "'"; for (int i = 0; i < valueToWrite.size() - 1; i++) { content += valueToWrite.get(i) + "','"; } content += valueToWrite.get(valueToWrite.size()) + "'"; pw.print(content); pw.flush(); pw.close(); fw.close(); } }
From source file:twitbak.TwitBak.java
License:Open Source License
/** * Returns a JSONObject containing user data. * @param user// www. j a v a 2s . c om * @return * @throws TwitterException * @throws JSONException */ //TODO - should be void to match other Bak classes static JSONObject userToJson(User user) throws TwitterException, JSONException { JSONObject result = new JSONObject(); JSONObject userData = new JSONObject(); userData.put("ID", user.getId()); userData.put("Screen Name", user.getScreenName()); userData.put("Name", user.getName()); userData.put("Description", user.getDescription()); userData.put("Profile Image URL", user.getProfileImageURL()); userData.put("URL", user.getURL()); userData.put("Protected", user.isProtected()); userData.put("Followers", user.getFollowersCount()); userData.put("Created At", user.getCreatedAt().toString()); userData.put("Favorites", user.getFavouritesCount()); userData.put("Friends", user.getFriendsCount()); userData.put("Location", user.getLocation()); userData.put("Statuses", user.getStatusesCount()); userData.put("Profile Background Color", user.getProfileBackgroundColor()); userData.put("Profile Background Image URL", user.getProfileBackgroundImageUrl()); userData.put("Profile Sidebar Border Color", user.getProfileSidebarBorderColor()); userData.put("Profile Sidebar Fill Color", user.getProfileSidebarFillColor()); userData.put("Profile Text Color", user.getProfileTextColor()); userData.put("Time Zone", user.getTimeZone()); result.put("User data", userData); return result; }
From source file:twitter.crawler.TwitterCrawler.java
public static void main(String[] args) { try {//from ww w .j a v a 2 s .c o m // Authorise the library ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setOAuthConsumerKey("AhoydO8uSe4v8NEq7j2ISGFlq"); cb.setOAuthConsumerSecret("ptKEYwq3G9vpFkqAhvwFLSWFcBW8U1SfqycECwK4cH6wThVba6"); cb.setOAuthAccessToken("778240255577194496-taafqDIHebrg972oxT5kTqcNd3Uojod"); cb.setOAuthAccessTokenSecret("DMRmeRahnLJRvCBIGQGTaTzE6Pr3PAZMgMsfWIT5ue3PD"); Twitter twitter = new TwitterFactory(cb.build()).getInstance(); User user = twitter.verifyCredentials(); // Get main user long cursor = -1; // Print user profile System.out.println("@" + user.getScreenName()); System.out.println(user.getId()); System.out.println(user.getProfileImageURL()); System.out.println(user.getFriendsCount() + " friends."); System.out.println("-------"); // Print Home Timeline List<Status> statuses = twitter.getHomeTimeline(); System.out.println("Showing @" + user.getScreenName() + "'s home timeline."); for (Status status : statuses) { System.out.println("@" + status.getUser().getScreenName() + " - " + status.getText()); } //Print followers System.out.println("-------"); System.out.println("Showing Follwers:"); PagableResponseList<User> followers; //do //{ followers = twitter.getFollowersList(user.getScreenName(), cursor); for (User follower : followers) { System.out.println("@" + follower.getScreenName()); } //} //while ((cursor = followers.getNextCursor())!=-1); //Print follwees System.out.println("-------"); System.out.println("Showing Followees:"); PagableResponseList<User> followees; do { followees = twitter.getFriendsList(user.getScreenName(), cursor); for (User followee : followees) { System.out.println("@" + followee.getScreenName()); } } while ((cursor = followees.getNextCursor()) != -1); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to get timeline: " + te.getMessage()); System.exit(-1); } }
From source file:twitter.metrics.TwitterMetrics.java
/** * @param args the command line arguments */// w ww . j a v a2 s. c o m public static void main(String[] args) { try { /*Parte que guarda en un archivo*/ // Se crea el libro HSSFWorkbook libro = new HSSFWorkbook(); // Se crea una hoja dentro del libro HSSFSheet hoja = libro.createSheet(); // Se crea una fila dentro de la hoja HSSFRow fila = hoja.createRow(0); // Se crea una celda dentro de la fila HSSFCell celda = fila.createCell(1); // Se crea el contenido de la celda y se mete en ella. HSSFRichTextString texto = new HSSFRichTextString("Metricas de Twitter"); celda.setCellValue(texto); /************************************/ /*Conexion con Mongo DB*/ MongoClient mongoClient = new MongoClient("localhost", 27017); DB db = mongoClient.getDB("JavaMongoTwitter"); DBCollection datos = db.getCollection("Datos"); /***********************/ ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true); cb.setOAuthConsumerKey("TobUISZXWUhDda04ZBtFGQ"); cb.setOAuthConsumerSecret("7xurVN3iP6VDcBfKdFJxVuNsJjExERFYNmQIDgtg"); cb.setOAuthAccessToken("849956971-GJBiORhLIuWK4i3MJ2YCd4vidh65N1GzPIb6duXk"); cb.setOAuthAccessTokenSecret("4MJgPS9grxVuKbczrPCdSjNnumhcWs7t7OLy2F4kkpOdu"); TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter = tf.getInstance(); User u = twitter.showUser("Pringles"); System.out.println("Nombre: " + u.getName()); System.out.println("Seguidores: " + u.getFollowersCount()); System.out.println("Favoritos: " + u.getFavouritesCount()); System.out.println("Seguidos: " + u.getFriendsCount()); System.out.println("Ubicacion: " + u.getLocation()); System.out.println("Descripcin: " + u.getDescription()); System.out.println(""); fila = hoja.createRow(1); celda = fila.createCell(0); celda.setCellValue(new HSSFRichTextString("Nombre:")); celda = fila.createCell(1); celda.setCellValue(new HSSFRichTextString(u.getName())); fila = hoja.createRow(2); celda = fila.createCell(0); celda.setCellValue(new HSSFRichTextString("Seguidores:")); celda = fila.createCell(1); celda.setCellValue(new HSSFRichTextString(u.getFollowersCount() + "")); fila = hoja.createRow(3); celda = fila.createCell(0); celda.setCellValue(new HSSFRichTextString("Favoritos:")); celda = fila.createCell(1); celda.setCellValue(new HSSFRichTextString(u.getFavouritesCount() + "")); fila = hoja.createRow(4); celda = fila.createCell(0); celda.setCellValue(new HSSFRichTextString("Seguidos:")); celda = fila.createCell(1); celda.setCellValue(new HSSFRichTextString(u.getFriendsCount() + "")); fila = hoja.createRow(5); celda = fila.createCell(0); celda.setCellValue(new HSSFRichTextString("Ubicacin:")); celda = fila.createCell(1); celda.setCellValue(new HSSFRichTextString(u.getLocation() + "")); fila = hoja.createRow(6); celda = fila.createCell(0); celda.setCellValue(new HSSFRichTextString("Descripcin:")); celda = fila.createCell(1); celda.setCellValue(new HSSFRichTextString(u.getDescription() + "")); fila = hoja.createRow(7); celda = fila.createCell(3); celda.setCellValue(new HSSFRichTextString("Tweets!!!")); fila = hoja.createRow(9); celda = fila.createCell(1); celda.setCellValue(new HSSFRichTextString("IdTweet")); celda = fila.createCell(2); celda.setCellValue(new HSSFRichTextString("Cuenta")); celda = fila.createCell(3); celda.setCellValue(new HSSFRichTextString("Tweet")); celda = fila.createCell(4); celda.setCellValue(new HSSFRichTextString("Geolocation")); celda = fila.createCell(5); celda.setCellValue(new HSSFRichTextString("Place")); celda = fila.createCell(6); celda.setCellValue(new HSSFRichTextString("Retweets")); celda = fila.createCell(7); celda.setCellValue(new HSSFRichTextString("Favoritos")); Paging paging = new Paging(1, 1000); ResponseList<Status> s = twitter.getUserTimeline(u.getId(), paging); int i = 0; int filaNum = 10; for (Status st : s) { BasicDBObject obj = new BasicDBObject(); obj.append("idTweet", s.get(i).getId() + ""); obj.append("Cuenta", u.getName()); obj.append("Tweet", s.get(i).getText()); obj.append("Geolocation", s.get(i).getGeoLocation()); obj.append("Place", s.get(i).getPlace()); obj.append("Reteews", s.get(i).getRetweetCount()); obj.append("Favoritos", s.get(i).getFavoriteCount()); fila = hoja.createRow(filaNum); celda = fila.createCell(1); celda.setCellValue(new HSSFRichTextString(s.get(i).getId() + "")); celda = fila.createCell(2); celda.setCellValue(new HSSFRichTextString(u.getName())); celda = fila.createCell(3); celda.setCellValue(new HSSFRichTextString(s.get(i).getText())); celda = fila.createCell(4); celda.setCellValue(new HSSFRichTextString(s.get(i).getGeoLocation() + "")); celda = fila.createCell(5); celda.setCellValue(new HSSFRichTextString(s.get(i).getPlace() + "")); celda = fila.createCell(6); celda.setCellValue(new HSSFRichTextString(s.get(i).getRetweetCount() + "")); celda = fila.createCell(7); celda.setCellValue(new HSSFRichTextString(s.get(i).getFavoriteCount() + "")); i++; filaNum++; datos.insert(obj); } FileOutputStream elFichero = new FileOutputStream("Metricas_Twitter.xls"); libro.write(elFichero); elFichero.close(); /********************************/ System.out.println(i); //User usuario = twitter.showUser("@aaron21007"); // List<Status> statuses = twitter.getHomeTimeline(); // System.out.println("Showing home timeline."); // for (Status status : statuses) { // System.out.println(status.getUser().getName() + ":" + // status.getText()); // } // Twitter unauthenticatedTwitter = new TwitterFactory(cb.build()).getInstance(); // // List<String> listaTweets = new ArrayList(); // List<Long> ListaRettewts = new ArrayList(); // List<Integer> ListaFavoritos = new ArrayList(); // List<Integer> ListaMenciones = new ArrayList(); // List<Date> ListaFecha = new ArrayList(); // List<Long> ListaIds = new ArrayList(); //// // User usuario = unauthenticatedTwitter.showUser("@aaron21007"); // List<Status> ret = unauthenticatedTwitter.getRetweetsOfMe(); // List<Status> favoritos = unauthenticatedTwitter.getFavorites(); // Paging paging = new Paging(1, 1000); // ResponseList<Status> statuses = unauthenticatedTwitter.getUserTimeline(usuario.getId(), paging); // // // for (Status sta : statuses) { // // ListaIds.add(Long.valueOf(sta.getId())); // listaTweets.add(sta.getText()); // ListaRettewts.add(Long.valueOf(Long.parseLong(sta.getRetweetCount() + ""))); // ListaMenciones.add(Integer.valueOf(sta.getUserMentionEntities().length)); // ListaFecha.add(sta.getCreatedAt()); // ListaFavoritos.add(Integer.valueOf(sta.getFavoriteCount())); // System.out.println(sta.getText()); // // } // // // // // } catch (Exception e) { System.err.println("Fallo................." + e); } }
From source file:twitterrest.Followersids.java
License:Apache License
public static void main(String[] args) throws TwitterException { String ScreenName = "anondroid5";//?? // ?// ww w .j a v a 2s .co m Configuration configuration = new ConfigurationBuilder().setOAuthConsumerKey(CONSUMER_KEY) .setOAuthConsumerSecret(CONSUMER_SECRET).setOAuthAccessToken(ACCESS_TOKEN) .setOAuthAccessTokenSecret(ACCESS_TOKEN_SECRET).build(); Twitter twitter = new TwitterFactory(configuration).getInstance(); List<Long> followersList = followers(twitter, ScreenName);//? System.out.println(ScreenName + ":FolloweID List"); for (int i = 0; i < followersList.size(); i++) { System.out.println("[" + (i + 1) + "]" + followersList.get(i)); //? User user = twitter.showUser(followersList.get(i)); System.out.println("User ID : " + user.getId());//UserID System.out.println("ScreenName : " + user.getScreenName());//ScreenName System.out.println("User's Name : " + user.getName());//UserName System.out.println("Number of Followers : " + user.getFollowersCount());//Number of Followers System.out.println("Number of Friends : " + user.getFriendsCount());//Number of Friends System.out.println("Language : " + user.getLang());//Language } }
From source file:uk.ac.susx.tag.method51.twitter.Tweet.java
License:Apache License
public Tweet(Status status) { this();//from www . j a v a 2 s.c o m created = status.getCreatedAt(); id = status.getId(); text = status.getText(); inReplyToStatusId = status.getInReplyToStatusId(); inReplyToUserId = status.getInReplyToUserId(); originalText = null; retweetId = -1; isTruncated = status.isTruncated(); isRetweet = status.isRetweet(); Status entities = status; if (isRetweet) { Status origTweet = status.getRetweetedStatus(); entities = origTweet; retweetId = origTweet.getId(); originalText = text; text = origTweet.getText(); } StringBuilder sb = new StringBuilder(); for (HashtagEntity e : entities.getHashtagEntities()) { sb.append(e.getText()); sb.append(" "); } hashtags = sb.toString(); sb = new StringBuilder(); for (UserMentionEntity e : entities.getUserMentionEntities()) { sb.append(e.getScreenName()); sb.append(" "); } mentions = sb.toString(); sb = new StringBuilder(); for (URLEntity e : entities.getURLEntities()) { //String url = e.getURL(); String url = e.getExpandedURL(); if (url == null) { url = e.getURL(); if (url != null) { sb.append(url); } } else { sb.append(url); } sb.append(" "); } urls = sb.toString(); sb = new StringBuilder(); //seems to be null if no entries MediaEntity[] mediaEntities = entities.getMediaEntities(); if (mediaEntities != null) { for (MediaEntity e : mediaEntities) { String url = e.getMediaURL(); sb.append(url); sb.append(" "); } mediaUrls = sb.toString(); } else { mediaUrls = ""; } received = new Date(); source = status.getSource(); GeoLocation geoLoc = status.getGeoLocation(); Place place = status.getPlace(); if (geoLoc != null) { geoLong = geoLoc.getLongitude(); geoLat = geoLoc.getLatitude(); } else if (place != null && place.getBoundingBoxCoordinates() != null && place.getBoundingBoxCoordinates().length > 0) { GeoLocation[] locs = place.getBoundingBoxCoordinates()[0]; double avgLat = 0; double avgLon = 0; for (GeoLocation loc : locs) { avgLat += loc.getLatitude(); avgLon += loc.getLongitude(); } avgLat /= locs.length; avgLon /= locs.length; geoLat = avgLat; geoLong = avgLon; } else { geoLong = null; geoLat = null; } twitter4j.User user = status.getUser(); if (user != null) { userId = user.getId(); location = user.getLocation(); screenName = user.getScreenName(); following = user.getFriendsCount(); name = user.getName(); lang = user.getLang(); timezone = user.getTimeZone(); userCreated = user.getCreatedAt(); followers = user.getFollowersCount(); statusCount = user.getStatusesCount(); description = user.getDescription(); url = user.getURL(); utcOffset = user.getUtcOffset(); favouritesCount = user.getFavouritesCount(); this.user = new User(user); } }
From source file:uk.ac.susx.tag.method51.webapp.handler.TwitterPinAuthHandler.java
License:Apache License
private void getUserInfo(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { final Params params = new Params(); params.addValidator("id", new SystemStringValidator(true)); new DoSomethingAfterValidatingMyParams(params, request, response) { @Override/* w ww .j a v a 2s .c o m*/ public void something() throws IOException { final String id = request.getParameter("id"); final Twitter twitter = newTwitterInstance(ApiKeyStore.getKey(id)); try { final AccountSettings as = twitter.getAccountSettings(); final String userScreenName = twitter.getScreenName(); final long userId = twitter.getId(); final User user = twitter.showUser(userId); okHereIsYourJson(response, "name", user.getName(), "description", user.getDescription(), "created", user.getCreatedAt(), "favourites_count", user.getFavouritesCount(), "followers_count", user.getFollowersCount(), "friends_count", user.getFriendsCount(), "profile_image_url", user.getProfileImageURL(), "screen_name", userScreenName, "user_id", userId, "language", as.getLanguage(), "sleep_time_enabled", as.isSleepTimeEnabled(), "sleep_end_time", as.getSleepEndTime(), "sleep_start_time", as.getSleepStartTime(), "timezone", as.getTimeZone(), "trend_locations", as.getTrendLocations(), "always_use_https", as.isAlwaysUseHttps(), "discoverable_by_email", as.isDiscoverableByEmail(), "geo_enabled", as.isGeoEnabled()); } catch (TwitterException e) { LOG.warn("Failed to retrieve users data.", e); error(e.getMessage()); } } }; }
From source file:uk.co.cathtanconsulting.twitter.TwitterSource.java
License:Apache License
/** * @param status/* ww w . j a v a 2s . c o m*/ * * Generate a TweetRecord object and submit to * */ private void extractRecord(Status status) { TweetRecord record = new TweetRecord(); //Basic attributes record.setId(status.getId()); //Using SimpleDateFormat "yyyy-MM-dd'T'HH:mm:ss'Z'" record.setCreatedAtStr(formatterTo.format(status.getCreatedAt())); //Use millis since epoch since Avro doesn't do dates record.setCreatedAtLong(status.getCreatedAt().getTime()); record.setTweet(status.getText()); //User based attributes - denormalized to keep the Source stateless //but also so that we can see user attributes changing over time. //N.B. we could of course fork this off as a separate stream of user info User user = status.getUser(); record.setUserId(user.getId()); record.setUserScreenName(user.getScreenName()); record.setUserFollowersCount(user.getFollowersCount()); record.setUserFriendsCount(user.getFriendsCount()); record.setUserLocation(user.getLocation()); //If it is zero then leave the value null if (status.getInReplyToStatusId() != 0) { record.setInReplyToStatusId(status.getInReplyToStatusId()); } //If it is zero then leave the value null if (status.getInReplyToUserId() != 0) { record.setInReplyToUserId(status.getInReplyToUserId()); } //Do geo. N.B. Twitter4J doesn't give use the geo type GeoLocation geo = status.getGeoLocation(); if (geo != null) { record.setGeoLat(geo.getLatitude()); record.setGeoLong(geo.getLongitude()); } //If a status is a retweet then the original tweet gets bundled in //Because we can't guarantee that we'll have the original we can //extract the original tweet and process it as we have done this time //using recursion. Note: we will end up with dupes. Status retweetedStatus = status.getRetweetedStatus(); if (retweetedStatus != null) { record.setRetweetedStatusId(retweetedStatus.getId()); record.setRetweetedUserId(retweetedStatus.getUser().getId()); extractRecord(retweetedStatus); } //Submit the populated record onto the channel processRecord(record); }
From source file:Utils.ConvertUsers.java
License:Open Source License
public Set<TwitterUser> convertAll(Set<User> users) { Set<TwitterUser> twitterUsers = new HashSet(); TwitterUser twitterUser;//www .j av a2s.com for (User user : users) { twitterUser = new TwitterUser(); twitterUser.setCreated_at(user.getCreatedAt()); twitterUser.setDescription(user.getDescription()); twitterUser.setFollowers_count(user.getFollowersCount()); twitterUser.setLang(user.getLang()); twitterUser.setLocation(user.getLocation()); twitterUser.setName(user.getName()); twitterUser.setProfile_image_url(user.getProfileImageURL()); twitterUser.setScreen_name(user.getScreenName()); twitterUser.setIdTwitter(user.getId()); twitterUser.setFriends_count(user.getFriendsCount()); twitterUser.setProfile_banner_url(user.getProfileBannerURL()); twitterUsers.add(twitterUser); } return twitterUsers; }