public static List<String> extractFilePathFromRepresentationOtherMetadata(StoragePath path) { // AIP/[aipId]/representations/[representationId]/metadata/other/[type]/.../file.bin String container = path.getContainerName(); List<String> directoryPath = path.getDirectoryPath(); if (container.equals(RodaConstants.STORAGE_CONTAINER_AIP) && directoryPath.size() > 5 && directoryPath.get(1).equals(RodaConstants.STORAGE_DIRECTORY_REPRESENTATIONS) && directoryPath.get(3).equals(RodaConstants.STORAGE_DIRECTORY_METADATA) && directoryPath.get(4).equals(RodaConstants.STORAGE_DIRECTORY_OTHER)) { return directoryPath.subList(6, directoryPath.size()); } return new ArrayList<>(); }
public static Optional<String> extractAipId(StoragePath path) { // AIP/[aipId]/... String container = path.getContainerName(); List<String> directoryPath = path.getDirectoryPath(); if (container.equals(RodaConstants.STORAGE_CONTAINER_AIP) && !directoryPath.isEmpty()) { return Optional.of(directoryPath.get(0)); } return Optional.empty(); }
public static Optional<String> extractDipId(StoragePath path) { // DIP/[dipId]/... String container = path.getContainerName(); List<String> directoryPath = path.getDirectoryPath(); if (container.equals(RodaConstants.STORAGE_CONTAINER_DIP) && !directoryPath.isEmpty()) { return Optional.of(directoryPath.get(0)); } return Optional.empty(); }
public static List<String> extractFilePathFromAipPreservationMetadata(StoragePath path) { // AIP/[aipId]/metadata/preservation/.../file.bin String container = path.getContainerName(); List<String> directoryPath = path.getDirectoryPath(); if (container.equals(RodaConstants.STORAGE_CONTAINER_AIP) && directoryPath.size() > 2 && directoryPath.get(1).equals(RodaConstants.STORAGE_DIRECTORY_METADATA) && directoryPath.get(2).equals(RodaConstants.STORAGE_DIRECTORY_PRESERVATION)) { return directoryPath.subList(3, directoryPath.size()); } return new ArrayList<>(); }
public static List<String> extractFilePathFromRepresentationPreservationMetadata(StoragePath path) { // AIP/[aipId]/representations/[representationId]/metadata/preservation/.../file.bin String container = path.getContainerName(); List<String> directoryPath = path.getDirectoryPath(); if (container.equals(RodaConstants.STORAGE_CONTAINER_AIP) && directoryPath.size() > 4 && directoryPath.get(1).equals(RodaConstants.STORAGE_DIRECTORY_REPRESENTATIONS) && directoryPath.get(3).equals(RodaConstants.STORAGE_DIRECTORY_METADATA) && directoryPath.get(4).equals(RodaConstants.STORAGE_DIRECTORY_PRESERVATION)) { return directoryPath.subList(5, directoryPath.size()); } return new ArrayList<>(); }
public static List<String> extractFilePathFromRepresentationData(StoragePath path) { // AIP/[aipId]/representations/[representationId]/data/.../file.bin String container = path.getContainerName(); List<String> directoryPath = path.getDirectoryPath(); if (container.equals(RodaConstants.STORAGE_CONTAINER_AIP) && directoryPath.size() > 3 && directoryPath.get(1).equals(RodaConstants.STORAGE_DIRECTORY_REPRESENTATIONS) && directoryPath.get(3).equals(RodaConstants.STORAGE_DIRECTORY_DATA)) { return directoryPath.subList(4, directoryPath.size()); } return new ArrayList<>(); }
public static List<String> extractFilePathFromDIPData(StoragePath path) { // DIP/[dipId]/data/.../file.bin String container = path.getContainerName(); List<String> directoryPath = path.getDirectoryPath(); if (container.equals(RodaConstants.STORAGE_CONTAINER_DIP) && directoryPath.size() > 1 && directoryPath.get(1).equals(RodaConstants.STORAGE_DIRECTORY_DATA)) { return directoryPath.subList(2, directoryPath.size()); } return new ArrayList<>(); }
public static List<String> extractFilePathFromAipOtherMetadata(StoragePath path) { // AIP/[aipId]/metadata/other/[type]/.../file.bin String container = path.getContainerName(); List<String> directoryPath = path.getDirectoryPath(); if (container.equals(RodaConstants.STORAGE_CONTAINER_AIP) && directoryPath.size() > 3 && directoryPath.get(1).equals(RodaConstants.STORAGE_DIRECTORY_METADATA) && directoryPath.get(2).equals(RodaConstants.STORAGE_DIRECTORY_OTHER)) { return directoryPath.subList(4, directoryPath.size()); } return new ArrayList<>(); }
public static Optional<String> extractRepresentationId(StoragePath path) { // AIP/[aipId]/representations/[representationId]/... String container = path.getContainerName(); List<String> directoryPath = path.getDirectoryPath(); if (container.equals(RodaConstants.STORAGE_CONTAINER_AIP) && directoryPath.size() > 1 && directoryPath.get(1).equals(RodaConstants.STORAGE_DIRECTORY_REPRESENTATIONS)) { if (directoryPath.size() > 2) { return Optional.of(directoryPath.get(2)); } else { return Optional.of(path.getName()); } } return Optional.empty(); }
public static Optional<String> extractTypeFromAipOtherMetadata(StoragePath path) { // AIP/[aipId]/metadata/other/[type]/... String container = path.getContainerName(); List<String> directoryPath = path.getDirectoryPath(); if (container.equals(RodaConstants.STORAGE_CONTAINER_AIP) && directoryPath.size() > 2 && directoryPath.get(1).equals(RodaConstants.STORAGE_DIRECTORY_METADATA) && directoryPath.get(2).equals(RodaConstants.STORAGE_DIRECTORY_OTHER)) { if (directoryPath.size() > 3) { return Optional.of(directoryPath.get(3)); } else { return Optional.of(path.getName()); } } return Optional.empty(); }
public static Optional<String> extractTypeFromRepresentationOtherMetadata(StoragePath path) { // AIP/[aipId]/representations/[representationId]/metadata/other/[type]/... String container = path.getContainerName(); List<String> directoryPath = path.getDirectoryPath(); if (container.equals(RodaConstants.STORAGE_CONTAINER_AIP) && directoryPath.size() > 4 && directoryPath.get(1).equals(RodaConstants.STORAGE_DIRECTORY_REPRESENTATIONS) && directoryPath.get(3).equals(RodaConstants.STORAGE_DIRECTORY_METADATA) && directoryPath.get(4).equals(RodaConstants.STORAGE_DIRECTORY_OTHER)) { if (directoryPath.size() > 5) { return Optional.of(directoryPath.get(5)); } else { return Optional.of(path.getName()); } } return Optional.empty(); }
public File renameFolder(File folder, String newName, boolean reindexResources) throws AlreadyExistsException, GenericException, NotFoundException, RequestNotValidException, AuthorizationDeniedException { RodaCoreFactory.checkIfWriteIsAllowedAndIfFalseThrowException(nodeType); StoragePath folderStoragePath = ModelUtils.getFileStoragePath(folder); if (storage.hasDirectory(folderStoragePath)) { List<String> newFolderPathList = new ArrayList<>(); newFolderPathList.add(folderStoragePath.getContainerName()); newFolderPathList.addAll(folderStoragePath.getDirectoryPath()); newFolderPathList.add(newName); StoragePath newFileStoragePath = DefaultStoragePath.parse(newFolderPathList); storage.move(storage, folderStoragePath, newFileStoragePath); if (reindexResources) { notifyAipUpdated(folder.getAipId()); } return retrieveFile(folder.getAipId(), folder.getRepresentationId(), folder.getPath(), newName); } else { throw new NotFoundException("Folder was moved or does not exist"); } }
Resource resource = resourceIterator.next(); if (!resource.isDirectory() && !resource.getStoragePath().getContainerName().equals(RodaConstants.STORAGE_CONTAINER_PRESERVATION)) { hasFileResources = true;