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();
}
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();
}
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);
}
Aggregations