org.sakaiproject.tool.announcement
Class AnnouncementAction

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.sakaiproject.vm.ComponentServlet
              extended byorg.sakaiproject.vm.VmServlet
                  extended byorg.sakaiproject.cheftool.VmServlet
                      extended byorg.sakaiproject.cheftool.ToolServlet
                          extended byorg.sakaiproject.cheftool.VelocityPortletPaneledAction
                              extended byorg.sakaiproject.cheftool.PagedResourceActionII
                                  extended byorg.sakaiproject.tool.announcement.AnnouncementAction
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public class AnnouncementAction
extends PagedResourceActionII

See Also:
Serialized Form

Nested Class Summary
static class AnnouncementAction.AnnouncementWrapper
          Decorator for the "Message" class.
 
Nested classes inherited from class org.sakaiproject.cheftool.VelocityPortletPaneledAction
VelocityPortletPaneledAction.MyLogger
 
Field Summary
protected static String STATE_INITED
           
static String STATE_MESSAGE
           
static String STATE_MESSAGES
           
 
Fields inherited from class org.sakaiproject.cheftool.PagedResourceActionII
DEFAULT_PAGE_SIZE, FORM_PAGE_NUMBER, FORM_SEARCH, PAGESIZES, PARAM_PAGESIZE, rb_praII, STATE_CURRENT_PAGE, STATE_FIRST_PAGE_EXISTS, STATE_GO_FIRST_PAGE, STATE_GO_LAST_PAGE, STATE_GO_NEXT, STATE_GO_NEXT_PAGE, STATE_GO_PREV, STATE_GO_PREV_PAGE, STATE_GOTO_PAGE, STATE_LAST_PAGE_EXISTS, STATE_MANUAL_REFRESH, STATE_NEXT_EXISTS, STATE_NEXT_PAGE_EXISTS, STATE_NUM_MESSAGES, STATE_PAGESIZE, STATE_PREV_EXISTS, STATE_PREV_PAGE_EXISTS, STATE_SEARCH, STATE_TOP_PAGE_MESSAGE, STATE_TOTAL_PAGENUMBER, STATE_VIEW_ID
 
Fields inherited from class org.sakaiproject.cheftool.VelocityPortletPaneledAction
ATTR_CONFIG, ATTR_CONTEXT, ATTR_FRAME_FOCUS, ATTR_FRAME_REFRESH, ATTR_PORTLET, ATTR_RUNDATA, ATTR_TOP_REFRESH, BUTTON, CONTEXT_SITE_COLLECTION_ID, CONTEXT_SITE_COLLECTION_URL, LAYOUT_MAIN, Log, MODE_OPTIONS, STATE_ACTION, STATE_FLOAT, STATE_HELPER, STATE_MODE, STATE_OBSERVER, STATE_OBSERVER2, STATE_PRESENCE_OBSERVER, STATE_TOOL
 
Fields inherited from class org.sakaiproject.cheftool.ToolServlet
ALERT_ATTR, ALERT_STATE_INITED, MENU_ATTR, PARAM_ACTION, PARAM_ACTION_COMBO, TITLE_PANEL, TOOL_MODE_ATTR, TOOL_MODE_DEFAULT
 
Fields inherited from class org.sakaiproject.cheftool.VmServlet
m_validator
 
Fields inherited from class org.sakaiproject.vm.ComponentServlet
ATTR_PARAMS
 
Constructor Summary
AnnouncementAction()
           
 
Method Summary
protected  String buildCancelContext(VelocityPortlet portlet, Context context, RunData rundata, AnnouncementActionState state)
          Build the context for cancelling the operation and going back to list view
protected  String buildDeleteAnnouncementContext(VelocityPortlet portlet, Context context, RunData rundata, AnnouncementActionState state)
          Build the context for asking for the delete confirmation
 String buildMainPanelContext(VelocityPortlet portlet, Context context, RunData rundata, SessionState sstate)
          Default is to use when Portal starts up
 String buildMergeContext(VelocityPortlet portlet, Context context, RunData runData, AnnouncementActionState state, SessionState sstate)
          Build the context for showing merged view
 String buildOptionsPanelContext(VelocityPortlet portlet, Context context, RunData runData, SessionState state)
          Setup for the options panel.
protected  String buildPreviewContext(VelocityPortlet portlet, Context context, RunData rundata, AnnouncementActionState state)
          Build the context for preview an attachment
protected  String buildReviseAnnouncementContext(VelocityPortlet portlet, Context context, RunData rundata, AnnouncementActionState state, SessionState sstate)
          Build the context for revising the announcement
protected  String buildShowMetadataContext(VelocityPortlet portlet, Context context, RunData rundata, AnnouncementActionState state, SessionState sstate)
          Build the context for viewing announcement content
 void buildSortedContext(VelocityPortlet portlet, Context context, RunData rundata, SessionState sstate)
           
 void doAnnouncement_form(RunData data, Context context)
          Dispatcher function for various actions on add/revise announcement page
 void doAttachments(RunData data, Context context)
           
 void doCancel(RunData rundata, Context context)
          Action is to use when doCancel requested, corresponding to chef_announcement "eventSubmit_doCancel"
 void doDelete_announcement_link(RunData rundata, Context context)
          Action is to use when doDelete_announcement_link requested, corresponding to chef_announcements the link of deleting announcement item
 void doDelete(RunData rundata, Context context)
          Action is to use when ddoDelete requested, to perform deletion corresponding to chef_announcements-delete "eventSubmit_doDelete"
 void doDeleteannouncement(RunData rundata, Context context)
          Action is to use when doDeleteannouncement requested, corresponding to chef_announcements or chef_announcements-metadata menu "Delete"
 void doLinkcancel(RunData rundata, Context context)
          Action is to use when doLinkcancel requested, corresponding to chef_announcement "eventSubmit_doLinkcancel"
 void doMerge(RunData runData, Context context)
          Handle the "Merge" button on the toolbar
 void doNewannouncement(RunData rundata, Context context)
          Action is to use when doNewannouncement requested, corresponding to chef_announcements menu "New..."
 void doNext_message(RunData rundata, Context context)
          Responding to the request of going to next message
 void doOptions(RunData runData, Context context)
          Handle a request to set options.
 void doOptionsUpdate(RunData runData, Context context)
          This handles the "doUpdate" if we're in a processing an update from the options page.
 void doPermissions(RunData data, Context context)
          Fire up the permissions editor
 void doPost(RunData rundata, Context context)
          Action is to use when doPost requested, corresponding to chef_announcements-revise or -preview "eventSubmit_doPost"
 void doPrev_message(RunData rundata, Context context)
          Responding to the request of going to previous message
 void doPreviewrevise(RunData rundata, Context context)
          Action is to use when doPreviewrevise requested from preview status corresponding to chef_announcements-preview "eventSubmit_doPreviewrevise"
 void doReviseannouncement(RunData rundata, Context context)
          Action is to use when doReviseannouncement requested, corresponding to chef_announcements the link of any draft announcement item
 void doReviseannouncementfrommenu(RunData rundata, Context context)
          Action is to use when doReviseannouncementfrommenu requested, corresponding to chef_announcements.vm and -metadata.vm menu "Revise"
 void doRevisepreview(RunData rundata, Context context)
          Action is to use when doRevisePreview requested, corresponding to chef_announcements-revise "eventSubmit_doRevisePreview" from revise view to preview view
 void doSavedraft(RunData rundata, Context context)
          Action is to use when doSavedraft requested, corresponding to chef_announcements-preview "eventSubmit_doSavedraft"
 void doShowmetadata(RunData rundata, Context context)
          corresponding to chef_announcements doShowMetadata
 void doSortbychannel(RunData rundata, Context context)
          Do sort by the announcement channel name.
 void doSortbydate(RunData rundata, Context context)
          Do sort by the date of the announcement.
 void doSortbyfor(RunData rundata, Context context)
          Do sort by for - grouop/site/public
 void doSortbyfrom(RunData rundata, Context context)
          Do sort by from - the author
 void doSortbygroupdescription(RunData rundata, Context context)
          Do sort by group description
 void doSortbygrouptitle(RunData rundata, Context context)
          Do sort by group title
 void doSortbypublic(RunData rundata, Context context)
          Do sort by public
 void doSortbysubject(RunData rundata, Context context)
          Do sort by subject
 void doUpdate(RunData runData, Context context)
          Handles the user clicking on the save button on the page to specify which calendars will be merged into the present schedule.
 void doView(RunData data, Context context)
           
protected  void enableObserver(SessionState sstate, boolean enable)
          Enable or disable the observer
protected  ControllerState getState(Context context, RunData rundata, Class stateClass)
          Get the proper state for this instance (if portlet is not known, only context).
protected  ControllerState getState(String peid, RunData rundata, Class stateClass)
          Get the proper state for this instance (if portlet id is known).
protected  ControllerState getState(VelocityPortlet portlet, RunData rundata, Class stateClass)
          Get the proper state for this instance (if portlet is known).
 String getTemplate(VelocityPortlet portlet, Context context, RunData rundata, SessionState sstate, AnnouncementActionState state, String value)
           
protected  void initState(SessionState state, VelocityPortlet portlet, JetspeedRunData rundata)
          Populate the state object, if needed.
protected  boolean notificationEnabled(AnnouncementActionState state)
          is notification enabled?
protected  void postOrSaveDraft(RunData rundata, Context context, boolean post)
          post or save draft of a message?
protected  void readAnnouncementForm(RunData rundata, Context context, boolean checkForm)
          Read user inputs in announcement form
protected  List readResourcesPage(SessionState state, int first, int last)
          Implement this to return a list of all the resources in this record range, with search and sorting applied.
protected  void releaseState(Context context, RunData rundata)
          Release the proper state for this instance (if portlet is not known, only context).
protected  void releaseState(String peid, RunData rundata)
          Release the proper state for this instance (if portlet id is known).
protected  void releaseState(VelocityPortlet portlet, RunData rundata)
          Release the proper state for this instance (if portlet is known).
protected  int sizeResources(SessionState state)
          Implement this to return the number of records that are currently selected.
 
Methods inherited from class org.sakaiproject.cheftool.PagedResourceActionII
addListPagingMenus, addRefreshMenus, addSearchMenus, addViewPagingMenus, cleanStatePaging, doAuto, doChange_pagesize, doList_first, doList_last, doList_next, doList_prev, doRefresh, doSearch_clear, doSearch, doView_next, doView_page, doView_prev, enableObserver, pagingInfoToContext, prepPage, resetPaging, totalPageNumber
 
Methods inherited from class org.sakaiproject.cheftool.VelocityPortletPaneledAction
actionDispatch, addAlert, addOptionsMenu, cancelOptions, clientWindowId, disableObservers, doGet, doReset, enableObservers, getContext, helperActionDispatch, initState, justDelivered, mainPanelUpdateId, processAction, resetTool, saveOptions, scheduleFocusRefresh, schedulePeerFrameRefresh, scheduleTopRefresh, setVmCourier, setVmStdRef, titlePanelUpdateId, toolModeDispatch, updateState
 
Methods inherited from class org.sakaiproject.cheftool.ToolServlet
doPost, getAlert, getAlert, getMenu, getPid, getState, getToolMode, prepState, setToolMode
 
Methods inherited from class org.sakaiproject.vm.VmServlet
getActionURL, getVmReference, includeVm, setVmReference
 
Methods inherited from class org.sakaiproject.vm.ComponentServlet
sendParentRedirect, service, setNoCacheHeaders
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_MESSAGE

public static final String STATE_MESSAGE
See Also:
Constant Field Values

STATE_MESSAGES

public static final String STATE_MESSAGES
See Also:
Constant Field Values

STATE_INITED

protected static final String STATE_INITED
See Also:
Constant Field Values
Constructor Detail

AnnouncementAction

public AnnouncementAction()
Method Detail

enableObserver

protected void enableObserver(SessionState sstate,
                              boolean enable)
Enable or disable the observer

Parameters:
enable - if true, the observer is enabled, if false, it is disabled

buildMergeContext

public String buildMergeContext(VelocityPortlet portlet,
                                Context context,
                                RunData runData,
                                AnnouncementActionState state,
                                SessionState sstate)
Build the context for showing merged view


buildMainPanelContext

public String buildMainPanelContext(VelocityPortlet portlet,
                                    Context context,
                                    RunData rundata,
                                    SessionState sstate)
Default is to use when Portal starts up


buildSortedContext

public void buildSortedContext(VelocityPortlet portlet,
                               Context context,
                               RunData rundata,
                               SessionState sstate)

getTemplate

public String getTemplate(VelocityPortlet portlet,
                          Context context,
                          RunData rundata,
                          SessionState sstate,
                          AnnouncementActionState state,
                          String value)

buildOptionsPanelContext

public String buildOptionsPanelContext(VelocityPortlet portlet,
                                       Context context,
                                       RunData runData,
                                       SessionState state)
Setup for the options panel.


buildPreviewContext

protected String buildPreviewContext(VelocityPortlet portlet,
                                     Context context,
                                     RunData rundata,
                                     AnnouncementActionState state)
Build the context for preview an attachment


buildReviseAnnouncementContext

protected String buildReviseAnnouncementContext(VelocityPortlet portlet,
                                                Context context,
                                                RunData rundata,
                                                AnnouncementActionState state,
                                                SessionState sstate)
Build the context for revising the announcement


buildShowMetadataContext

protected String buildShowMetadataContext(VelocityPortlet portlet,
                                          Context context,
                                          RunData rundata,
                                          AnnouncementActionState state,
                                          SessionState sstate)
Build the context for viewing announcement content


doNext_message

public void doNext_message(RunData rundata,
                           Context context)
Responding to the request of going to next message


doPrev_message

public void doPrev_message(RunData rundata,
                           Context context)
Responding to the request of going to previous message


doShowmetadata

public void doShowmetadata(RunData rundata,
                           Context context)
corresponding to chef_announcements doShowMetadata


buildCancelContext

protected String buildCancelContext(VelocityPortlet portlet,
                                    Context context,
                                    RunData rundata,
                                    AnnouncementActionState state)
Build the context for cancelling the operation and going back to list view


buildDeleteAnnouncementContext

protected String buildDeleteAnnouncementContext(VelocityPortlet portlet,
                                                Context context,
                                                RunData rundata,
                                                AnnouncementActionState state)
Build the context for asking for the delete confirmation


doNewannouncement

public void doNewannouncement(RunData rundata,
                              Context context)
Action is to use when doNewannouncement requested, corresponding to chef_announcements menu "New..."


doAnnouncement_form

public void doAnnouncement_form(RunData data,
                                Context context)
Dispatcher function for various actions on add/revise announcement page


readAnnouncementForm

protected void readAnnouncementForm(RunData rundata,
                                    Context context,
                                    boolean checkForm)
Read user inputs in announcement form

Parameters:
checkForm - need to check form data or not

doPost

public void doPost(RunData rundata,
                   Context context)
Action is to use when doPost requested, corresponding to chef_announcements-revise or -preview "eventSubmit_doPost"


postOrSaveDraft

protected void postOrSaveDraft(RunData rundata,
                               Context context,
                               boolean post)
post or save draft of a message?


doPreviewrevise

public void doPreviewrevise(RunData rundata,
                            Context context)
Action is to use when doPreviewrevise requested from preview status corresponding to chef_announcements-preview "eventSubmit_doPreviewrevise"


doDelete

public void doDelete(RunData rundata,
                     Context context)
Action is to use when ddoDelete requested, to perform deletion corresponding to chef_announcements-delete "eventSubmit_doDelete"


doDeleteannouncement

public void doDeleteannouncement(RunData rundata,
                                 Context context)
Action is to use when doDeleteannouncement requested, corresponding to chef_announcements or chef_announcements-metadata menu "Delete"


doDelete_announcement_link

public void doDelete_announcement_link(RunData rundata,
                                       Context context)
Action is to use when doDelete_announcement_link requested, corresponding to chef_announcements the link of deleting announcement item


doReviseannouncement

public void doReviseannouncement(RunData rundata,
                                 Context context)
Action is to use when doReviseannouncement requested, corresponding to chef_announcements the link of any draft announcement item


doReviseannouncementfrommenu

public void doReviseannouncementfrommenu(RunData rundata,
                                         Context context)
Action is to use when doReviseannouncementfrommenu requested, corresponding to chef_announcements.vm and -metadata.vm menu "Revise"


doRevisepreview

public void doRevisepreview(RunData rundata,
                            Context context)
Action is to use when doRevisePreview requested, corresponding to chef_announcements-revise "eventSubmit_doRevisePreview" from revise view to preview view


doAttachments

public void doAttachments(RunData data,
                          Context context)

doCancel

public void doCancel(RunData rundata,
                     Context context)
Action is to use when doCancel requested, corresponding to chef_announcement "eventSubmit_doCancel"


doLinkcancel

public void doLinkcancel(RunData rundata,
                         Context context)
Action is to use when doLinkcancel requested, corresponding to chef_announcement "eventSubmit_doLinkcancel"


doSavedraft

public void doSavedraft(RunData rundata,
                        Context context)
Action is to use when doSavedraft requested, corresponding to chef_announcements-preview "eventSubmit_doSavedraft"


doSortbysubject

public void doSortbysubject(RunData rundata,
                            Context context)
Do sort by subject


doSortbyfrom

public void doSortbyfrom(RunData rundata,
                         Context context)
Do sort by from - the author


doSortbypublic

public void doSortbypublic(RunData rundata,
                           Context context)
Do sort by public


doSortbydate

public void doSortbydate(RunData rundata,
                         Context context)
Do sort by the date of the announcement.


doSortbychannel

public void doSortbychannel(RunData rundata,
                            Context context)
Do sort by the announcement channel name.


doSortbyfor

public void doSortbyfor(RunData rundata,
                        Context context)
Do sort by for - grouop/site/public


doSortbygrouptitle

public void doSortbygrouptitle(RunData rundata,
                               Context context)
Do sort by group title


doSortbygroupdescription

public void doSortbygroupdescription(RunData rundata,
                                     Context context)
Do sort by group description


initState

protected void initState(SessionState state,
                         VelocityPortlet portlet,
                         JetspeedRunData rundata)
Populate the state object, if needed.

Overrides:
initState in class PagedResourceActionII

doPermissions

public void doPermissions(RunData data,
                          Context context)
Fire up the permissions editor


doMerge

public void doMerge(RunData runData,
                    Context context)
Handle the "Merge" button on the toolbar


doUpdate

public void doUpdate(RunData runData,
                     Context context)
Handles the user clicking on the save button on the page to specify which calendars will be merged into the present schedule.


doOptionsUpdate

public void doOptionsUpdate(RunData runData,
                            Context context)
This handles the "doUpdate" if we're in a processing an update from the options page.


doOptions

public void doOptions(RunData runData,
                      Context context)
Description copied from class: VelocityPortletPaneledAction
Handle a request to set options.

Overrides:
doOptions in class VelocityPortletPaneledAction

notificationEnabled

protected boolean notificationEnabled(AnnouncementActionState state)
is notification enabled?


readResourcesPage

protected List readResourcesPage(SessionState state,
                                 int first,
                                 int last)
Description copied from class: PagedResourceActionII
Implement this to return a list of all the resources in this record range, with search and sorting applied.

Specified by:
readResourcesPage in class PagedResourceActionII
Parameters:
first - The first record to include (1 based).
last - The last record to include (inclusive, 1 based).

sizeResources

protected int sizeResources(SessionState state)
Description copied from class: PagedResourceActionII
Implement this to return the number of records that are currently selected.

Specified by:
sizeResources in class PagedResourceActionII

doView

public void doView(RunData data,
                   Context context)

getState

protected ControllerState getState(Context context,
                                   RunData rundata,
                                   Class stateClass)
Get the proper state for this instance (if portlet is not known, only context).

Parameters:
context - The Template Context (it contains a reference to the portlet).
rundata - The Jetspeed (Turbine) rundata associated with the request.
stateClass - The Class of the ControllerState to find / create.
Returns:
The proper state object for this instance.

getState

protected ControllerState getState(VelocityPortlet portlet,
                                   RunData rundata,
                                   Class stateClass)
Get the proper state for this instance (if portlet is known).

Parameters:
portlet - The portlet being rendered.
rundata - The Jetspeed (Turbine) rundata associated with the request.
stateClass - The Class of the ControllerState to find / create.
Returns:
The proper state object for this instance.

getState

protected ControllerState getState(String peid,
                                   RunData rundata,
                                   Class stateClass)
Get the proper state for this instance (if portlet id is known).

Parameters:
peid - The portlet id.
rundata - The Jetspeed (Turbine) rundata associated with the request.
stateClass - The Class of the ControllerState to find / create.
Returns:
The proper state object for this instance.

releaseState

protected void releaseState(Context context,
                            RunData rundata)
Release the proper state for this instance (if portlet is not known, only context).

Parameters:
context - The Template Context (it contains a reference to the portlet).
rundata - The Jetspeed (Turbine) rundata associated with the request.

releaseState

protected void releaseState(VelocityPortlet portlet,
                            RunData rundata)
Release the proper state for this instance (if portlet is known).

Parameters:
portlet - The portlet being rendered.
rundata - The Jetspeed (Turbine) rundata associated with the request.

releaseState

protected void releaseState(String peid,
                            RunData rundata)
Release the proper state for this instance (if portlet id is known).

Parameters:
peid - The portlet id being rendered.
rundata - The Jetspeed (Turbine) rundata associated with the request.