Package org.silverpeas.components.infoletter.implementation

## Class InfoLetterDataManager

- java.lang.Object
- - org.silverpeas.components.infoletter.implementation.InfoLetterDataManager

- All Implemented Interfaces:
    `InfoLetterService`, `org.silverpeas.core.ApplicationService`

      @Service
      @Named("infoLetterService")
      public class InfoLetterDataManager
      extends Object
      implements InfoLetterService

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `InfoLetterDataManager()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `InfoLetter` | `createDefaultLetter​(String componentId)` | Create a default Info Letter when instantiated
    `void` | `createInfoLetter​(InfoLetter il)` | Implementation of InfoLetterService interface
    `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
    `org.silverpeas.kernel.bundle.LocalizationBundle` | `getComponentMessages​(String language)` |
    `org.silverpeas.kernel.bundle.SettingBundle` | `getComponentSettings()` |
    `<T extends org.silverpeas.core.contribution.model.Contribution> Optional<T>` | `getContributionById​(org.silverpeas.core.contribution.model.ContributionIdentifier contributionId)` |
    `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 id)` | 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 instanceId)` | 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` | `isRelatedTo​(String instanceId)` |
    `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 ie)` | Update information letter
    `void` | `updateInfoLetterPublication​(InfoLetterPublicationPdC ilp)` | Update information letter publication

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

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

- - ### Constructor Detail

    - #### InfoLetterDataManager

          public InfoLetterDataManager()

  - ### Method Detail

    - #### getContributionById

          public <T extends org.silverpeas.core.contribution.model.Contribution> Optional<T> getContributionById​(org.silverpeas.core.contribution.model.ContributionIdentifier contributionId)

      Specified by:
        `getContributionById` in interface `org.silverpeas.core.ApplicationService`

    - #### getComponentSettings

          public org.silverpeas.kernel.bundle.SettingBundle getComponentSettings()

      Specified by:
        `getComponentSettings` in interface `org.silverpeas.core.ApplicationService`

    - #### getComponentMessages

          public org.silverpeas.kernel.bundle.LocalizationBundle getComponentMessages​(String language)

      Specified by:
        `getComponentMessages` in interface `org.silverpeas.core.ApplicationService`

    - #### isRelatedTo

          public boolean isRelatedTo​(String instanceId)

      Specified by:
        `isRelatedTo` in interface `org.silverpeas.core.ApplicationService`

    - #### createInfoLetter

          public void createInfoLetter​(InfoLetter il)

      Implementation of InfoLetterService interface
      Specified by:
        `createInfoLetter` in interface `InfoLetterService`
      Parameters:
        `il` - the information letter to create

    - #### updateInfoLetter

          public void updateInfoLetter​(InfoLetter ie)

      Description copied from interface: `InfoLetterService`
      Update information letter
      Specified by:
        `updateInfoLetter` in interface `InfoLetterService`
      Parameters:
        `ie` - the information letter to update

    - #### getInfoLetters

          public List<InfoLetter> getInfoLetters​(String instanceId)

      Description copied from interface: `InfoLetterService`
      Retrieve information letters
      Specified by:
        `getInfoLetters` in interface `InfoLetterService`
      Parameters:
        `instanceId` - the application identifier
      Returns:
        the information letters of the current application identifier given in parameter

    - #### getInfoLetterPublications

          public List<InfoLetterPublication> getInfoLetterPublications​(org.silverpeas.core.contribution.model.ContributionIdentifier id)

      Description copied from interface: `InfoLetterService`
      Retrieve information letter publications
      Specified by:
        `getInfoLetterPublications` in interface `InfoLetterService`
      Parameters:
        `id` - the information letter unique identifier
      Returns:
        the list of information letter publications of an information letter

    - #### createInfoLetterPublication

          public void createInfoLetterPublication​(InfoLetterPublicationPdC ilp,
                                                  String userId)

      Description copied from interface: `InfoLetterService`
      Create information letter publication
      Specified by:
        `createInfoLetterPublication` in interface `InfoLetterService`
      Parameters:
        `ilp` - the information letter publication pdc to create
        `userId` - the creator user identifier

    - #### deleteInfoLetterPublication

          public void deleteInfoLetterPublication​(org.silverpeas.core.contribution.model.ContributionIdentifier id)

      Description copied from interface: `InfoLetterService`
      Delete information letter publication
      Specified by:
        `deleteInfoLetterPublication` in interface `InfoLetterService`
      Parameters:
        `id` - the information letter publication unique identifier

    - #### updateInfoLetterPublication

          public void updateInfoLetterPublication​(InfoLetterPublicationPdC ilp)

      Description copied from interface: `InfoLetterService`
      Update information letter publication
      Specified by:
        `updateInfoLetterPublication` in interface `InfoLetterService`
      Parameters:
        `ilp` - the information letter publication to update

    - #### getInfoLetter

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

      Description copied from interface: `InfoLetterService`
      Retrieve an information letter from his primary key
      Specified by:
        `getInfoLetter` in interface `InfoLetterService`
      Parameters:
        `id` - the unique identifier of the info letter
      Returns:
        the infirmation letter

    - #### getInfoLetterPublication

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

      Description copied from interface: `InfoLetterService`
      Retrieve information letter publication from his key
      Specified by:
        `getInfoLetterPublication` in interface `InfoLetterService`
      Parameters:
        `id` - the unique information letter identifier
      Returns:
        an Information Letter Publication PdC

    - #### createDefaultLetter

          public InfoLetter createDefaultLetter​(String componentId)

      Description copied from interface: `InfoLetterService`
      Create a default Info Letter when instantiated
      Specified by:
        `createDefaultLetter` in interface `InfoLetterService`
      Parameters:
        `componentId` - the component identifier
      Returns:
        a default Info Letter

    - #### deleteAllInfoLetters

          public void deleteAllInfoLetters​(String componentId)

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

    - #### getInternalSubscribers

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

      Specified by:
        `getInternalSubscribers` in interface `InfoLetterService`
      Parameters:
        `componentId` - componentId component instance id
      Returns:
        a list of subscriber ids indexed by type of subscriber

    - #### setInternalSubscribers

          public void setInternalSubscribers​(String componentId,
                                             org.silverpeas.core.admin.user.model.User[] users,
                                             org.silverpeas.core.admin.user.model.Group[] groups)

      Description copied from interface: `InfoLetterService`
      Update internal user subscribers list
      Specified by:
        `setInternalSubscribers` in interface `InfoLetterService`
      Parameters:
        `componentId` - componentId component instance id
        `users` - an array of User detail
        `groups` - an array of Group

    - #### getEmailsExternalsSubscribers

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

      Description copied from interface: `InfoLetterService`
      Retrieve external emails address
      Specified by:
        `getEmailsExternalsSubscribers` in interface `InfoLetterService`
      Parameters:
        `id` - the info letter identifier
      Returns:
        a set of external emails

    - #### setEmailsExternalsSubscribers

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

      Description copied from interface: `InfoLetterService`
      Save external subscriber emails address
      Specified by:
        `setEmailsExternalsSubscribers` in interface `InfoLetterService`
      Parameters:
        `id` - the letter unique identifier
        `emails` - the list of external emails to save

    - #### toggleSubscriber

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

      Description copied from interface: `InfoLetterService`
      Toggle subscription unsubscription of a user to the newsletter
      Specified by:
        `toggleSubscriber` in interface `InfoLetterService`
      Parameters:
        `userId` - the user identifier
        `componentId` - the info letter component instance identifier
        `isUserSubscribing` - true if user is subscribing, false else if

    - #### isUserSubscribed

          public boolean isUserSubscribed​(String userId,
                                          String componentId)

      Description copied from interface: `InfoLetterService`
      Check if use is an internal subscriber of the information letter
      Specified by:
        `isUserSubscribed` in interface `InfoLetterService`
      Parameters:
        `userId` - the user identifier
        `componentId` - the info letter component instance identifier
      Returns:
        true if user is a subscriber, false else if

    - #### initTemplate

          public void initTemplate​(org.silverpeas.core.contribution.model.ContributionIdentifier id,
                                   String userId)

      Description copied from interface: `InfoLetterService`
      Initialize template
      Specified by:
        `initTemplate` in interface `InfoLetterService`
      Parameters:
        `id` - the info letter identifier
        `userId` - the user identifier

    - #### sendLetterByMail

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

      Description copied from interface: `InfoLetterService`
      Send letter by mail
      Specified by:
        `sendLetterByMail` in interface `InfoLetterService`
      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

          public void indexInfoLetter​(String componentId)

      Description copied from interface: `InfoLetterService`
      Indexes all info letter indexable data.
      Specified by:
        `indexInfoLetter` in interface `InfoLetterService`
      Parameters:
        `componentId` - the identifier of the concerned component instance.