Search in sources :

Example 1 with Position

use of com.sun.syndication.feed.module.georss.geometries.Position in project pentaho-kettle by pentaho.

the class RssOutput method createEntry.

/**
 * @param author
 *          : The author of the event
 * @param title
 *          : The title of the event
 * @param link
 *          : The link to the element in RES
 * @param date
 *          : The event's date
 * @param desc
 *          : The event's description
 */
@SuppressWarnings("unchecked")
public boolean createEntry(String author, String title, String link, Date date, String desc, String geopointLat, String geopointLong) {
    boolean retval = false;
    try {
        // Add entry to the feed
        SyndEntry entry = new SyndEntryImpl();
        SyndContent description;
        entry = new SyndEntryImpl();
        if (title != null) {
            entry.setTitle(title);
        }
        if (link != null) {
            entry.setLink(link);
        }
        if (date != null) {
            entry.setPublishedDate(date);
        }
        if (author != null) {
            entry.setAuthor(author);
        }
        if (desc != null) {
            description = new SyndContentImpl();
            description.setType("text/plain");
            description.setValue(desc);
            entry.setDescription(description);
        }
        if (meta.AddGeoRSS() && geopointLat != null && geopointLong != null) {
            // Add GeoRSS?
            GeoRSSModule geoRSSModule = new SimpleModuleImpl();
            if (meta.useGeoRSSGML()) {
                geoRSSModule = new W3CGeoModuleImpl();
            }
            geoRSSModule.setPosition(new Position(Const.toDouble(geopointLat.replace(',', '.'), 0), Const.toDouble(geopointLong.replace(',', '.'), 0)));
            entry.getModules().add(geoRSSModule);
        }
        data.entries.add(entry);
        retval = true;
    } catch (Exception e) {
        logError(BaseMessages.getString(PKG, "RssOutput.Log.ErrorAddingEntry", e.getMessage()));
        setErrors(1);
        retval = false;
    }
    return retval;
}
Also used : SyndContent(com.sun.syndication.feed.synd.SyndContent) Position(com.sun.syndication.feed.module.georss.geometries.Position) SyndEntry(com.sun.syndication.feed.synd.SyndEntry) SyndContentImpl(com.sun.syndication.feed.synd.SyndContentImpl) SyndEntryImpl(com.sun.syndication.feed.synd.SyndEntryImpl) GeoRSSModule(com.sun.syndication.feed.module.georss.GeoRSSModule) SimpleModuleImpl(com.sun.syndication.feed.module.georss.SimpleModuleImpl) W3CGeoModuleImpl(com.sun.syndication.feed.module.georss.W3CGeoModuleImpl) KettleException(org.pentaho.di.core.exception.KettleException) KettleStepException(org.pentaho.di.core.exception.KettleStepException)

Aggregations

GeoRSSModule (com.sun.syndication.feed.module.georss.GeoRSSModule)1 SimpleModuleImpl (com.sun.syndication.feed.module.georss.SimpleModuleImpl)1 W3CGeoModuleImpl (com.sun.syndication.feed.module.georss.W3CGeoModuleImpl)1 Position (com.sun.syndication.feed.module.georss.geometries.Position)1 SyndContent (com.sun.syndication.feed.synd.SyndContent)1 SyndContentImpl (com.sun.syndication.feed.synd.SyndContentImpl)1 SyndEntry (com.sun.syndication.feed.synd.SyndEntry)1 SyndEntryImpl (com.sun.syndication.feed.synd.SyndEntryImpl)1 KettleException (org.pentaho.di.core.exception.KettleException)1 KettleStepException (org.pentaho.di.core.exception.KettleStepException)1