public File moveFile(File file, String newAipId, String newRepresentationId, List<String> newDirectoryPath,
String newId, boolean reindexResources) throws AlreadyExistsException, GenericException, NotFoundException,
RequestNotValidException, AuthorizationDeniedException {
RodaCoreFactory.checkIfWriteIsAllowedAndIfFalseThrowException(nodeType);
StoragePath fileStoragePath = ModelUtils.getFileStoragePath(file);
if (!storage.exists(fileStoragePath)) {
throw new NotFoundException("File/folder '" + fileStoragePath.toString() + "' were moved or do not exist");
}
File newFile = new File(newId, newAipId, newRepresentationId, newDirectoryPath, file.isDirectory());
StoragePath newFileStoragePath = ModelUtils.getFileStoragePath(newFile);
storage.move(storage, fileStoragePath, newFileStoragePath);
if (reindexResources) {
notifyRepresentationUpdated(retrieveRepresentation(newAipId, newRepresentationId)).failOnError();
if (!newAipId.equals(file.getAipId()) || !newRepresentationId.equals(file.getRepresentationId())) {
notifyRepresentationUpdated(retrieveRepresentation(file.getAipId(), file.getRepresentationId())).failOnError();
}
}
return newFile;
}