za.org.coefficient.modules
Class BaseModule

java.lang.Object
  extended by za.org.coefficient.modules.BaseModule
All Implemented Interfaces:
CoefficientEventPublisher, ModuleLocal
Direct Known Subclasses:
About, About, AttributeDataManagement, AttributeManagement, AttributeSearch, BaseNavigate, BaseNavProjectModule, BaseProjectBrowse, BaseProjectModule, CategoryBrowse, CategoryManagement, ChangeTheme, Configuration, DgroupsNavigation, Error, Faq, GlobalProjectAdmin, Home, Legal, Login, MostActiveDiscussions, MostActiveProjects, MostRecentFileUploads, MostRecentProjects, MyData, ProjectModuleLinks, Projects, QuickSearch, Security, StatisticsDisplay, SwapTheme, UserAdmin, Welcome, WorkflowAdmin

public abstract class BaseModule
extends java.lang.Object
implements ModuleLocal, CoefficientEventPublisher

DOCUMENT ME!

Version:
$Revision: 1.10 $
Author:
$author$

Field Summary
private  CoefficientContext ctx
           
private static java.lang.String SESSION
           
 
Constructor Summary
BaseModule()
           
 
Method Summary
 java.lang.String canExecuteForRole(CoefficientContext ctx, java.lang.String methodName, Role usersHighestRole)
          This is a base implementation that will allow all methods to be invoked without regard to roles
protected  void createRSSItem(java.lang.String title, java.lang.String text, java.lang.String link, Project project, java.util.List affectedObjects)
          Create an RSS item (originating from this module).
 java.lang.String displayUsersData(CoefficientUser user)
          This is a base implementation that will return an empty string for a modules user related data.
 CoefficientContext getCoefficientContext()
           
abstract  java.lang.String getMainMethod()
          This method is used to determine which method should be invoked when the module is requested without an operation.
abstract  java.lang.String getModuleDescription()
          This method is used to find the description of the module
abstract  java.lang.String getModuleDisplayName()
          This method is used to find the display name of the module
 java.lang.String getModuleName()
          This is a base implementation so all modules will have the right format of their names
private  java.lang.String getRSSOrigin()
          Get the string to use as the "origin" for RSS items.
 boolean isProjectRequired()
          This method is used determine if we implement BaseProjectModule
 void publishEvent(CoefficientEvent event)
           
 void setCoefficientContext(CoefficientContext ctx)
           
 CoefficientContext showHelp(CoefficientContext ctx)
          This method is used to show help on the your module.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SESSION

private static final java.lang.String SESSION
See Also:
Constant Field Values

ctx

private CoefficientContext ctx
Constructor Detail

BaseModule

public BaseModule()
Method Detail

getMainMethod

public abstract java.lang.String getMainMethod()
Description copied from interface: ModuleLocal
This method is used to determine which method should be invoked when the module is requested without an operation.

Specified by:
getMainMethod in interface ModuleLocal
Returns:
name of the method that should be invoked

getModuleDescription

public abstract java.lang.String getModuleDescription()
Description copied from interface: ModuleLocal
This method is used to find the description of the module

Specified by:
getModuleDescription in interface ModuleLocal
Returns:
the description of the module

getModuleDisplayName

public abstract java.lang.String getModuleDisplayName()
Description copied from interface: ModuleLocal
This method is used to find the display name of the module

Specified by:
getModuleDisplayName in interface ModuleLocal
Returns:
the display name of the module

setCoefficientContext

public void setCoefficientContext(CoefficientContext ctx)
Specified by:
setCoefficientContext in interface ModuleLocal

getCoefficientContext

public CoefficientContext getCoefficientContext()
Specified by:
getCoefficientContext in interface ModuleLocal

getModuleName

public java.lang.String getModuleName()
This is a base implementation so all modules will have the right format of their names

Specified by:
getModuleName in interface ModuleLocal
Returns:
the system name of the module

canExecuteForRole

public java.lang.String canExecuteForRole(CoefficientContext ctx,
                                          java.lang.String methodName,
                                          Role usersHighestRole)
This is a base implementation that will allow all methods to be invoked without regard to roles

Specified by:
canExecuteForRole in interface ModuleLocal
Returns:
null if we can execute the method an error message if not

displayUsersData

public java.lang.String displayUsersData(CoefficientUser user)
This is a base implementation that will return an empty string for a modules user related data. This should be implmented to show what data the module contains that relates to the currently logged in user.

Returns:
String containing the html to display for the modules summary.

showHelp

public CoefficientContext showHelp(CoefficientContext ctx)
Description copied from interface: ModuleLocal
This method is used to show help on the your module. You can get the op name by calling CoefficientContext.getLastNonHelpOp()

Specified by:
showHelp in interface ModuleLocal

isProjectRequired

public final boolean isProjectRequired()
Description copied from interface: ModuleLocal
This method is used determine if we implement BaseProjectModule

Specified by:
isProjectRequired in interface ModuleLocal

publishEvent

public void publishEvent(CoefficientEvent event)
Specified by:
publishEvent in interface CoefficientEventPublisher
See Also:
CoefficientEventPublisher.publishEvent(za.org.coefficient.events.CoefficientEvent)

getRSSOrigin

private java.lang.String getRSSOrigin()
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:blog_id" 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).

Returns:
the origin to use for RSS items

createRSSItem

protected void createRSSItem(java.lang.String title,
                             java.lang.String text,
                             java.lang.String link,
                             Project project,
                             java.util.List affectedObjects)
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.

Parameters:
title - The RSS item title
text - The RSS item text/body
link - The RSS item link/url
project - The project that this RSS item is associated with, or null if not associated to a project
affectedObjects - A list of RSSItemCreatedEvent.AffectedObject objects for this RSS item


Copyright CSIR. All Rights Reserved.