Package org.silverpeas.components.gallery.model

# Interface MediaOrderCriteriaProcessor

All Known Implementing Classes:
  `MediaOrderSQLQueryBuilder`

public interface MediaOrderCriteriaProcessor
A processor of an order 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

  Modifier and Type
  Method
  Description
  `void`
  `endProcessing()`
  Informs the processor the process is ended.
  `List<Order>`
  `orderingResult(List<Order> order)`
  This method must be called after the order list is entirely loaded.
  `MediaOrderCriteriaProcessor`
  `processComponentInstance(String componentInstanceId)`
  Processes the criterion on the component instance identifier.
  `MediaOrderCriteriaProcessor`
  `processIdentifiers(List<String> identifiers)`
  Processes the criterion on the order identifiers.
  `MediaOrderCriteriaProcessor`
  `processNbDaysAfterThatDeleteAnOrder(Date referenceDate, int nbDaysAfterThatDeleteAnOrder)`
  Processes the criterion on the number of days after that an order should be deleted.
  `MediaOrderCriteriaProcessor`
  `processOrderer(String ordererId)`
  Processes the criterion on the orderer identifier of the orders.
  `<T> T`
  `result()`
  Gets the result of the processing.
  `void`
  `startProcessing()`
  Informs the processor the start of the process.
  `MediaOrderCriteriaProcessor`
  `then()`
  Informs the processor that there is a new criterion to process.

- ## Method Details

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

    MediaOrderCriteriaProcessor 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 processing.
    Returns:
      the processor itself.

  - ### processIdentifiers

    MediaOrderCriteriaProcessor processIdentifiers(List<String> identifiers)
    Processes the criterion on the order identifiers.
    Parameters:
      `identifiers` - the order identifiers concerned by the criterion.
    Returns:
      the processor itself.

  - ### processComponentInstance

    MediaOrderCriteriaProcessor 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.

  - ### processOrderer

    MediaOrderCriteriaProcessor processOrderer(String ordererId)
    Processes the criterion on the orderer identifier of the orders.
    Parameters:
      `ordererId` - the orderer user concerned by the criterion.
    Returns:
      the processor itself.

  - ### processNbDaysAfterThatDeleteAnOrder

    MediaOrderCriteriaProcessor processNbDaysAfterThatDeleteAnOrder(Date referenceDate, int nbDaysAfterThatDeleteAnOrder)
    Processes the criterion on the number of days after that an order should be deleted.
    Parameters:
      `referenceDate` - the date used as reference for number of days.
      `nbDaysAfterThatDeleteAnOrder` - the nb of days after that an order should be deleted.
    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<Order> orderingResult(List<Order> order)
    This method must be called after the order 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:
      `order` - the list of orders to apply on the result.