-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into TASK-6442
- Loading branch information
Showing
27 changed files
with
170 additions
and
16 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
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
43 changes: 43 additions & 0 deletions
43
...ain/java/org/opencb/opencga/app/migrations/v4/v4_0_0/catalog/AddNewNoteTypeMigration.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,43 @@ | ||
package org.opencb.opencga.app.migrations.v4.v4_0_0.catalog; | ||
|
||
import com.mongodb.client.MongoCollection; | ||
import com.mongodb.client.model.Filters; | ||
import com.mongodb.client.model.Updates; | ||
import org.bson.Document; | ||
import org.bson.conversions.Bson; | ||
import org.opencb.opencga.catalog.db.mongodb.OrganizationMongoDBAdaptorFactory; | ||
import org.opencb.opencga.catalog.migration.Migration; | ||
import org.opencb.opencga.catalog.migration.MigrationTool; | ||
import org.opencb.opencga.core.api.ParamConstants; | ||
import org.opencb.opencga.core.models.notes.NoteType; | ||
|
||
import java.util.Arrays; | ||
|
||
@Migration(id = "addNewNoteType__task_7046", | ||
description = "Add new Note type #7046", version = "4.0.0", | ||
language = Migration.MigrationLanguage.JAVA, domain = Migration.MigrationDomain.CATALOG, date = 20241030) | ||
public class AddNewNoteTypeMigration extends MigrationTool { | ||
|
||
@Override | ||
protected void run() throws Exception { | ||
NoteType type = NoteType.UNKNOWN; | ||
if (ParamConstants.ADMIN_ORGANIZATION.equals(organizationId)) { | ||
type = NoteType.ORGANIZATION; | ||
} | ||
MongoCollection<Document> collection = getMongoCollection(OrganizationMongoDBAdaptorFactory.NOTE_COLLECTION); | ||
Bson query = Filters.exists("type", false); | ||
Bson update = Updates.set("type", type); | ||
logger.info("Setting all notes from organization '{}' to type '{}'", organizationId, type); | ||
collection.updateMany(query, update); | ||
|
||
// Drop old index | ||
Document oldIndex = new Document() | ||
.append("id", 1) | ||
.append("studyUid", 1) | ||
.append("version", 1); | ||
dropIndex(Arrays.asList(OrganizationMongoDBAdaptorFactory.NOTE_COLLECTION, OrganizationMongoDBAdaptorFactory.NOTE_ARCHIVE_COLLECTION), | ||
oldIndex); | ||
// Generate new indexes | ||
catalogManager.installIndexes(organizationId, 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
Oops, something went wrong.