Package org.silverpeas.components.gallery.service

## Class DefaultGalleryService

- java.lang.Object
- - org.silverpeas.components.gallery.service.DefaultGalleryService

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

      @Service
      @Named("galleryService")
      public class DefaultGalleryService
      extends Object
      implements GalleryService

  DefaultGalleryService is the service layer which manage a media gallery

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addMediaToAlbums​(Media media, String... albums)` |
    `long` | `countAllMedia​(org.silverpeas.core.node.model.NodePK albumPk)` | Counts the number of media the specified album and all of its children album contain.
    `AlbumDetail` | `createAlbum​(AlbumDetail album, org.silverpeas.core.node.model.NodePK nodePK)` |
    `Media` | `createMedia​(org.silverpeas.core.admin.user.model.UserDetail user, String componentInstanceId, Watermark watermark, MediaDataCreateDelegate delegate)` |
    `String` | `createOrder​(Collection<String> basket, String userId, String componentId)` |
    `void` | `deleteAlbum​(org.silverpeas.core.admin.user.model.UserDetail user, String componentInstanceId, org.silverpeas.core.node.model.NodePK nodePK)` |
    `void` | `deleteMedia​(org.silverpeas.core.admin.user.model.UserDetail user, String componentInstanceId, Collection<String> mediaIds)` |
    `void` | `deleteOrders​(List<Order> orders)` |
    `AlbumDetail` | `getAlbum​(org.silverpeas.core.node.model.NodePK nodePK)` |
    `Collection<String>` | `getAlbumIdsOf​(Media media)` |
    `Collection<AlbumDetail>` | `getAllAlbums​(String instanceId)` |
    `Collection<Media>` | `getAllMedia​(String instanceId, MediaCriteria.VISIBILITY visibility)` |
    `Collection<Media>` | `getAllMedia​(org.silverpeas.core.node.model.NodePK nodePK, MediaCriteria.VISIBILITY visibility)` |
    `List<org.silverpeas.core.socialnetwork.model.SocialInformation>` | `getAllMediaByUserId​(String userId, org.silverpeas.core.date.period.Period period)` | get my list of SocialInformationGallery according to options and number of Item and the first Index.
    `Collection<Media>` | `getAllMediaThatWillBeNotVisible​(int nbDays)` |
    `List<Order>` | `getAllOrders​(String userId, String instanceId)` |
    `List<Order>` | `getAllOrderToDelete​(int nbDays)` |
    `Collection<Photo>` | `getAllPhotos​(org.silverpeas.core.node.model.NodePK nodePK)` |
    `Collection<Photo>` | `getAllPhotos​(org.silverpeas.core.node.model.NodePK nodePK, MediaCriteria.VISIBILITY visibility)` |
    `org.silverpeas.kernel.bundle.LocalizationBundle` | `getComponentMessages​(String language)` |
    `org.silverpeas.kernel.bundle.SettingBundle` | `getComponentSettings()` |
    `Optional<Media>` | `getContributionById​(org.silverpeas.core.contribution.model.ContributionIdentifier contributionId)` |
    `List<Media>` | `getLastRegisteredMedia​(String instanceId)` |
    `List<Media>` | `getMedia​(List<String> mediaIds, String componentInstanceId)` |
    `List<Media>` | `getMedia​(List<String> mediaIds, String componentInstanceId, MediaCriteria.VISIBILITY visibility)` |
    `Media` | `getMedia​(MediaPK mediaPK)` |
    `Media` | `getMedia​(MediaPK mediaPK, MediaCriteria.VISIBILITY visibility)` |
    `Collection<Media>` | `getNotVisible​(String instanceId)` |
    `Order` | `getOrder​(String orderId, String instanceId)` |
    `Collection<org.silverpeas.core.node.model.NodeDetail>` | `getPath​(org.silverpeas.core.node.model.NodePK nodePK)` |
    `Photo` | `getPhoto​(MediaPK mediaPK)` |
    `int` | `getSilverObjectId​(MediaPK mediaPK)` |
    `List<org.silverpeas.core.socialnetwork.model.SocialInformation>` | `getSocialInformationListOfMyContacts​(List<String> listOfUserId, List<String> availableComponent, org.silverpeas.core.date.period.Period period)` | get list of SocialInformationGallery of my contacts according to options and number of Item and the first Index.
    `void` | `importFromRepository​(org.silverpeas.core.admin.user.model.UserDetail user, String componentInstanceId, File repository, MediaDataCreateDelegate delegate)` |
    `void` | `indexGallery​(org.silverpeas.core.admin.user.model.UserDetail user, String instanceId)` |
    `boolean` | `isRelatedTo​(String instanceId)` |
    `void` | `paste​(org.silverpeas.core.admin.user.model.UserDetail user, String componentInstanceId, GalleryPasteDelegate delegate)` |
    `void` | `removeMediaFromAllAlbums​(Media media)` |
    `Collection<Media>` | `search​(org.silverpeas.core.index.search.model.QueryDescription query)` |
    `void` | `sortAlbums​(List<org.silverpeas.core.node.model.NodePK> nodePKs)` |
    `void` | `updateAlbum​(AlbumDetail album)` |
    `void` | `updateMedia​(org.silverpeas.core.admin.user.model.UserDetail user, String componentInstanceId, Collection<String> mediaIds, String albumId, MediaDataUpdateDelegate delegate)` |
    `void` | `updateMedia​(org.silverpeas.core.admin.user.model.UserDetail user, String componentInstanceId, Media media, Watermark watermark, MediaDataUpdateDelegate delegate)` |
    `void` | `updateOrder​(Order order)` |
    `void` | `updateOrderRow​(OrderRow row)` |

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

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

- - ### Constructor Detail

    - #### DefaultGalleryService

          public DefaultGalleryService()

  - ### Method Detail

    - #### getContributionById

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

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

    - #### 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`

    - #### getAlbum

          public AlbumDetail getAlbum​(org.silverpeas.core.node.model.NodePK nodePK)

      Specified by:
        `getAlbum` in interface `GalleryService`

    - #### getAllAlbums

          public Collection<AlbumDetail> getAllAlbums​(String instanceId)

      Specified by:
        `getAllAlbums` in interface `GalleryService`

    - #### createAlbum

          public AlbumDetail createAlbum​(AlbumDetail album,
                                         org.silverpeas.core.node.model.NodePK nodePK)

      Specified by:
        `createAlbum` in interface `GalleryService`

    - #### updateAlbum

          public void updateAlbum​(AlbumDetail album)

      Specified by:
        `updateAlbum` in interface `GalleryService`

    - #### deleteAlbum

          public void deleteAlbum​(org.silverpeas.core.admin.user.model.UserDetail user,
                                  String componentInstanceId,
                                  org.silverpeas.core.node.model.NodePK nodePK)

      Specified by:
        `deleteAlbum` in interface `GalleryService`

    - #### getPhoto

          public Photo getPhoto​(MediaPK mediaPK)

      Specified by:
        `getPhoto` in interface `GalleryService`

    - #### getMedia

          public Media getMedia​(MediaPK mediaPK)

      Specified by:
        `getMedia` in interface `GalleryService`

    - #### getMedia

          public Media getMedia​(MediaPK mediaPK,
                                MediaCriteria.VISIBILITY visibility)

      Specified by:
        `getMedia` in interface `GalleryService`

    - #### getMedia

          public List<Media> getMedia​(List<String> mediaIds,
                                      String componentInstanceId)

      Specified by:
        `getMedia` in interface `GalleryService`

    - #### getMedia

          public List<Media> getMedia​(List<String> mediaIds,
                                      String componentInstanceId,
                                      MediaCriteria.VISIBILITY visibility)

      Specified by:
        `getMedia` in interface `GalleryService`

    - #### getAllMedia

          public Collection<Media> getAllMedia​(String instanceId,
                                               MediaCriteria.VISIBILITY visibility)

      Specified by:
        `getAllMedia` in interface `GalleryService`

    - #### getAllMedia

          public Collection<Media> getAllMedia​(org.silverpeas.core.node.model.NodePK nodePK,
                                               MediaCriteria.VISIBILITY visibility)

      Specified by:
        `getAllMedia` in interface `GalleryService`

    - #### countAllMedia

          public long countAllMedia​(org.silverpeas.core.node.model.NodePK albumPk)

      Description copied from interface: `GalleryService`
      Counts the number of media the specified album and all of its children album contain.
      Specified by:
        `countAllMedia` in interface `GalleryService`
      Parameters:
        `albumPk` - the unique identifier of an album.
      Returns:
        the total number of media the given album recursively contains.

    - #### getAllPhotos

          public Collection<Photo> getAllPhotos​(org.silverpeas.core.node.model.NodePK nodePK)

      Specified by:
        `getAllPhotos` in interface `GalleryService`

    - #### getAllPhotos

          public Collection<Photo> getAllPhotos​(org.silverpeas.core.node.model.NodePK nodePK,
                                                MediaCriteria.VISIBILITY visibility)

      Specified by:
        `getAllPhotos` in interface `GalleryService`

    - #### getNotVisible

          public Collection<Media> getNotVisible​(String instanceId)

      Specified by:
        `getNotVisible` in interface `GalleryService`

    - #### paste

          public void paste​(org.silverpeas.core.admin.user.model.UserDetail user,
                            String componentInstanceId,
                            GalleryPasteDelegate delegate)

      Specified by:
        `paste` in interface `GalleryService`

    - #### importFromRepository

          public void importFromRepository​(org.silverpeas.core.admin.user.model.UserDetail user,
                                           String componentInstanceId,
                                           File repository,
                                           MediaDataCreateDelegate delegate)

      Specified by:
        `importFromRepository` in interface `GalleryService`

    - #### createMedia

          public Media createMedia​(org.silverpeas.core.admin.user.model.UserDetail user,
                                   String componentInstanceId,
                                   Watermark watermark,
                                   MediaDataCreateDelegate delegate)

      Specified by:
        `createMedia` in interface `GalleryService`

    - #### updateMedia

          public void updateMedia​(org.silverpeas.core.admin.user.model.UserDetail user,
                                  String componentInstanceId,
                                  Collection<String> mediaIds,
                                  String albumId,
                                  MediaDataUpdateDelegate delegate)

      Specified by:
        `updateMedia` in interface `GalleryService`

    - #### updateMedia

          public void updateMedia​(org.silverpeas.core.admin.user.model.UserDetail user,
                                  String componentInstanceId,
                                  Media media,
                                  Watermark watermark,
                                  MediaDataUpdateDelegate delegate)

      Specified by:
        `updateMedia` in interface `GalleryService`

    - #### deleteMedia

          public void deleteMedia​(org.silverpeas.core.admin.user.model.UserDetail user,
                                  String componentInstanceId,
                                  Collection<String> mediaIds)

      Specified by:
        `deleteMedia` in interface `GalleryService`

    - #### getLastRegisteredMedia

          public List<Media> getLastRegisteredMedia​(String instanceId)

      Specified by:
        `getLastRegisteredMedia` in interface `GalleryService`

    - #### getPath

          public Collection<org.silverpeas.core.node.model.NodeDetail> getPath​(org.silverpeas.core.node.model.NodePK nodePK)

      Specified by:
        `getPath` in interface `GalleryService`

    - #### getAlbumIdsOf

          public Collection<String> getAlbumIdsOf​(Media media)

      Specified by:
        `getAlbumIdsOf` in interface `GalleryService`

    - #### removeMediaFromAllAlbums

          public void removeMediaFromAllAlbums​(Media media)

      Specified by:
        `removeMediaFromAllAlbums` in interface `GalleryService`

    - #### addMediaToAlbums

          public void addMediaToAlbums​(Media media,
                                       String... albums)

      Specified by:
        `addMediaToAlbums` in interface `GalleryService`

    - #### indexGallery

          public void indexGallery​(org.silverpeas.core.admin.user.model.UserDetail user,
                                   String instanceId)

      Specified by:
        `indexGallery` in interface `GalleryService`

    - #### getSilverObjectId

          public int getSilverObjectId​(MediaPK mediaPK)

      Specified by:
        `getSilverObjectId` in interface `GalleryService`

    - #### search

          public Collection<Media> search​(org.silverpeas.core.index.search.model.QueryDescription query)

      Specified by:
        `search` in interface `GalleryService`

    - #### getAllMediaThatWillBeNotVisible

          public Collection<Media> getAllMediaThatWillBeNotVisible​(int nbDays)

      Specified by:
        `getAllMediaThatWillBeNotVisible` in interface `GalleryService`

    - #### createOrder

          public String createOrder​(Collection<String> basket,
                                    String userId,
                                    String componentId)

      Specified by:
        `createOrder` in interface `GalleryService`

    - #### getAllOrders

          public List<Order> getAllOrders​(String userId,
                                          String instanceId)

      Specified by:
        `getAllOrders` in interface `GalleryService`

    - #### updateOrder

          public void updateOrder​(Order order)

      Specified by:
        `updateOrder` in interface `GalleryService`

    - #### updateOrderRow

          public void updateOrderRow​(OrderRow row)

      Specified by:
        `updateOrderRow` in interface `GalleryService`

    - #### getOrder

          public Order getOrder​(String orderId,
                                String instanceId)

      Specified by:
        `getOrder` in interface `GalleryService`

    - #### getAllOrderToDelete

          public List<Order> getAllOrderToDelete​(int nbDays)

      Specified by:
        `getAllOrderToDelete` in interface `GalleryService`

    - #### deleteOrders

          public void deleteOrders​(List<Order> orders)

      Specified by:
        `deleteOrders` in interface `GalleryService`

    - #### getAllMediaByUserId

          public List<org.silverpeas.core.socialnetwork.model.SocialInformation> getAllMediaByUserId​(String userId,
                                                                                                     org.silverpeas.core.date.period.Period period)

      get my list of SocialInformationGallery according to options and number of Item and the first Index.
      Specified by:
        `getAllMediaByUserId` in interface `GalleryService`
      Parameters:
        `period` - the period on which the data are requested.
        `userId` - the unique identifier of a user
      Returns:
        List

    - #### getSocialInformationListOfMyContacts

          public List<org.silverpeas.core.socialnetwork.model.SocialInformation> getSocialInformationListOfMyContacts​(List<String> listOfUserId,
                                                                                                                      List<String> availableComponent,
                                                                                                                      org.silverpeas.core.date.period.Period period)

      get list of SocialInformationGallery of my contacts according to options and number of Item and the first Index.
      Specified by:
        `getSocialInformationListOfMyContacts` in interface `GalleryService`
      Parameters:
        `period` - the period on which the data are requested.
        `listOfUserId` - a list of unique identifier of users.
        `availableComponent` - a list of unique identifier of component instances.
      Returns:
        List

    - #### sortAlbums

          public void sortAlbums​(List<org.silverpeas.core.node.model.NodePK> nodePKs)

      Specified by:
        `sortAlbums` in interface `GalleryService`