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

- - ### 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 instantiated
    `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.contribution.model.ContributionIdentifier id)` | Delete information letter publication
    `static InfoLetterService` | `get()` |
    `Set<String>` | `getEmailsExternalsSubscribers​(org.silverpeas.core.contribution.model.ContributionIdentifier id)` | Retrieve external emails address
    `InfoLetter` | `getInfoLetter​(org.silverpeas.core.contribution.model.ContributionIdentifier id)` | Retrieve an information letter from his primary key
    `InfoLetterPublicationPdC` | `getInfoLetterPublication​(org.silverpeas.core.contribution.model.ContributionIdentifier identifier)` | Retrieve information letter publication from his key
    `List<InfoLetterPublication>` | `getInfoLetterPublications​(org.silverpeas.core.contribution.model.ContributionIdentifier id)` | Retrieve information letter publications
    `List<InfoLetter>` | `getInfoLetters​(String applicationId)` | Retrieve information letters
    `org.silverpeas.core.subscription.util.SubscriptionSubscriberList` | `getInternalSubscribers​(String componentId)` |
    `void` | `indexInfoLetter​(String componentId)` | Indexes all info letter indexable data.
    `void` | `initTemplate​(org.silverpeas.core.contribution.model.ContributionIdentifier id, String userId)` | Initialize template
    `boolean` | `isUserSubscribed​(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
    `void` | `setEmailsExternalsSubscribers​(org.silverpeas.core.contribution.model.ContributionIdentifier id, Set<String> emails)` | Save external subscriber emails address
    `void` | `setInternalSubscribers​(String componentId, org.silverpeas.core.admin.user.model.User[] users, org.silverpeas.core.admin.user.model.Group[] groups)` | Update internal user subscribers list
    `void` | `toggleSubscriber​(String userId, String componentId, boolean isUserSubscribing)` | Toggle subscription unsubscription of a user to the newsletter
    `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.contribution.model.ContributionIdentifier id)

      Retrieve information letter publications
      Parameters:
        `id` - the information letter unique identifier
      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.contribution.model.ContributionIdentifier id)

      Delete information letter publication
      Parameters:
        `id` - the information letter publication unique identifier

    - #### updateInfoLetterPublication

          void updateInfoLetterPublication​(InfoLetterPublicationPdC ilp)

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

    - #### getInfoLetter

          InfoLetter getInfoLetter​(org.silverpeas.core.contribution.model.ContributionIdentifier id)

      Retrieve an information letter from his primary key
      Parameters:
        `id` - the unique identifier of the info letter
      Returns:
        the infirmation letter

    - #### getInfoLetterPublication

          InfoLetterPublicationPdC getInfoLetterPublication​(org.silverpeas.core.contribution.model.ContributionIdentifier identifier)

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

    - #### createDefaultLetter

          InfoLetter createDefaultLetter​(String componentId)

      Create a default Info Letter when instantiated
      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.

    - #### getInternalSubscribers

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

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

    - #### setInternalSubscribers

          void setInternalSubscribers​(String componentId,
                                      org.silverpeas.core.admin.user.model.User[] 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

    - #### getEmailsExternalsSubscribers

          Set<String> getEmailsExternalsSubscribers​(org.silverpeas.core.contribution.model.ContributionIdentifier id)

      Retrieve external emails address
      Parameters:
        `id` - the info letter identifier
      Returns:
        a set of external emails

    - #### setEmailsExternalsSubscribers

          void setEmailsExternalsSubscribers​(org.silverpeas.core.contribution.model.ContributionIdentifier id,
                                             Set<String> emails)

      Save external subscriber emails address
      Parameters:
        `id` - the letter unique identifier
        `emails` - the list of external emails to save

    - #### toggleSubscriber

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

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

    - #### isUserSubscribed

          boolean isUserSubscribed​(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​(org.silverpeas.core.contribution.model.ContributionIdentifier id,
                            String userId)

      Initialize template
      Parameters:
        `id` - the info letter identifier
        `userId` - the user identifier

    - #### 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:
        set of emails in error

    - #### indexInfoLetter

          void indexInfoLetter​(String componentId)

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