Class Database
java.lang.Object
org.opencastproject.assetmanager.impl.persistence.Database
Data access object.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclaimVersion(String mpId) Claim a new version for media packagempId.longlongcountEvents(String organization) Count events with snapshots in the asset managerlonglongcountSnapshots(String organization) Count events with snapshots in the asset managerintdeleteAllButLatestSnapshot(String mediaPackageId, String orgId) intdeleteProperties(String mediaPackageId) Delete all properties for a given media package identifierintdeleteProperties(String mediaPackageId, String namespace) Delete all properties for a given media package identifier and namespace.intdeleteSnapshots(String mediaPackageId, String orgId) findAssetByChecksumAndStoreAndOrg(String checksum, String storeId, String orgId) getAsset(VersionImpl version, String mpId, String mpeId) Get an asset.getLatestSnapshot(String mediaPackageId) getLatestSnapshot(String mediaPackageId, String orgId) getLatestSnapshotsByMediaPackageIds(Collection mediaPackageIds, String orgId) getMediaPackage(String mediaPackageId) getMediaPackage(String mediaPackageId, String orgId) getSnapshot(String mediaPackageId, String orgId, Long version) getSnapshot(VersionImpl version, String mpId) getSnapshots(String mediaPackageId) getSnapshots(String mediaPackageId, String orgId) getSnapshots(String mediaPackageId, String orgId, String orderByVersion) getSnapshotsByDateOrderByMpId(Date start, Date end, String orgId) getSnapshotsByMpdIdAndDate(String mediaPackageId, Date start, Date end, String orgId) getSnapshotsByMpdIdAndDate(String mediaPackageId, Date start, Date end, String orgId, String orderByVersion) getSnapshotsByMpIdAndVersion(String mediaPackageId, Long version, String orgId) getSnapshotsByNotStorageAndDate(String storageId, Date start, Date end, String orgId) getSnapshotsBySeries(String seriesId, String orgId) getSnapshotsForIndexRebuild(int offset, int limit) getVersionsByMediaPackage(String mediaPackageId, String orgId) static <A> AbooleansaveProperty(Property property) Save a property to the database.saveSnapshot(String orgId, PartialMediaPackage pmp, Date archivalDate, VersionImpl version, Availability availability, String storageId, String owner) Save a snapshot and all of its assets.selectProperties(String mediaPackageId, String namespace) Select all properties for a specific media package.voidsetAssetStorageLocation(VersionImpl version, String mpId, String mpeId, String storageId) intsetAvailability(VersionImpl version, String mpId, Availability availability) voidsetHttpAssetProvider(HttpAssetProvider httpAssetProvider) voidsetStorageLocation(Snapshot snapshot, String storageId) voidsetStorageLocation(VersionImpl version, String mpId, String storageId) booleansnapshotExists(String mediaPackageId) Check if any snapshot with the given media package identifier exists.booleansnapshotExists(String mediaPackageId, String organization) Check if any snapshot with the given media package identifier exists.
-
Constructor Details
-
Database
-
-
Method Details
-
setHttpAssetProvider
-
saveProperty
Save a property to the database. This is either an insert or an update operation. -
claimVersion
Claim a new version for media packagempId. -
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
-
setStorageLocation
-
setAssetStorageLocation
public void setAssetStorageLocation(VersionImpl version, String mpId, String mpeId, String storageId) -
setAvailability
-
getAsset
Get an asset. If no version is specified return the latest version.- Returns:
- the asset or none, if no asset can be found
-
getSnapshot
-
deleteProperties
Delete all properties for a given media package identifier- Parameters:
mediaPackageId- Media package identifier- Returns:
- Number of deleted rows
-
deleteProperties
Delete all properties for a given media package identifier and namespace.- Parameters:
mediaPackageId- Media package identifiernamespace- A namespace prefix to use for deletion- Returns:
- Number of deleted rows
-
snapshotExists
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
Check if any snapshot with the given media package identifier exists.- Parameters:
mediaPackageId- The media package identifier to check fororganization- The organization to filter for- Returns:
- If a snapshot exists for the given media package
-
selectProperties
Select all properties for a specific media package.- Parameters:
mediaPackageId- Media package identifier to check fornamespace- Namespace to limit the search to- Returns:
- List of properties
-
countEvents
Count events with snapshots in the asset manager- Parameters:
organization- An organization to count in- Returns:
- Number of events
-
countSnapshots
Count events with snapshots in the asset manager- Parameters:
organization- An organization to count in- Returns:
- Number of events
-
countAssets
public long countAssets() -
countProperties
public long countProperties() -
findAssetByChecksumAndStoreAndOrg
public Optional<AssetDtos.Full> findAssetByChecksumAndStoreAndOrg(String checksum, String storeId, String orgId) -
getLatestSnapshot
-
getLatestSnapshot
-
getMediaPackage
-
getMediaPackage
-
getSnapshots
-
getSnapshots
-
getSnapshots
-
deleteSnapshots
-
deleteAllButLatestSnapshot
-
getSnapshotsByMpIdAndVersion
-
getSnapshotsByDateOrderByMpId
-
getSnapshotsByMpdIdAndDate
-
getSnapshotsByMpdIdAndDate
-
getSnapshotsByNotStorageAndDate
-
getSnapshotsBySeries
-
getLatestSnapshotsByMediaPackageIds
-
getSnapshot
-
getSnapshotsForIndexRebuild
-
getVersionsByMediaPackage
-
insidePersistenceContextCheck
public static <A> A insidePersistenceContextCheck(A a)
-