Record.java

  1. /*
  2.  * *********************************************************************************************************************
  3.  *
  4.  * blueMarine II: Semantic Media Centre
  5.  * http://tidalwave.it/projects/bluemarine2
  6.  *
  7.  * Copyright (C) 2015 - 2021 by Tidalwave s.a.s. (http://tidalwave.it)
  8.  *
  9.  * *********************************************************************************************************************
  10.  *
  11.  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  12.  * the License. You may obtain a copy of the License at
  13.  *
  14.  *     http://www.apache.org/licenses/LICENSE-2.0
  15.  *
  16.  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  17.  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the
  18.  * specific language governing permissions and limitations under the License.
  19.  *
  20.  * *********************************************************************************************************************
  21.  *
  22.  * git clone https://bitbucket.org/tidalwave/bluemarine2-src
  23.  * git clone https://github.com/tidalwave-it/bluemarine2-src
  24.  *
  25.  * *********************************************************************************************************************
  26.  */
  27. package it.tidalwave.bluemarine2.model.audio;

  28. import javax.annotation.Nonnull;
  29. import java.util.Optional;
  30. import java.net.URL;
  31. import it.tidalwave.role.Identifiable;
  32. import it.tidalwave.bluemarine2.model.finder.audio.TrackFinder;
  33. import it.tidalwave.bluemarine2.model.spi.Entity;
  34. import it.tidalwave.bluemarine2.model.spi.SourceAware;

  35. /***********************************************************************************************************************
  36.  *
  37.  * Represents a record made of audio tracks. Maps the homonymous concept from the Music Ontology.
  38.  *
  39.  * @stereotype  Datum
  40.  *
  41.  * @author  Fabrizio Giudici
  42.  *
  43.  **********************************************************************************************************************/
  44. public interface Record extends Entity, SourceAware, Identifiable
  45.   {
  46.     public static final Class<Record> _Record_ = Record.class;

  47.     /*******************************************************************************************************************
  48.      *
  49.      * If this record is part of a multiple record release, return its disk number.
  50.      *
  51.      * @return  the disk number
  52.      *
  53.      ******************************************************************************************************************/
  54.     @Nonnull
  55.     public Optional<Integer> getDiskNumber();

  56.     /*******************************************************************************************************************
  57.      *
  58.      * If this record is part of a multiple record release, return the count of disks in the release.
  59.      *
  60.      * @return  the disk count
  61.      *
  62.      ******************************************************************************************************************/
  63.     @Nonnull
  64.     public Optional<Integer> getDiskCount();

  65.     /*******************************************************************************************************************
  66.      *
  67.      * Returns the number of tracks in this record, if available. Note that this value is the number of tracks
  68.      * contained in the release, and might differ from {@code findTracks().count()} if only a subset of tracks is
  69.      * available in the catalog (for instance, if not all of them have been bought/imported).
  70.      *
  71.      * @see #findTracks()
  72.      *
  73.      * @return  the track count
  74.      *
  75.      ******************************************************************************************************************/
  76.     @Nonnull
  77.     public Optional<Integer> getTrackCount();

  78.     /*******************************************************************************************************************
  79.      *
  80.      * Finds the {@link Track}s in this record.
  81.      *
  82.      * @see #getTrackCount()
  83.      *
  84.      * @return  a {@code Finder} for the tracks
  85.      *
  86.      ******************************************************************************************************************/
  87.     @Nonnull
  88.     public TrackFinder findTracks();

  89.     /*******************************************************************************************************************
  90.      *
  91.      * Returns the Amazon ASIN of this record.
  92.      *
  93.      * @return  the Amazon ASIN
  94.      *
  95.      ******************************************************************************************************************/
  96.     @Nonnull
  97.     public Optional<String> getAsin();

  98.     /*******************************************************************************************************************
  99.      *
  100.      * Returns the bar code of this record.
  101.      *
  102.      * @return  the bar code
  103.      *
  104.      ******************************************************************************************************************/
  105.     @Nonnull
  106.     public Optional<String> getGtin();

  107.     /*******************************************************************************************************************
  108.      *
  109.      * Returns the cover image URL of this record.
  110.      *
  111.      * @return  the cover image URL
  112.      *
  113.      ******************************************************************************************************************/
  114.     @Nonnull
  115.     public Optional<URL> getImageUrl();
  116.   }