Class AbstractMediaPackageElementSelector<T extends MediaPackageElement>
java.lang.Object
org.opencastproject.mediapackage.selector.AbstractMediaPackageElementSelector<T>
- All Implemented Interfaces:
MediaPackageElementSelector<T>
- Direct Known Subclasses:
AttachmentSelector,CatalogSelector,SimpleElementSelector,TrackSelector
public abstract class AbstractMediaPackageElementSelector<T extends MediaPackageElement>
extends Object
implements MediaPackageElementSelector<T>
This selector will return any
MediaPackageElements from a MediaPackage that matches the tag
and flavors.-
Field Summary
FieldsModifier and TypeFieldDescriptionThe tags to excludeprotected List<MediaPackageElementFlavor> The flavorsstatic final StringThe prefix indicating that a tag should be excluded from a search for elements usingMediaPackage.getElementsByTags(Collection)The tags -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given flavor to the list of flavors.voidaddFlavor(MediaPackageElementFlavor flavor) Adds the given flavor to the list of flavors.voidaddFlavorAt(int index, String flavor) Adds the given flavor to the list of flavors.voidaddFlavorAt(int index, MediaPackageElementFlavor flavor) Adds the given flavor to the list of flavors.voidAddstagto the list of tags that are used to select the media.voidRemoves all of the tags from this selector.Returns the list of flavors.String[]getTags()Returns the tags.voidremoveFlavor(String flavor) Removes all occurences of the given flavor from the list of flavors.voidRemoves all occurences of the given flavor from the list of flavors.voidremoveFlavorAt(int index) Removes all occurences of the given flavor from the list of flavors.voidAddstagto the list of tags that are used to select the media.select(List<MediaPackageElement> elements, boolean withTagsAndFlavors) Returns the media package elements that are matched by this selector.select(MediaPackage mediaPackage, boolean withTagsAndFlavors) This base implementation will return those media package elements that match the type specified as the type parameter to the class and that flavor (if specified) AND at least one of the tags (if specified) match.select(MediaPackage mediaPackage, String publicationChannel, boolean withTagsAndFlavors) Similar to above, but will get media package elements from the given publication instead.voidsetFlavors(List<MediaPackageElementFlavor> flavors) Sets the flavors.
-
Field Details
-
tags
The tags -
excludeTags
The tags to exclude -
flavors
The flavors -
NEGATE_TAG_PREFIX
The prefix indicating that a tag should be excluded from a search for elements usingMediaPackage.getElementsByTags(Collection)- See Also:
-
-
Constructor Details
-
AbstractMediaPackageElementSelector
public AbstractMediaPackageElementSelector()
-
-
Method Details
-
select
This base implementation will return those media package elements that match the type specified as the type parameter to the class and that flavor (if specified) AND at least one of the tags (if specified) match.- Specified by:
selectin interfaceMediaPackageElementSelector<T extends MediaPackageElement>- Parameters:
mediaPackage- the media packagewithTagsAndFlavors- define if the elements must match with flavors and tags, or just one of these parameters- Returns:
- the selected elements
-
select
public Collection<T> select(MediaPackage mediaPackage, String publicationChannel, boolean withTagsAndFlavors) Similar to above, but will get media package elements from the given publication instead.- Specified by:
selectin interfaceMediaPackageElementSelector<T extends MediaPackageElement>- Parameters:
mediaPackage- the media packagepublicationChannel- the publication to get elements fromwithTagsAndFlavors- define if the elements must match with flavors and tags, or just one of these parameters- Returns:
- the selected elements
-
select
Description copied from interface:MediaPackageElementSelectorReturns the media package elements that are matched by this selector.- Specified by:
selectin interfaceMediaPackageElementSelector<T extends MediaPackageElement>- Parameters:
elements- the elements to select fromwithTagsAndFlavors- define if the elements must match with flavors and tags, or just one of these parameters- Returns:
- the selected elements
-
setFlavors
Sets the flavors.Note that the order is relevant to the selection of the track returned by this selector.
- Parameters:
flavors- the list of flavors- Throws:
IllegalArgumentException- if the flavors list isnull
-
addFlavor
Adds the given flavor to the list of flavors.Note that the order is relevant to the selection of the track returned by this selector.
- Parameters:
flavor-
-
addFlavor
Adds the given flavor to the list of flavors.Note that the order is relevant to the selection of the track returned by this selector.
- Parameters:
flavor-
-
addFlavorAt
Adds the given flavor to the list of flavors.Note that the order is relevant to the selection of the track returned by this selector.
- Parameters:
index- the position in the listflavor- the flavor to add
-
addFlavorAt
Adds the given flavor to the list of flavors.Note that the order is relevant to the selection of the track returned by this selector.
- Parameters:
index- the position in the listflavor- the flavor to add
-
removeFlavor
Removes all occurences of the given flavor from the list of flavors.- Parameters:
flavor- the flavor to remove
-
removeFlavor
Removes all occurences of the given flavor from the list of flavors.- Parameters:
flavor- the flavor to remove
-
removeFlavorAt
public void removeFlavorAt(int index) Removes all occurences of the given flavor from the list of flavors.- Parameters:
index- the position in the list
-
getFlavors
Returns the list of flavors.- Returns:
- the flavors
-
addTag
Addstagto the list of tags that are used to select the media.- Parameters:
tag- the tag to include
-
removeTag
Addstagto the list of tags that are used to select the media.- Parameters:
tag- the tag to include
-
getTags
Returns the tags.- Returns:
- the tags
-
clearTags
public void clearTags()Removes all of the tags from this selector.
-