aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchMapper.java
blob: dbd11313580f460d57996fbe6d7cc98504823745 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
 * SonarQube
 * Copyright (C) 2009-2025 SonarSource SA
 * mailto:info AT sonarsource DOT com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package org.sonar.db.component;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.ibatis.annotations.Param;

public interface BranchMapper {

  void insert(@Param("dto") BranchDto dto, @Param("now") long now);

  int update(@Param("dto") BranchDto dto, @Param("now") long now);

  int updateBranchName(@Param("branchUuid") String branchUuid, @Param("newBranchName") String newBranchName, @Param("now") long now);

  int updateExcludeFromPurge(@Param("uuid") String uuid, @Param("excludeFromPurge") boolean excludeFromPurge,
    @Param("now") long now);

  BranchDto selectByKey(@Param("projectUuid") String projectUuid, @Param("key") String key, @Param("branchType") BranchType branchType);

  List<BranchDto> selectByKeys(@Param("projectUuid") String projectUuid, @Param("keys") Collection<String> branchKeys);

  BranchDto selectByUuid(@Param("uuid") String uuid);

  Collection<BranchDto> selectByProjectUuid(@Param("projectUuid") String projectUuid);

  List<PrBranchAnalyzedLanguageCountByProjectDto> countPrBranchAnalyzedLanguageByProjectUuid();

  List<BranchDto> selectByBranchKeys(@Param("branchKeyByProjectUuid") Map<String, String> branchKeyByProjectUuid);

  List<BranchDto> selectByPullRequestKeys(@Param("prKeyByProjectUuid") Map<String, String> prKeyByProjectUuid);

  List<BranchDto> selectByUuids(@Param("uuids") Collection<String> uuids);

  List<String> selectProjectUuidsWithIssuesNeedSync(@Param("projectUuids") Collection<String> uuids);

  long countByTypeAndCreationDate(@Param("branchType") String branchType, @Param("sinceDate") long sinceDate);

  short hasAnyBranchWhereNeedIssueSync(@Param("needIssueSync") boolean needIssueSync);

  List<BranchDto> selectBranchNeedingIssueSync();

  List<BranchDto> selectBranchNeedingIssueSyncForProject(@Param("projectUuid") String projectUuid);

  long updateAllNeedIssueSync(@Param("now") long now);

  long updateAllNeedIssueSyncForProject(@Param("projectUuid") String projectUuid, @Param("now") long now);

  long updateNeedIssueSync(@Param("uuid") String uuid, @Param("needIssueSync") boolean needIssueSync, @Param("now") long now);

  long updateIsMain(@Param("uuid") String uuid, @Param("isMain") boolean isMain, @Param("now") long now);

  short doAnyOfComponentsNeedIssueSync(@Param("componentKeys") List<String> components);

  Optional<BranchDto> selectMainBranchByProjectUuid(String projectUuid);

  List<BranchDto> selectMainBranchesByProjectUuids(@Param("projectUuids") Collection<String> projectUuids);

  List<BranchMeasuresDto> selectBranchMeasuresWithCaycMetric(long yesterday);

  List<BranchDto> selectMainBranches();

  List<BranchDto> selectMainBranchesAssociatedToDefaultQualityProfile();

  List<BranchDto> selectPullRequestsTargetingBranch(@Param("projectUuid") String projectUuid, @Param("branchUuid") String branchUuid);
}