Class DateVersionSelector
- java.lang.Object
- 
- org.apache.jackrabbit.core.version.DateVersionSelector
 
- 
- All Implemented Interfaces:
- VersionSelector
 
 public class DateVersionSelector extends Object implements VersionSelector This Class implements a version selector that selects a version by creation date. The selected version is the latest that is older or equal than the given date. If no version could be foundnullis returned unless thereturnLatestflag is set totrue, where the latest version is returned.V1.0 - 02-Sep-2006 V1.1 - 03-Sep-2006 V1.2 - 05-Sep-2006 new DateVersionSelector("03-Sep-2006").select() -> V1.1 new DateVersionSelector("04-Sep-2006").select() -> V1.1 new DateVersionSelector("01-Sep-2006").select() -> null new DateVersionSelector("01-Sep-2006", true).select() -> V1.2 new DateVersionSelector(null, true).select() -> V1.2
- 
- 
Constructor SummaryConstructors Constructor Description DateVersionSelector(Calendar date)Creates aDateVersionSelectorthat will select the latest version of all those that are older than the given date.DateVersionSelector(Calendar date, boolean returnLatest)Creates aDateVersionSelectorthat will select the latest version of all those that are older than the given date.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CalendargetDate()Returns the date hintbooleanisReturnLatest()Returns the flag, if the latest version should be selected, if no version can be found using the given hint.InternalVersionselect(InternalVersionHistory versionHistory)Selects a version of the given version history.static InternalVersionselectByDate(InternalVersionHistory history, Calendar date)Selects a version by date.voidsetDate(Calendar date)Sets the date hintvoidsetReturnLatest(boolean returnLatest)Sets the flag, if the latest version should be selected, if no version can be found using the given hint.StringtoString()returns debug information
 
- 
- 
- 
Constructor Detail- 
DateVersionSelectorpublic DateVersionSelector(Calendar date) Creates aDateVersionSelectorthat will select the latest version of all those that are older than the given date.- Parameters:
- date- reference date
 
 - 
DateVersionSelectorpublic DateVersionSelector(Calendar date, boolean returnLatest) Creates aDateVersionSelectorthat will select the latest version of all those that are older than the given date.- Parameters:
- date- reference date
- returnLatest- if- truelatest is selected
 
 
- 
 - 
Method Detail- 
getDatepublic Calendar getDate() Returns the date hint- Returns:
- the date hint.
 
 - 
setDatepublic void setDate(Calendar date) Sets the date hint- Parameters:
- date- reference date
 
 - 
isReturnLatestpublic boolean isReturnLatest() Returns the flag, if the latest version should be selected, if no version can be found using the given hint.- Returns:
- trueif it returns latest.
 
 - 
setReturnLatestpublic void setReturnLatest(boolean returnLatest) Sets the flag, if the latest version should be selected, if no version can be found using the given hint.- Parameters:
- returnLatest- the- returnLatestflag
 
 - 
selectpublic InternalVersion select(InternalVersionHistory versionHistory) throws RepositoryException Selects a version of the given version history. If this VersionSelector is unable to select one, it can returnnull. Please note, that a version selector is not allowed to return the root version. Selects a version from the given version history using the previously assigned hint in the following order: name, label, date, latest.- Specified by:
- selectin interface- VersionSelector
- Parameters:
- versionHistory- version history to select a version from
- Returns:
- A version or null.
- Throws:
- RepositoryException- if an error occurs.
 
 - 
selectByDatepublic static InternalVersion selectByDate(InternalVersionHistory history, Calendar date) throws RepositoryException Selects a version by date.- Parameters:
- history- history to select from
- date- reference date
- Returns:
- the latest version that is older than the given date date or
 null
- Throws:
- RepositoryException- if an error occurs
 
 
- 
 
-