Class MediaSQLQueryBuilder
- java.lang.Object
-
- org.silverpeas.components.gallery.dao.MediaSQLQueryBuilder
-
- All Implemented Interfaces:
MediaCriteriaProcessor
public class MediaSQLQueryBuilder extends Object implements MediaCriteriaProcessor
A dynamic builder of a SQL query.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidendProcessing()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.MediaCriteriaProcessorprocessAlbums(List<String> albumIds)Processes the criterion on the identifiers of albums (Actually, Album = Node).MediaCriteriaProcessorprocessComponentInstance(String componentInstanceId)Processes the criterion on the component instance identifier.MediaCriteriaProcessorprocessCreator(org.silverpeas.core.admin.user.model.UserDetail creator)Processes the criterion on the creator of the medias.MediaCriteriaProcessorprocessIdentifiers(List<String> identifiers)Processes the criterion on the media identifiers.MediaCriteriaProcessorprocessMediaTypes(List<MediaType> mediaTypes)Processes the criterion on type of media.MediaCriteriaProcessorprocessNbDaysBeforeThatMediaIsNotVisible(Date referenceDate, int nbDaysBeforeThatMediaIsNotVisible)Processes the criterion on the nb of days before that a media is not visible.MediaCriteriaProcessorprocessOrdering(List<MediaCriteria.QUERY_ORDER_BY> orderings)Processes the criterion on orderings of the medias matching the criteria.MediaCriteriaProcessorprocessResultLimit(int resultLimit)Processes the criterion on the media result limit.MediaCriteriaProcessorprocessVisibility(MediaCriteria.VISIBILITY visibility, Date dateReference, org.silverpeas.core.admin.user.model.UserDetail creator)Processes the criterion on the media visibility.org.silverpeas.core.persistence.jdbc.sql.JdbcSqlQueryresult()Gets the result of the processing.voidstartProcessing()Informs the processor the start of the process.MediaCriteriaProcessorthen()Informs the processor that there is a new criterion to process.
-
-
-
Method Detail
-
startProcessing
public void startProcessing()
Description copied from interface:MediaCriteriaProcessorInforms 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.- Specified by:
startProcessingin interfaceMediaCriteriaProcessor
-
endProcessing
public void endProcessing()
Description copied from interface:MediaCriteriaProcessorInforms 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.- Specified by:
endProcessingin interfaceMediaCriteriaProcessor
-
result
public org.silverpeas.core.persistence.jdbc.sql.JdbcSqlQuery result()
Description copied from interface:MediaCriteriaProcessorGets the result of the processing. Warning, the result can be incomplete if called before the processing ending (triggered with the call ofMediaCriteriaProcessor.endProcessing()method).- Specified by:
resultin interfaceMediaCriteriaProcessor- Returns:
- the processing result.
-
then
public MediaCriteriaProcessor then()
Description copied from interface:MediaCriteriaProcessorInforms the processor that there is a new criterion to process. This method must be used by the caller to chain the different criterion processings.- Specified by:
thenin interfaceMediaCriteriaProcessor- Returns:
- the processor itself.
-
processResultLimit
public MediaCriteriaProcessor processResultLimit(int resultLimit)
Description copied from interface:MediaCriteriaProcessorProcesses the criterion on the media result limit.- Specified by:
processResultLimitin interfaceMediaCriteriaProcessor- Parameters:
resultLimit- the limit of the result (0 = no limit)- Returns:
- the processor itself.
-
processVisibility
public MediaCriteriaProcessor processVisibility(MediaCriteria.VISIBILITY visibility, Date dateReference, org.silverpeas.core.admin.user.model.UserDetail creator)
Description copied from interface:MediaCriteriaProcessorProcesses the criterion on the media visibility.- Specified by:
processVisibilityin interfaceMediaCriteriaProcessor- Parameters:
visibility- the requested visibility.creator- User Detail- Returns:
- the processor itself.
-
processComponentInstance
public MediaCriteriaProcessor processComponentInstance(String componentInstanceId)
Description copied from interface:MediaCriteriaProcessorProcesses the criterion on the component instance identifier.- Specified by:
processComponentInstancein interfaceMediaCriteriaProcessor- Parameters:
componentInstanceId- the identifier of the component instance concerned by the criterion.- Returns:
- the processor itself.
-
processAlbums
public MediaCriteriaProcessor processAlbums(List<String> albumIds)
Description copied from interface:MediaCriteriaProcessorProcesses the criterion on the identifiers of albums (Actually, Album = Node).- Specified by:
processAlbumsin interfaceMediaCriteriaProcessor- Parameters:
albumIds- the identifiers of albums concerned by the criterion.- Returns:
- the processor itself.
-
processCreator
public MediaCriteriaProcessor processCreator(org.silverpeas.core.admin.user.model.UserDetail creator)
Description copied from interface:MediaCriteriaProcessorProcesses the criterion on the creator of the medias.- Specified by:
processCreatorin interfaceMediaCriteriaProcessor- Parameters:
creator- the user concerned by the criterion.- Returns:
- the processor itself.
-
processMediaTypes
public MediaCriteriaProcessor processMediaTypes(List<MediaType> mediaTypes)
Description copied from interface:MediaCriteriaProcessorProcesses the criterion on type of media.- Specified by:
processMediaTypesin interfaceMediaCriteriaProcessor- Parameters:
mediaTypes- the media types concerned by the criterion.- Returns:
- the processor itself.
-
processNbDaysBeforeThatMediaIsNotVisible
public MediaCriteriaProcessor processNbDaysBeforeThatMediaIsNotVisible(Date referenceDate, int nbDaysBeforeThatMediaIsNotVisible)
Description copied from interface:MediaCriteriaProcessorProcesses the criterion on the nb of days before that a media is not visible.- Specified by:
processNbDaysBeforeThatMediaIsNotVisiblein interfaceMediaCriteriaProcessornbDaysBeforeThatMediaIsNotVisible- the nb of days before that a media is not visible.- Returns:
- the processor itself.
-
processOrdering
public MediaCriteriaProcessor processOrdering(List<MediaCriteria.QUERY_ORDER_BY> orderings)
Description copied from interface:MediaCriteriaProcessorProcesses the criterion on orderings of the medias matching the criteria.- Specified by:
processOrderingin interfaceMediaCriteriaProcessor- Parameters:
orderings- the result orderings concerned by the criterion.- Returns:
- the processor itself.
-
processIdentifiers
public MediaCriteriaProcessor processIdentifiers(List<String> identifiers)
Description copied from interface:MediaCriteriaProcessorProcesses the criterion on the media identifiers.- Specified by:
processIdentifiersin interfaceMediaCriteriaProcessor- Parameters:
identifiers- the media identifiers concerned by the criterion.- Returns:
- the processor itself.
-
orderingResult
public List<Media> orderingResult(List<Media> media)
Description copied from interface:MediaCriteriaProcessorThis 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.- Specified by:
orderingResultin interfaceMediaCriteriaProcessor
-
-