public Path getWorkspace() { return study != null ? Paths.get(study.getUri().getRawPath()) : null; }
private boolean isExternal(Study study, String catalogFilePath, URI fileUri) throws CatalogException { URI studyUri = study.getUri(); String studyFilePath = studyUri.resolve(catalogFilePath).getPath(); String originalFilePath = fileUri.getPath(); logger.info("Study file path: {}", studyFilePath); logger.info("File path: {}", originalFilePath); return !studyFilePath.equals(originalFilePath); }
private URI getStudyUri(long studyId) throws CatalogException { return studyDBAdaptor.get(studyId, INCLUDE_STUDY_URI).first().getUri(); }
@Deprecated private Path getWorkspace(long studyId, String sessionId) throws CatalogException, IOException { // Obtain the study uri QueryOptions studyOptions = new QueryOptions(QueryOptions.INCLUDE, FileDBAdaptor.QueryParams.URI.key()); QueryResult<Study> studyQueryResult = catalogManager.getStudyManager().get(String.valueOf((Long) studyId), studyOptions, sessionId); if (studyQueryResult .getNumResults() != 1) { logger.error("Critical error: Study {} not found in catalog.", studyId); throw new CatalogException("Critical error: Study " + studyId + " not found in catalog"); } Path workspace = Paths.get(studyQueryResult.first().getUri().getRawPath()).resolve(".opencga").resolve("alignments"); if (!workspace.toFile().exists()) { Files.createDirectories(workspace); } return workspace; }
throws CatalogException { long studyId = study.getUid(); URI studyUri = study.getUri();
@Test public void testScanStudyURI() throws IOException, CatalogException { CatalogManagerTest.createDebugFile(directory.resolve("file1.txt").toString()); FileScanner fileScanner = new FileScanner(catalogManager); List<File> files = fileScanner.scan(folder, directory.toUri(), FileScanner.FileScannerPolicy.REPLACE, true, true, sessionIdUser); assertEquals(1, files.size()); URI studyUri = study.getUri(); CatalogManagerTest.createDebugFile(studyUri.resolve("data/test/folder/").resolve("file2.txt").getPath()); File root = catalogManager.getFileManager().get(study.getFqn(), new Query("name", "."), null, sessionIdUser).first(); files = fileScanner.scan(root, studyUri, FileScanner.FileScannerPolicy.REPLACE, true, true, sessionIdUser); assertEquals(1, files.size()); files.forEach((f) -> assertTrue(f.getSize() > 0)); files.forEach((f) -> assertEquals(f.getStatus().getName(), File.FileStatus.READY)); files.forEach((f) -> assertTrue(StringUtils.isNotEmpty(f.getChecksum()))); }
URI getStudyURI() throws CatalogException { return catalogManager.getStudyManager().get(studyFqn, new QueryOptions(QueryOptions.INCLUDE, StudyDBAdaptor.QueryParams.URI.key()), sessionIdUser).first().getUri(); }
java.nio.file.Path studyPath = Paths.get(study.getUri());
URI studyUri = study.getUri();
if (parents) { URI studyURI = study.getUri(); createParents(study, userId, studyURI, catalogPath, true);