org.graylog.plugins.views.search.views.widgets.messagelist.MessageListConfigDTO 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.search.views.widgets.messagelist;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import org.graylog.plugins.views.search.views.WidgetConfigDTO;
import org.graylog.plugins.views.search.views.widgets.aggregation.sort.SortConfigDTO;
import org.graylog2.decorators.Decorator;
import org.graylog2.decorators.DecoratorImpl;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@AutoValue
@JsonTypeName(MessageListConfigDTO.NAME)
@JsonDeserialize(builder = MessageListConfigDTO.Builder.class)
public abstract class MessageListConfigDTO implements WidgetConfigDTO {
public static final String NAME = "messages";
private static final String FIELD_FIELDS = "fields";
private static final String FIELD_SHOW_MESSAGE_ROW = "show_message_row";
private static final String FIELD_SHOW_SUMMARY = "show_summary";
private static final String FIELD_DECORATORS = "decorators";
private static final String FIELD_SORT = "sort";
@JsonProperty(FIELD_FIELDS)
public abstract ImmutableSet fields();
@JsonProperty(FIELD_SHOW_MESSAGE_ROW)
public abstract boolean showMessageRow();
@JsonProperty(FIELD_SHOW_SUMMARY)
@Nullable
public abstract Boolean showSummary();
@JsonProperty(FIELD_DECORATORS)
public abstract List decorators();
@JsonProperty(FIELD_SORT)
public abstract List sort();
@AutoValue.Builder
public abstract static class Builder {
@JsonProperty(FIELD_FIELDS)
public abstract Builder fields(ImmutableSet fields);
@JsonProperty(FIELD_SHOW_MESSAGE_ROW)
public abstract Builder showMessageRow(boolean showMessageRow);
@JsonProperty(FIELD_SHOW_SUMMARY)
@Nullable
public abstract Builder showSummary(Boolean showSummary);
@JsonProperty(FIELD_DECORATORS)
public Builder _decorators(List decorators) {
return decorators(new ArrayList<>(decorators));
}
public abstract Builder decorators(List decorators);
@JsonProperty(FIELD_SORT)
public abstract Builder sort(List sort);
public abstract MessageListConfigDTO build();
@JsonCreator
public static Builder builder() {
return new AutoValue_MessageListConfigDTO.Builder()
.decorators(Collections.emptyList())
.sort(Collections.emptyList());
}
}
}