Java Code Examples for com.rometools.rome.feed.atom.Link#getType()

The following examples show how to use com.rometools.rome.feed.atom.Link#getType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpenSearchModuleGenerator.java    From rome with Apache License 2.0 6 votes vote down vote up
protected Element generateLinkElement(final Link link) {
    final Element linkElement = new Element("link", OS_NS);

    if (link.getRel() != null) {
        final Attribute relAttribute = new Attribute("rel", "search");
        linkElement.setAttribute(relAttribute);
    }

    if (link.getType() != null) {
        final Attribute typeAttribute = new Attribute("type", link.getType());
        linkElement.setAttribute(typeAttribute);
    }

    if (link.getHref() != null) {
        final Attribute hrefAttribute = new Attribute("href", link.getHref());
        linkElement.setAttribute(hrefAttribute);
    }

    if (link.getHreflang() != null) {
        final Attribute hreflangAttribute = new Attribute("hreflang", link.getHreflang());
        linkElement.setAttribute(hreflangAttribute);
    }
    return linkElement;
}
 
Example 2
Source File: Atom03Generator.java    From rome with Apache License 2.0 6 votes vote down vote up
protected Element generateLinkElement(final Link link) {

        final Element linkElement = new Element("link", getFeedNamespace());

        final String rel = link.getRel();
        if (rel != null) {
            final Attribute relAttribute = new Attribute("rel", rel);
            linkElement.setAttribute(relAttribute);
        }

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

        final String href = link.getHref();
        if (href != null) {
            final Attribute hrefAttribute = new Attribute("href", href);
            linkElement.setAttribute(hrefAttribute);
        }

        return linkElement;

    }
 
Example 3
Source File: AtomModuleGenerator.java    From rome with Apache License 2.0 5 votes vote down vote up
private Element generateLink(Link link) {
    Element linkElement = new Element("link", NS);

    if (link.getHref() != null) {
        Attribute href = new Attribute(AtomLinkAttribute.HREF, link.getHref());
        linkElement.setAttribute(href);
    }
    if (link.getType() != null) {
        Attribute type = new Attribute(AtomLinkAttribute.TYPE, link.getType());
        linkElement.setAttribute(type);
    }
    if (link.getRel() != null) {
        Attribute rel = new Attribute(AtomLinkAttribute.REL, link.getRel());
        linkElement.setAttribute(rel);
    }

    if (link.getHreflang() != null) {
        final Attribute hreflangAttribute = new Attribute(AtomLinkAttribute.HREF_LANG, link.getHreflang());
        linkElement.setAttribute(hreflangAttribute);
    }

    if (link.getTitle() != null) {
        final Attribute title = new Attribute(AtomLinkAttribute.TITLE, link.getTitle());
        linkElement.setAttribute(title);
    }

    if (link.getLength() != 0) {
        final Attribute length = new Attribute(AtomLinkAttribute.LENGTH, Long.toString(link.getLength()));
        linkElement.setAttribute(length);
    }

    return linkElement;
}
 
Example 4
Source File: Atom10Generator.java    From rome with Apache License 2.0 4 votes vote down vote up
protected Element generateLinkElement(final Link link) {

        final Namespace namespace = getFeedNamespace();
        final Element linkElement = new Element("link", namespace);

        final String rel = link.getRel();
        if (rel != null) {
            final Attribute relAttribute = new Attribute("rel", rel);
            linkElement.setAttribute(relAttribute);
        }

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

        final String href = link.getHref();
        if (href != null) {
            final Attribute hrefAttribute = new Attribute("href", href);
            linkElement.setAttribute(hrefAttribute);
        }

        final String hreflang = link.getHreflang();
        if (hreflang != null) {
            final Attribute hreflangAttribute = new Attribute("hreflang", hreflang);
            linkElement.setAttribute(hreflangAttribute);
        }

        final String linkTitle = link.getTitle();
        if (linkTitle != null) {
            final Attribute title = new Attribute("title", linkTitle);
            linkElement.setAttribute(title);
        }

        if (link.getLength() != 0) {
            final Attribute lenght = new Attribute("length", Long.toString(link.getLength()));
            linkElement.setAttribute(lenght);
        }

        return linkElement;

    }