List of usage examples for twitter4j Trends getTrendAt
Date getTrendAt();
From source file:com.dwdesign.tweetings.util.Utils.java
License:Open Source License
public static ContentValues[] makeTrendsContentValues(final List<Trends> trends_list) { if (trends_list == null) return new ContentValues[0]; final List<ContentValues> result_list = new ArrayList<ContentValues>(); for (final Trends trends : trends_list) { if (trends == null) { continue; }//from www.j av a 2 s .c o m final long timestamp = trends.getTrendAt().getTime(); for (final Trend trend : trends.getTrends()) { final ContentValues values = new ContentValues(); values.put(CachedTrends.NAME, trend.getName()); values.put(CachedTrends.TIMESTAMP, timestamp); result_list.add(values); } } return result_list.toArray(new ContentValues[result_list.size()]); }
From source file:de.vanita5.twittnuker.util.ContentValuesCreator.java
License:Open Source License
public static ContentValues[] makeTrendsContentValues(final List<Trends> trendsList) { if (trendsList == null) return new ContentValues[0]; final List<ContentValues> resultList = new ArrayList<>(); for (final Trends trends : trendsList) { if (trends == null) { continue; }/*w w w . j a va 2 s. c o m*/ final long timestamp = trends.getTrendAt().getTime(); for (final Trend trend : trends.getTrends()) { final ContentValues values = new ContentValues(); values.put(CachedTrends.NAME, trend.getName()); values.put(CachedTrends.TIMESTAMP, timestamp); resultList.add(values); } } return resultList.toArray(new ContentValues[resultList.size()]); }
From source file:org.apache.camel.component.twitter.util.TwitterConverter.java
License:Apache License
@Converter public static String toString(Trends trends) throws ParseException { StringBuilder s = new StringBuilder(); s.append("(" + trends.getTrendAt().toString() + ") "); boolean first = true; for (Trend trend : trends.getTrends()) { if (first) { first = false;//from ww w.j a v a 2 s. co m } else { s.append(","); } s.append(toString(trend)); } return s.toString(); }
From source file:org.getlantern.firetweet.util.ContentValuesCreator.java
License:Open Source License
public static ContentValues[] createTrends(final List<Trends> trendsList) { if (trendsList == null) return new ContentValues[0]; final List<ContentValues> resultList = new ArrayList<>(); for (final Trends trends : trendsList) { final long timestamp = trends.getTrendAt().getTime(); for (final Trend trend : trends.getTrends()) { final ContentValues values = new ContentValues(); values.put(CachedTrends.NAME, trend.getName()); values.put(CachedTrends.TIMESTAMP, timestamp); resultList.add(values);/*from w w w .jav a 2 s. co m*/ } } return resultList.toArray(new ContentValues[resultList.size()]); }
From source file:org.jwebsocket.plugins.twitter.TwitterPlugIn.java
License:Apache License
private void getTrends(WebSocketConnector aConnector, Token aToken) { TokenServer lServer = getServer();// w ww. j a v a 2 s . c om // instantiate response token Token lResponse = lServer.createResponse(aToken); String lMsg; try { if (mLog.isDebugEnabled()) { mLog.debug("Retreiving trends..."); } if (!mCheckAuth(lResponse)) { mLog.error(lResponse.getString("msg")); } else { // return the list of messages as an array of strings... Map<String, List<String>> lAsOf = new FastMap<String, List<String>>(); List<String> lMessages; ResponseList lTrendList = mTwitter.getDailyTrends(); for (int lIdx = 0; lIdx < lTrendList.size(); lIdx++) { lMessages = new FastList<String>(); Trends lTrends = (Trends) lTrendList.get(lIdx); Trend[] lTrendArray = lTrends.getTrends(); for (Trend lTrend : lTrendArray) { lMessages.add(lTrend.getName() + ": " + lTrend.getQuery() + ", URL: " + lTrend.getUrl()); } lAsOf.put(Tools.DateToISO8601(lTrends.getTrendAt()), lMessages); } lResponse.setMap("messages", lAsOf); if (mLog.isInfoEnabled()) { mLog.info("Trends successfully received"); } } } catch (Exception lEx) { lMsg = lEx.getClass().getSimpleName() + ": " + lEx.getMessage(); mLog.error(lMsg); lResponse.setInteger("code", -1); lResponse.setString("msg", lMsg); } // send response to requester lServer.sendToken(aConnector, lResponse); }