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 Details

  • Constructor Details

    • AbstractMediaPackageElementSelector

      public AbstractMediaPackageElementSelector()
  • Method Details

    • select

      public Collection<T> 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.
      Specified by:
      select in interface MediaPackageElementSelector<T extends MediaPackageElement>
      Parameters:
      mediaPackage - the media package
      withTagsAndFlavors - 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:
      select in interface MediaPackageElementSelector<T extends MediaPackageElement>
      Parameters:
      mediaPackage - the media package
      publicationChannel - the publication to get elements from
      withTagsAndFlavors - 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(List<MediaPackageElement> elements, boolean withTagsAndFlavors)
      Description copied from interface: MediaPackageElementSelector
      Returns the media package elements that are matched by this selector.
      Specified by:
      select in interface MediaPackageElementSelector<T extends MediaPackageElement>
      Parameters:
      elements - the elements to select from
      withTagsAndFlavors - define if the elements must match with flavors and tags, or just one of these parameters
      Returns:
      the selected elements
    • setFlavors

      public void setFlavors(List<MediaPackageElementFlavor> flavors)
      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 is null
    • addFlavor

      public void addFlavor(MediaPackageElementFlavor flavor)
      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

      public void addFlavor(String flavor)
      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

      public void addFlavorAt(int index, MediaPackageElementFlavor flavor)
      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 list
      flavor - the flavor to add
    • addFlavorAt

      public void addFlavorAt(int index, String flavor)
      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 list
      flavor - the flavor to add
    • removeFlavor

      public void removeFlavor(MediaPackageElementFlavor flavor)
      Removes all occurences of the given flavor from the list of flavors.
      Parameters:
      flavor - the flavor to remove
    • removeFlavor

      public void removeFlavor(String flavor)
      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

      public MediaPackageElementFlavor[] getFlavors()
      Returns the list of flavors.
      Returns:
      the flavors
    • addTag

      public void addTag(String tag)
      Adds tag to the list of tags that are used to select the media.
      Parameters:
      tag - the tag to include
    • removeTag

      public void removeTag(String tag)
      Adds tag to the list of tags that are used to select the media.
      Parameters:
      tag - the tag to include
    • getTags

      public String[] getTags()
      Returns the tags.
      Returns:
      the tags
    • clearTags

      public void clearTags()
      Removes all of the tags from this selector.