From: Simon Brandhof Date: Sun, 2 Dec 2018 14:53:17 +0000 (+0100) Subject: SONARCLOUD-220 add WS api/autoscan/github_repository X-Git-Tag: 7.5~20 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=888b5bc305ac0483d4691e0dcd0c8c82a24b2eea;p=sonarqube.git SONARCLOUD-220 add WS api/autoscan/github_repository --- diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/alm/AlmAppInstallDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/alm/AlmAppInstallDao.java index 63a6846f8a4..6629c36a226 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/alm/AlmAppInstallDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/alm/AlmAppInstallDao.java @@ -26,6 +26,7 @@ import org.sonar.api.utils.System2; import org.sonar.core.util.UuidFactory; import org.sonar.db.Dao; import org.sonar.db.DbSession; +import org.sonar.db.organization.OrganizationDto; import static com.google.common.base.Preconditions.checkArgument; import static java.util.Objects.requireNonNull; @@ -62,6 +63,12 @@ public class AlmAppInstallDao implements Dao { return Optional.ofNullable(mapper.selectByInstallationId(alm.getId(), installationId)); } + public Optional selectByOrganization(DbSession dbSession, ALM alm, OrganizationDto organization) { + AlmAppInstallMapper mapper = getMapper(dbSession); + return Optional.ofNullable(mapper.selectByOrganizationUuid(alm.getId(), organization.getUuid())); + } + + public List selectUnboundByUserExternalId(DbSession dbSession, String userExternalId) { return getMapper(dbSession).selectUnboundByUserExternalId(userExternalId); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/alm/AlmAppInstallMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/alm/AlmAppInstallMapper.java index 11668864c4e..637626a24f9 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/alm/AlmAppInstallMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/alm/AlmAppInstallMapper.java @@ -35,6 +35,9 @@ public interface AlmAppInstallMapper { @CheckForNull AlmAppInstallDto selectByUuid(@Param("uuid") String uuid); + @CheckForNull + AlmAppInstallDto selectByOrganizationUuid(@Param("almId") String almId, @Param("organizationUuid") String organizationUuid); + List selectUnboundByUserExternalId(@Param("userExternalId") String userExternalId); void insert(@Param("uuid") String uuid, @Param("almId") String almId, @Param("ownerId") String ownerId, diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/alm/AlmAppInstallMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/alm/AlmAppInstallMapper.xml index fbfb720b866..b29b7ec7268 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/alm/AlmAppInstallMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/alm/AlmAppInstallMapper.xml @@ -40,11 +40,21 @@ uuid = #{uuid, jdbcType=VARCHAR} + +