Package org.silverpeas.components.gallery.model

## Interface MediaCriteriaProcessor

- All Known Implementing Classes:
    `MediaSQLQueryBuilder`

      public interface MediaCriteriaProcessor

  A processor of a media criteria. The aim of a such processor is to process each criterion of the criteria in the order expected by the caller in order to perform some specific works.
  Author:
    mmoquillon

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `endProcessing()` | Informs the processor the process is ended.
    `List<Media>` | `orderingResult​(List<Media> media)` | This method must be called after the media list is entirely loaded.
    `MediaCriteriaProcessor` | `processAlbums​(List<String> albumIds)` | Processes the criterion on the identifiers of albums (Actually, Album = Node).
    `MediaCriteriaProcessor` | `processComponentInstance​(String componentInstanceId)` | Processes the criterion on the component instance identifier.
    `MediaCriteriaProcessor` | `processIdentifiers​(List<String> identifiers)` | Processes the criterion on the media identifiers.
    `MediaCriteriaProcessor` | `processMediaTypes​(List<MediaType> mediaTypes)` | Processes the criterion on type of media.
    `MediaCriteriaProcessor` | `processNbDaysBeforeThatMediaIsNotVisible​(Date referenceDate, int nbDaysBeforeThatMediaIsNotVisible)` | Processes the criterion on the nb of days before that a media is not visible.
    `MediaCriteriaProcessor` | `processOrdering​(List<MediaCriteria.QUERY_ORDER_BY> orderings)` | Processes the criterion on orderings of the medias matching the criteria.
    `MediaCriteriaProcessor` | `processResultLimit​(int resultLimit)` | Processes the criterion on the media result limit.
    `MediaCriteriaProcessor` | `processVisibility​(MediaCriteria.VISIBILITY visibility, Date dateReference, org.silverpeas.core.admin.user.model.UserDetail creator)` | Processes the criterion on the media visibility.
    `<T> T` | `result()` | Gets the result of the processing.
    `void` | `startProcessing()` | Informs the processor the start of the process.
    `MediaCriteriaProcessor` | `then()` | Informs the processor that there is a new criterion to process.

- - ### Method Detail

    - #### startProcessing

          void startProcessing()

      Informs the processor the start of the process. The processor use this method to allocate all the resources required by the processing here. It uses it to initialize the processor state machine.

    - #### endProcessing

          void endProcessing()

      Informs the processor the process is ended. The processor use this method to deallocate all the resources that were used during the processing. It uses it to tear down the processor state machine or to finalize some treatments.

      The processing has to stop once this method is called. Hence, the call of process methods should result to nothing or to an exception.

    - #### then

          MediaCriteriaProcessor then()

      Informs the processor that there is a new criterion to process. This method must be used by the caller to chain the different criterion processings.
      Returns:
        the processor itself.

    - #### processResultLimit

          MediaCriteriaProcessor processResultLimit​(int resultLimit)

      Processes the criterion on the media result limit.
      Parameters:
        `resultLimit` - the limit of the result (0 = no limit)
      Returns:
        the processor itself.

    - #### processVisibility

          MediaCriteriaProcessor processVisibility​(MediaCriteria.VISIBILITY visibility,
                                                   Date dateReference,
                                                   org.silverpeas.core.admin.user.model.UserDetail creator)

      Processes the criterion on the media visibility.
      Parameters:
        `visibility` - the requested visibility.
        `dateReference` -
        `creator` - User Detail
      Returns:
        the processor itself.

    - #### processIdentifiers

          MediaCriteriaProcessor processIdentifiers​(List<String> identifiers)

      Processes the criterion on the media identifiers.
      Parameters:
        `identifiers` - the media identifiers concerned by the criterion.
      Returns:
        the processor itself.

    - #### processComponentInstance

          MediaCriteriaProcessor processComponentInstance​(String componentInstanceId)

      Processes the criterion on the component instance identifier.
      Parameters:
        `componentInstanceId` - the identifier of the component instance concerned by the criterion.
      Returns:
        the processor itself.

    - #### processAlbums

          MediaCriteriaProcessor processAlbums​(List<String> albumIds)

      Processes the criterion on the identifiers of albums (Actually, Album = Node).
      Parameters:
        `albumIds` - the identifiers of albums concerned by the criterion.
      Returns:
        the processor itself.

    - #### processMediaTypes

          MediaCriteriaProcessor processMediaTypes​(List<MediaType> mediaTypes)

      Processes the criterion on type of media.
      Parameters:
        `mediaTypes` - the media types concerned by the criterion.
      Returns:
        the processor itself.

    - #### processNbDaysBeforeThatMediaIsNotVisible

          MediaCriteriaProcessor processNbDaysBeforeThatMediaIsNotVisible​(Date referenceDate,
                                                                          int nbDaysBeforeThatMediaIsNotVisible)

      Processes the criterion on the nb of days before that a media is not visible.
      Parameters:
        `referenceDate` -
        `nbDaysBeforeThatMediaIsNotVisible` - the nb of days before that a media is not visible.
      Returns:
        the processor itself.

    - #### processOrdering

          MediaCriteriaProcessor processOrdering​(List<MediaCriteria.QUERY_ORDER_BY> orderings)

      Processes the criterion on orderings of the medias matching the criteria.
      Parameters:
        `orderings` - the result orderings concerned by the criterion.
      Returns:
        the processor itself.

    - #### result

          <T> T result()

      Gets the result of the processing. Warning, the result can be incomplete if called before the processing ending (triggered with the call of `endProcessing()` method).
      Type Parameters:
        `T` - the type of the result.
      Returns:
        the processing result.

    - #### orderingResult

          List<Media> orderingResult​(List<Media> media)

      This method must be called after the media list is entirely loaded. If an ordering was specified and if it was not possible to perform it by SQL clauses, then a logical sort is performed.
      Parameters:
        `media` -