java.lang.Object
org.opencastproject.assetmanager.impl.persistence.Database
All Implemented Interfaces:
EntityPaths

@ParametersAreNonnullByDefault public class Database extends Object implements EntityPaths
Data access object.
  • Field Details

    • TEMPLATES

      public static final com.mysema.query.jpa.JPQLTemplates TEMPLATES
  • Constructor Details

  • Method Details

    • run

      public <A> A run(Function<com.mysema.query.jpa.impl.JPAQueryFactory,A> q)
      Run a Queryldsl query inside a persistence context/transaction.
      Parameters:
      q - the query function to run
    • logQuery

      public void logQuery(com.mysema.query.jpa.impl.JPAQuery q)
    • logDelete

      public void logDelete(String queryName, com.mysema.query.jpa.impl.JPADeleteClause q)
    • saveProperty

      public boolean saveProperty(Property property)
      Save a property to the database. This is either an insert or an update operation.
    • claimVersion

      public VersionImpl claimVersion(String mpId)
      Claim a new version for media package mpId.
    • saveSnapshot

      public SnapshotDto saveSnapshot(String orgId, PartialMediaPackage pmp, Date archivalDate, VersionImpl version, Availability availability, String storageId, String owner)
      Save a snapshot and all of its assets.
    • setStorageLocation

      public void setStorageLocation(Snapshot snapshot, String storageId)
    • setStorageLocation

      public void setStorageLocation(VersionImpl version, String mpId, String storageId)
    • setAssetStorageLocation

      public void setAssetStorageLocation(VersionImpl version, String mpId, String mpeId, String storageId)
    • setAvailability

      public void setAvailability(VersionImpl version, String mpId, Availability availability)
    • getAsset

      public Optional<AssetDtos.Medium> getAsset(VersionImpl version, String mpId, String mpeId)
      Get an asset. If no version is specified return the latest version.
      Returns:
      the asset or none, if no asset can be found
    • getSnapshot

      public Optional<SnapshotDtos.Medium> getSnapshot(VersionImpl version, String mpId)
    • findAssetByChecksum

      public Optional<AssetDtos.Full> findAssetByChecksum(String checksum)
    • deleteProperties

      public int deleteProperties(String mediaPackageId)
      Delete all properties for a given media package identifier
      Parameters:
      mediaPackageId - Media package identifier
      Returns:
      Number of deleted rows
    • deleteProperties

      public int deleteProperties(String mediaPackageId, String namespace)
      Delete all properties for a given media package identifier and namespace.
      Parameters:
      mediaPackageId - Media package identifier
      namespace - A namespace prefix to use for deletion
      Returns:
      Number of deleted rows
    • snapshotExists

      public boolean snapshotExists(String mediaPackageId)
      Check if any snapshot with the given media package identifier exists.
      Parameters:
      mediaPackageId - The media package identifier to check for
      Returns:
      If a snapshot exists for the given media package
    • snapshotExists

      public boolean snapshotExists(String mediaPackageId, String organization)
      Check if any snapshot with the given media package identifier exists.
      Parameters:
      mediaPackageId - The media package identifier to check for
      organization - The organization to filter for
      Returns:
      If a snapshot exists for the given media package
    • selectProperties

      public List<Property> selectProperties(String mediaPackageId, String namespace)
      Select all properties for a specific media package.
      Parameters:
      mediaPackageId - Media package identifier to check for
      namespace - Namespace to limit the search to
      Returns:
      List of properties
    • countEvents

      public long countEvents(String organization)
      Count events with snapshots in the asset manager
      Parameters:
      organization - An organization to count in
      Returns:
      Number of events
    • findAssetByChecksumAndStoreAndOrg

      public Optional<AssetDtos.Full> findAssetByChecksumAndStoreAndOrg(String checksum, String storeId, String orgId)
    • insidePersistenceContextCheck

      public static <A> A insidePersistenceContextCheck(A a)