use of org.sonar.db.project.ProjectDto in project sonarqube by SonarSource.
the class UnsetBaselineAction method doHandle.
private void doHandle(Request request) {
String projectKey = request.mandatoryParam(PARAM_PROJECT);
String branchKey = trimToNull(request.param(PARAM_BRANCH));
try (DbSession dbSession = dbClient.openSession(false)) {
ProjectDto project = componentFinder.getProjectByKey(dbSession, projectKey);
userSession.checkProjectPermission(UserRole.ADMIN, project);
BranchDto branch = loadBranch(dbSession, project, branchKey);
dbClient.newCodePeriodDao().delete(dbSession, project.getUuid(), branch.getUuid());
dbSession.commit();
}
}
use of org.sonar.db.project.ProjectDto in project sonarqube by SonarSource.
the class TagsWsSupport method updateProjectTags.
public void updateProjectTags(DbSession dbSession, String projectKey, List<String> providedTags) {
List<String> validatedTags = checkAndUnifyTags(providedTags);
ProjectDto project = componentFinder.getProjectByKey(dbSession, projectKey);
updateTagsForProjectsOrApplication(dbSession, validatedTags, project);
}
use of org.sonar.db.project.ProjectDto in project sonarqube by SonarSource.
the class TagsWsSupport method updateApplicationTags.
public void updateApplicationTags(DbSession dbSession, String applicationKey, List<String> providedTags) {
List<String> validatedTags = checkAndUnifyTags(providedTags);
ProjectDto application = componentFinder.getApplicationByKey(dbSession, applicationKey);
updateTagsForProjectsOrApplication(dbSession, validatedTags, application);
}
use of org.sonar.db.project.ProjectDto in project sonarqube by SonarSource.
the class StatusAction method handle.
@Override
public void handle(Request request, Response response) throws Exception {
String uuid = request.param(PARAM_PROJECT_ID);
String key = request.param(PARAM_PROJECT_KEY);
checkRequest(uuid == null ^ key == null, "Project id or project key must be provided, not both.");
try (DbSession dbSession = dbClient.openSession(false)) {
ProjectDto project = getProject(dbSession, uuid, key);
userSession.checkProjectPermission(UserRole.ADMIN, project);
WsResponse wsResponse = new WsResponse();
checkDumps(project, wsResponse);
SnapshotsStatus snapshots = checkSnapshots(dbSession, project);
if (snapshots.hasLast) {
wsResponse.setCanBeExported();
} else if (!snapshots.hasAny) {
wsResponse.setCanBeImported();
}
write(response, wsResponse);
}
}
use of org.sonar.db.project.ProjectDto in project sonarqube by SonarSource.
the class DeselectAction method handle.
@Override
public void handle(Request request, Response response) {
try (DbSession dbSession = dbClient.openSession(false)) {
ProjectDto project = wsSupport.getProject(dbSession, request.mandatoryParam(PARAM_PROJECT_KEY));
dissociateProject(dbSession, project);
response.noContent();
}
}
Aggregations