Search in sources :

Example 1 with OrganizationDao

use of org.sonar.db.organization.OrganizationDao in project sonarqube by SonarSource.

the class SearchActionComponentsMediumTest method setUp.

@Before
public void setUp() {
    tester.clearDbAndIndexes();
    db = tester.get(DbClient.class);
    wsTester = tester.get(WsTester.class);
    session = db.openSession(false);
    OrganizationDao organizationDao = db.organizationDao();
    DefaultOrganization defaultOrganization = tester.get(DefaultOrganizationProvider.class).get();
    this.defaultOrganization = organizationDao.selectByUuid(session, defaultOrganization.getUuid()).get();
    this.otherOrganization1 = OrganizationTesting.newOrganizationDto().setKey("my-org-1");
    this.otherOrganization2 = OrganizationTesting.newOrganizationDto().setKey("my-org-2");
    organizationDao.insert(session, this.otherOrganization1);
    organizationDao.insert(session, this.otherOrganization2);
    session.commit();
}
Also used : DbClient(org.sonar.db.DbClient) WsTester(org.sonar.server.ws.WsTester) DefaultOrganizationProvider(org.sonar.server.organization.DefaultOrganizationProvider) OrganizationDao(org.sonar.db.organization.OrganizationDao) DefaultOrganization(org.sonar.server.organization.DefaultOrganization) Before(org.junit.Before)

Example 2 with OrganizationDao

use of org.sonar.db.organization.OrganizationDao in project sonarqube by SonarSource.

the class SearchActionMediumTest method setUp.

@Before
public void setUp() {
    tester.clearDbAndIndexes();
    db = tester.get(DbClient.class);
    wsTester = tester.get(WsTester.class);
    session = db.openSession(false);
    OrganizationDao organizationDao = db.organizationDao();
    DefaultOrganization defaultOrganization = tester.get(DefaultOrganizationProvider.class).get();
    this.defaultOrganization = organizationDao.selectByUuid(session, defaultOrganization.getUuid()).get();
    this.otherOrganization1 = OrganizationTesting.newOrganizationDto().setKey("my-org-1");
    this.otherOrganization2 = OrganizationTesting.newOrganizationDto().setKey("my-org-2");
    organizationDao.insert(session, this.otherOrganization1);
    organizationDao.insert(session, this.otherOrganization2);
    session.commit();
}
Also used : DbClient(org.sonar.db.DbClient) WsTester(org.sonar.server.ws.WsTester) DefaultOrganizationProvider(org.sonar.server.organization.DefaultOrganizationProvider) OrganizationDao(org.sonar.db.organization.OrganizationDao) DefaultOrganization(org.sonar.server.organization.DefaultOrganization) Before(org.junit.Before)

Example 3 with OrganizationDao

use of org.sonar.db.organization.OrganizationDao in project sonarqube by SonarSource.

the class SetDefaultTemplateAction method setDefaultTemplateUuid.

private void setDefaultTemplateUuid(DbSession dbSession, PermissionTemplateDto permissionTemplateDto, String qualifier) {
    String organizationUuid = permissionTemplateDto.getOrganizationUuid();
    OrganizationDao organizationDao = dbClient.organizationDao();
    DefaultTemplates defaultTemplates = checkFoundWithOptional(organizationDao.getDefaultTemplates(dbSession, organizationUuid), "No Default templates for organization with uuid '%s'", organizationUuid);
    if (Qualifiers.PROJECT.equals(qualifier)) {
        defaultTemplates.setProjectUuid(permissionTemplateDto.getUuid());
    } else if (Qualifiers.VIEW.equals(qualifier)) {
        defaultTemplates.setViewUuid(permissionTemplateDto.getUuid());
    }
    organizationDao.setDefaultTemplates(dbSession, organizationUuid, defaultTemplates);
}
Also used : OrganizationDao(org.sonar.db.organization.OrganizationDao) DefaultTemplates(org.sonar.db.organization.DefaultTemplates)

Aggregations

OrganizationDao (org.sonar.db.organization.OrganizationDao)3 Before (org.junit.Before)2 DbClient (org.sonar.db.DbClient)2 DefaultOrganization (org.sonar.server.organization.DefaultOrganization)2 DefaultOrganizationProvider (org.sonar.server.organization.DefaultOrganizationProvider)2 WsTester (org.sonar.server.ws.WsTester)2 DefaultTemplates (org.sonar.db.organization.DefaultTemplates)1