本文整理了Java中com.rometools.rome.feed.atom.Feed.getEntries()
方法的一些代码示例,展示了Feed.getEntries()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feed.getEntries()
方法的具体详情如下:
包路径:com.rometools.rome.feed.atom.Feed
类名称:Feed
方法名:getEntries
[英]Returns the feed entries.
[中]返回提要条目。
代码示例来源:origin: spring-projects/spring-framework
@Test
public void read() throws IOException {
InputStream is = getClass().getResourceAsStream("atom.xml");
MockHttpInputMessage inputMessage = new MockHttpInputMessage(is);
inputMessage.getHeaders().setContentType(new MediaType("application", "atom+xml", StandardCharsets.UTF_8));
Feed result = converter.read(Feed.class, inputMessage);
assertEquals("title", result.getTitle());
assertEquals("subtitle", result.getSubtitle().getValue());
List<?> entries = result.getEntries();
assertEquals(2, entries.size());
Entry entry1 = (Entry) entries.get(0);
assertEquals("id1", entry1.getId());
assertEquals("title1", entry1.getTitle());
Entry entry2 = (Entry) entries.get(1);
assertEquals("id2", entry2.getId());
assertEquals("title2", entry2.getTitle());
}
代码示例来源:origin: rometools/rome
private Entry findEntry(final String id, final Feed feed) {
for (final Entry entry : feed.getEntries()) {
if (id.equals(entry.getId())) {
return entry;
}
}
return null;
}
代码示例来源:origin: rometools/rome
private void updateFeedDocumentWithNewEntry(final Feed f, final Entry e) throws AtomException {
boolean inserted = false;
for (int i = 0; i < f.getEntries().size(); i++) {
final Entry entry = f.getEntries().get(i);
final AppModule mod = (AppModule) entry.getModule(AppModule.URI);
final AppModule newMod = (AppModule) e.getModule(AppModule.URI);
if (newMod.getEdited().before(mod.getEdited())) {
f.getEntries().add(i, e);
inserted = true;
break;
}
}
if (!inserted) {
f.getEntries().add(0, e);
}
updateFeedDocument(f);
}
代码示例来源:origin: rometools/rome
private void updateFeedDocumentRemovingEntry(final Feed f, final String id) throws AtomException {
final Entry e = findEntry("urn:uuid:" + id, f);
f.getEntries().remove(e);
updateFeedDocument(f);
}
代码示例来源:origin: rometools/rome
private void updateFeedDocumentWithExistingEntry(final Feed f, final Entry e) throws AtomException {
final Entry old = findEntry(e.getId(), f);
f.getEntries().remove(old);
boolean inserted = false;
for (int i = 0; i < f.getEntries().size(); i++) {
final Entry entry = f.getEntries().get(i);
final AppModule entryAppModule = (AppModule) entry.getModule(AppModule.URI);
final AppModule eAppModule = (AppModule) entry.getModule(AppModule.URI);
if (eAppModule.getEdited().before(entryAppModule.getEdited())) {
f.getEntries().add(i, e);
inserted = true;
break;
}
}
if (!inserted) {
f.getEntries().add(0, e);
}
updateFeedDocument(f);
}
代码示例来源:origin: rometools/rome
protected void addEntries(final Feed feed, final Element parent) throws FeedException {
final List<Entry> items = feed.getEntries();
for (final Entry entry : items) {
addEntry(entry, parent);
}
checkEntriesConstraints(parent);
}
代码示例来源:origin: rometools/rome
protected void addEntries(final Feed feed, final Element parent) throws FeedException {
final List<Entry> entries = feed.getEntries();
for (final Entry entry : entries) {
addEntry(entry, parent);
}
checkEntriesConstraints(parent);
}
代码示例来源:origin: com.rometools/rome
protected void addEntries(final Feed feed, final Element parent) throws FeedException {
final List<Entry> entries = feed.getEntries();
for (final Entry entry : entries) {
addEntry(entry, parent);
}
checkEntriesConstraints(parent);
}
代码示例来源:origin: com.rometools/rome
protected void addEntries(final Feed feed, final Element parent) throws FeedException {
final List<Entry> items = feed.getEntries();
for (final Entry entry : items) {
addEntry(entry, parent);
}
checkEntriesConstraints(parent);
}
代码示例来源:origin: mploed/event-driven-spring-boot
Feed feed = response.getBody();
Date lastUpdateInFeed = null;
for (Entry entry : feed.getEntries()) {
String applicationNumber = entry.getSummary().getValue();
if ((lastModified == null) || (entry.getUpdated().after(lastModified))) {
代码示例来源:origin: rometools/rome
private void getNextEntries() throws ProponoException {
if (nextURI == null) {
return;
}
final GetMethod colGet = new GetMethod(collection.getHrefResolved(nextURI));
collection.addAuthentication(colGet);
try {
collection.getHttpClient().executeMethod(colGet);
final SAXBuilder builder = new SAXBuilder();
final Document doc = builder.build(colGet.getResponseBodyAsStream());
final WireFeedInput feedInput = new WireFeedInput();
col = (Feed) feedInput.build(doc);
} catch (final Exception e) {
throw new ProponoException("ERROR: fetching or parsing next entries, HTTP code: " + (colGet != null ? colGet.getStatusCode() : -1), e);
} finally {
colGet.releaseConnection();
}
members = col.getEntries().iterator();
col.getEntries().size();
nextURI = null;
final List<Link> altLinks = col.getOtherLinks();
if (altLinks != null) {
for (final Link link : altLinks) {
if ("next".equals(link.getRel())) {
nextURI = link.getHref();
}
}
}
}
代码示例来源:origin: mploed/ddd-with-spring
Date lastUpdateInFeed = null;
ObjectMapper mapper = new ObjectMapper();
for (Entry entry : feed.getEntries()) {
String ratingAsJson = entry.getSummary().getValue();
if ((lastModified == null) || (entry.getUpdated().after(lastModified))) {
代码示例来源:origin: pebbleblog/pebble
for (Entry entry : (List<Entry>)atomFeed.getEntries()) {
String href = "";
for (Link link : (List<Link>)entry.getAlternateLinks()) {
代码示例来源:origin: rometools/rome
/**
* Parse entry from reader.
*/
public static Entry parseEntry(final Reader rd, final String baseURI, final Locale locale) throws JDOMException, IOException, IllegalArgumentException,
FeedException {
// Parse entry into JDOM tree
final SAXBuilder builder = new SAXBuilder();
final Document entryDoc = builder.build(rd);
final Element fetchedEntryElement = entryDoc.getRootElement();
fetchedEntryElement.detach();
// Put entry into a JDOM document with 'feed' root so that Rome can
// handle it
final Feed feed = new Feed();
feed.setFeedType("atom_1.0");
final WireFeedOutput wireFeedOutput = new WireFeedOutput();
final Document feedDoc = wireFeedOutput.outputJDom(feed);
feedDoc.getRootElement().addContent(fetchedEntryElement);
if (baseURI != null) {
feedDoc.getRootElement().setAttribute("base", baseURI, Namespace.XML_NAMESPACE);
}
final WireFeedInput input = new WireFeedInput(false, locale);
final Feed parsedFeed = (Feed) input.build(feedDoc);
return parsedFeed.getEntries().get(0);
}
代码示例来源:origin: com.rometools/rome
/**
* Parse entry from reader.
*/
public static Entry parseEntry(final Reader rd, final String baseURI, final Locale locale) throws JDOMException, IOException, IllegalArgumentException,
FeedException {
// Parse entry into JDOM tree
final SAXBuilder builder = new SAXBuilder();
final Document entryDoc = builder.build(rd);
final Element fetchedEntryElement = entryDoc.getRootElement();
fetchedEntryElement.detach();
// Put entry into a JDOM document with 'feed' root so that Rome can
// handle it
final Feed feed = new Feed();
feed.setFeedType("atom_1.0");
final WireFeedOutput wireFeedOutput = new WireFeedOutput();
final Document feedDoc = wireFeedOutput.outputJDom(feed);
feedDoc.getRootElement().addContent(fetchedEntryElement);
if (baseURI != null) {
feedDoc.getRootElement().setAttribute("base", baseURI, Namespace.XML_NAMESPACE);
}
final WireFeedInput input = new WireFeedInput(false, locale);
final Feed parsedFeed = (Feed) input.build(feedDoc);
return parsedFeed.getEntries().get(0);
}
代码示例来源:origin: rometools/rome
final List<Entry> aEntries = aFeed.getEntries();
if (Lists.isNotEmpty(aEntries)) {
syndFeed.setEntries(createSyndEntries(aEntries, syndFeed.isPreservingWireFeed()));
代码示例来源:origin: rometools/rome
final List<Entry> aEntries = aFeed.getEntries();
if (aEntries != null) {
syndFeed.setEntries(createSyndEntries(aFeed, aEntries, syndFeed.isPreservingWireFeed()));
代码示例来源:origin: com.rometools/rome
final List<Entry> aEntries = aFeed.getEntries();
if (Lists.isNotEmpty(aEntries)) {
syndFeed.setEntries(createSyndEntries(aEntries, syndFeed.isPreservingWireFeed()));
代码示例来源:origin: com.rometools/rome
final List<Entry> aEntries = aFeed.getEntries();
if (aEntries != null) {
syndFeed.setEntries(createSyndEntries(aFeed, aEntries, syndFeed.isPreservingWireFeed()));
内容来源于网络,如有侵权,请联系作者删除!