*/
package org.sonar.plugins.core.filters;
+import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.web.Criterion;
-
import org.sonar.api.web.Filter;
import org.sonar.api.web.FilterColumn;
import org.sonar.api.web.FilterTemplate;
filter.setDisplayAs(Filter.LIST);
filter.setFavouritesOnly(true);
filter.add(Criterion.createForQualifier("VW", "SVW", "TRK", "BRC", "DIR", "PAC", "FIL", "CLA", "UTS", "LIB"));
- filter.add(FilterColumn.create("metric", "alert_status", FilterColumn.DESC, false));
+ filter.add(FilterColumn.create("metric", CoreMetrics.ALERT_STATUS_KEY, FilterColumn.DESC, false));
filter.add(FilterColumn.create("name", null, FilterColumn.ASC, false));
- filter.add(FilterColumn.create("metric", "ncloc", FilterColumn.DESC, false));
- filter.add(FilterColumn.create("metric", "violations_density", FilterColumn.DESC, false));
+ filter.add(FilterColumn.create("metric", CoreMetrics.NCLOC_KEY, FilterColumn.DESC, false));
+ filter.add(FilterColumn.create("metric", CoreMetrics.VIOLATIONS_DENSITY_KEY, FilterColumn.DESC, false));
filter.add(FilterColumn.create("date", null, FilterColumn.DESC, false));
-
return filter;
}
}
*/
package org.sonar.plugins.core.filters;
+import org.sonar.api.measures.CoreMetrics;
+import org.sonar.api.resources.Qualifiers;
import org.sonar.api.web.Criterion;
import org.sonar.api.web.Filter;
import org.sonar.api.web.FilterColumn;
public Filter createFilter() {
Filter filter = Filter.create();
filter.setDisplayAs(Filter.LIST);
- filter.add(Criterion.createForQualifier("TRK"));
- filter.add(FilterColumn.create("metric", "alert_status", FilterColumn.DESC, false));
+ filter.add(Criterion.createForQualifier(Qualifiers.PROJECT));
+ filter.add(FilterColumn.create("metric", CoreMetrics.ALERT_STATUS_KEY, FilterColumn.DESC, false));
filter.add(FilterColumn.create("name", null, FilterColumn.ASC, false));
filter.add(FilterColumn.create("version", null, FilterColumn.DESC, false));
- filter.add(FilterColumn.create("metric", "ncloc", FilterColumn.DESC, false));
- filter.add(FilterColumn.create("metric", "violations_density", FilterColumn.DESC, false));
+ filter.add(FilterColumn.create("metric", CoreMetrics.NCLOC_KEY, FilterColumn.DESC, false));
+ filter.add(FilterColumn.create("metric", CoreMetrics.VIOLATIONS_DENSITY_KEY, FilterColumn.DESC, false));
filter.add(FilterColumn.create("date", null, FilterColumn.DESC, false));
filter.add(FilterColumn.create("links", null, FilterColumn.DESC, false));
*/
package org.sonar.plugins.core.filters;
+import org.sonar.api.measures.CoreMetrics;
+import org.sonar.api.resources.Qualifiers;
import org.sonar.api.web.Criterion;
-
import org.sonar.api.web.Filter;
import org.sonar.api.web.FilterColumn;
import org.sonar.api.web.FilterTemplate;
public Filter createFilter() {
Filter filter = Filter.create();
filter.setDisplayAs(Filter.TREEMAP);
- filter.add(Criterion.createForQualifier("TRK"));
+ filter.add(Criterion.createForQualifier(Qualifiers.PROJECT));
filter.add(FilterColumn.create("name", null, FilterColumn.ASC, false));
- filter.add(FilterColumn.create("metric", "ncloc", FilterColumn.DESC, false));
- filter.add(FilterColumn.create("metric", "violations_density", FilterColumn.DESC, false));
-
+ filter.add(FilterColumn.create("metric", CoreMetrics.NCLOC_KEY, FilterColumn.DESC, false));
+ filter.add(FilterColumn.create("metric", CoreMetrics.VIOLATIONS_DENSITY_KEY, FilterColumn.DESC, false));
+
return filter;
}
}
private String keyRegexp;
private String nameRegexp;
private boolean onDirectChildren = false;
- private boolean isViewContext = false;
// filters on measures
private List<MeasureCriterion> measureCriteria = Lists.newLinkedList();
private boolean isNumericMetric = true;
private boolean ascendingSort = true;
- public Filter setPath(Integer rootSnapshotId, Integer snapshotId, String snapshotPath, boolean isViewContext) {
+ public Filter setPath(Integer rootSnapshotId, Integer snapshotId, String snapshotPath) {
this.baseSnapshotId = snapshotId;
if (rootSnapshotId == null) {
this.rootSnapshotId = snapshotId;
this.rootSnapshotId = rootSnapshotId;
}
this.baseSnapshotPath = StringUtils.defaultString(snapshotPath, ""); //With Oracle the path can be null (see SONAR-2582)
- this.isViewContext = isViewContext;
return this;
}
if filter.resource_id
snapshot=Snapshot.find(:first, :conditions => {:project_id => filter.resource_id, :islast => true})
if snapshot
- java_filter.setPath(snapshot.root_snapshot_id, snapshot.id, snapshot.path, (snapshot.view? || snapshot.subview?))
+ java_filter.setPath(snapshot.root_snapshot_id, snapshot.id, snapshot.path)
else
- java_filter.setPath(-1, -1, '', false)
+ java_filter.setPath(-1, -1, '')
end
end
public void filterOnBaseSnapshot() {
setupData("shared");
FilterExecutor executor = new FilterExecutor(getSession(), new Derby());
- FilterResult result = executor.execute(Filter.createForAllQualifiers().setPath(2, 2, "", false));
+ FilterResult result = executor.execute(Filter.createForAllQualifiers().setPath(2, 2, ""));
assertSnapshotIds(result, 4);
}
setupData("views");
FilterExecutor executor = new FilterExecutor(getSession(), new Derby());
Filter filter = new Filter()
- .setPath(2, 2, "", true)
+ .setPath(2, 2, "")
.setQualifiers(Sets.newHashSet(Qualifiers.SUBVIEW, Qualifiers.PROJECT));
FilterResult result = executor.execute(filter);