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


Java Outline类代码示例

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


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

示例1: parseOutline

import com.rometools.opml.feed.opml.Outline; //导入依赖的package包/类
@Override
protected Outline parseOutline(final Element e, final boolean validate, final Locale locale) throws FeedException {
    Outline retValue;

    retValue = super.parseOutline(e, validate, locale);

    if (e.getAttributeValue("created") != null) {
        retValue.setCreated(DateParser.parseRFC822(e.getAttributeValue("created"), locale));
    }

    final List<Attribute> atts = retValue.getAttributes();

    for (int i = 0; i < atts.size(); i++) {
        final Attribute a = atts.get(i);

        if (a.getName().equals("created")) {
            retValue.getAttributes().remove(a);

            break;
        }
    }

    return retValue;
}
 
开发者ID:rometools,项目名称:rome,代码行数:25,代码来源:OPML20Parser.java

示例2: generateOutline

import com.rometools.opml.feed.opml.Outline; //导入依赖的package包/类
protected Element generateOutline(final Outline outline) {
    final Element e = new Element("outline");
    addNotNullAttribute(e, "text", outline.getText());
    addNotNullAttribute(e, "type", outline.getType());
    addNotNullAttribute(e, "title", outline.getTitle());

    if (outline.isBreakpoint()) {
        addNotNullAttribute(e, "isBreakpoint", "true");
    }

    if (outline.isComment()) {
        addNotNullAttribute(e, "isComment", "true");
    }

    final List<Attribute> atts = Collections.synchronizedList(outline.getAttributes());

    for (int i = 0; i < atts.size(); i++) {
        final Attribute att = atts.get(i);
        addNotNullAttribute(e, att.getName(), att.getValue());
    }

    super.generateItemModules(outline.getModules(), e);
    e.addContent(generateOutlines(outline.getChildren()));

    return e;
}
 
开发者ID:rometools,项目名称:rome,代码行数:27,代码来源:OPML10Generator.java

示例3: categoryOf

import com.rometools.opml.feed.opml.Outline; //导入依赖的package包/类
private NodeList categoryOf(final String... categories) {

        try {

            final Outline outline = new Outline("outline1", null);
            outline.setCategories(Arrays.asList(categories));

            final Opml opml = new Opml();
            opml.setFeedType("opml_2.0");
            opml.setTitle("title");
            opml.setOutlines(Arrays.asList(outline));

            final WireFeedOutput output = new WireFeedOutput();
            final String xml = output.outputString(opml);

            final Document document = XMLUnit.buildControlDocument(xml);
            return XMLUnit.newXpathEngine().getMatchingNodes("/opml/body/outline/@category", document);

        } catch (final Exception e) {
            throw new RuntimeException(e);
        }

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

示例4: buildCategoryOutline

import com.rometools.opml.feed.opml.Outline; //导入依赖的package包/类
private Outline buildCategoryOutline(FeedCategory cat, List<FeedCategory> categories, List<FeedSubscription> subscriptions) {
	Outline outline = new Outline();
	outline.setText(cat.getName());
	outline.setTitle(cat.getName());

	for (FeedCategory child : categories.stream().filter(c -> c.getParent() != null && c.getParent().getId().equals(cat.getId()))
			.collect(Collectors.toList())) {
		outline.getChildren().add(buildCategoryOutline(child, categories, subscriptions));
	}

	for (FeedSubscription sub : subscriptions.stream()
			.filter(s -> s.getCategory() != null && s.getCategory().getId().equals(cat.getId())).collect(Collectors.toList())) {
		outline.getChildren().add(buildSubscriptionOutline(sub));
	}
	return outline;
}
 
开发者ID:Athou,项目名称:commafeed,代码行数:17,代码来源:OPMLExporter.java

示例5: generates_OPML_correctly

import com.rometools.opml.feed.opml.Outline; //导入依赖的package包/类
@Test
public void generates_OPML_correctly() {
	when(feedCategoryDAO.findAll(user)).thenReturn(categories);
	when(feedSubscriptionDAO.findAll(user)).thenReturn(subscriptions);

	Opml opml = new OPMLExporter(feedCategoryDAO, feedSubscriptionDAO).export(user);

	List<Outline> rootOutlines = opml.getOutlines();
	assertEquals(2, rootOutlines.size());
	assertTrue(containsCategory(rootOutlines, "cat1"));
	assertTrue(containsFeed(rootOutlines, "rootFeed", "rootFeed.com"));

	Outline cat1Outline = getCategoryOutline(rootOutlines, "cat1");
	List<Outline> cat1Children = cat1Outline.getChildren();
	assertEquals(2, cat1Children.size());
	assertTrue(containsCategory(cat1Children, "cat2"));
	assertTrue(containsFeed(cat1Children, "cat1Feed", "cat1Feed.com"));

	Outline cat2Outline = getCategoryOutline(cat1Children, "cat2");
	List<Outline> cat2Children = cat2Outline.getChildren();
	assertEquals(1, cat2Children.size());
	assertTrue(containsFeed(cat2Children, "cat2Feed", "cat2Feed.com"));
}
 
开发者ID:Athou,项目名称:commafeed,代码行数:24,代码来源:OPMLExporterTest.java

示例6: createEntries

import com.rometools.opml.feed.opml.Outline; //导入依赖的package包/类
protected void createEntries(final Stack<Integer> context, final List<SyndEntry> allEntries, final List<Outline> outlines) {
    final List<Outline> so = Collections.synchronizedList(outlines);

    for (int i = 0; i < so.size(); i++) {
        createEntry(context, allEntries, so.get(i));
    }
}
 
开发者ID:rometools,项目名称:rome,代码行数:8,代码来源:ConverterForOPML10.java

示例7: generateOutlines

import com.rometools.opml.feed.opml.Outline; //导入依赖的package包/类
protected List<Element> generateOutlines(final List<Outline> outlines) {
    final ArrayList<Element> elements = new ArrayList<Element>();
    for (int i = 0; outlines != null && i < outlines.size(); i++) {
        elements.add(generateOutline(outlines.get(i)));
    }
    return elements;
}
 
开发者ID:rometools,项目名称:rome,代码行数:8,代码来源:OPML10Generator.java

示例8: parseOutlines

import com.rometools.opml.feed.opml.Outline; //导入依赖的package包/类
protected List<Outline> parseOutlines(final List<Element> elements, final boolean validate, final Locale locale) throws FeedException {
    final ArrayList<Outline> results = new ArrayList<Outline>();
    for (int i = 0; i < elements.size(); i++) {
        results.add(parseOutline(elements.get(i), validate, locale));
    }
    return results;
}
 
开发者ID:rometools,项目名称:rome,代码行数:8,代码来源:OPML10Parser.java

示例9: importOpml

import com.rometools.opml.feed.opml.Outline; //导入依赖的package包/类
public void importOpml(User user, String xml) {
	xml = xml.substring(xml.indexOf('<'));
	WireFeedInput input = new WireFeedInput();
	try {
		Opml feed = (Opml) input.build(new StringReader(xml));
		List<Outline> outlines = feed.getOutlines();
		for (int i = 0; i < outlines.size(); i++) {
			handleOutline(user, outlines.get(i), null, i);
		}
	} catch (Exception e) {
		log.error(e.getMessage(), e);
	}

}
 
开发者ID:Athou,项目名称:commafeed,代码行数:15,代码来源:OPMLImporter.java

示例10: buildSubscriptionOutline

import com.rometools.opml.feed.opml.Outline; //导入依赖的package包/类
private Outline buildSubscriptionOutline(FeedSubscription sub) {
	Outline outline = new Outline();
	outline.setText(sub.getTitle());
	outline.setTitle(sub.getTitle());
	outline.setType("rss");
	outline.getAttributes().add(new Attribute("xmlUrl", sub.getFeed().getUrl()));
	if (sub.getFeed().getLink() != null) {
		outline.getAttributes().add(new Attribute("htmlUrl", sub.getFeed().getLink()));
	}
	return outline;
}
 
开发者ID:Athou,项目名称:commafeed,代码行数:12,代码来源:OPMLExporter.java

示例11: containsCategory

import com.rometools.opml.feed.opml.Outline; //导入依赖的package包/类
private boolean containsCategory(List<Outline> outlines, String category) {
	for (Outline o : outlines)
		if (!"rss".equals(o.getType()))
			if (category.equals(o.getTitle()))
				return true;

	return false;
}
 
开发者ID:Athou,项目名称:commafeed,代码行数:9,代码来源:OPMLExporterTest.java

示例12: containsFeed

import com.rometools.opml.feed.opml.Outline; //导入依赖的package包/类
private boolean containsFeed(List<Outline> outlines, String title, String url) {
	for (Outline o : outlines)
		if ("rss".equals(o.getType()))
			if (title.equals(o.getTitle()) && o.getAttributeValue("xmlUrl").equals(url))
				return true;

	return false;
}
 
开发者ID:Athou,项目名称:commafeed,代码行数:9,代码来源:OPMLExporterTest.java

示例13: getCategoryOutline

import com.rometools.opml.feed.opml.Outline; //导入依赖的package包/类
private Outline getCategoryOutline(List<Outline> outlines, String title) {
	for (Outline o : outlines)
		if (o.getTitle().equals(title))
			return o;

	return null;
}
 
开发者ID:Athou,项目名称:commafeed,代码行数:8,代码来源:OPMLExporterTest.java

示例14: OutlineHolder

import com.rometools.opml.feed.opml.Outline; //导入依赖的package包/类
public OutlineHolder(final Outline outline, final String parent) {
    this.outline = outline;
    this.parent = parent;
}
 
开发者ID:rometools,项目名称:rome,代码行数:5,代码来源:ConverterForOPML10.java

示例15: generateOutline

import com.rometools.opml.feed.opml.Outline; //导入依赖的package包/类
@Override
protected Element generateOutline(final Outline outline) {

    final Element outlineElement = super.generateOutline(outline);

    if (outline.getCreated() != null) {
        outlineElement.setAttribute("created", DateParser.formatRFC822(outline.getCreated(), Locale.US));
    }

    final List<String> categories = outline.getCategories();
    final String categoryValue = generateCategoryValue(categories);
    addNotNullAttribute(outlineElement, "category", categoryValue);

    return outlineElement;

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


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