private Boolean sortedByMeasureVariation = Boolean.FALSE;
private boolean sortedByLanguage;
private boolean sortedByName;
+ private boolean sortedByKey;
private boolean sortedByDate;
private boolean sortedByVersion;
private boolean isNumericMetric = true;
}
public boolean isTextSort() {
- return !isNumericMetric || sortedByLanguage || sortedByName || sortedByVersion;
+ return !isNumericMetric || sortedByLanguage || sortedByName || sortedByVersion || sortedByKey;
}
public Filter setSortedMetricId(Integer id, boolean isNumericValue, Boolean isVariation) {
return sortedByName;
}
+ public boolean isSortedByKey() {
+ return sortedByKey;
+ }
+
public boolean isSortedByVersion() {
return sortedByVersion;
}
}
public boolean isSorted() {
- return isSortedByLanguage() || isSortedByName() || isSortedByDate() || isSortedByVersion() || getSortedMetricId() != null;
+ return isSortedByLanguage() || isSortedByName() || isSortedByKey() || isSortedByDate() || isSortedByVersion() || getSortedMetricId() != null;
}
public boolean isSortedByDate() {
return this;
}
+ public Filter setSortedByKey() {
+ unsetSorts();
+ this.sortedByKey = true;
+ return this;
+ }
+
private void unsetSorts() {
this.sortedByDate = false;
this.sortedByLanguage = false;
this.sortedByName = false;
+ this.sortedByKey = false;
this.sortedMetricId = null;
this.sortedByVersion = false;
this.isNumericMetric = true;
} else if (filter.isSortedByName()) {
sql.append(", MAX(p.long_name) as name ");
+ } else if (filter.isSortedByKey()) {
+ sql.append(", MAX(p.kee) as kee ");
+
} else if (filter.isSortedByDate()) {
sql.append(", MAX(s.created_at) as createdat ");
assertSortedSnapshotIds(result, 2, 4, 3);
}
+ @Test
+ public void sortByKey() {
+ setupData("shared");
+ FilterExecutor executor = new FilterExecutor(getSession());
+ FilterResult result = executor.execute(Filter.createForAllQualifiers().setSortedByKey());
+ assertSortedSnapshotIds(result, 3, 2, 4);
+ }
+
@Test
public void sortByDate() {
setupData("shared");