Skip to content

Commit

Permalink
Put checks for when legacyStudyFqnToValue is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
njhlai committed Feb 16, 2022
1 parent 3f1dc32 commit b6236c9
Showing 1 changed file with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,25 +175,27 @@ class V3StudyMigrationUpgrade(
Optional.empty(),
false
).forEach { (legacyStudyEkid, legacyStudyFqnToValue) ->
logger.info("Processing all legacy participants of $legacyStudyEkid")
try {
entitySets.keySet(
Predicates.equal<UUID, EntitySet>("name", "chronicle_participants_${legacyStudyFqnToValue[FullQualifiedName("general.stringid")]!!.first()}")
).forEach { participantESID ->
dataQueryService.getEntitiesWithPropertyTypeFqns(
mapOf(participantESID to Optional.of(setOf<UUID>())),
mapOf(participantESID to legacyParticipantPropertyTypes),
emptyMap(),
EnumSet.noneOf(MetadataOption::class.java),
Optional.empty(),
false
).forEach { (_, legacyParticipantFqnToValue) ->
logger.info("Inserting participant: $legacyParticipantFqnToValue into candidates")
insertIntoCandidatesTable(connection, legacyStudyEkid, legacyParticipantFqnToValue)
logger.info("Processing all legacy participants of $legacyStudyEkid, with stringid ${legacyStudyFqnToValue.getOrDefault(FullQualifiedName("general.stringid"), null)}")
if (legacyStudyFqnToValue.isNotEmpty()) {
try {
entitySets.keySet(
Predicates.equal<UUID, EntitySet>("name", "chronicle_participants_${legacyStudyFqnToValue.getOrDefault(FullQualifiedName("general.stringid"), null)}")
).forEach { participantESID ->
dataQueryService.getEntitiesWithPropertyTypeFqns(
mapOf(participantESID to Optional.of(setOf<UUID>())),
mapOf(participantESID to legacyParticipantPropertyTypes),
emptyMap(),
EnumSet.noneOf(MetadataOption::class.java),
Optional.empty(),
false
).forEach { (_, legacyParticipantFqnToValue) ->
logger.info("Inserting participant: $legacyParticipantFqnToValue into candidates")
insertIntoCandidatesTable(connection, legacyStudyEkid, legacyParticipantFqnToValue)
}
}
} catch (ex: Exception) {
logger.error("An error occurred processing legacy participants of $legacyStudyEkid", ex)
}
} catch (ex: Exception) {
logger.error("An error occurred processing legacy participants of $legacyStudyEkid", ex)
}
}
}
Expand Down

0 comments on commit b6236c9

Please sign in to comment.