com.stratelia.webactiv.almanach.control
Class AlmanachSessionController

java.lang.Object
  extended by com.stratelia.silverpeas.peasCore.AbstractComponentSessionController
      extended by com.stratelia.webactiv.almanach.control.AlmanachSessionController
All Implemented Interfaces:
com.stratelia.silverpeas.peasCore.ComponentSessionController

public class AlmanachSessionController
extends com.stratelia.silverpeas.peasCore.AbstractComponentSessionController

The AlmanachSessionController provides features to handle almanachs and theirs events. A such object wraps in fact the current almanach in the user session; in others words, the almanach on which the user works currently. As the almanach is displayed in a given window time, the AlmanachSessionController instance maintains the current opened window time and provides a way to move this window front or back in the time. The window time depends on the view mode choosen by the user: it can be a monthly view, a weekly view, and so on.


Field Summary
 
Fields inherited from class com.stratelia.silverpeas.peasCore.AbstractComponentSessionController
CHARACTER_ENCODING, context
 
Constructor Summary
AlmanachSessionController(com.stratelia.silverpeas.peasCore.MainSessionController mainSessionCtrl, com.stratelia.silverpeas.peasCore.ComponentContext context)
          Constructs a new AlmanachSessionController instance.
 
Method Summary
 EventPK addEvent(EventDetail eventDetail, Collection<org.silverpeas.upload.UploadedFile> uploadedFiles)
          Adds the specified event into the underlying almanach.
 EventPK addEvent(EventDetail eventDetail, Collection<org.silverpeas.upload.UploadedFile> uploadedFiles, com.silverpeas.pdc.web.PdcClassificationEntity classification)
          Adds the specified event into the underlying almanach.
 String buildPdf(String mode)
          Builds a PDF document with the events of the underlying almanach and that satisfy the specified criteria key.
 void close()
           
 String exportToICal()
          Exports the current almanach in iCal format.
 List<AlmanachDTO> getAccessibleInstances()
          Gets the others almanach instances that are accessible from the current underlying almanach instance.
 List<AlmanachDTO> getAggregatedAlmanachs()
          Gets the almanachs that can be aggregated with the curren t underlying one.
 int getAgregatedAlmanachsCount()
          Gets the count of almanachs agregated with the undermying one.
protected  List<EventDetail> getAllAgregationEvents()
          Gets all events resulting of the agregation of the current almanach with others'.
 List<EventDetail> getAllEvents()
          Gets all events of the underlying almanach.
protected  AlmanachBm getAlmanachBm()
          Gets the remote business object for handling almanachs and events.
 AlmanachCalendarView getAlmanachCalendarView()
          Gets a view in time of the current underlying almanach.
 AlmanachCalendarView getAlmanachCalendarViewOnTheNextEvents(boolean aggregated)
          Gets a view on the next events that will occur and that are defined in the current underlying almanach.
 String getAlmanachColor(String instanceId)
          Get the color of the almanach
 String getAlmanachICSURL()
          Gets the URL of the ICS representation of the current almamach.
 Date getCurrentDay()
          Gets the current day in the current window in time.
 EventDetail getCurrentEvent()
          Gets the current event, selected by the user.
 EventDetail getEventDetail(String id)
          Gets the detail of the event identified by the specified identifier.
 AlmanachCalendarView getMonthlyAlmanachCalendarView()
          Gets a view in the current month of the current underlying almanach.
 String getRSSUrl()
           
 int getSilverObjectId(String eventId)
          Gets the identifier of the specified event as a Silverpeas object (an object that have a content that can be managed in Silverpeas).
 AlmanachCalendarView getWeekyAlmanachCalendarView()
          Gets a view in the current week of the current underlying almanach.
 AlmanachCalendarView getYearlyAlmanachCalendarView()
          Gets a view in the current year of the current underlying almanach.
 void indexEvent(EventDetail event)
          Indexes the specified event for the Silverpeas search engine.
 String initAlertUser(String eventId)
           
 boolean isAgregationUsed()
          Is the agregation is activated for the current underlying almanach?
 boolean isAlmanachAgregated(String almanachId)
          Is the specified almanach is agregated with the current underlying one.
 boolean isPdcUsed()
          Is this almanach instance is parameterized to use the classification plan (PdC) to classify the events on it.
 boolean isWeekendNotVisible()
          Is the weekend is taken in charge by the current underlying almanach?
 void nextView()
          Moves the window in time to the next calendar view according to the current view mode.
 void prepareNewEvent(EventDetail event)
           
 void previousView()
          Moves the window in time to the previous calendar view according to the current view mode.
 void removeEvent(String id)
          Removes the event identified by the specified identifier.
 void removeOccurenceEvent(EventDetail eventDetail, String startDate)
          Removes just an occurrence of the specified event.
protected  void setAlmanachBm(AlmanachBm anAlmanachBm)
          Sets a specific reference to a remote Almanach business object
 void setCurrentDay(Date date)
          Sets explicitly the new current day.
 void setCurrentEvent(EventDetail event)
          Sets the current event the user has selected.
 void setViewMode(org.silverpeas.calendar.CalendarViewType viewMode)
          Sets the current view mode of the almanach rendering.
 void today()
          Moves the window in time in a such way the current day is now today.
 void updateAgregatedAlmanachs(String[] instanceIds)
          Updates the list of the agregated almanachs with the specified ones.
 void updateEvent(EventDetail eventDetail)
          Updates the specified event into the underlying almanach.
 void updateEventOccurence(EventDetail event, String dateDebutIteration, String dateFinIteration)
          Update event occurence (cas particulier de modification d'une occurence d'événement périodique)
 
Methods inherited from class com.stratelia.silverpeas.peasCore.AbstractComponentSessionController
addClipboardSelection, clipboardPasteDone, getAlertUser, getClipboardCount, getClipboardErrorMessage, getClipboardExceptionError, getClipboardName, getClipboardObjects, getClipboardSelectedObjects, getClipboardSize, getComponentAccessController, getComponentId, getComponentLabel, getComponentName, getComponentParameters, getComponentParameterValue, getComponentParameterValue, getComponentRootName, getComponentUrl, getFavoriteSpace, getGenericPanel, getHighestSilverpeasUserRole, getIcon, getLanguage, getLastResults, getLook, getMultilang, getOrganisationController, getPersonalization, getSelection, getServerNameAndPort, getSettings, getSilverpeasUserRoles, getSpaceId, getSpaceLabel, getString, getSubscriptionContext, getUrlEncodedParameter, getUserAccessLevel, getUserAvailComponentIds, getUserAvailSpaceIds, getUserDetail, getUserDetail, getUserId, getUserManageableGroupIds, getUserManageableSpaceIds, getUserRoleLevel, getUserRoles, isAppInMaintenance, isGroupManager, isPasswordChangeAllowed, isSpaceInMaintenance, removeClipboardElement, setAppModeMaintenance, setClipboardError, setClipboardSelectedElement, setComponentRootName, setFavoriteSpaceToMainSessionController, setGenericPanel, setIconFileName, setLastResults, setMultilangFileName, setResourceFileName, setSpaceModeMaintenance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlmanachSessionController

public AlmanachSessionController(com.stratelia.silverpeas.peasCore.MainSessionController mainSessionCtrl,
                                 com.stratelia.silverpeas.peasCore.ComponentContext context)
Constructs a new AlmanachSessionController instance.

Parameters:
mainSessionCtrl - the main session controller of the user.
context - the context of the almanach component.
Method Detail

getCurrentDay

public Date getCurrentDay()
Gets the current day in the current window in time.

Returns:
the current day.

setCurrentDay

public void setCurrentDay(Date date)
Sets explicitly the new current day.

Parameters:
date - the date of the new current day.

getCurrentEvent

public EventDetail getCurrentEvent()
Gets the current event, selected by the user.

Returns:
the detail about the current selected event or null if no event is selected.

setCurrentEvent

public void setCurrentEvent(EventDetail event)
Sets the current event the user has selected.

Parameters:
event - the detail of the current selected event.

nextView

public void nextView()
Moves the window in time to the next calendar view according to the current view mode.


previousView

public void previousView()
Moves the window in time to the previous calendar view according to the current view mode.


today

public void today()
Moves the window in time in a such way the current day is now today.


setViewMode

public void setViewMode(org.silverpeas.calendar.CalendarViewType viewMode)
Sets the current view mode of the almanach rendering.

Parameters:
viewMode - the view mode (monthly, weekly, ...).

getAllEvents

public List<EventDetail> getAllEvents()
                               throws AlmanachException
Gets all events of the underlying almanach.

Returns:
a list with the details of the events registered in the almanach.
Throws:
AlmanachException - if an error occurs while getting the list of events.

getAllAgregationEvents

protected List<EventDetail> getAllAgregationEvents()
                                            throws AlmanachException
Gets all events resulting of the agregation of the current almanach with others'.

Returns:
a list with the details of the all events in the agregation of several almanachs. If the agregation for the current almanach isn't activated, then only the events of the almanach are returned.
Throws:
AlmanachException - if an error occurs while getting the list of events.

getAgregatedAlmanachsCount

public int getAgregatedAlmanachsCount()
Gets the count of almanachs agregated with the undermying one.

Returns:
the number of agregated almanachs.

getEventDetail

public EventDetail getEventDetail(String id)
                           throws AlmanachException,
                                  AlmanachNoSuchFindEventException
Gets the detail of the event identified by the specified identifier.

Parameters:
id - the unique identifier of the event to get.
Returns:
the detail of the event.
Throws:
AlmanachException - if an error occurs while getting the detail of the event.
AlmanachNoSuchFindEventException - if no event exists with a such identifier.

removeEvent

public void removeEvent(String id)
                 throws AlmanachException,
                        com.stratelia.webactiv.util.exception.UtilException,
                        org.silverpeas.wysiwyg.WysiwygException
Removes the event identified by the specified identifier.

Parameters:
id - the identifier of the event to remove.
Throws:
AlmanachException - if an error occurs while removing the event.
com.stratelia.webactiv.util.exception.UtilException - if an error occurs while getting the WYSIWYG content of the event.
org.silverpeas.wysiwyg.WysiwygException

removeOccurenceEvent

public void removeOccurenceEvent(EventDetail eventDetail,
                                 String startDate)
                          throws ParseException,
                                 AlmanachException
Removes just an occurrence of the specified event. The occurrence is identified by its start date.

Parameters:
eventDetail - the detail of the event to which the occurrence belongs.
startDate - the start date of the event occurrence.
Throws:
ParseException - if an error occurs while parsing date infomation.
AlmanachException - if an error occurs while removing the occurrence of the event.

prepareNewEvent

public void prepareNewEvent(EventDetail event)

addEvent

public EventPK addEvent(EventDetail eventDetail,
                        Collection<org.silverpeas.upload.UploadedFile> uploadedFiles)
                 throws AlmanachBadParamException,
                        AlmanachException,
                        org.silverpeas.wysiwyg.WysiwygException
Adds the specified event into the underlying almanach.

Parameters:
eventDetail - the detail of the event to add.
uploadedFiles - the files uploaded in the aim to be attached to the event.
Throws:
AlmanachBadParamException - if the event detail isn't well defined.
AlmanachException - if an error occurs while adding the event.
org.silverpeas.wysiwyg.WysiwygException - if an error occurs while parsing the WYSIWYG content of the event.

addEvent

public EventPK addEvent(EventDetail eventDetail,
                        Collection<org.silverpeas.upload.UploadedFile> uploadedFiles,
                        com.silverpeas.pdc.web.PdcClassificationEntity classification)
                 throws AlmanachBadParamException,
                        AlmanachException,
                        org.silverpeas.wysiwyg.WysiwygException
Adds the specified event into the underlying almanach.

Parameters:
eventDetail - the detail of the event to add.
uploadedFiles - the files uploaded in the aim to be attached to the event.
Throws:
AlmanachBadParamException - if the event detail isn't well defined.
AlmanachException - if an error occurs while adding the event.
org.silverpeas.wysiwyg.WysiwygException - if an error occurs while parsing the WYSIWYG content of the event.

updateEvent

public void updateEvent(EventDetail eventDetail)
                 throws AlmanachBadParamException,
                        AlmanachException,
                        org.silverpeas.wysiwyg.WysiwygException
Updates the specified event into the underlying almanach.

Parameters:
eventDetail - the detail of the event to update.
Throws:
AlmanachBadParamException - if the event detail isn't well defined.
AlmanachException - if an error occurs while updating the event.
org.silverpeas.wysiwyg.WysiwygException - if an error occurs while parsing the WYSIWYG content of the event.

indexEvent

public void indexEvent(EventDetail event)
                throws AlmanachException
Indexes the specified event for the Silverpeas search engine.

Parameters:
event - the detail of the event to index.
Throws:
AlmanachException - if an error occurs while indexing the event.

getAlmanachBm

protected AlmanachBm getAlmanachBm()
                            throws AlmanachException
Gets the remote business object for handling almanachs and events.

Returns:
the remote business object.
Throws:
AlmanachException - if an error occurs while getting the remote object.

setAlmanachBm

protected void setAlmanachBm(AlmanachBm anAlmanachBm)
Sets a specific reference to a remote Almanach business object

Parameters:
anAlmanachBm - the reference to a remote business object.

buildPdf

public String buildPdf(String mode)
Builds a PDF document with the events of the underlying almanach and that satisfy the specified criteria key.

Parameters:
mode - the criteria key.
Returns:
the content of the PDF document as a String.

isPdcUsed

public boolean isPdcUsed()
Is this almanach instance is parameterized to use the classification plan (PdC) to classify the events on it.


isWeekendNotVisible

public boolean isWeekendNotVisible()
Is the weekend is taken in charge by the current underlying almanach?

Returns:
true if the weekend should be displayed for the current almanach, false otherwise.

getRSSUrl

public String getRSSUrl()
Overrides:
getRSSUrl in class com.stratelia.silverpeas.peasCore.AbstractComponentSessionController

isAgregationUsed

public boolean isAgregationUsed()
Is the agregation is activated for the current underlying almanach?

Returns:
true if the agregation is used for the current almanach, false otherwise.

getAccessibleInstances

public List<AlmanachDTO> getAccessibleInstances()
Gets the others almanach instances that are accessible from the current underlying almanach instance.

Returns:
a list of DTO carrying information about the others almanach instances.

getSilverObjectId

public int getSilverObjectId(String eventId)
                      throws AlmanachBadParamException,
                             AlmanachException
Gets the identifier of the specified event as a Silverpeas object (an object that have a content that can be managed in Silverpeas).

Parameters:
eventId - the identifier of the event.
Returns:
the identifier of the Silverpeas object that represents the specified event.
Throws:
AlmanachBadParamException - if parameter is invalid; it doesn't represent an event identifier.
AlmanachException - if the operation fail.

getAlmanachColor

public String getAlmanachColor(String instanceId)
Get the color of the almanach

Parameters:
instanceId -
Returns:
color of almanach

getAggregatedAlmanachs

public List<AlmanachDTO> getAggregatedAlmanachs()
Gets the almanachs that can be aggregated with the curren t underlying one.

Returns:
a list of AlmanachDTO instances, each of them carrying some data about an almanach.

isAlmanachAgregated

public boolean isAlmanachAgregated(String almanachId)
Is the specified almanach is agregated with the current underlying one.

Parameters:
almanachId - the unique identifier of the almanach instance.
Returns:
boolean true if the almanach is currently agregated with the current one.

updateAgregatedAlmanachs

public void updateAgregatedAlmanachs(String[] instanceIds)
Updates the list of the agregated almanachs with the specified ones.

Parameters:
instanceIds - the identifier of the new agregated almanachs.

initAlertUser

public String initAlertUser(String eventId)
                     throws AlmanachException,
                            AlmanachNoSuchFindEventException
Parameters:
eventId -
Returns:
Throws:
AlmanachException
AlmanachNoSuchFindEventException

close

public void close()
Overrides:
close in class com.stratelia.silverpeas.peasCore.AbstractComponentSessionController

updateEventOccurence

public void updateEventOccurence(EventDetail event,
                                 String dateDebutIteration,
                                 String dateFinIteration)
                          throws AlmanachBadParamException,
                                 AlmanachException,
                                 org.silverpeas.wysiwyg.WysiwygException,
                                 ParseException
Update event occurence (cas particulier de modification d'une occurence d'événement périodique)

Parameters:
event -
dateDebutIteration -
dateFinIteration -
Throws:
AlmanachBadParamException
AlmanachException
org.silverpeas.wysiwyg.WysiwygException
ParseException

getAlmanachCalendarView

public AlmanachCalendarView getAlmanachCalendarView()
                                             throws AlmanachException,
                                                    AlmanachNoSuchFindEventException
Gets a view in time of the current underlying almanach. The view depends on the current selected view mode and the current selected window in time.

Returns:
an AlmanachCalendarView instance.
Throws:
AlmanachException - if an error occurs while getting the calendar view.
AlmanachNoSuchFindEventException - if a detail about an event in the almanach cannot be found.

getYearlyAlmanachCalendarView

public AlmanachCalendarView getYearlyAlmanachCalendarView()
                                                   throws AlmanachException,
                                                          AlmanachNoSuchFindEventException
Gets a view in the current year of the current underlying almanach.

Returns:
an AlmanachCalendarView instance.
Throws:
AlmanachException - if an error occurs while getting the calendar view.
AlmanachNoSuchFindEventException - if a detail about an event in the almanach cannot be found.

getMonthlyAlmanachCalendarView

public AlmanachCalendarView getMonthlyAlmanachCalendarView()
                                                    throws AlmanachException,
                                                           AlmanachNoSuchFindEventException
Gets a view in the current month of the current underlying almanach.

Returns:
an AlmanachCalendarView instance.
Throws:
AlmanachException - if an error occurs while getting the calendar view.
AlmanachNoSuchFindEventException - if a detail about an event in the almanach cannot be found.

getWeekyAlmanachCalendarView

public AlmanachCalendarView getWeekyAlmanachCalendarView()
                                                  throws AlmanachException,
                                                         AlmanachNoSuchFindEventException
Gets a view in the current week of the current underlying almanach.

Returns:
an AlmanachCalendarView instance.
Throws:
AlmanachException - if an error occurs while getting the calendar view.
AlmanachNoSuchFindEventException - if a detail about an event in the almanach cannot be found.

getAlmanachCalendarViewOnTheNextEvents

public AlmanachCalendarView getAlmanachCalendarViewOnTheNextEvents(boolean aggregated)
                                                            throws AlmanachException,
                                                                   AlmanachNoSuchFindEventException
Gets a view on the next events that will occur and that are defined in the current underlying almanach.

Parameters:
aggregated - is the calendar view should contains also the events of aggregated almanachs?
Returns:
an AlmanachCalendarView instance.
Throws:
AlmanachException - if an error occurs while getting the calendar view.
AlmanachNoSuchFindEventException - if a detail about an event in the almanach cannot be found.

getAlmanachICSURL

public String getAlmanachICSURL()
Gets the URL of the ICS representation of the current almamach.

Returns:
the URL of the almanach ICS.

exportToICal

public String exportToICal()
                    throws com.silverpeas.export.ExportException,
                           IOException
Exports the current almanach in iCal format. The iCal file is generated into the temporary directory. If there is no events to export, a NoDataToExportException exception is then thrown.

Returns:
the iCal file name into which is generated the current alamanch.
Throws:
com.silverpeas.export.ExportException - if an error occurs while exporting the almanach in iCal format. The errors can come from a failure on getting the events to export, the fact there is no events to export (empty almanach) or the failure of the export process itself.
IOException - if an error occurs while creating or opening the file into which the export will be done. Such errors can be come from a forbidden write granting, and so on.


Copyright © 2016 Silverpeas. All Rights Reserved.