aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao
diff options
context:
space:
mode:
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>2017-04-24 16:19:23 +0200
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-04-27 14:25:54 +0200
commite453a6e3fdb6f7bb929ba43030a27c7ca062535e (patch)
treecbb170111cad0e226b98a5349d5f43ec125c87b5 /server/sonar-db-dao
parent6cb11d0e16a33960b6c699f9122d486655f30f84 (diff)
downloadsonarqube-e453a6e3fdb6f7bb929ba43030a27c7ca062535e.tar.gz
sonarqube-e453a6e3fdb6f7bb929ba43030a27c7ca062535e.zip
SONAR-9091 add visibility flag to api/components/create
Diffstat (limited to 'server/sonar-db-dao')
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationDao.java4
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationMapper.java2
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/organization/OrganizationMapper.xml9
3 files changed, 15 insertions, 0 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationDao.java
index a6513bd16b1..4ddc575bd86 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationDao.java
@@ -117,6 +117,10 @@ public class OrganizationDao implements Dao {
return getMapper(dbSession).selectNewProjectPrivateByUuid(organization.getUuid());
}
+ public void setNewProjectPrivate(DbSession dbSession, OrganizationDto organization, boolean newProjectPrivate) {
+ getMapper(dbSession).updateNewProjectPrivate(organization.getUuid(), newProjectPrivate, system2.now());
+ }
+
public int update(DbSession dbSession, OrganizationDto organization) {
checkDto(organization);
organization.setUpdatedAt(system2.now());
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationMapper.java
index fb024e3c934..5f891da130a 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationMapper.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationMapper.java
@@ -70,5 +70,7 @@ public interface OrganizationMapper {
void updateDefaultGroupId(@Param("organizationUuid") String organizationUuid,
@Param("defaultGroupId") int defaultGroupId, @Param("now") long now);
+ void updateNewProjectPrivate(@Param("organizationUuid") String organizationUuid, @Param("newProjectPrivate") boolean newProjectPrivate, @Param("now") long now);
+
int deleteByUuid(@Param("uuid") String uuid);
}
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/organization/OrganizationMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/organization/OrganizationMapper.xml
index c9394628103..ee804cfdf04 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/organization/OrganizationMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/organization/OrganizationMapper.xml
@@ -256,6 +256,15 @@
uuid = #{organizationUuid, jdbcType=VARCHAR}
</update>
+ <update id="updateNewProjectPrivate">
+ update organizations
+ set
+ new_project_private = #{newProjectPrivate, jdbcType=INTEGER},
+ updated_at = #{now, jdbcType=BIGINT}
+ where
+ uuid = #{organizationUuid, jdbcType=VARCHAR}
+ </update>
+
<delete id="deleteByUuid">
delete from organizations
where