]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8278 add DbSession param to DefaultRubyComponentService#create()
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 20 Oct 2016 15:09:21 +0000 (17:09 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 21 Oct 2016 13:58:39 +0000 (15:58 +0200)
server/sonar-server/src/main/java/org/sonar/server/component/DefaultRubyComponentService.java

index 5b633541ee93bb0cead440c6914bd31cb12b538e..26aceab58c664950c99c7f6bfcaa29cfd866e5e0 100644 (file)
@@ -74,13 +74,16 @@ public class DefaultRubyComponentService implements RubyComponentService {
   @CheckForNull
   public Long createComponent(String key, @Nullable String branch, String name, @Nullable String qualifier) {
     try (DbSession dbSession = dbClient.openSession(false)) {
-      ComponentDto provisionedComponent = componentService.create(dbSession, NewComponent.create(key, name).setQualifier(qualifier).setBranch(branch));
-      permissionService.applyDefaultPermissionTemplate(dbSession, provisionedComponent.getKey());
-      dbSession.commit();
-      return provisionedComponent.getId();
+      return createComponent(dbSession, key, branch, name, qualifier);
     }
   }
 
+  public long createComponent(DbSession dbSession, String key, @Nullable String branch, String name, @Nullable String qualifier) {
+    ComponentDto provisionedComponent = componentService.create(dbSession, NewComponent.create(key, name).setQualifier(qualifier).setBranch(branch));
+    permissionService.applyDefaultPermissionTemplate(dbSession, provisionedComponent.getKey());
+    return provisionedComponent.getId();
+  }
+
   // Used in GOV
   public List<ResourceDto> findProvisionedProjects(Map<String, Object> params) {
     ComponentQuery query = toQuery(params);