Package org.silverpeas.components.infoletter.model

## Interface InfoLetterService

- All Superinterfaces:
    `org.silverpeas.core.ApplicationService`
  All Known Implementing Classes:
    `InfoLetterDataManager`

      public interface InfoLetterService
      extends org.silverpeas.core.ApplicationService

  Contract to access info letter data
  Author:

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `InfoLetter` | `createDefaultLetter​(String componentId)` | Create a default Info Letter when instanciated
    `void` | `createInfoLetter​(InfoLetter il)` | Create information letter
    `void` | `createInfoLetterPublication​(InfoLetterPublicationPdC ilp, String userId)` | Create information letter publication
    `void` | `deleteAllInfoLetters​(String componentId)` | Deletes all the info letters (and then all the publications and external subscribers) in the specified component instance.
    `void` | `deleteInfoLetterPublication​(org.silverpeas.core.WAPrimaryKey pk, String componentId)` | Delete information letter publication
    `static InfoLetterService` | `get()` |
    `Set<String>` | `getEmailsExternalsSuscribers​(org.silverpeas.core.WAPrimaryKey letterPK)` | Retrieve external emails address
    `InfoLetter` | `getInfoLetter​(org.silverpeas.core.WAPrimaryKey letterPK)` | Retrieve an information letter from his primary key
    `InfoLetterPublicationPdC` | `getInfoLetterPublication​(org.silverpeas.core.WAPrimaryKey publiPK)` | Retrieve information letter publication from his key
    `List<InfoLetterPublication>` | `getInfoLetterPublications​(org.silverpeas.core.WAPrimaryKey letterPK)` | Retrieve information letter publications
    `List<InfoLetter>` | `getInfoLetters​(String applicationId)` | Retrieve information letters
    `org.silverpeas.core.subscription.util.SubscriptionSubscriberList` | `getInternalSuscribers​(String componentId)` |
    `int` | `getSilverObjectId​(String pubId, String componentId)` |
    `void` | `indexInfoLetter​(String componentId)` | Indexes all info letter indexable data.
    `void` | `initTemplate​(String componentId, org.silverpeas.core.WAPrimaryKey letterPK, String userId)` | Initialize template
    `boolean` | `isUserSuscribed​(String userId, String componentId)` | Check if use is an internal subscriber of the information letter
    `Set<String>` | `sendLetterByMail​(InfoLetterPublicationPdC ilp, String mimeMultipart, Set<String> listEmailDest, String subject, String emailFrom)` | Send letter by mail
    `Set<String>` | `sendTemplateByMail​(InfoLetter il, String mimeMultipart, Set<String> listEmailDest, String subject, String emailFrom)` | Send letter by mail
    `void` | `setEmailsExternalsSubscribers​(org.silverpeas.core.WAPrimaryKey letterPK, Set<String> emails)` | Save external subscriber emails address
    `void` | `setInternalSuscribers​(String componentId, org.silverpeas.core.admin.user.model.UserDetail[] users, org.silverpeas.core.admin.user.model.Group[] groups)` | Update internal user subscribers list
    `void` | `toggleSuscriber​(String userId, String componentId, boolean isUserSubscribing)` | Toggle subscription unsubscription of a user to the news letter
    `void` | `updateInfoLetter​(InfoLetter il)` | Update information letter
    `void` | `updateInfoLetterPublication​(InfoLetterPublicationPdC ilp)` | Update information letter publication

    - ### Methods inherited from interface org.silverpeas.core.ApplicationService

      `getComponentMessages, getComponentSettings, getContributionById, isRelatedTo`

- - ### Method Detail

    - #### get

          static InfoLetterService get()

    - #### createInfoLetter

          void createInfoLetter​(InfoLetter il)

      Create information letter
      Parameters:
        `il` - the information letter to create

    - #### updateInfoLetter

          void updateInfoLetter​(InfoLetter il)

      Update information letter
      Parameters:
        `il` - the information letter to update

    - #### getInfoLetters

          List<InfoLetter> getInfoLetters​(String applicationId)

      Retrieve information letters
      Parameters:
        `applicationId` - the application identifier
      Returns:
        the information letters of the current application identifier given in parameter

    - #### getInfoLetterPublications

          List<InfoLetterPublication> getInfoLetterPublications​(org.silverpeas.core.WAPrimaryKey letterPK)

      Retrieve information letter publications
      Parameters:
        `letterPK` - the information letter primary key
      Returns:
        the list of information letter publications of an information letter

    - #### createInfoLetterPublication

          void createInfoLetterPublication​(InfoLetterPublicationPdC ilp,
                                           String userId)

      Create information letter publication
      Parameters:
        `ilp` - the information letter publication pdc to create
        `userId` - the creator user identifier

    - #### deleteInfoLetterPublication

          void deleteInfoLetterPublication​(org.silverpeas.core.WAPrimaryKey pk,
                                           String componentId)

      Delete information letter publication
      Parameters:
        `pk` - the information letter publication primary key
        `componentId` - the component identifier

    - #### updateInfoLetterPublication

          void updateInfoLetterPublication​(InfoLetterPublicationPdC ilp)

      Update information letter publication
      Parameters:
        `ilp` - the information letter publication to update

    - #### getInfoLetter

          InfoLetter getInfoLetter​(org.silverpeas.core.WAPrimaryKey letterPK)

      Retrieve an information letter from his primary key
      Parameters:
        `letterPK` - the letter primary key
      Returns:
        the infirmation letter

    - #### getInfoLetterPublication

          InfoLetterPublicationPdC getInfoLetterPublication​(org.silverpeas.core.WAPrimaryKey publiPK)

      Retrieve information letter publication from his key
      Parameters:
        `publiPK` - the information letter publication primary key
      Returns:
        an Information Letter Publication PdC

    - #### createDefaultLetter

          InfoLetter createDefaultLetter​(String componentId)

      Create a default Info Letter when instanciated
      Parameters:
        `componentId` - the component identifier
      Returns:
        a default Info Letter

    - #### deleteAllInfoLetters

          void deleteAllInfoLetters​(String componentId)

      Deletes all the info letters (and then all the publications and external subscribers) in the specified component instance.
      Parameters:
        `componentId` - the unique identifier of the InfoLetter instance.

    - #### getInternalSuscribers

          org.silverpeas.core.subscription.util.SubscriptionSubscriberList getInternalSuscribers​(String componentId)

      Parameters:
        `componentId` - componentId component instance id
      Returns:
        map of subscriber ids indexed by type of subscriber

    - #### setInternalSuscribers

          void setInternalSuscribers​(String componentId,
                                     org.silverpeas.core.admin.user.model.UserDetail[] users,
                                     org.silverpeas.core.admin.user.model.Group[] groups)

      Update internal user subscribers list
      Parameters:
        `componentId` - componentId component instance id
        `users` - an array of User detail
        `groups` - an array of Group

    - #### getEmailsExternalsSuscribers

          Set<String> getEmailsExternalsSuscribers​(org.silverpeas.core.WAPrimaryKey letterPK)

      Retrieve external emails address
      Parameters:
        `letterPK` - the info letter identifier (letter primary key)
      Returns:
        a set of external emails

    - #### setEmailsExternalsSubscribers

          void setEmailsExternalsSubscribers​(org.silverpeas.core.WAPrimaryKey letterPK,
                                             Set<String> emails)

      Save external subscriber emails address
      Parameters:
        `letterPK` - the letter primary key
        `emails` - the list of external emails to save

    - #### toggleSuscriber

          void toggleSuscriber​(String userId,
                               String componentId,
                               boolean isUserSubscribing)

      Toggle subscription unsubscription of a user to the news letter
      Parameters:
        `userId` - the user identifier
        `componentId` - the info letter component instance identifier
        `isUserSubscribing` - true if user is subscribing, false else if

    - #### isUserSuscribed

          boolean isUserSuscribed​(String userId,
                                  String componentId)

      Check if use is an internal subscriber of the information letter
      Parameters:
        `userId` - the user identifier
        `componentId` - the info letter component instance identifier
      Returns:
        true if user is a subscriber, false else if

    - #### initTemplate

          void initTemplate​(String componentId,
                            org.silverpeas.core.WAPrimaryKey letterPK,
                            String userId)

      Initialize template
      Parameters:
        `componentId` - the info letter component instance identifier
        `letterPK` - the info letter identifier
        `userId` - the user identifier

    - #### getSilverObjectId

          int getSilverObjectId​(String pubId,
                                String componentId)

    - #### sendTemplateByMail

          Set<String> sendTemplateByMail​(InfoLetter il,
                                         String mimeMultipart,
                                         Set<String> listEmailDest,
                                         String subject,
                                         String emailFrom)

      Send letter by mail
      Parameters:
        `il` - the template
        `mimeMultipart` - please have a look to https://en.wikipedia.org/wiki/MIME#Multipart_subtypes
        `listEmailDest` - list of email
        `subject` - subject of email
        `emailFrom` - sender of email
      Returns:
        list of emails in error

    - #### sendLetterByMail

          Set<String> sendLetterByMail​(InfoLetterPublicationPdC ilp,
                                       String mimeMultipart,
                                       Set<String> listEmailDest,
                                       String subject,
                                       String emailFrom)

      Send letter by mail
      Parameters:
        `ilp` - the information letter
        `mimeMultipart` - please have a look to https://en.wikipedia.org/wiki/MIME#Multipart_subtypes
        `listEmailDest` - list of email
        `subject` - subject of email
        `emailFrom` - sender of email
      Returns:
        list of emails in error

    - #### indexInfoLetter

          void indexInfoLetter​(String componentId)

      Indexes all info letter indexable data.
      Parameters:
        `componentId` - the identifier of the concerned component instance.