Class LabelVersionSelector
- java.lang.Object
-
- org.apache.jackrabbit.core.version.LabelVersionSelector
-
- All Implemented Interfaces:
VersionSelector
public class LabelVersionSelector extends Object implements VersionSelector
This Class implements a version selector that selects a version by label.V1.0 V1.1 - "foo" new LabelVersionSelector("foo").select() --> V1.1 new LabelVersionSelector("bar").select() --> null
-
-
Constructor Summary
Constructors Constructor Description LabelVersionSelector(Name label)
Creates aLabelVersionSelector
that will try to select a version with the given label.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Name
getLabel()
Returns the label hintInternalVersion
select(InternalVersionHistory versionHistory)
Selects a version of the given version history.static InternalVersion
selectByLabel(InternalVersionHistory history, Name label)
Selects a version by labelvoid
setLabel(Name label)
Sets the label hintString
toString()
returns debug information
-
-
-
Constructor Detail
-
LabelVersionSelector
public LabelVersionSelector(Name label)
Creates aLabelVersionSelector
that will try to select a version with the given label.- Parameters:
label
- label hint
-
-
Method Detail
-
getLabel
public Name getLabel()
Returns the label hint- Returns:
- the label hint.
-
setLabel
public void setLabel(Name label)
Sets the label hint- Parameters:
label
- label hint
-
select
public 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:
select
in interfaceVersionSelector
- Parameters:
versionHistory
- version history to select a version from- Returns:
- A version or
null
. - Throws:
RepositoryException
- if an error occurs.
-
selectByLabel
public static InternalVersion selectByLabel(InternalVersionHistory history, Name label) throws RepositoryException
Selects a version by label- Parameters:
history
- history to select fromlabel
- desired label- Returns:
- the version with the given label or
null
- Throws:
RepositoryException
- if an error occurs
-
-