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


Java Content类代码示例

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


Content类属于com.rometools.rome.feed.atom包,在下文中一共展示了Content类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildFeedMetadata

import com.rometools.rome.feed.atom.Content; //导入依赖的package包/类
@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) {
	feed.setId("https://github.com/mploed/event-driven-spring-boot/customer");
	feed.setTitle("Customer");
	List<Link> alternateLinks = new ArrayList<>();
	Link link = new Link();
	link.setRel("self");
	link.setHref(baseUrl(request) + "feed");
	alternateLinks.add(link);
	List<SyndPerson> authors = new ArrayList<SyndPerson>();
	Person person = new Person();
	person.setName("Big Pug Bank");
	authors.add(person);
	feed.setAuthors(authors);

	feed.setAlternateLinks(alternateLinks);
	feed.setUpdated(customerRepository.lastUpdate());
	Content subtitle = new Content();
	subtitle.setValue("List of all customers");
	feed.setSubtitle(subtitle);
}
 
开发者ID:mploed,项目名称:event-driven-spring-boot,代码行数:22,代码来源:CustomerAtomFeedView.java

示例2: buildFeedEntries

import com.rometools.rome.feed.atom.Content; //导入依赖的package包/类
@Override
protected List<Entry> buildFeedEntries(Map<String, Object> model, HttpServletRequest request,
                                       HttpServletResponse response) throws Exception {

	List<Entry> entries = new ArrayList<Entry>();
	List<Customer> customerlist = (List<Customer>) model.get("customers");

	for (Customer o : customerlist) {
		Entry entry = new Entry();
		entry.setId("https://github.com/mploed/event-driven-spring-boot/customer/" + Long.toString(o.getId()));
		entry.setUpdated(o.getUpdated());
		entry.setTitle("Customer " + o.getId());
		List<Content> contents = new ArrayList<Content>();
		Content content = new Content();
		content.setSrc(baseUrl(request) + "customer/rest/" + Long.toString(o.getId()));
		content.setType("application/json");
		contents.add(content);
		entry.setContents(contents);
		Content summary = new Content();
		summary.setValue("This is the customer " + o.getId());
		entry.setSummary(summary);
		entries.add(entry);
	}

	return entries;
}
 
开发者ID:mploed,项目名称:event-driven-spring-boot,代码行数:27,代码来源:CustomerAtomFeedView.java

示例3: buildFeedMetadata

import com.rometools.rome.feed.atom.Content; //导入依赖的package包/类
@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) {
	feed.setId("tag:ewolff.com/microservice-atom/order");
	feed.setTitle("Order");
	List<Link> alternateLinks = new ArrayList<>();
	Link link = new Link();
	link.setRel("self");
	link.setHref(baseUrl(request) + "feed");
	alternateLinks.add(link);
	List<SyndPerson> authors = new ArrayList<SyndPerson>();
	Person person = new Person();
	person.setName("Big Money Online Commerce Inc.");
	authors.add(person);
	feed.setAuthors(authors);

	feed.setAlternateLinks(alternateLinks);
	feed.setUpdated(orderRepository.lastUpdate());
	Content subtitle = new Content();
	subtitle.setValue("List of all orders");
	feed.setSubtitle(subtitle);
}
 
开发者ID:ewolff,项目名称:microservice-atom,代码行数:22,代码来源:OrderAtomFeedView.java

示例4: buildFeedEntries

import com.rometools.rome.feed.atom.Content; //导入依赖的package包/类
@Override
protected List<Entry> buildFeedEntries(Map<String, Object> model, HttpServletRequest request,
		HttpServletResponse response) throws Exception {

	List<Entry> entries = new ArrayList<Entry>();
	List<Order> orderlist = (List<Order>) model.get("orders");

	for (Order o : orderlist) {
		Entry entry = new Entry();
		entry.setId("tag:ewolff.com/microservice-atom/order/" + Long.toString(o.getId()));
		entry.setUpdated(o.getUpdated());
		entry.setTitle("Order " + o.getId());
		List<Content> contents = new ArrayList<Content>();
		Content content = new Content();
		content.setSrc(baseUrl(request) + "order/" + Long.toString(o.getId()));
		content.setType("application/json");
		contents.add(content);
		entry.setContents(contents);
		Content summary = new Content();
		summary.setValue("This is the order " + o.getId());
		entry.setSummary(summary);
		entries.add(entry);
	}

	return entries;
}
 
开发者ID:ewolff,项目名称:microservice-atom,代码行数:27,代码来源:OrderAtomFeedView.java

示例5: feedReturnsNewlyCreatedOrder

import com.rometools.rome.feed.atom.Content; //导入依赖的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

示例6: buildFeedEntries

import com.rometools.rome.feed.atom.Content; //导入依赖的package包/类
@Override
protected List<Entry> buildFeedEntries(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
  List<Owner> owners = (List<Owner>) model.get("owners");
  List<Entry> entries = new ArrayList<>();
  for (Owner owner : owners) {
    Entry entry = new Entry();
    entry.setId(String.format("%d", owner.getId()));
    Person person = new Person();
    person.setName(owner.getFirstName());
    entry.setAuthors(Collections.singletonList(person));
    entry.setTitle(owner.getAddress());
    Content summary = new Content();
    summary.setValue(owner.getAddress());
    entry.setSummary(summary);
    entries.add(entry);
  }
  return entries;
}
 
开发者ID:puncha,项目名称:petclinic,代码行数:19,代码来源:OwnerAtomFeedView.java

示例7: toEntry

import com.rometools.rome.feed.atom.Content; //导入依赖的package包/类
private Entry toEntry(OPDSEntryI opdsEntryI, Locale locale) {

        Entry entry = new Entry();
        entry.setId(String.valueOf(opdsEntryI.getId()));
        if (opdsEntryI.getUpdated() != null) {
            entry.setUpdated(opdsEntryI.getUpdated());
        }
        Res title = opdsEntryI.getTitle();

        entry.setTitle(res.get(locale, title.getKey(), title.getObjs()));
        opdsEntryI.getContent().ifPresent(contents -> {
            entry.setContents(contents.stream().map(s -> {
                        Content content = new Content();
                        content.setValue(s.getValue(res, locale));
                        content.setType(s.getType());
                        content.setSrc(s.getSrc());
                        return content;
                    }).
                    reduce(this::reduceContent).
                    map(Collections::singletonList).get());
        });
        entry.setOtherLinks(opdsEntryI.getLinks().stream().map(this::toLink).collect(Collectors.toList()));
        opdsEntryI.getAuthors().ifPresent(opdsAuthors ->
                entry.setAuthors(opdsAuthors.stream().map(this::toPerson).collect(Collectors.toList())));
        return entry;
    }
 
开发者ID:patexoid,项目名称:ZombieLib2,代码行数:27,代码来源:OpdsView.java

示例8: buildFeedEntries

import com.rometools.rome.feed.atom.Content; //导入依赖的package包/类
@Override
protected List<Entry> buildFeedEntries(Map<String, Object> model,
                                       HttpServletRequest request, HttpServletResponse response) throws Exception {

    Vets vets = (Vets) model.get("vets");
    List<Vet> vetList = vets.getVetList();
    List<Entry> entries = new ArrayList<Entry>(vetList.size());

    for (Vet vet : vetList) {
        Entry entry = new Entry();
        // see http://diveintomark.org/archives/2004/05/28/howto-atom-id#other
        entry.setId(String.format("tag:springsource.org,%s", vet.getId()));
        entry.setTitle(String.format("Vet: %s %s", vet.getFirstName(), vet.getLastName()));
        //entry.setUpdated(visit.getDate().toDate());

        Content summary = new Content();
        summary.setValue(vet.getSpecialties().toString());
        entry.setSummary(summary);

        entries.add(entry);
    }
    response.setContentType("blabla");
    return entries;

}
 
开发者ID:jenkinsci,项目名称:docker-workflow-plugin,代码行数:26,代码来源:VetsAtomView.java

示例9: generateTagLineElement

import com.rometools.rome.feed.atom.Content; //导入依赖的package包/类
protected Element generateTagLineElement(final Content tagline) {

        final Element taglineElement = new Element("tagline", getFeedNamespace());

        final String type = tagline.getType();
        if (type != null) {
            final Attribute typeAttribute = new Attribute("type", type);
            taglineElement.setAttribute(typeAttribute);
        }

        final String value = tagline.getValue();
        if (value != null) {
            taglineElement.addContent(value);
        }

        return taglineElement;

    }
 
开发者ID:rometools,项目名称:rome,代码行数:19,代码来源:Atom03Generator.java

示例10: generateTagLineElement

import com.rometools.rome.feed.atom.Content; //导入依赖的package包/类
protected Element generateTagLineElement(final Content tagline) {

        final Element taglineElement = new Element("subtitle", getFeedNamespace());

        final String type = tagline.getType();
        if (type != null) {
            final Attribute typeAttribute = new Attribute("type", type);
            taglineElement.setAttribute(typeAttribute);
        }

        final String value = tagline.getValue();
        if (value != null) {
            taglineElement.addContent(value);
        }

        return taglineElement;

    }
 
开发者ID:rometools,项目名称:rome,代码行数:19,代码来源:Atom10Generator.java

示例11: getAsStream

import com.rometools.rome.feed.atom.Content; //导入依赖的package包/类
/**
 * Get media resource as an InputStream, should work regardless of whether you set the media
 * resource data as an InputStream or as a byte array.
 */
public InputStream getAsStream() throws ProponoException {
    if (getContents() != null && !getContents().isEmpty()) {
        final Content c = getContents().get(0);
        if (c.getSrc() != null) {
            return getResourceAsStream();
        } else if (inputStream != null) {
            return inputStream;
        } else if (bytes != null) {
            return new ByteArrayInputStream(bytes);
        } else {
            throw new ProponoException("ERROR: no src URI or binary data to return");
        }
    } else {
        throw new ProponoException("ERROR: no content found in entry");
    }
}
 
开发者ID:rometools,项目名称:rome,代码行数:21,代码来源:ClientMediaEntry.java

示例12: buildFeedEntries

import com.rometools.rome.feed.atom.Content; //导入依赖的package包/类
@Override
protected List<Entry> buildFeedEntries(Map<String, Object> model,
		HttpServletRequest req, HttpServletResponse response) throws Exception {
	// get data model which is passed by the Spring container
	  List<HrmsNews> news = (List<HrmsNews>) model.get("allNews");
       List<Entry> entries = new ArrayList<Entry>(news.size());
		
		for(HrmsNews topic : news ){
		
			Entry entry = new Entry();
			
			
			entry.setId(topic.getId()+"");
						
			entry.setTitle(topic.getDescription());
			
			Content summary = new Content();
			summary.setValue(topic.getSummary());
		    entry.setSummary(summary);
		       
		    Link link = new Link();
		    link.setType("text/html");
		    link.setHref(topic.getLink()); //because I have a different controller to show news at http://yourfanstasticsiteUrl.com/news/ID
		    List arrLinks = new ArrayList();
		    arrLinks.add(link);
		    entry.setAlternateLinks(arrLinks);
		    entry.setUpdated(new Date());
			
		    entries.add(entry);
		}
		
		return entries;
}
 
开发者ID:PacktPublishing,项目名称:Spring-MVC-Blueprints,代码行数:34,代码来源:HrmsAtomViewBuilder.java

示例13: buildFeedEntries

import com.rometools.rome.feed.atom.Content; //导入依赖的package包/类
@Override
protected List<Entry> buildFeedEntries(Map model, HttpServletRequest request, HttpServletResponse response)
		throws Exception {
	List<Entry> entries = new ArrayList<Entry>();
	for (Iterator iterator = model.keySet().iterator(); iterator.hasNext();) {
		String name = (String) iterator.next();
		Entry entry = new Entry();
		entry.setTitle(name);
		Content content = new Content();
		content.setValue((String) model.get(name));
		entry.setSummary(content);
		entries.add(entry);
	}
	return entries;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:16,代码来源:AtomFeedViewTests.java

示例14: reduceContent

import com.rometools.rome.feed.atom.Content; //导入依赖的package包/类
private Content reduceContent(Content first, Content second) {
    Content newContent = new Content();
    String type = first.getType();
    String newValue;
    if (type.toLowerCase().contains("html")) {
        newValue = first.getValue() + "<br/>" + second.getValue();
    } else {
        newValue = first.getValue() + "\n " + second.getValue();

    }
    newContent.setValue(newValue);
    newContent.setType(type);
    newContent.setSrc(first.getSrc());
    return newContent;
}
 
开发者ID:patexoid,项目名称:ZombieLib2,代码行数:16,代码来源:OpdsView.java

示例15: buildFeedMetadata

import com.rometools.rome.feed.atom.Content; //导入依赖的package包/类
protected void buildFeedMetadata(Map model, Feed feed, HttpServletRequest request) {
    feed.setId("" + model.get("feed_id"));
    feed.setTitle("" + model.get("feed_title"));
    Content subTitle = new Content();
    subTitle.setValue("" + model.get("feed_description"));
    feed.setSubtitle(subTitle);
}
 
开发者ID:PodcastpediaOrg,项目名称:podcastpedia-web,代码行数:8,代码来源:GenericAtomFeedView.java


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