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 instanciated
    `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.WAPrimaryKey pk, String componentId)` | 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>` | `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 instanceId)` | 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` | `isRelatedTo​(String instanceId)` |
    `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 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.WAPrimaryKey letterPK)

      Description copied from interface: `InfoLetterService`
      Retrieve information letter publications
      Specified by:
        `getInfoLetterPublications` in interface `InfoLetterService`
      Parameters:
        `letterPK` - the information letter primary key
      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.WAPrimaryKey pk,
                                                  String componentId)

      Description copied from interface: `InfoLetterService`
      Delete information letter publication
      Specified by:
        `deleteInfoLetterPublication` in interface `InfoLetterService`
      Parameters:
        `pk` - the information letter publication primary key
        `componentId` - the component 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.WAPrimaryKey letterPK)

      Description copied from interface: `InfoLetterService`
      Retrieve an information letter from his primary key
      Specified by:
        `getInfoLetter` in interface `InfoLetterService`
      Parameters:
        `letterPK` - the letter primary key
      Returns:
        the infirmation letter

    - #### getInfoLetterPublication

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

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

    - #### createDefaultLetter

          public InfoLetter createDefaultLetter​(String componentId)

      Description copied from interface: `InfoLetterService`
      Create a default Info Letter when instanciated
      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.

    - #### getSilverObjectId

          public int getSilverObjectId​(String pubId,
                                       String componentId)

      Specified by:
        `getSilverObjectId` in interface `InfoLetterService`

    - #### getInternalSuscribers

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

      Specified by:
        `getInternalSuscribers` in interface `InfoLetterService`
      Parameters:
        `componentId` - componentId component instance id
      Returns:
        map of subscriber ids indexed by type of subscriber

    - #### setInternalSuscribers

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

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

    - #### getEmailsExternalsSuscribers

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

      Description copied from interface: `InfoLetterService`
      Retrieve external emails address
      Specified by:
        `getEmailsExternalsSuscribers` in interface `InfoLetterService`
      Parameters:
        `letterPK` - the info letter identifier (letter primary key)
      Returns:
        a set of external emails

    - #### setEmailsExternalsSubscribers

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

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

    - #### toggleSuscriber

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

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

    - #### isUserSuscribed

          public boolean isUserSuscribed​(String userId,
                                         String componentId)

      Description copied from interface: `InfoLetterService`
      Check if use is an internal subscriber of the information letter
      Specified by:
        `isUserSuscribed` 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​(String componentId,
                                   org.silverpeas.core.WAPrimaryKey letterPK,
                                   String userId)

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

    - #### sendTemplateByMail

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

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

          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:
        list 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.