/** * Sets the application attribute using the name passed to the constructor on a batch feed. * * @param batchFeed */ @SuppressWarnings("unchecked") private void addApplicationAttribute(IFeed iFeed) { if (!(iFeed instanceof BaseFeed)) { throw new IllegalArgumentException("Unexpected feed type: " + iFeed); } BaseFeed<?, ?> batchFeed = (BaseFeed<?, ?>) iFeed; BatchOperationType defaultType = BatchUtils.getBatchOperationType(batchFeed); if (defaultType == null) { defaultType = BatchOperationType.INSERT; } List<? extends BaseEntry> entries = batchFeed.getEntries(); for (BaseEntry<?> entry : entries) { BatchOperationType type = BatchUtils.getBatchOperationType(entry); if (type == null) { type = defaultType; } if (type == BatchOperationType.INSERT || type == BatchOperationType.UPDATE) { addApplicationAttribute(entry); } } }
/** * Prints detailed information regarding a Generic Feed * * @param feed The feed of interest */ private static void printBasicFeedDetails(BaseFeed feed) { System.out.println("\tFeed is " + (feed.getCanPost() ? "writable!" : "read-only!")); System.out.println("\tNumber of entries: " + feed.getTotalResults()); System.out.println("\tStart Index: " + feed.getStartIndex()); System.out.println("\tEnd Index: " + feed.getItemsPerPage()); System.out.println( "\tFeed URI: " + (feed.getSelfLink() == null ? "<none>" : feed.getSelfLink().getHref()) + "\n"); System.out.println("\tFeed Title: " + feed.getTitle().getPlainText()); System.out.println("\tAtom ID: " + feed.getId()); System.out.println("\tLast updated: " + feed.getUpdated()); System.out.println("\tFeed Categories:"); Iterator it = feed.getCategories().iterator(); while (it.hasNext()) { System.out.println("\t\t" + it.next().toString()); } System.out.println("\tLinks:"); if (feed.getLinks().size() == 0) { System.out.println("\t\t<No links, sorry!>"); } for (int i = 0; i < feed.getLinks().size(); i++) { System.out.println("\t\t" + feed.getLinks().get(i).getHref()); } System.out.println("\t" + "HTML Link: " + feed.getHtmlLink().getHref()); }