All Superinterfaces:
Comparable<StoreElement>, HistoryProvider, IDProvider, PackagePoolItem, Referenceable, StoreElement, Workflowable

public interface Media extends Referenceable, PackagePoolItem
This interface provides methods to handle a media object from the MediaStore.

The Media interface provides two different types of objects File and Picture which can be distinguished by using the getType()-method. Depending on the type of data from the MediaStore you are working with, further information and extensive API functionality regarding files can be drawn from one of the two interfaces.

Since:
3.0
See Also:
  • Field Details

  • Method Details

    • getType

      int getType()
      Get the type (FILE or PICTURE) of the current media.
      Returns:
      type of the media
      Since:
      3.0
    • getName

      @NotNull @Deprecated @NotNull String getName()
      Deprecated.
      since 4.1.10 - use IDProvider.getUid()
      Get the unique name of the current media.
      Specified by:
      getName in interface StoreElement
      Returns:
      unique name of the media
      Since:
      3.0
    • isLanguageDependent

      boolean isLanguageDependent()
      Indicates whether this media is language dependent or not.
      Returns:
      true if this media is languagedependent, false otherwise
      Since:
      3.0
    • makeLanguageIndependent

      void makeLanguageIndependent(@NotNull @NotNull Language toKeep)
      Makes this media language independent. Removes all language varieties (Images or Files and their descriptions) except for the one provided as an argument.
      Parameters:
      toKeep - is the one Language to keep when reducing to one single language
      Since:
      5.2.1606
    • makeLanguageDependent

      void makeLanguageDependent(Language... languages)
      Makes this media language dependent. Creates one set of media content (Picture or File) and description for every project language.
      Every language provided in the parameter list will be filled with the current language-independent media content and description.
      Parameters:
      languages - to which of the project languages should data from the old (single) language be assigned?
      Since:
      5.2.1606
    • getFilename

      String getFilename()
      Get the filename of the current media.
      Returns:
      filename of the media
      Since:
      3.0
    • setFilename

      void setFilename(String filename)
      Set the filename of the current media.
      Parameters:
      filename - new filename of the media
      Since:
      3.0
    • getParseFile

      boolean getParseFile()
      State if the media must be parsed during the generation (only FILE)
      Returns:
      true if the file "must be parsed", false otherwise
      Since:
      3.0
    • setParseFile

      void setParseFile(boolean parseFile)
      Set if the media must be parsed during the generation (only FILE)
      Parameters:
      parseFile - true file "must be parsed", false "must not be parsed"
      Since:
      3.0
    • getMediaContent

      @Nullable @Nullable Object getMediaContent(Language language)
      Get the media-content of the current media for the given language as File or Picture object
      Parameters:
      language - language of the media
      Returns:
      media-content as File or Picture object or null if current media is language dependent but given language is not a project language
      Since:
      3.0
      See Also:
    • getPicture

      @Nullable @Nullable Picture getPicture(@Nullable @Nullable Language language)
      Get the given media as a Picture object in the language provided. Pass null if this media object is language independent.
      Parameters:
      language - may be null for a language independent media
      Returns:
      The picture for the specified language if getType() == PICTURE, else null
      Since:
      4.0
    • getFile

      @Nullable @Nullable File getFile(@Nullable @Nullable Language language)
      Get the given media as a File object in the language provided. Pass null if this media object is language independent.
      Parameters:
      language - may be null for a language independent media
      Returns:
      The file for the specified language if getType() == FILE, else null
      Since:
      4.0
    • save

      void save()
      Save all changes made to media object.
      Specified by:
      save in interface StoreElement
      Throws:
      DuplicateReferenceNameException - if a medium with this IDProvider.getUid() already exists on the server
      Since:
      2.3
      See Also:
    • getUidType

      @NotNull @NotNull IDProvider.UidType getUidType()
      Return UID_TYPE.
      Specified by:
      getUidType in interface IDProvider
      Returns:
      the unique identifier
      Since:
      4.0
      See Also:
    • getStoredUrl

      @Nullable @Nullable String getStoredUrl(@Nullable @Nullable Language language, @Nullable @Nullable Resolution resolution)
      Get the stored URL for this node and the provided combination of language and resolution. Returns null if no URL is (yet) stored.
      Parameters:
      language - Language to get the URL for - or null for language independent media nodes.
      resolution - Resolution to get the URL for - or null for instances of type FILE.
      Returns:
      The stored URL or null, if no URL is yet stored.
      Throws:
      NullPointerException - if parameter language is null and this node is language dependent or parameter resolution is null and this node is of type PICTURE.
      Since:
      5.0.4
      See Also: