diff options
author | Guillaume Jambet <guillaume.jambet@sonarsource.com> | 2018-02-15 17:14:59 +0100 |
---|---|---|
committer | Guillaume Jambet <guillaume.jambet@gmail.com> | 2018-03-01 15:21:05 +0100 |
commit | 74745908c3dd0c19cdde5e5a44fb9bb43c451d9b (patch) | |
tree | d597bd30061cc0ced0b43db3f9f49293207ea231 /server/sonar-db-migration | |
parent | d535686f89484af334723467ed820a685fba4fb0 (diff) | |
download | sonarqube-74745908c3dd0c19cdde5e5a44fb9bb43c451d9b.tar.gz sonarqube-74745908c3dd0c19cdde5e5a44fb9bb43c451d9b.zip |
SONAR-10346 Add latest deliveries information to webhooks search ws.
Diffstat (limited to 'server/sonar-db-migration')
-rw-r--r-- | server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MigrateWebhooksToWebhooksTable.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MigrateWebhooksToWebhooksTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MigrateWebhooksToWebhooksTable.java index 5e133925daa..fb782d5f236 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MigrateWebhooksToWebhooksTable.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MigrateWebhooksToWebhooksTable.java @@ -25,6 +25,7 @@ import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.function.Function; +import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; @@ -33,6 +34,7 @@ import org.sonar.db.Database; import org.sonar.server.platform.db.migration.step.DataChange; import org.sonar.server.platform.db.migration.version.v63.DefaultOrganizationUuidProvider; +import static com.google.common.base.Preconditions.checkNotNull; import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toMap; @@ -124,11 +126,13 @@ public class MigrateWebhooksToWebhooksTable extends DataChange { for (String value : values) { PropertyRow name = properties.get("sonar.webhooks.project." + value + ".name"); PropertyRow url = properties.get("sonar.webhooks.project." + value + ".url"); - webhooks.add(new Webhook(name, url, null, projectUuidOf(context, name))); + String projectUuid = checkNotNull(projectUuidOf(context, name), "Project was not found for property : sonar.webhooks.project.%s", value); + webhooks.add(new Webhook(name, url, null, projectUuid)); } return webhooks; } + @CheckForNull private static String projectUuidOf(Context context, PropertyRow row) throws SQLException { return context .prepareSelect("select uuid from projects where id = ?") |