当前位置: 首页>>代码示例>>Java>>正文


Java Feed.getEntries方法代码示例

本文整理汇总了Java中com.rometools.rome.feed.atom.Feed.getEntries方法的典型用法代码示例。如果您正苦于以下问题:Java Feed.getEntries方法的具体用法?Java Feed.getEntries怎么用?Java Feed.getEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.rometools.rome.feed.atom.Feed的用法示例。


在下文中一共展示了Feed.getEntries方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: pollInternal

import com.rometools.rome.feed.atom.Feed; //导入方法依赖的package包/类
public void pollInternal() {
	HttpHeaders requestHeaders = new HttpHeaders();
	if (lastModified != null) {
		requestHeaders.set(HttpHeaders.IF_MODIFIED_SINCE, DateUtils.formatDate(lastModified));
	}
	HttpEntity<?> requestEntity = new HttpEntity(requestHeaders);
	ResponseEntity<Feed> response = restTemplate.exchange(url, HttpMethod.GET, requestEntity, Feed.class);

	if (response.getStatusCode() != HttpStatus.NOT_MODIFIED) {
		log.trace("data has been modified");
		Feed feed = response.getBody();
		for (Entry entry : feed.getEntries()) {
			if ((lastModified == null) || (entry.getUpdated().after(lastModified))) {
				Invoice invoice = restTemplate
						.getForEntity(entry.getContents().get(0).getSrc(), Invoice.class).getBody();
				log.trace("saving invoice {}", invoice.getId());
				invoiceService.generateInvoice(invoice);
			}
		}
		if (response.getHeaders().getFirst(HttpHeaders.LAST_MODIFIED) != null) {
			lastModified = DateUtils.parseDate(response.getHeaders().getFirst(HttpHeaders.LAST_MODIFIED));
			log.trace("Last-Modified header {}", lastModified);
		}
	} else {
		log.trace("no new data");
	}
}
 
开发者ID:ewolff,项目名称:microservice-atom,代码行数:28,代码来源:InvoicePoller.java

示例2: feedReturnsNewlyCreatedOrder

import com.rometools.rome.feed.atom.Feed; //导入方法依赖的package包/类
@Test
public void feedReturnsNewlyCreatedOrder() {
	Order order = new Order();
	order.setCustomer(customerRepository.findAll().iterator().next());
	orderRepository.save(order);
	Feed feed = retrieveFeed();
	boolean foundLinkToCreatedOrder = false;
	List<Entry> entries = feed.getEntries();
	for (Entry entry : entries) {
		for (Content content : entry.getContents()) {
			if (content.getSrc().contains(Long.toString(order.getId()))) {
				foundLinkToCreatedOrder = true;
			}
		}
	}
	assertTrue(foundLinkToCreatedOrder);
}
 
开发者ID:ewolff,项目名称:microservice-atom,代码行数:18,代码来源:AtomClientTest.java

示例3: pollInternal

import com.rometools.rome.feed.atom.Feed; //导入方法依赖的package包/类
public void pollInternal() {
	HttpHeaders requestHeaders = new HttpHeaders();
	if (lastModified != null) {
		requestHeaders.set(HttpHeaders.IF_MODIFIED_SINCE, DateUtils.formatDate(lastModified));
	}
	HttpEntity<?> requestEntity = new HttpEntity(requestHeaders);
	ResponseEntity<Feed> response = restTemplate.exchange(url, HttpMethod.GET, requestEntity, Feed.class);

	if (response.getStatusCode() != HttpStatus.NOT_MODIFIED) {
		log.trace("data has been modified");
		Feed feed = response.getBody();
		for (Entry entry : feed.getEntries()) {
			if ((lastModified == null) || (entry.getUpdated().after(lastModified))) {
				Shipment shipping = restTemplate
						.getForEntity(entry.getContents().get(0).getSrc(), Shipment.class).getBody();
				log.trace("saving shipping {}", shipping.getId());
				shipmentService.ship(shipping);
			}
		}
		if (response.getHeaders().getFirst("Last-Modified") != null) {
			lastModified = DateUtils.parseDate(response.getHeaders().getFirst(HttpHeaders.LAST_MODIFIED));
			log.trace("Last-Modified header {}", lastModified);
		}
	} else {
		log.trace("no new data");
	}
}
 
开发者ID:ewolff,项目名称:microservice-atom,代码行数:28,代码来源:ShippingPoller.java

示例4: read

import com.rometools.rome.feed.atom.Feed; //导入方法依赖的package包/类
@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", utf8));
	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());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:20,代码来源:AtomFeedHttpMessageConverterTests.java

示例5: poll

import com.rometools.rome.feed.atom.Feed; //导入方法依赖的package包/类
@Scheduled(fixedDelay = 15000)
public void poll() {

	HttpHeaders requestHeaders = new HttpHeaders();
	if (lastModified != null) {
		requestHeaders.set("If-Modified-Since", DateUtils.formatDate(lastModified));
	}
	HttpEntity<?> requestEntity = new HttpEntity(requestHeaders);
	ResponseEntity<Feed> response = restTemplate.exchange(creditDecisionFeed, HttpMethod.GET, requestEntity, Feed.class);

	if (response.getStatusCode() != HttpStatus.NOT_MODIFIED) {
		Feed feed = response.getBody();
		Date lastUpdateInFeed = null;
		for (Entry entry : feed.getEntries()) {
			String applicationNumber = entry.getSummary().getValue();
			if ((lastModified == null) || (entry.getUpdated().after(lastModified))) {
				log.info(applicationNumber + " is new, updating the status");


				CreditApplicationStatus applicationStatus = repository.findByApplicationNumber(applicationNumber);
				if (applicationStatus != null) {
					applicationStatus.setApproved(true);
					repository.save(applicationStatus);
				}
				if ((lastUpdateInFeed == null) || (entry.getUpdated().after(lastUpdateInFeed))) {
					lastUpdateInFeed = entry.getUpdated();
				}
			}
		}
		if (response.getHeaders().getFirst("Last-Modified") != null) {
			lastModified = DateUtils.parseDate(response.getHeaders().getFirst("Last-Modified"));
			log.info("LastModified header {}", lastModified);
		} else {
			if (lastUpdateInFeed != null) {
				lastModified = lastUpdateInFeed;
				log.info("Last in feed {}", lastModified);
			}

		}
	}
}
 
开发者ID:mploed,项目名称:event-driven-spring-boot,代码行数:42,代码来源:CreditDecisionPoller.java

示例6: addEntries

import com.rometools.rome.feed.atom.Feed; //导入方法依赖的package包/类
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);
}
 
开发者ID:rometools,项目名称:rome,代码行数:8,代码来源:Atom03Generator.java

示例7: addEntries

import com.rometools.rome.feed.atom.Feed; //导入方法依赖的package包/类
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);
}
 
开发者ID:rometools,项目名称:rome,代码行数:8,代码来源:Atom10Generator.java

示例8: findEntry

import com.rometools.rome.feed.atom.Feed; //导入方法依赖的package包/类
private Entry findEntry(final String id, final Feed feed) {
    for (final Entry entry : feed.getEntries()) {
        if (id.equals(entry.getId())) {
            return entry;
        }
    }
    return null;
}
 
开发者ID:rometools,项目名称:rome,代码行数:9,代码来源:FileBasedCollection.java

示例9: addEntries

import com.rometools.rome.feed.atom.Feed; //导入方法依赖的package包/类
private void addEntries(final Feed feed, final Element parent) throws FeedException {
    final List<Entry> items = feed.getEntries();
    for (final Entry entry : items) {
        addEntry(entry, parent);
    }
}
 
开发者ID:patexoid,项目名称:ZombieLib2,代码行数:7,代码来源:OPDSGenerator.java


注:本文中的com.rometools.rome.feed.atom.Feed.getEntries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。