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
Modifier and TypeMethodDescriptionvoidInforms the processor the process is ended.orderingResult(List<Media> media) This method must be called after the media list is entirely loaded.processAlbums(List<String> albumIds) Processes the criterion on the identifiers of albums (Actually, Album = Node).processComponentInstance(String componentInstanceId) Processes the criterion on the component instance identifier.processCreator(org.silverpeas.core.admin.user.model.UserDetail creator) Processes the criterion on the creator of the medias.processIdentifiers(List<String> identifiers) Processes the criterion on the media identifiers.processMediaTypes(List<MediaType> mediaTypes) Processes the criterion on type of media.processNbDaysBeforeThatMediaIsNotVisible(Date referenceDate, int nbDaysBeforeThatMediaIsNotVisible) Processes the criterion on the nb of days before that a media is not visible.processOrdering(List<MediaCriteria.QUERY_ORDER_BY> orderings) Processes the criterion on orderings of the medias matching the criteria.processResultLimit(int resultLimit) Processes the criterion on the media result limit.processVisibility(MediaCriteria.VISIBILITY visibility, Date dateReference, org.silverpeas.core.admin.user.model.UserDetail creator) Processes the criterion on the media visibility.<T> Tresult()Gets the result of the processing.voidInforms the processor the start of the process.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
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 processing.- Returns:
- the processor itself.
-
processResultLimit
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- the date to use as referencecreator- User Detail- Returns:
- the processor itself.
-
processIdentifiers
Processes the criterion on the media identifiers.- Parameters:
identifiers- the media identifiers concerned by the criterion.- Returns:
- the processor itself.
-
processComponentInstance
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
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.
-
processCreator
Processes the criterion on the creator of the medias.- Parameters:
creator- the user concerned by the criterion.- Returns:
- the processor itself.
-
processMediaTypes
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- the date to use as referencenbDaysBeforeThatMediaIsNotVisible- the nb of days before that a media is not visible.- Returns:
- the processor itself.
-
processOrdering
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 ofendProcessing()method).- Type Parameters:
T- the type of the result.- Returns:
- the processing result.
-
orderingResult
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- the list of media to sort
-