Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;
import org.datatransferproject.api.launcher.Monitor;
import org.datatransferproject.datatransfer.google.common.GoogleCredentialFactory;
Expand All @@ -30,6 +32,7 @@
public final class DriveImporter
implements Importer<TokensAndUrlAuthData, BlobbyStorageContainerResource> {
private static final String ROOT_FOLDER_ID = "root-id";
private static final String ROOT_FOLDER_FORMAT_STRING = "transfer-%s";

private final GoogleCredentialFactory credentialFactory;
private final TemporaryPerJobDataStore jobStore;
Expand Down Expand Up @@ -63,7 +66,7 @@ public ImportResult importItem(
idempotentExecutor.executeOrThrowException(
ROOT_FOLDER_ID,
data.getName(),
() -> importSingleFolder(driveInterface, "MigratedContent", null));
() -> importSingleFolder(driveInterface, getRootFolderName(), null));
} else {
parentId = idempotentExecutor.getCachedValue(data.getId());
}
Expand Down Expand Up @@ -153,4 +156,11 @@ private synchronized Drive getDriveInterface(TokensAndUrlAuthData authData) {

return driveInterface;
}

private String getRootFolderName() {
// TODO(alexeyqu): use PortabilityJob.createdTimestamp here for consistency
return String.format(
ROOT_FOLDER_FORMAT_STRING,
new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date()));
}
}