From: Thomas F. <tfo...@us...> - 2005-07-21 11:24:34
|
Update of /cvsroot/coefficient/coefficient/src/za/org/coefficient/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21611/src/za/org/coefficient/modules Modified Files: BaseModule.java Log Message: added support for the RSS stuff Index: BaseModule.java =================================================================== RCS file: /cvsroot/coefficient/coefficient/src/za/org/coefficient/modules/BaseModule.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** BaseModule.java 19 Apr 2005 08:13:06 -0000 1.9 --- BaseModule.java 21 Jul 2005 11:21:24 -0000 1.10 *************** *** 20,28 **** package za.org.coefficient.modules; import za.org.coefficient.authentication.CoefficientUser; import za.org.coefficient.authentication.Role; import za.org.coefficient.events.*; - import za.org.coefficient.events.CoefficientEvent; - import za.org.coefficient.events.CoefficientEventPublisher; import za.org.coefficient.interfaces.CoefficientContext; import za.org.coefficient.interfaces.ModuleLocal; --- 20,30 ---- package za.org.coefficient.modules; + import java.util.Date; + import java.util.List; + import za.org.coefficient.authentication.CoefficientUser; import za.org.coefficient.authentication.Role; + import za.org.coefficient.core.Project; import za.org.coefficient.events.*; import za.org.coefficient.interfaces.CoefficientContext; import za.org.coefficient.interfaces.ModuleLocal; *************** *** 115,117 **** --- 117,151 ---- CoefficientEvents.publishEvent(event); } + + /** + * Get the string to use as the "origin" for RSS items. Most modules won't need to touch this; + * it's here so that the "blog" module can override it to be something like "blog:<i>blog_id</i>" + * This may be necessary so that the blog pages and feeds can find the correct items quicky (the affectedObject + * mechanism may be better, and more generic, so it may replace this). + * @return the origin to use for RSS items + */ + private String getRSSOrigin(){ + return "module:" + getModuleName(); + } + + /** + * Create an RSS item (originating from this module). If the RSS module is installed, this item + * will be added to the pool available for display in RSS feeds/channels. + * @param title The RSS item title + * @param text The RSS item text/body + * @param link The RSS item link/url + * @param project The project that this RSS item is associated with, or null if not associated to a project + * @param affectedObjects A list of RSSItemCreatedEvent.AffectedObject objects for this RSS item + */ + protected void createRSSItem(String title, String text, String link, Project project, List affectedObjects) { + RSSItemCreatedEvent event = new RSSItemCreatedEvent(title); + event.setCreateDate(new Date()); + event.setItemText(text); + event.setLink(link); + event.setProject(project); + event.setOrigin(getRSSOrigin()); + event.setCreator(getModuleDisplayName()); + event.setAffectedObjects(affectedObjects); + publishEvent(event); + } } |