|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.jackrabbit.core.version.GenericVersionSelector
This Class implements a generic version selector that either selects a
version by name, label or creation date. If no version is found and the
'returnLatest' flag is set to true
, the latest version is
returned.
Constructor Summary | |
GenericVersionSelector()
Creates a default GenericVersionSelector that always selects
the latest version. |
|
GenericVersionSelector(Calendar date)
Creates a GenericVersionSelector that will select the oldest
version of all those that are more recent than the given date. |
|
GenericVersionSelector(String label)
Creates a GenericVersionSelector that will try to select a
version with the given label. |
Method Summary | |
Calendar |
getDate()
Returns the date hint |
String |
getLabel()
Returns the label hint |
String |
getName()
Returns the name hint. |
boolean |
isReturnLatest()
Returns the flag, if the latest version should be selected, if no version can be found using the given hint. |
Version |
select(VersionHistory versionHistory)
Selects a version from the given version history using the previously assigned hint in the following order: name, label, date, latest. |
static Version |
selectByDate(VersionHistory history,
Calendar date)
Selects a version by date. |
static Version |
selectByLabel(VersionHistory history,
String label)
Selects a version by label |
static Version |
selectByName(VersionHistory history,
String name)
Selects a version by version name. |
void |
setDate(Calendar date)
Sets the date hint |
void |
setLabel(String label)
Sets the label hint |
void |
setName(String name)
Sets the name hint |
void |
setReturnLatest(boolean returnLatest)
Sets the flag, if the latest version should be selected, if no version can be found using the given hint. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GenericVersionSelector()
GenericVersionSelector
that always selects
the latest version.
public GenericVersionSelector(String label)
GenericVersionSelector
that will try to select a
version with the given label.
label
- public GenericVersionSelector(Calendar date)
GenericVersionSelector
that will select the oldest
version of all those that are more recent than the given date.
date
- Method Detail |
public String getName()
public void setName(String name)
name
- public String getLabel()
public void setLabel(String label)
label
- public Calendar getDate()
public void setDate(Calendar date)
date
- public boolean isReturnLatest()
true
if it returns latest.public void setReturnLatest(boolean returnLatest)
returnLatest
- public Version select(VersionHistory versionHistory) throws RepositoryException
select
in interface VersionSelector
versionHistory
-
RepositoryException
public static Version selectByName(VersionHistory history, String name) throws RepositoryException
history
- name
-
null
RepositoryException
public static Version selectByLabel(VersionHistory history, String label) throws RepositoryException
history
- label
-
null
RepositoryException
public static Version selectByDate(VersionHistory history, Calendar date) throws RepositoryException
history
- date
-
null
RepositoryException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |