ContentStorageImpl (Media Authoring with Java API)
Date: 2016-02-05

tv.amwa.maj.model.impl

## Class ContentStorageImpl

- java.lang.Object
- - tv.amwa.maj.model.impl.InterchangeObjectImpl
  - - tv.amwa.maj.model.impl.ContentStorageImpl

- All Implemented Interfaces:
    Serializable, Cloneable, MediaEntity, MetadataObject, XMLSerializable, ContentStorage, InterchangeObject

      @MediaClass(uuid1=218169601,
                  uuid2=257,
                  uuid3=6144,
                  uuid4={6,14,43,52,2,6,1,1},
                  definedName="ContentStorage",
                  description="The ContentStorage class has the Package and EssenceData objects.",
                  symbol="ContentStorage")
      public class ContentStorageImpl
      extends InterchangeObjectImpl
      implements ContentStorage, Serializable, XMLSerializable, Cloneable

  Implements storage for content that has package and essence data within it. An AAF file shall have exactly one content storage.

  See Also:
    `TypeDefinitions.ContentStorageStrongReference`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class tv.amwa.maj.model.impl.InterchangeObjectImpl

      `ObjectClassPropertyID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContentStorageImpl()`
    `ContentStorageImpl(Set<Package> packages, Set<EssenceData> essenceData)` Creates and initializes a content storage object, which has the `package` and `essence data` objects of an AAF persistent unit.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addEssenceDataObject(EssenceData essenceDataObject)` Adds the given essence data item to the set of those stored in this content storage..
    `void` | `addPackage(Package packageToAdd)` Adds the given package to the set of packages in this content storage.
    `void` | `clearEssenceDataObjects()`
    `void` | `clearPackages()`
    `ContentStorage` | `clone()` Create a cloned copy of this interchange object.
    `boolean` | `containsPackage(Package packageToCheck)`
    `int` | `countEssenceDataObjects()` Returns the total number of essence data items in this content storage.
    `int` | `countPackages()` Returns the total number of packages in this content storage.
    `int` | `countPackages(PackageKind packageKind)` Find the number of matches for the given package kind stored in this content storage.
    `Set<EssenceData>` | `enumEssenceDataObjects()` Returns the complete set of essence data contained within this content storage object.
    `Set<Package>` | `enumPackages()`
    `String` | `getComment()` Include a comment when serializing a value to XML.
    `Set<EssenceData>` | `getEssenceDataObjects()` Returns the complete set of essence data contained within this content storage object.
    `Set<EssenceData>` | `getEssenceDataObjects(CriteriaType mediaCriteria)` Returns the set of essence data contained within this content storage object, filtered according to the media criteria provided.
    `Set<Package>` | `getPackages()` Returns a set of all packages stored in this content storage.
    `Set<Package>` | `getPackages(SearchCriteria searchCriteria)` Returns a set of packages from this content storage according to a given search criteria.
    `static Set<Package>` | `initializePackages()`
    `boolean` | `isEssenceDataObjectPresent(EssenceData essenceData)`
    `boolean` | `isEssenceDataPresent(PackageID filePackageID)` Returns `true` if essence data identified by the given package id is contained in this content storage.
    `EssenceData` | `lookupEssenceDataObject(PackageID packageID)` Looks up and returns an essence data item stored in this content storage that matches the given package id.
    `Package` | `lookupPackage(PackageID packageID)` Returns the package that matches the given package id from the set of packages in this content storage.
    `void` | `removeEssenceDataObject(EssenceData essenceDataObject)` Removes the given essence data item from the set stored in this content storage.
    `void` | `removePackage(Package packageToRemove)` Removes the given package from the set stored in this content storage.

    - ### Methods inherited from class tv.amwa.maj.model.impl.InterchangeObjectImpl

      `addApplicationPlugin, appendXMLChildren, clearApplicationPlugins, containsApplicationPlugin, containsApplicationPlugin, countApplicationPlugins, deepEquals, disableGenerationTracking, enableGenerationTracking, equals, getApplicationPlugins, getGeneration, getLinkedGenerationID, getLinkedGenerationIDString, getObjectClass, getPersistentID, getPersistentIndex, hashCode, isGenerationTracked, removeApplicationPlugin, removeApplicationPlugin, setLinkedGenerationID, setLinkedGenerationIDString, setObjectClass, setPersistentID, setPersistentIndex, toString`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface tv.amwa.maj.model.InterchangeObject

      `addApplicationPlugin, clearApplicationPlugins, containsApplicationPlugin, containsApplicationPlugin, countApplicationPlugins, deepEquals, disableGenerationTracking, enableGenerationTracking, equals, getApplicationPlugins, getGeneration, getLinkedGenerationID, getObjectClass, isGenerationTracked, removeApplicationPlugin, removeApplicationPlugin, setLinkedGenerationID, setObjectClass, toString`

    - ### Methods inherited from interface tv.amwa.maj.industry.MediaEntity

      `getPersistentID, setPersistentIndex`

    - ### Methods inherited from interface tv.amwa.maj.io.xml.XMLSerializable

      `appendXMLChildren`

- - ### Constructor Detail

    - #### ContentStorageImpl

          public ContentStorageImpl()

    - #### ContentStorageImpl

          public ContentStorageImpl(Set<Package> packages,
                                    Set<EssenceData> essenceData)
                             throws NullPointerException

      Creates and initializes a content storage object, which has the `package` and `essence data` objects of an AAF persistent unit. An AAF persistent unit shall have exactly one content storage object.

      Parameters:
        `packages` - Set of all packages to place into the new content storage.
        `essenceData` - Set of all essence data objects to place into the new content storage.
      Throws:
        `NullPointerException` - One or both of the sets are `null`. Use empty sets to indicate no packages or essence data items are in storage.

  - ### Method Detail

    - #### addEssenceDataObject

          @MediaSetAdd(value="EssenceDataObjects")
          public void addEssenceDataObject(EssenceData essenceDataObject)
                                                                             throws DuplicatePackageIDException,
                                                                                    NullPointerException

      Description copied from interface: `ContentStorage`

      Adds the given essence data item to the set of those stored in this content storage..

      Specified by:
        `addEssenceDataObject` in interface `ContentStorage`
      Parameters:
        `essenceDataObject` - Essence data object to add to those stored in this content storage.
      Throws:
        `DuplicatePackageIDException` - The given package has already been added. The validation is done by comparing package ids, which should be unique amongst all essence data in a content storage unit.
        `NullPointerException` - The given essence data item is `null`.
      See Also:
        `EssenceData.getLinkedPackageID()`

    - #### addPackage

          @MediaSetAdd(value="Packages")
          public void addPackage(Package packageToAdd)
                                                         throws NullPointerException,
                                                                DuplicatePackageIDException

      Description copied from interface: `ContentStorage`

      Adds the given package to the set of packages in this content storage.

      Specified by:
        `addPackage` in interface `ContentStorage`
      Parameters:
        `packageToAdd` - Package to add to this content storage.
      Throws:
        `NullPointerException` - The given package is `null`.
        `DuplicatePackageIDException` - The given package is already contained in this content storage.

    - #### containsPackage

          @MediaPropertyContains(value="Packages")
          public boolean containsPackage(Package packageToCheck)

    - #### countEssenceDataObjects

          @MediaPropertyCount(value="EssenceDataObjects")
          public int countEssenceDataObjects()

      Description copied from interface: `ContentStorage`

      Returns the total number of essence data items in this content storage.

      Specified by:
        `countEssenceDataObjects` in interface `ContentStorage`
      Returns:
        Total number of essence data items.

    - #### countPackages

          @MediaPropertyCount(value="Packages")
          public int countPackages()

      Description copied from interface: `ContentStorage`

      Returns the total number of packages in this content storage.

      Specified by:
        `countPackages` in interface `ContentStorage`
      Returns:
        Total number of packages in this content storage.
      See Also:
        `ContentStorage.countPackages(PackageKind)`

    - #### countPackages

          public int countPackages(PackageKind packageKind)
                            throws NullPointerException

      Description copied from interface: `ContentStorage`

      Find the number of matches for the given package kind stored in this content storage.

      Specified by:
        `countPackages` in interface `ContentStorage`
      Parameters:
        `packageKind` - The kind of package to count.
      Returns:
        Total number of packages of the given package kind stored in this content storage.
      Throws:
        `NullPointerException` - The given package kind is `null`.
      See Also:
        `ContentStorage.countPackages()`

    - #### enumEssenceDataObjects

          @MediaProperty(uuid1=100729092,
                         uuid2=1282,
                         uuid3=0,
                         uuid4={6,14,43,52,1,1,1,2},
                         definedName="EssenceDataObjects",
                         aliases={"EssenceData","ContentStorageEssenceData"},
                         typeName="EssenceDataStrongReferenceSet",
                         optional=true,
                         uniqueIdentifier=false,
                         pid=6402,
                         symbol="EssenceDataObjects")
          public Set<EssenceData> enumEssenceDataObjects()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        throws PropertyNotPresentException

      Description copied from interface: `ContentStorage`

      Returns the complete set of essence data contained within this content storage object. Essence data does not have to be carried in the same container as the metadata, so this is an optional property.

      Calling this method produces the same result as calling `getEssenceData(CriteriaType.AnyRepresentation)`.

      Specified by:
        `enumEssenceDataObjects` in interface `ContentStorage`
      Returns:
        Shallow copy of the set of essence data stored in this content storage.
      Throws:
        `PropertyNotPresentException` - No essence data objects are present in this content storage.
      See Also:
        `ContentStorage.getEssenceDataObjects()`, `Preface.enumEssenceData()`, `TypeDefinitions.EssenceDataStrongReferenceSet`

    - #### getEssenceDataObjects

          public Set<EssenceData> getEssenceDataObjects()
                                                 throws PropertyNotPresentException

      Description copied from interface: `ContentStorage`

      Returns the complete set of essence data contained within this content storage object. Essence data does not have to be carried in the same container as the metadata, so this is an optional property.

      Calling this method produces the same result as calling `getEssenceData(CriteriaType.AnyRepresentation)`.

      Specified by:
        `getEssenceDataObjects` in interface `ContentStorage`
      Returns:
        Shallow copy of the set of essence data stored in this content storage.
      Throws:
        `PropertyNotPresentException` - No essence data objects are present in this content storage.
      See Also:
        `ContentStorage.getEssenceDataObjects(CriteriaType)`, `ContentStorage.enumEssenceDataObjects()`, `Preface.enumEssenceData()`, `TypeDefinitions.EssenceDataStrongReferenceSet`

    - #### getEssenceDataObjects

          public Set<EssenceData> getEssenceDataObjects(CriteriaType mediaCriteria)
                                                 throws NullPointerException

      Description copied from interface: `ContentStorage`

      Returns the set of essence data contained within this content storage object, filtered according to the media criteria provided.

      If the mediaCriteria is set to `CriteriaType.AnyRepresentation`, all essence data is returned.

      Specified by:
        `getEssenceDataObjects` in interface `ContentStorage`
      Parameters:
        `mediaCriteria` - Criteria to use to select the required essence data.
      Returns:
        Shallow copy of the set of essence stored in the content storage object.
      Throws:
        `NullPointerException`
      See Also:
        `ContentStorage.enumEssenceDataObjects()`, `Preface.getEssenceData(CriteriaType)`, `TypeDefinitions.EssenceDataStrongReferenceSet`

    - #### lookupEssenceDataObject

          public EssenceData lookupEssenceDataObject(PackageID packageID)
                                              throws NullPointerException,
                                                     PackageNotFoundException

      Description copied from interface: `ContentStorage`

      Looks up and returns an essence data item stored in this content storage that matches the given package id.

      Specified by:
        `lookupEssenceDataObject` in interface `ContentStorage`
      Parameters:
        `packageID` - The package id identifying the essence data stored in this content storage.
      Returns:
        Essence data stored in this content storage with the given package id.
      Throws:
        `NullPointerException` - The given essece data package id is `null`.
        `PackageNotFoundException` - The requested essence data was not found stored in this content storage.

    - #### enumPackages

          public Set<Package> enumPackages()

    - #### getPackages

          @MediaProperty(uuid1=100729092,
                         uuid2=1281,
                         uuid3=0,
                         uuid4={6,14,43,52,1,1,1,2},
                         definedName="Packages",
                         aliases="Mobs",
                         typeName="PackageStrongReferenceSet",
                         optional=false,
                         uniqueIdentifier=false,
                         pid=6401,
                         symbol="Packages")
          public Set<Package> getPackages()

      Description copied from interface: `ContentStorage`

      Returns a set of all packages stored in this content storage.

      Specified by:
        `getPackages` in interface `ContentStorage`
      Returns:
        Shallow copy of the set of all the packages in this content storage.
      See Also:
        `ContentStorage.getPackages(SearchCriteria)`, `Preface.getPackages(SearchCriteria)`

    - #### initializePackages

          public static final Set<Package> initializePackages()

    - #### getPackages

          public Set<Package> getPackages(SearchCriteria searchCriteria)

      Description copied from interface: `ContentStorage`

      Returns a set of packages from this content storage according to a given search criteria. If the search criteria is `null` then all of the packages in storage are returned.

      Specified by:
        `getPackages` in interface `ContentStorage`
      Parameters:
        `searchCriteria` - Search criteria to filter the set of stored packages of this content storage with.
      Returns:
        Shallow copy of the set of all the packages matching the given search criteria.
      See Also:
        `SearchCriteria`, `Preface.getPackages(SearchCriteria)`, `TypeDefinitions.PackageStrongReferenceSet`

    - #### isEssenceDataObjectPresent

          @MediaPropertyContains(value="EssenceDataObjects")
          public boolean isEssenceDataObjectPresent(EssenceData essenceData)

    - #### isEssenceDataPresent

          public boolean isEssenceDataPresent(PackageID filePackageID)
                                       throws NullPointerException

      Description copied from interface: `ContentStorage`

      Returns `true` if essence data identified by the given package id is contained in this content storage.

      Specified by:
        `isEssenceDataPresent` in interface `ContentStorage`
      Parameters:
        `filePackageID` - Identifier of the essence data to check for within this content storage.
      Returns:
        True if the essence data is found in this content storage.
      Throws:
        `NullPointerException` - One or more of the arguments in `null`.

    - #### lookupPackage

          public Package lookupPackage(PackageID packageID)
                                throws NullPointerException,
                                       PackageNotFoundException

      Description copied from interface: `ContentStorage`

      Returns the package that matches the given package id from the set of packages in this content storage.

      Specified by:
        `lookupPackage` in interface `ContentStorage`
      Parameters:
        `packageID` - The identifier of the package to find in this content storage.
      Returns:
        Package with the given identifier from this content storage.
      Throws:
        `NullPointerException` - The given package identifier is `null`.
        `PackageNotFoundException` - The requested package is not stored in this content storage.

    - #### removeEssenceDataObject

          @MediaPropertyRemove(value="EssenceDataObjects")
          public void removeEssenceDataObject(EssenceData essenceDataObject)
                                                                                        throws NullPointerException,
                                                                                               EssenceNotFoundException

      Description copied from interface: `ContentStorage`

      Removes the given essence data item from the set stored in this content storage.

      Specified by:
        `removeEssenceDataObject` in interface `ContentStorage`
      Parameters:
        `essenceDataObject` - Essence data to remove from this content storage.
      Throws:
        `NullPointerException` - The given essence data item is `null`.
        `EssenceNotFoundException` - The given essence data item is not currently contained in this content storage.

    - #### removePackage

          @MediaPropertyRemove(value="Packages")
          public void removePackage(Package packageToRemove)
                                                                    throws NullPointerException,
                                                                           PackageNotFoundException

      Description copied from interface: `ContentStorage`

      Removes the given package from the set stored in this content storage.

      Specified by:
        `removePackage` in interface `ContentStorage`
      Parameters:
        `packageToRemove` - Package to remove from this content storage.
      Throws:
        `NullPointerException` - The given package to remove is `null`.
        `PackageNotFoundException` - The given package is not current contained in this content storage.

    - #### clearPackages

          @MediaPropertyClear(value="Packages")
          public void clearPackages()

    - #### clearEssenceDataObjects

          @MediaPropertyClear(value="EssenceDataObjects")
          public void clearEssenceDataObjects()

    - #### clone

          public ContentStorage clone()

      Description copied from interface: `InterchangeObject`

      Create a cloned copy of this interchange object.

      Specified by:
        `clone` in interface `MediaEntity`
      Specified by:
        `clone` in interface `ContentStorage`
      Specified by:
        `clone` in interface `InterchangeObject`
      Overrides:
        `clone` in class `InterchangeObjectImpl`
      Returns:
        Cloned copy of this interchange object.

    - #### getComment

          public String getComment()

      Description copied from interface: `XMLSerializable`

      Include a comment when serializing a value to XML. The comment will be inserted as the first child node of the element representing the class.

      Specified by:
        `getComment` in interface `XMLSerializable`
      Overrides:
        `getComment` in class `InterchangeObjectImpl`
      Returns:
        Comment to add as the first child node of the element representing this class.

(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.