org.graylog.plugins.views.migrations.V20191125144500_MigrateDashboardsToViewsSupport.Pivot Maven / Gradle / Ivy
/*
* Copyright (C) 2020 Graylog, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* 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
* Server Side Public License for more details.
*
* You should have received a copy of the Server Side Public License
* along with this program. If not, see
* .
*/
package org.graylog.plugins.views.migrations.V20191125144500_MigrateDashboardsToViewsSupport;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.auto.value.AutoValue;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import static com.google.common.collect.ImmutableList.of;
@AutoValue
abstract class Pivot implements SearchType {
static final String NAME = "pivot";
@JsonProperty
String type() {
return NAME;
}
@JsonProperty
public abstract Optional name();
@JsonProperty("row_groups")
abstract List rowGroups();
@JsonProperty("column_groups")
abstract List columnGroups();
@JsonProperty
abstract List series();
@JsonProperty
abstract List sort();
@JsonProperty
abstract boolean rollup();
@Nullable
@JsonProperty
Object filter() { return null; }
static Builder builder() {
return new AutoValue_Pivot.Builder()
.rowGroups(of())
.columnGroups(of())
.sort(of())
.streams(Collections.emptySet());
}
@AutoValue.Builder
static abstract class Builder {
abstract Builder id(String id);
abstract Builder name(@Nullable String name);
abstract Builder rowGroups(List rowGroups);
abstract Builder columnGroups(List columnGroups);
abstract Builder series(List series);
abstract Builder sort(List sort);
abstract Builder rollup(boolean rollup);
abstract Builder timerange(@Nullable TimeRange timerange);
abstract Builder query(@Nullable ElasticsearchQueryString query);
Builder query(String query) {
return query(ElasticsearchQueryString.create(query));
}
abstract Builder streams(Set streams);
abstract Pivot build();
}
}