Search in sources :

Example 6 with EnclosureImpl

use of org.olat.modules.webFeed.model.EnclosureImpl in project openolat by klemens.

the class RomeFeedFetcher method convertEnclosures.

/**
 * Converts a List of <code>SyndEnclosures</code> into an <code>Enclosure</code>.
 * Only one media file is supported. If the List has more than one entry, the
 * first entry is taken.
 * SyndEnclosures without an URL are not converted, because it is necessary to
 * fetch the enclosure.
 *
 * @param enclosures
 * @return the enclosure or null
 */
protected Enclosure convertEnclosures(List<SyndEnclosure> enclosures) {
    if (enclosures == null || enclosures.isEmpty())
        return null;
    SyndEnclosure syndEnclosure = enclosures.get(0);
    Enclosure enclosure = null;
    if (StringHelper.containsNonWhitespace(syndEnclosure.getUrl())) {
        enclosure = new EnclosureImpl();
        enclosure.setExternalUrl(syndEnclosure.getUrl());
        enclosure.setLength(syndEnclosure.getLength());
        enclosure.setType(syndEnclosure.getType());
    }
    return enclosure;
}
Also used : SyndEnclosure(com.rometools.rome.feed.synd.SyndEnclosure) Enclosure(org.olat.modules.webFeed.Enclosure) SyndEnclosure(com.rometools.rome.feed.synd.SyndEnclosure) EnclosureImpl(org.olat.modules.webFeed.model.EnclosureImpl)

Aggregations

Enclosure (org.olat.modules.webFeed.Enclosure)6 EnclosureImpl (org.olat.modules.webFeed.model.EnclosureImpl)6 SyndEnclosure (com.rometools.rome.feed.synd.SyndEnclosure)2 LocalDate (java.time.LocalDate)2 Date (java.util.Date)2 Test (org.junit.Test)2 Identity (org.olat.core.id.Identity)2 Feed (org.olat.modules.webFeed.Feed)2 Item (org.olat.modules.webFeed.Item)2 OLATResource (org.olat.resource.OLATResource)2