use of bio.terra.service.dataset.DatasetDataProject in project jade-data-repo by DataBiosphere.
the class FireStoreDao method deleteFileMetadata.
public boolean deleteFileMetadata(Dataset dataset, String fileId) {
DatasetDataProject dataProject = dataLocationService.getProjectOrThrow(dataset);
Firestore firestore = FireStoreProject.get(dataProject.getGoogleProjectId()).getFirestore();
String datasetId = dataset.getId().toString();
return fileDao.deleteFileMetadata(firestore, datasetId, fileId);
}
use of bio.terra.service.dataset.DatasetDataProject in project jade-data-repo by DataBiosphere.
the class FireStoreDao method lookupDirectoryEntry.
public FireStoreDirectoryEntry lookupDirectoryEntry(Dataset dataset, String fileId) {
DatasetDataProject dataProject = dataLocationService.getProjectOrThrow(dataset);
Firestore firestore = FireStoreProject.get(dataProject.getGoogleProjectId()).getFirestore();
String datasetId = dataset.getId().toString();
return directoryDao.retrieveById(firestore, datasetId, fileId);
}
use of bio.terra.service.dataset.DatasetDataProject in project jade-data-repo by DataBiosphere.
the class FireStoreDependencyDao method fileHasSnapshotReference.
public boolean fileHasSnapshotReference(Dataset dataset, String fileId) throws InterruptedException {
DatasetDataProject dataProject = dataLocationService.getProjectOrThrow(dataset);
FireStoreProject fireStoreProject = FireStoreProject.get(dataProject.getGoogleProjectId());
String dependencyCollectionName = getDatasetDependencyId(dataset.getId().toString());
CollectionReference depColl = fireStoreProject.getFirestore().collection(dependencyCollectionName);
Query query = depColl.whereEqualTo("fileId", fileId);
return hasReference(query);
}
use of bio.terra.service.dataset.DatasetDataProject in project jade-data-repo by DataBiosphere.
the class FireStoreDependencyDao method getDatasetSnapshotFileIds.
public List<String> getDatasetSnapshotFileIds(Dataset dataset, String snapshotId) throws InterruptedException {
DatasetDataProject dataProject = dataLocationService.getProjectOrThrow(dataset);
FireStoreProject fireStoreProject = FireStoreProject.get(dataProject.getGoogleProjectId());
String dependencyCollectionName = getDatasetDependencyId(dataset.getId().toString());
CollectionReference depColl = fireStoreProject.getFirestore().collection(dependencyCollectionName);
Query query = depColl.whereEqualTo("snapshotId", snapshotId);
ApiFuture<QuerySnapshot> querySnapshot = query.get();
List<String> fileIds = new ArrayList<>();
try {
List<QueryDocumentSnapshot> documents = querySnapshot.get().getDocuments();
for (DocumentSnapshot docSnap : documents) {
FireStoreDependency fireStoreDependency = docSnap.toObject(FireStoreDependency.class);
fileIds.add(fireStoreDependency.getFileId());
}
return fileIds;
} catch (ExecutionException ex) {
throw new FileSystemExecutionException("get file ids - execution exception", ex);
}
}
use of bio.terra.service.dataset.DatasetDataProject in project jade-data-repo by DataBiosphere.
the class TestUtils method bigQueryProjectForDatasetName.
public static BigQueryProject bigQueryProjectForDatasetName(DatasetDao datasetDao, DataLocationService dataLocationService, String datasetName) throws InterruptedException {
Dataset dataset = datasetDao.retrieveByName(datasetName);
DatasetDataProject dataProject = dataLocationService.getOrCreateProject(dataset);
return BigQueryProject.get(dataProject.getGoogleProjectId());
}
Aggregations