Package org.silverpeas.components.infoletter.control

## Class InfoLetterSessionController

- java.lang.Object
- - org.silverpeas.core.web.mvc.controller.AbstractComponentSessionController
  - - org.silverpeas.components.infoletter.control.InfoLetterSessionController

- All Implemented Interfaces:
    `Serializable`, `org.silverpeas.core.web.mvc.controller.ComponentSessionController`, `org.silverpeas.core.web.session.SessionCloseable`

      public class InfoLetterSessionController
      extends org.silverpeas.core.web.mvc.controller.AbstractComponentSessionController

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `EXPORT_CSV_NAME` |

    - ### Fields inherited from class org.silverpeas.core.web.mvc.controller.AbstractComponentSessionController

      `context`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `InfoLetterSessionController​(org.silverpeas.core.web.mvc.controller.MainSessionController mainSessionCtrl, org.silverpeas.core.web.mvc.controller.ComponentContext componentContext)` | Standard Session Controller Constructeur

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addExternalsSubscribers​(String newMails)` |
    `void` | `createInfoLetterPublication​(InfoLetterPublicationPdC ilp)` |
    `void` | `deleteAllExternalsSubscribers()` | Remove all external emails
    `void` | `deleteExternalsSubscribers​(String[] mails)` |
    `void` | `deleteInfoLetterPublication​(String id)` |
    `boolean` | `exportCsvEmails()` | Export emails of external subscribers into a CSV file.
    `Set<String>` | `getEmailsExternalsSubscribers()` |
    `org.silverpeas.core.contribution.content.ddwe.DragAndDropWbeFile` | `getFileForEditionOf​(InfoLetterPublication ilp)` |
    `InfoLetter` | `getInfoLetter()` | Gets the newsletter template
    `InfoLetterPublicationPdC` | `getInfoLetterPublication​(String id)` |
    `List<InfoLetterPublication>` | `getInfoLetterPublications()` |
    `List<InfoLetter>` | `getInfoLetters()` |
    `org.silverpeas.core.contribution.content.ddwe.DragAndDropWbeFile` | `getTemplateFileForEdition()` |
    `void` | `importCsvEmails​(org.apache.commons.fileupload.FileItem filePart)` | Import email addresses of external subscribers to newsletters.
    `String` | `initUserPanel()` |
    `boolean` | `isNewsLetterSendByMail()` | return true if Newsletter is send by mail to internal users
    `boolean` | `isPdcUsed()` |
    `boolean` | `isSubscriber()` |
    `void` | `notifyInternalSubscribers​(InfoLetterPublicationPdC ilp)` | Notify the newsletter to internal subscribers
    `String[]` | `notifyManagers​(InfoLetterPublicationPdC ilp)` | Send letter to managers
    `String[]` | `notifyMe​(InfoLetterPublicationPdC ilp)` | Send letter to itself.
    `org.silverpeas.core.contribution.content.ddwe.DragAndDropWbeFile` | `resetWithTemplateFor​(InfoLetterPublication ilp)` |
    `void` | `retourUserPanel()` |
    `String[]` | `sendByMailToExternalSubscribers​(InfoLetterPublicationPdC ilp)` | Send letter by mail to external subscribers
    `void` | `subscribeUser()` |
    `void` | `unsubscribeUser()` |
    `void` | `updateInfoLetter​(InfoLetter ie)` |
    `void` | `updateInfoLetterPublication​(InfoLetterPublicationPdC ilp)` |

    - ### Methods inherited from class org.silverpeas.core.web.mvc.controller.AbstractComponentSessionController

      `addClipboardSelection, clipboardPasteDone, close, getClipboardErrorMessage, getClipboardExceptionError, getClipboardObjects, getClipboardSelectedObjects, getClipboardSize, getComponentAccessController, getComponentId, getComponentLabel, getComponentName, getComponentParameterValue, getComponentParameterValue, getComponentRootName, getComponentUrl, getHighestSilverpeasUserRole, getIcon, getLanguage, getLook, getMultilang, getOrganisationController, getPersonalization, getRSSUrl, getSelection, getSettings, getSilverpeasUserRoles, getSpaceId, getSpaceLabel, getString, getSubscriptionContext, getUrlEncodedParameter, getUserAccessLevel, getUserAvailComponentIds, getUserDetail, getUserDetail, getUserId, getUserManageableGroupIds, getUserManageableSpaceIds, getUserRoles, getZoneId, isAppInMaintenance, isGroupManager, isPasswordChangeAllowed, isSpaceInMaintenance, removeClipboardElement, setAppModeMaintenance, setClipboardSelectedElement, setComponentRootName, setSpaceModeMaintenance`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### EXPORT_CSV_NAME

          public static final String EXPORT_CSV_NAME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### InfoLetterSessionController

          public InfoLetterSessionController​(org.silverpeas.core.web.mvc.controller.MainSessionController mainSessionCtrl,
                                             org.silverpeas.core.web.mvc.controller.ComponentContext componentContext)

      Standard Session Controller Constructeur
      Parameters:
        `mainSessionCtrl` - The user's profile
        `componentContext` - The component's profile

  - ### Method Detail

    - #### initUserPanel

          public String initUserPanel()
                               throws InfoLetterException

      Throws:
        `InfoLetterException`

    - #### retourUserPanel

          public void retourUserPanel()

    - #### updateInfoLetter

          public void updateInfoLetter​(InfoLetter ie)

    - #### getInfoLetters

          public List<InfoLetter> getInfoLetters()

    - #### getInfoLetter

          public InfoLetter getInfoLetter()

      Gets the newsletter template

    - #### getTemplateFileForEdition

          public org.silverpeas.core.contribution.content.ddwe.DragAndDropWbeFile getTemplateFileForEdition()

    - #### getInfoLetterPublications

          public List<InfoLetterPublication> getInfoLetterPublications()

    - #### getFileForEditionOf

          public org.silverpeas.core.contribution.content.ddwe.DragAndDropWbeFile getFileForEditionOf​(InfoLetterPublication ilp)

    - #### resetWithTemplateFor

          public org.silverpeas.core.contribution.content.ddwe.DragAndDropWbeFile resetWithTemplateFor​(InfoLetterPublication ilp)

    - #### createInfoLetterPublication

          public void createInfoLetterPublication​(InfoLetterPublicationPdC ilp)

    - #### deleteInfoLetterPublication

          public void deleteInfoLetterPublication​(String id)

    - #### updateInfoLetterPublication

          public void updateInfoLetterPublication​(InfoLetterPublicationPdC ilp)

    - #### getInfoLetterPublication

          public InfoLetterPublicationPdC getInfoLetterPublication​(String id)

    - #### notifyInternalSubscribers

          public void notifyInternalSubscribers​(InfoLetterPublicationPdC ilp)

      Notify the newsletter to internal subscribers
      Parameters:
        `ilp` - the infoletter to send

    - #### sendByMailToExternalSubscribers

          public String[] sendByMailToExternalSubscribers​(InfoLetterPublicationPdC ilp)

      Send letter by mail to external subscribers
      Parameters:
        `ilp` - the classified InfoLetterPublication to send
      Returns:
        tab of emails in error

    - #### notifyMe

          public String[] notifyMe​(InfoLetterPublicationPdC ilp)

      Send letter to itself.

    - #### notifyManagers

          public String[] notifyManagers​(InfoLetterPublicationPdC ilp)

      Send letter to managers

    - #### getEmailsExternalsSubscribers

          public Set<String> getEmailsExternalsSubscribers()

    - #### addExternalsSubscribers

          public void addExternalsSubscribers​(String newMails)

    - #### deleteExternalsSubscribers

          public void deleteExternalsSubscribers​(String[] mails)

    - #### deleteAllExternalsSubscribers

          public void deleteAllExternalsSubscribers()

      Remove all external emails

    - #### subscribeUser

          public void subscribeUser()

    - #### unsubscribeUser

          public void unsubscribeUser()

    - #### isSubscriber

          public boolean isSubscriber()

    - #### isPdcUsed

          public boolean isPdcUsed()

    - #### importCsvEmails

          public void importCsvEmails​(org.apache.commons.fileupload.FileItem filePart)
                               throws org.silverpeas.core.exception.UtilTrappedException,
                                      InfoLetterPeasTrappedException,
                                      InfoLetterException

      Import email addresses of external subscribers to newsletters.
      Parameters:
        `filePart` - the uploaded CSV file.
      Throws:
        `org.silverpeas.core.exception.UtilTrappedException` - if an error occurs
        `InfoLetterPeasTrappedException` - if an error occurs during the import.
        `InfoLetterException` - if an error occurs during the import

    - #### exportCsvEmails

          public boolean exportCsvEmails()
                                  throws IOException,
                                         InfoLetterException

      Export emails of external subscribers into a CSV file.
      Returns:
        true if the export succeed.
      Throws:
        `IOException` - if an error occurs while recording the emails to the CSV file.
        `InfoLetterException` - if an error occurs during the export.

    - #### isNewsLetterSendByMail

          public boolean isNewsLetterSendByMail()

      return true if Newsletter is send by mail to internal users
      Returns:
        boolean