Package org.apache.roller.planet.pojos

Examples of org.apache.roller.planet.pojos.SubscriptionEntry


        // if we don't have a permalink then we can't continue
        if(romeEntry.getLink() == null) {
            return null;
        }
       
        SubscriptionEntry newEntry = new SubscriptionEntry();
       
        newEntry.setTitle(romeEntry.getTitle());
        newEntry.setPermalink(romeEntry.getLink());
       
        // Play some games to get the author
        DCModule entrydc = (DCModule)romeEntry.getModule(DCModule.URI);
        if (romeEntry.getAuthor() != null) {
            newEntry.setAuthor(romeEntry.getAuthor());
        } else {
            newEntry.setAuthor(entrydc.getCreator()); // use <dc:creator>
        }
       
        // Play some games to get the updated date
        if (romeEntry.getUpdatedDate() != null) {
            newEntry.setUpdateTime(new Timestamp(romeEntry.getUpdatedDate().getTime()));
        }
        // TODO: should we set a default update time here?
       
        // And more games getting publish date
        if (romeEntry.getPublishedDate() != null) {
            newEntry.setPubTime(new Timestamp(romeEntry.getPublishedDate().getTime())); // use <pubDate>
        } else if (entrydc != null && entrydc.getDate() != null) {
            newEntry.setPubTime(new Timestamp(entrydc.getDate().getTime())); // use <dc:date>
        } else {
            newEntry.setPubTime(newEntry.getUpdateTime());
        }
       
        // get content and unescape if it is 'text/plain'
        if (romeEntry.getContents().size() > 0) {
            SyndContent content= (SyndContent)romeEntry.getContents().get(0);
            if (content != null && content.getType().equals("text/plain")) {
                newEntry.setText(StringEscapeUtils.unescapeHtml(content.getValue()));
            } else if (content != null) {
                newEntry.setText(content.getValue());
            }
        }
       
        // no content, try summary
        if (newEntry.getText() == null || newEntry.getText().trim().length() == 0) {
            if (romeEntry.getDescription() != null) {
                newEntry.setText(romeEntry.getDescription().getValue());
            }
        }
       
        // copy categories
        if (romeEntry.getCategories().size() > 0) {
            List list = new ArrayList();
            Iterator cats = romeEntry.getCategories().iterator();
            while (cats.hasNext()) {
                SyndCategory cat = (SyndCategory)cats.next();
                list.add(cat.getName());
            }
            newEntry.setCategoriesString(list);
        }
       
        return newEntry;
    }
View Full Code Here


            // Populate subscription object with new entries
            PluginManager ppmgr = WebloggerFactory.getWeblogger().getPluginManager();
            Map pagePlugins = ppmgr.getWeblogEntryPlugins(localWeblog);
            for ( WeblogEntry rollerEntry : entries ) {
                SubscriptionEntry entry = new SubscriptionEntry();
                String content = "";
                if (!StringUtils.isEmpty(rollerEntry.getText())) {
                    content = rollerEntry.getText();
                } else {
                    content = rollerEntry.getSummary();
                }
                content = ppmgr.applyWeblogEntryPlugins(pagePlugins, rollerEntry, content);
               
                entry.setAuthor(rollerEntry.getCreator().getScreenName());
                entry.setTitle(rollerEntry.getTitle());
                entry.setPubTime(rollerEntry.getPubTime());
                entry.setText(content);
                entry.setPermalink(rollerEntry.getPermalink());
                entry.setCategoriesString(rollerEntry.getCategory().getPath());
               
                newSub.addEntry(entry);
            }
           
        } catch (WebloggerException ex) {
View Full Code Here

                    rawEntries.remove(rawEntries.size() - 1);
                }
               
                // wrap 'em
                for (Iterator it = rawEntries.iterator(); it.hasNext();) {
                    SubscriptionEntry entry = (SubscriptionEntry) it.next();
                    // TODO needs pojo wrapping from planet
                    results.add(entry);
                }
               
            } catch (Exception e) {
View Full Code Here

                }
               
                // wrap 'em
                int count = 0;
                for (Iterator it = entries.iterator(); it.hasNext();) {
                    SubscriptionEntry entry = (SubscriptionEntry) it.next();
                    // TODO needs pojo wrapping from planet
                    if (count++ < length) {
                        results.add(entry);
                    } else {
                        more = true;
View Full Code Here

TOP

Related Classes of org.apache.roller.planet.pojos.SubscriptionEntry

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.