|
12 | 12 | import com.google.common.base.Strings; |
13 | 13 | import com.google.common.collect.ImmutableList; |
14 | 14 | import java.io.IOException; |
| 15 | +import java.text.SimpleDateFormat; |
| 16 | +import java.util.Date; |
15 | 17 | import java.util.UUID; |
16 | 18 | import org.datatransferproject.api.launcher.Monitor; |
17 | 19 | import org.datatransferproject.datatransfer.google.common.GoogleCredentialFactory; |
|
30 | 32 | public final class DriveImporter |
31 | 33 | implements Importer<TokensAndUrlAuthData, BlobbyStorageContainerResource> { |
32 | 34 | private static final String ROOT_FOLDER_ID = "root-id"; |
| 35 | + private static final String ROOT_FOLDER_FORMAT_STRING = "transfer-%s"; |
33 | 36 |
|
34 | 37 | private final GoogleCredentialFactory credentialFactory; |
35 | 38 | private final TemporaryPerJobDataStore jobStore; |
@@ -63,7 +66,7 @@ public ImportResult importItem( |
63 | 66 | idempotentExecutor.executeOrThrowException( |
64 | 67 | ROOT_FOLDER_ID, |
65 | 68 | data.getName(), |
66 | | - () -> importSingleFolder(driveInterface, "MigratedContent", null)); |
| 69 | + () -> importSingleFolder(driveInterface, getRootFolderName(), null)); |
67 | 70 | } else { |
68 | 71 | parentId = idempotentExecutor.getCachedValue(data.getId()); |
69 | 72 | } |
@@ -153,4 +156,11 @@ private synchronized Drive getDriveInterface(TokensAndUrlAuthData authData) { |
153 | 156 |
|
154 | 157 | return driveInterface; |
155 | 158 | } |
| 159 | + |
| 160 | + private String getRootFolderName() { |
| 161 | + // TODO(alexeyqu): use PortabilityJob.createdTimestamp here for consistency |
| 162 | + return String.format( |
| 163 | + ROOT_FOLDER_FORMAT_STRING, |
| 164 | + new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date())); |
| 165 | + } |
156 | 166 | } |
0 commit comments