*/
package org.sonar.ce.app;
-@FunctionalInterface
interface StartupBarrier {
/**
* This blocking call, waits for a process (or anything) to be operational until either it is actually operational, or
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact 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.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.server.organization;
+
+import javax.annotation.ParametersAreNonnullByDefault;
private static Map<String, String> buildQualityGateStatuses(List<MeasureDto> measures) {
return ImmutableMap.copyOf(measures.stream()
- .collect(Collectors.toMap(measure -> measure.getComponentUuid(), MeasureDto::getData)));
+ .collect(Collectors.toMap(MeasureDto::getComponentUuid, MeasureDto::getData)));
}
static class Builder {
List<RuleKey> ruleKeys = result.getIds();
// rule order is managed by ES
Map<RuleKey, RuleDto> rulesByRuleKey = Maps.uniqueIndex(
- dbClient.ruleDao().selectByKeys(dbSession, ruleKeys), input -> input.getKey());
+ dbClient.ruleDao().selectByKeys(dbSession, ruleKeys), RuleDto::getKey);
List<RuleDto> rules = new ArrayList<>();
for (RuleKey ruleKey : ruleKeys) {
RuleDto rule = rulesByRuleKey.get(ruleKey);
return executeLargeInputs(logins, l -> mapper(dbSession).selectUserPermissionsByTemplateIdAndUserLogins(templateId, l));
}
- private List<PermissionTemplateUserDto> selectUserPermissionsByTemplateId(DbSession dbSession, long templateId) {
+ private static List<PermissionTemplateUserDto> selectUserPermissionsByTemplateId(DbSession dbSession, long templateId) {
return mapper(dbSession).selectUserPermissionsByTemplateIdAndUserLogins(templateId, Collections.emptyList());
}
return mapper(session).selectAll(null);
}
- public int countAll(DbSession dbSession, String nameQuery) {
- String upperCasedNameQuery = toUppercaseSqlQuery(nameQuery);
-
- return mapper(dbSession).countAll(upperCasedNameQuery);
- }
-
private static String toUppercaseSqlQuery(String nameMatch) {
String wildcard = "%";
return format("%s%s%s", wildcard, nameMatch.toUpperCase(Locale.ENGLISH), wildcard);
List<PermissionTemplateDto> selectAll(@Nullable @Param("nameMatch") String nameMatch);
- int countAll(@Param("nameMatch") String nameMatch);
-
void usersCountByTemplateIdAndPermission(Map<String, Object> parameters, ResultHandler resultHandler);
void groupsCountByTemplateIdAndPermission(Map<String, Object> parameters, ResultHandler resultHandler);
ORDER BY UPPER(name), name
</select>
- <select id="countAll" parameterType="String" resultType="int">
- SELECT count(1)
- FROM permission_templates
- <where>
- <if test="nameMatch!=null">
- AND (UPPER(name) LIKE #{nameMatch} ESCAPE '/')
- </if>
- </where>
- </select>
-
<select id="selectByName" parameterType="String" resultType="PermissionTemplate">
SELECT
<include refid="templateColumns"/>
templateDb.insertTemplate(newPermissionTemplateDto().setName("aaaccc"));
List<PermissionTemplateDto> templates = underTest.selectAll(dbSession, "aaa");
- int count = underTest.countAll(dbSession, "aaa");
assertThat(templates.get(0).getName()).isEqualTo("aaabbb");
- assertThat(count).isEqualTo(2);
}
@Test