use of com.rometools.rome.feed.synd.SyndEntry in project BIMserver by opensourceBIM.
the class SyndicationServlet method writeCheckoutsFeed.
private void writeCheckoutsFeed(HttpServletRequest request, HttpServletResponse response, ServiceMap serviceMap) throws ServiceException, IOException, FeedException, PublicInterfaceNotFoundException {
long poid = Long.parseLong(request.getParameter("poid"));
SProject sProject = serviceMap.getServiceInterface().getProjectByPoid(poid);
SyndFeed feed = new SyndFeedImpl();
feed.setFeedType(FEED_TYPE);
feed.setTitle("BIMserver.org checkouts feed for project '" + sProject.getName() + "'");
feed.setLink(request.getContextPath());
feed.setDescription("This feed represents all the checkouts of project '" + sProject.getName() + "'");
List<SyndEntry> entries = new ArrayList<SyndEntry>();
try {
List<SCheckout> allCheckoutsOfProject = serviceMap.getServiceInterface().getAllCheckoutsOfProjectAndSubProjects(poid);
for (SCheckout sCheckout : allCheckoutsOfProject) {
SRevision revision = serviceMap.getServiceInterface().getRevision(sCheckout.getRevision().getOid());
SProject project = serviceMap.getServiceInterface().getProjectByPoid(sCheckout.getProjectId());
SUser user = serviceMap.getServiceInterface().getUserByUoid(sCheckout.getUserId());
SyndEntry entry = new SyndEntryImpl();
entry.setTitle("Checkout on " + project.getName() + ", revision " + revision.getId());
entry.setLink(request.getContextPath() + "/project.jsp?poid=" + sProject.getOid());
entry.setPublishedDate(sCheckout.getDate());
SyndContent description = new SyndContentImpl();
description.setType("text/plain");
description.setValue("<table><tr><td>User</td><td>" + user.getUsername() + "</td></tr><tr><td>Revision</td><td>" + sCheckout.getRevision().getOid() + "</td></tr></table>");
entry.setDescription(description);
entries.add(entry);
}
} catch (UserException e) {
LOGGER.error("", e);
}
feed.setEntries(entries);
SyndFeedOutput output = new SyndFeedOutput();
output.output(feed, response.getWriter());
}
use of com.rometools.rome.feed.synd.SyndEntry in project spring-integration-samples by spring-projects.
the class FeedInboundChannelAdapterSample method runDemo.
@SuppressWarnings("unchecked")
@Test
public void runDemo() {
ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext("META-INF/spring/integration/FeedInboundChannelAdapterSample-context.xml");
PollableChannel feedChannel = ac.getBean("feedChannel", PollableChannel.class);
for (int i = 0; i < 10; i++) {
Message<SyndEntry> message = (Message<SyndEntry>) feedChannel.receive(1000);
if (message != null) {
SyndEntry entry = message.getPayload();
System.out.println(entry.getPublishedDate() + " - " + entry.getTitle());
} else {
break;
}
}
ac.close();
}
use of com.rometools.rome.feed.synd.SyndEntry in project rubia-forums by flashboss.
the class FeedsServlet method createCategoryFeed.
private void createCategoryFeed(SyndFeed feed, Integer id, String url, String urlType) throws ModuleException {
Category category = forumsModule.findCategoryById(id);
feed.setTitle("Rubia Forums Category Feed: " + category.getTitle());
feed.setLink(categoryLink(id.toString(), url, urlType));
feed.setDescription("Messages posted in category " + category.getTitle());
List<SyndEntry> entries = new ArrayList<SyndEntry>();
List<Post> posts = forumsModule.findPostsFromCategoryDesc(category, POST_LIMIT);
for (int i = 0; i < posts.size(); i++) {
entries.add(getEntry(posts.get(i), url, urlType));
}
feed.setEntries(entries);
}
use of com.rometools.rome.feed.synd.SyndEntry in project rubia-forums by flashboss.
the class FeedsServlet method createTopicFeed.
private void createTopicFeed(SyndFeed feed, Integer id, String url, String urlType) throws ModuleException {
Topic topic = forumsModule.findTopicById(id);
feed.setTitle("Rubia Forums Topic Feed: " + topic.getSubject());
feed.setLink(topicLink(id.toString(), url, urlType));
feed.setDescription("Messages posted in topic " + topic.getSubject() + " in forum " + topic.getForum().getName() + " in category " + topic.getForum().getCategory().getTitle());
List<SyndEntry> entries = new ArrayList<SyndEntry>();
List<Post> posts = forumsModule.findPostsByTopicId(topic);
for (int i = 0; i < posts.size(); i++) {
entries.add(getEntry(posts.get(i), url, urlType));
}
feed.setEntries(entries);
}
use of com.rometools.rome.feed.synd.SyndEntry in project rubia-forums by flashboss.
the class FeedsServlet method createForumFeed.
private void createForumFeed(SyndFeed feed, Integer id, String url, String urlType) throws ModuleException {
Forum forum = forumsModule.findForumById(id);
feed.setTitle("Rubia Forums Forum Feed: " + forum.getName());
feed.setLink(forumLink(id.toString(), url, urlType));
feed.setDescription("Messages posted in forum " + forum.getName() + " in category " + forum.getCategory().getTitle());
List<SyndEntry> entries = new ArrayList<SyndEntry>();
List<Post> posts = forumsModule.findPostsFromForumDesc(forum, POST_LIMIT);
for (int i = 0; i < posts.size(); i++) {
entries.add(getEntry(posts.get(i), url, urlType));
}
feed.setEntries(entries);
}
Aggregations