-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2328 from opencb/TASK-4641
TASK-4641- Update according to CellBase changes and remove and use VersionUtils from java-common-libs
- Loading branch information
Showing
90 changed files
with
280 additions
and
396 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
opencga-app/src/main/java/org/opencb/opencga/app/cli/main/OpenCgaCompleter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
opencga-app/src/main/java/org/opencb/opencga/app/cli/main/OpencgaCliOptionsParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...ain/java/org/opencb/opencga/app/migrations/v2_9_0/catalog/RenameCellBaseToken2ApiKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.opencb.opencga.app.migrations.v2_9_0.catalog; | ||
|
||
import com.mongodb.client.model.Projections; | ||
import com.mongodb.client.model.UpdateOneModel; | ||
import com.mongodb.client.model.Updates; | ||
import org.bson.Document; | ||
import org.opencb.opencga.catalog.db.mongodb.MongoDBAdaptorFactory; | ||
import org.opencb.opencga.catalog.migration.Migration; | ||
import org.opencb.opencga.catalog.migration.MigrationTool; | ||
|
||
import java.util.List; | ||
|
||
import static com.mongodb.client.model.Filters.eq; | ||
|
||
@Migration(id = "rename_cellbase_token_2_api_key" , | ||
description = "Rename CellBase Token to ApiKey", | ||
version = "2.9.0", | ||
domain = Migration.MigrationDomain.CATALOG, | ||
language = Migration.MigrationLanguage.JAVA, | ||
date = 20230829 | ||
) | ||
public class RenameCellBaseToken2ApiKey extends MigrationTool { | ||
|
||
@Override | ||
protected void run() throws Exception { | ||
|
||
migrateCollection(MongoDBAdaptorFactory.USER_COLLECTION, | ||
new Document("projects.id", new Document("$exists", true)), | ||
Projections.include("_id", "projects"), | ||
(userDocument, bulk) -> { | ||
List<Document> projects = userDocument.getList("projects", Document.class); | ||
for (int i = 0; i < projects.size(); i++) { | ||
Document project = projects.get(i); | ||
Document cellbase = project.get("cellbase", Document.class); | ||
if (cellbase != null) { | ||
String token = cellbase.getString("token"); | ||
if (token != null) { | ||
bulk.add(new UpdateOneModel<>( | ||
eq("_id", userDocument.get("_id")), | ||
Updates.combine( | ||
Updates.set("projects." + i + ".cellbase.apiKey", token), | ||
Updates.unset("projects." + i + ".cellbase.token") | ||
))); | ||
} | ||
} | ||
} | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.