aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db/src
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2016-11-04 17:50:32 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2016-11-08 11:12:52 +0100
commitf9c7367366926ef82c4a8031debf6d77a1fae1d4 (patch)
tree0a098f627c4f66e396a7c67f749bfd821376217a /sonar-db/src
parent109b9c274486b03fad3a11b77c38852ad960e516 (diff)
downloadsonarqube-f9c7367366926ef82c4a8031debf6d77a1fae1d4.tar.gz
sonarqube-f9c7367366926ef82c4a8031debf6d77a1fae1d4.zip
SONAR-8089 Cleanup ComponentTreeQuery
Diffstat (limited to 'sonar-db/src')
-rw-r--r--sonar-db/src/main/java/org/sonar/db/component/ComponentTreeQuery.java92
1 files changed, 0 insertions, 92 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/component/ComponentTreeQuery.java b/sonar-db/src/main/java/org/sonar/db/component/ComponentTreeQuery.java
index dff3bc31448..5405f9cb364 100644
--- a/sonar-db/src/main/java/org/sonar/db/component/ComponentTreeQuery.java
+++ b/sonar-db/src/main/java/org/sonar/db/component/ComponentTreeQuery.java
@@ -21,18 +21,12 @@ package org.sonar.db.component;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.List;
import java.util.Locale;
-import java.util.function.Function;
-import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.sonar.db.WildcardPosition;
-import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.Lists.newArrayList;
-import static java.lang.String.format;
import static java.util.Objects.requireNonNull;
import static org.sonar.db.DatabaseUtils.buildLikeValue;
import static org.sonar.db.WildcardPosition.AFTER;
@@ -48,24 +42,14 @@ public class ComponentTreeQuery {
// SONAR-7681 a public implementation of List must be used in MyBatis - potential concurrency exceptions otherwise
@CheckForNull
private final ArrayList<String> qualifiers;
- @CheckForNull
- private final Integer page;
- @CheckForNull
- private final Integer pageSize;
private final String baseUuid;
- private final String sqlSort;
- private final String direction;
private final Strategy strategy;
private ComponentTreeQuery(Builder builder) {
this.nameOrKeyQuery = builder.nameOrKeyQuery;
this.qualifiers = builder.qualifiers == null ? null : newArrayList(builder.qualifiers);
- this.page = builder.page;
- this.pageSize = builder.pageSize;
this.baseUuid = builder.baseUuid;
this.strategy = requireNonNull(builder.strategy);
- this.direction = builder.asc ? "ASC" : "DESC";
- this.sqlSort = builder.sortFields != null ? sortFieldsToSqlSort(builder.sortFields, direction) : null;
}
@CheckForNull
@@ -83,16 +67,6 @@ public class ComponentTreeQuery {
return nameOrKeyQuery == null ? null : buildLikeValue(nameOrKeyQuery, AFTER).toLowerCase(Locale.ENGLISH);
}
- @Deprecated
- public Integer getPage() {
- return page;
- }
-
- @Deprecated
- public Integer getPageSize() {
- return pageSize;
- }
-
public String getBaseUuid() {
return baseUuid;
}
@@ -101,16 +75,6 @@ public class ComponentTreeQuery {
return strategy;
}
- @Deprecated
- public String getSqlSort() {
- return sqlSort;
- }
-
- @Deprecated
- public String getDirection() {
- return direction;
- }
-
public String getUuidPath(ComponentDto component) {
switch (strategy) {
case CHILDREN:
@@ -126,26 +90,12 @@ public class ComponentTreeQuery {
return new Builder();
}
- @Deprecated
- private static String sortFieldsToSqlSort(List<String> sortFields, String direction) {
- return sortFields
- .stream()
- .map(new SortFieldToSqlSortFieldFunction(direction)::apply)
- .collect(Collectors.joining(", "));
- }
-
public static class Builder {
@CheckForNull
private String nameOrKeyQuery;
@CheckForNull
private Collection<String> qualifiers;
- @CheckForNull
- private Integer page;
- @CheckForNull
- private Integer pageSize;
private String baseUuid;
- private List<String> sortFields;
- private boolean asc = true;
private Strategy strategy;
private Builder() {
@@ -167,18 +117,6 @@ public class ComponentTreeQuery {
return this;
}
- @Deprecated
- public Builder setPage(int page) {
- this.page = page;
- return this;
- }
-
- @Deprecated
- public Builder setPageSize(int pageSize) {
- this.pageSize = pageSize;
- return this;
- }
-
public Builder setBaseUuid(String uuid) {
this.baseUuid = uuid;
return this;
@@ -188,35 +126,5 @@ public class ComponentTreeQuery {
this.strategy = requireNonNull(strategy);
return this;
}
-
- @Deprecated
- public Builder setSortFields(List<String> sorts) {
- checkArgument(sorts != null && !sorts.isEmpty());
- this.sortFields = sorts;
- return this;
- }
-
- @Deprecated
- public Builder setAsc(boolean asc) {
- this.asc = asc;
- return this;
- }
- }
-
- @Deprecated
- private static class SortFieldToSqlSortFieldFunction implements Function<String, String> {
- private static final String PATTERN = "LOWER(p.%1$s) %2$s, p.%1$s %2$s";
-
- private final String direction;
-
- private SortFieldToSqlSortFieldFunction(String direction) {
- this.direction = direction;
- }
-
- @Nonnull
- @Override
- public String apply(@Nonnull String input) {
- return format(PATTERN, input, direction);
- }
}
}