@Test public void testFindAllByMediaPackage() throws Exception { StoragePath path1 = new StoragePath(ORG, MP_ID, new VersionImpl(1L), ASSET1_ID); database.storeMapping(path1, "archive_path/" + ASSET1_ID, AWS_VERSION_1); StoragePath path2 = new StoragePath(ORG, MP_ID, new VersionImpl(1L), ASSET2_ID); database.storeMapping(path2, "archive_path/" + ASSET2_ID, AWS_VERSION_2); StoragePath path = new StoragePath(ORG, MP_ID, new VersionImpl(2L), ASSET1_ID); database.storeMapping(path, "archive_path/" + ASSET1_ID, AWS_VERSION_1); path = new StoragePath(ORG, MP_ID, new VersionImpl(3L), ASSET1_ID); database.storeMapping(path, "archive_path/" + ASSET1_ID, AWS_VERSION_1); database.deleteMapping(path1); database.deleteMapping(path2); List<AwsAssetMapping> mappings = database.findAllByMediaPackage(MP_ID); Assert.assertEquals(4, mappings.size()); }
@Override public List<AwsAssetMapping> findAllByMediaPackage(String mpId) throws AwsAssetDatabaseException { List<AwsAssetMappingDto> list = AwsAssetMappingDto.findMappingsByMediaPackage(emf.createEntityManager(), mpId); List<AwsAssetMapping> resultList = new ArrayList<AwsAssetMapping>(); for (AwsAssetMappingDto dto : list) { resultList.add(dto.toAWSArchiveMapping()); } return resultList; }
AwsAssetDatabaseImpl implements AwsAssetDatabase { @Override public List<AwsAssetMapping> findAllByMediaPackage(String mpId) throws AwsAssetDatabaseException { List<AwsAssetMappingDto> list = AwsAssetMappingDto.findMappingsByMediaPackage(emf.createEntityManager(), mpId); List<AwsAssetMapping> resultList = new ArrayList<AwsAssetMapping>(); for (AwsAssetMappingDto dto : list) { resultList.add(dto.toAWSArchiveMapping()); } return resultList; } }
AwsAssetDatabaseImpl implements AwsAssetDatabase { @Override public List<AwsAssetMapping> findAllByMediaPackage(String mpId) throws AwsAssetDatabaseException { List<AwsAssetMappingDto> list = AwsAssetMappingDto.findMappingsByMediaPackage(emf.createEntityManager(), mpId); List<AwsAssetMapping> resultList = new ArrayList<AwsAssetMapping>(); for (AwsAssetMappingDto dto : list) { resultList.add(dto.toAWSArchiveMapping()); } return resultList; }  }
AwsAssetDatabaseImpl implements AwsAssetDatabase { @Override public List<AwsAssetMapping> findAllByMediaPackage(String mpId) throws AwsAssetDatabaseException { List<AwsAssetMappingDto> list = AwsAssetMappingDto.findMappingsByMediaPackage(emf.createEntityManager(), mpId); List<AwsAssetMapping> resultList = new ArrayList<AwsAssetMapping>(); for (AwsAssetMappingDto dto : list) { resultList.add(dto.toAWSArchiveMapping()); } return resultList; }  @Activate void activate(ComponentContext cc); @Deactivate void deactivate(ComponentContext cc); @Reference(name = "entityManagerFactory", target = "(osgi.unit.name=org.opencastproject.assetmanager.aws.persistence)") void setEntityManagerFactory(EntityManagerFactory emf); @Override AwsAssetMapping storeMapping(StoragePath path, String objectKey, String objectVersion); @Override void deleteMapping(StoragePath path); @Override AwsAssetMapping findMapping(StoragePath path); @Override List<AwsAssetMapping> findMappingsByKey(String objectKey); @Override List<AwsAssetMapping> findMappingsByMediaPackageAndVersion(StoragePath path); @Override List<AwsAssetMapping> findAllByMediaPackage(String mpId); }
AwsAssetDatabaseImpl implements AwsAssetDatabase { @Override public List<AwsAssetMapping> findAllByMediaPackage(String mpId) throws AwsAssetDatabaseException { List<AwsAssetMappingDto> list = AwsAssetMappingDto.findMappingsByMediaPackage(emf.createEntityManager(), mpId); List<AwsAssetMapping> resultList = new ArrayList<AwsAssetMapping>(); for (AwsAssetMappingDto dto : list) { resultList.add(dto.toAWSArchiveMapping()); } return resultList; }  @Activate void activate(ComponentContext cc); @Deactivate void deactivate(ComponentContext cc); @Reference(name = "entityManagerFactory", target = "(osgi.unit.name=org.opencastproject.assetmanager.aws.persistence)") void setEntityManagerFactory(EntityManagerFactory emf); @Override AwsAssetMapping storeMapping(StoragePath path, String objectKey, String objectVersion); @Override void deleteMapping(StoragePath path); @Override AwsAssetMapping findMapping(StoragePath path); @Override List<AwsAssetMapping> findMappingsByKey(String objectKey); @Override List<AwsAssetMapping> findMappingsByMediaPackageAndVersion(StoragePath path); @Override List<AwsAssetMapping> findAllByMediaPackage(String mpId); static final String PERSISTENCE_UNIT; }