@Override public void process(RequestContext rc, AdapterResponse<Feed> adapterResponse) { final Feed f = adapterResponse.getBody(); // If there are no entries in the feed if (f == null || f.getEntries() == null || f.getEntries().isEmpty()) { return; } // Add an updated element to the feed final Calendar localNow = Calendar.getInstance(TimeZone.getDefault()); localNow.setTimeInMillis(System.currentTimeMillis()); f.setUpdated(localNow.getTime()); } }
public static void printAllPosts( GoogleService myService, String blogId) throws ServiceException, IOException { // Request the feed URL feedUrl = new URL("http://www.blogger.com/feeds/" + blogID + "/posts/default"); Feed resultFeed = myService.getFeed(feedUrl, Feed.class); // Print the results System.out.println(resultFeed.getTitle().getPlainText()); for (int i = 0; i < resultFeed.getEntries().size(); i++) { Entry entry = resultFeed.getEntries().get(i); System.out.println("\t" + entry.getTitle().getPlainText()); } System.out.println(); }
protected Feed createFeedFromCollectionWrapper(Factory factory, Object o, Class<?> pojoClass) throws Exception { Feed feed = factory.newFeed(); boolean writerUsed = buildFeed(feed, o, pojoClass); if (feed.getEntries().size() > 0) { return feed; } String methodName = getCollectionMethod(o.getClass(), true); Object collection = null; Method m = null; try { m = o.getClass().getMethod(methodName, new Class[]{}); collection = m.invoke(o, new Object[]{}); } catch (Exception ex) { reportError("Collection for " + o.getClass().getName() + " can not be retrieved", ex); } setFeedFromCollection(factory, feed, o, pojoClass, collection, m.getReturnType(), m.getGenericReturnType(), writerUsed); return feed; }
protected Feed createFeedFromCollectionWrapper(Factory factory, Object o, Class<?> pojoClass) throws Exception { Feed feed = factory.newFeed(); boolean writerUsed = buildFeed(feed, o, pojoClass); if (feed.getEntries().size() > 0) { return feed; } String methodName = getCollectionMethod(o.getClass(), true); Object collection = null; Method m = null; try { m = o.getClass().getMethod(methodName, new Class[]{}); collection = m.invoke(o, new Object[]{}); } catch (Exception ex) { reportError("Collection for " + o.getClass().getName() + " can not be retrieved", ex); } setFeedFromCollection(factory, feed, o, pojoClass, collection, m.getReturnType(), m.getGenericReturnType(), writerUsed); return feed; }
protected Feed createFeedFromCollectionWrapper(Factory factory, Object o, Class<?> pojoClass) throws Exception { Feed feed = factory.newFeed(); boolean writerUsed = buildFeed(feed, o, pojoClass); if (feed.getEntries().size() > 0) { return feed; } String methodName = getCollectionMethod(o.getClass(), true); Object collection = null; Method m = null; try { m = o.getClass().getMethod(methodName, new Class[]{}); collection = m.invoke(o, new Object[]{}); } catch (Exception ex) { reportError("Collection for " + o.getClass().getName() + " can not be retrieved", ex); } setFeedFromCollection(factory, feed, o, pojoClass, collection, m.getReturnType(), m.getGenericReturnType(), writerUsed); return feed; }
@Override public void process(RequestContext rc, AdapterResponse<Feed> adapterResponse) { final Feed f = adapterResponse.getBody(); if(f == null) { return; } final int totalEntries = f.getEntries().size(); // If there are no entries in the feed if (totalEntries == 0) { return; } // Get the id of the first entry on this page String id = f.getEntries().get(0).getId().toString(); // Get the id of the last entry on this page String lastId = f.getEntries().get(totalEntries-1).getId().toString(); EntityTag feedEtag = createEntityTag(rc, id, lastId); adapterResponse.setEntityTag(feedEtag); }
if (condition == null && feed.getEntries().size() == pageSize) { synchronized (feeds) { feeds.put(page, feed);
private void addDatastreams(Feed feed, DigitalObject obj, String encoding, int transContext, File tempDir) throws UnsupportedEncodingException, StreamIOException, ObjectIntegrityException { feed.sortEntries(new UpdatedIdComparator(true)); List<Entry> entries = feed.getEntries(); for (Entry entry : entries) { if (ThreadHelper.getInReplyTo(entry) != null) { addDatastreamVersion(feed, entry, obj, encoding, transContext, tempDir); } } }
private void addDatastreams(Feed feed, DigitalObject obj, String encoding, int transContext, File tempDir) throws UnsupportedEncodingException, StreamIOException, ObjectIntegrityException { feed.sortEntries(new UpdatedIdComparator(true)); List<Entry> entries = feed.getEntries(); for (Entry entry : entries) { if (ThreadHelper.getInReplyTo(entry) != null) { addDatastreamVersion(feed, entry, obj, encoding, transContext, tempDir); } } }
if ( hydratedFeed.getEntries() != null && hydratedFeed.getEntries().size() < pageSize ) { LOG.warn("User requested " + getFeedRequest.getFeedName() + " feed with limit " + pageSize + ", but returning only " + hydratedFeed.getEntries().size()); List<Entry> entries = hydratedFeed.getEntries(); StringBuilder sb = new StringBuilder(); for (int idx=0; idx<entries.size(); idx++) { } else if ( hydratedFeed.getEntries() == null ) { LOG.warn("User requested " + getFeedRequest.getFeedName() + " feed with limit " + pageSize + ", but no entries are available");
final Feed feed = doc.getRoot().sortEntriesByEdited(true); for (final Entry entry : feed.getEntries()) {
= (Class<Object>)InjectionUtils.getActualType(m.getGenericParameterTypes()[0]); List<Object> objects = new ArrayList<>(); for (Entry e : feed.getEntries()) { objects.add(readFromEntry(e, realCls));
= (Class<Object>)InjectionUtils.getActualType(m.getGenericParameterTypes()[0]); List<Object> objects = new ArrayList<>(); for (Entry e : feed.getEntries()) { objects.add(readFromEntry(e, realCls));
GoogleService myService = new GoogleService("blogger", "exampleCo-exampleApp-1"); myService.setUserCredentials("EMAIL", "PWD"); Entry myEntry = new Entry(); myEntry.setTitle(new PlainTextConstruct("TITLE post update")); myEntry.setContent(new PlainTextConstruct("STATUS POST")); URL feedUrl = new URL("http://www.blogger.com/feeds/default/blogs"); Feed resultFeed = myService.getFeed(feedUrl, Feed.class); String blog_name = "blog_name"; //the name of the blog where you want to post status String BLOG_ID = ""; for (int i = 0; i < resultFeed.getEntries().size(); i++) { Entry entry = resultFeed.getEntries().get(i); if (entry.getTitle().getPlainText().equalsIgnoreCase(blog_name)) { String[] split = entry.getId().split("-"); BLOG_ID = split[split.length - 1]; } System.out.println("Posting to:" + " " + "Blog id: " + BLOG_ID + " " + "Blog name: " + blog_name); } URL postUrl = new URL("http://www.blogger.com/feeds/" + BLOG_ID + "/posts/default"); Entry insert = myService.insert(postUrl, myEntry); System.out.println(insert.getHtmlLink().getHref());
= (Class<Object>)InjectionUtils.getActualType(m.getGenericParameterTypes()[0]); List<Object> objects = new ArrayList<Object>(); for (Entry e : feed.getEntries()) { objects.add(readFromEntry(e, realCls));
for (org.apache.abdera.model.Entry feedEntry : feed.getEntries()) { Entry<Object, Object> entry = entry(feedEntry,
feed.addLink(self, "self"); int feedSize = feed.getEntries().size(); String searchExpression = getSearchExpression();
for (org.apache.abdera.model.Entry feedEntry : feed.getEntries()) { Entry<Object, Object> entry = entry(feedEntry,
} else { feed.setTitle(String.format(wrapper.getClass().getSimpleName() + " collection with %d entry(ies)", feed.getEntries().size()));
} else { feed.setTitle(String.format(wrapper.getClass().getSimpleName() + " collection with %d entry(ies)", feed.getEntries().size()));