Package org.apache.wink.common.model.synd

Examples of org.apache.wink.common.model.synd.SyndLink


     * @throws WebApplicationException if neither the 'edit' nor the 'self'
     *             links exist.
     */
    private String getResourceLink(SyndBase synd) {
        // try 'edit' link
        SyndLink link = synd.getLink("edit"); //$NON-NLS-1$
        if (link == null) {
            // try 'self' link
            link = synd.getLink("self"); //$NON-NLS-1$
        }
        if (link == null) {
            // no link in the resource
            if (logger.isErrorEnabled()) {
                logger.error(Messages.getMessage("webDAVNoEditOrSelfLink", synd.getId())); //$NON-NLS-1$
            }
            throw new WebApplicationException();
        }

        URI uri = URI.create(link.getHref()).normalize();
        if (!uri.isAbsolute()) {
            // add base URI for relative links
            URI base = uriInfo.getAbsolutePath();
            if (synd.getBase() != null) {
                base = URI.create(synd.getBase());
View Full Code Here


            return;
        }
        if (syndFeed.getTitle() != null && syndFeed.getTitle().getValue() != null) {
            setTitle(syndFeed.getTitle().getValue());
        }
        SyndLink link = syndFeed.getLink("alternate");
        if (link != null && link.getHref() != null) {
            setLink(link.getHref());
        }
        if (syndFeed.getSubtitle() != null && syndFeed.getSubtitle().getValue() != null) {
            setDescription(syndFeed.getSubtitle().getValue());
        }
        if (syndFeed.getLang() != null) {
View Full Code Here

        }
        if (getTitle() != null) {
            syndFeed.setTitle(new SyndText(getTitle(), SyndTextType.text));
        }
        if (getLink() != null) {
            SyndLink syndLink = new SyndLink();
            syndLink.setHref(getLink());
            syndLink.setRel("alternate");
            syndFeed.getLinks().add(syndLink);
        }
        if (getDescription() != null) {
            syndFeed.setSubtitle(new SyndText(getDescription(), SyndTextType.text));
        }
View Full Code Here

    private List<SyndLink> getLinksAsSynd() {
        List<SyndLink> authors = new ArrayList<SyndLink>();
        for (AtomLink value : getLinks()) {
            if (value != null) {
                authors.add(value.toSynd(new SyndLink()));
            }
        }
        return authors;
    }
View Full Code Here

     */
    public RssItem(SyndEntry syndEntry) {
        if (syndEntry.getTitle() != null && syndEntry.getTitle().getValue() != null) {
            setTitle(syndEntry.getTitle().getValue());
        }
        SyndLink link = syndEntry.getLink("alternate");
        if (link != null && link.getHref() != null) {
            setLink(link.getHref());
        }
        if (syndEntry.getSummary() != null && syndEntry.getSummary().getValue() != null) {
            setDescription(syndEntry.getSummary().getValue());
        }
        if (syndEntry.getAuthors().size() > 0) {
View Full Code Here

        }
        if (getTitle() != null) {
            syndEntry.setTitle(new SyndText(getTitle(), SyndTextType.text));
        }
        if (getLink() != null) {
            SyndLink syndLink = new SyndLink();
            syndLink.setHref(getLink());
            syndLink.setRel("alternate");
            syndEntry.getLinks().add(syndLink);
        }
        if (getDescription() != null) {
            syndEntry.setSummary(new SyndText(getDescription()));
        }
        if (getAuthor() != null) {
            SyndPerson syndAuthor = new SyndPerson();
            String authorEmail = getAuthor();
            syndAuthor.setEmail(authorEmail);
            syndAuthor.setName(authorEmail.substring(0, authorEmail.indexOf("@")));
            syndEntry.getAuthors().add(syndAuthor);
        }
        syndEntry.getCategories().clear();
        for (RssCategory rssCategory : getCategories()) {
            SyndCategory syndCategory = new SyndCategory();
            syndCategory = rssCategory.toSynd(syndCategory);
            syndEntry.getCategories().add(syndCategory);
        }
        if (getEnclosure() != null) {
            SyndLink syndEnclosureLink = new SyndLink();
            syndEnclosureLink = getEnclosure().toSynd(syndEnclosureLink);
            syndEntry.getLinks().add(syndEnclosureLink);
        }
        if (getGuid() != null) {
            syndEntry.setId(getGuid().getContent());
View Full Code Here

    }

    // -- helpers

    public static void assertLink(List<SyndLink> links, String rel, String type, String href) {
        SyndLink link = new SyndLink(rel, type, href);
        assertTrue(links.contains(link));
    }
View Full Code Here

    private List<SyndLink> getLinksAsSynd() {
        List<SyndLink> authors = new ArrayList<SyndLink>();
        for (AtomLink value : getLinks()) {
            if (value != null) {
                authors.add(value.toSynd(new SyndLink()));
            }
        }
        return authors;
    }
View Full Code Here

     */
    public RssItem(SyndEntry syndEntry) {
        if (syndEntry.getTitle() != null && syndEntry.getTitle().getValue() != null) {
            setTitle(syndEntry.getTitle().getValue());
        }
        SyndLink link = syndEntry.getLink("alternate"); //$NON-NLS-1$
        if (link != null && link.getHref() != null) {
            setLink(link.getHref());
        }
        if (syndEntry.getSummary() != null && syndEntry.getSummary().getValue() != null) {
            setDescription(syndEntry.getSummary().getValue());
        }
        if (syndEntry.getAuthors().size() > 0) {
View Full Code Here

        }
        if (getTitle() != null) {
            syndEntry.setTitle(new SyndText(getTitle(), SyndTextType.text));
        }
        if (getLink() != null) {
            SyndLink syndLink = new SyndLink();
            syndLink.setHref(getLink());
            syndLink.setRel("alternate"); //$NON-NLS-1$
            syndEntry.getLinks().add(syndLink);
        }
        if (getDescription() != null) {
            syndEntry.setSummary(new SyndText(getDescription()));
        }
        if (getAuthor() != null) {
            SyndPerson syndAuthor = new SyndPerson();
            String authorEmail = getAuthor();
            syndAuthor.setEmail(authorEmail);
            syndAuthor.setName(authorEmail.substring(0, authorEmail.indexOf("@"))); //$NON-NLS-1$
            syndEntry.getAuthors().add(syndAuthor);
        }
        syndEntry.getCategories().clear();
        for (RssCategory rssCategory : getCategories()) {
            SyndCategory syndCategory = new SyndCategory();
            syndCategory = rssCategory.toSynd(syndCategory);
            syndEntry.getCategories().add(syndCategory);
        }
        if (getEnclosure() != null) {
            SyndLink syndEnclosureLink = new SyndLink();
            syndEnclosureLink = getEnclosure().toSynd(syndEnclosureLink);
            syndEntry.getLinks().add(syndEnclosureLink);
        }
        if (getGuid() != null) {
            syndEntry.setId(getGuid().getContent());
View Full Code Here

TOP

Related Classes of org.apache.wink.common.model.synd.SyndLink

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.