org.graylog.plugins.pipelineprocessor.db.RuleDao Maven / Gradle / Ivy
/**
* This file is part of Graylog.
*
* Graylog is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Graylog 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
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Graylog. If not, see .
*/
package org.graylog.plugins.pipelineprocessor.db;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.auto.value.AutoValue;
import org.joda.time.DateTime;
import org.mongojack.Id;
import org.mongojack.ObjectId;
import javax.annotation.Nullable;
@AutoValue
public abstract class RuleDao {
@JsonProperty("id")
@Nullable
@Id
@ObjectId
public abstract String id();
@JsonProperty
public abstract String title();
@JsonProperty
@Nullable
public abstract String description();
@JsonProperty
public abstract String source();
@JsonProperty
@Nullable
public abstract DateTime createdAt();
@JsonProperty
@Nullable
public abstract DateTime modifiedAt();
public static Builder builder() {
return new AutoValue_RuleDao.Builder();
}
public abstract Builder toBuilder();
@JsonCreator
public static RuleDao create(@Id @ObjectId @JsonProperty("_id") @Nullable String id,
@JsonProperty("title") String title,
@JsonProperty("description") @Nullable String description,
@JsonProperty("source") String source,
@JsonProperty("created_at") @Nullable DateTime createdAt,
@JsonProperty("modified_at") @Nullable DateTime modifiedAt) {
return builder()
.id(id)
.source(source)
.title(title)
.description(description)
.createdAt(createdAt)
.modifiedAt(modifiedAt)
.build();
}
@AutoValue.Builder
public abstract static class Builder {
public abstract RuleDao build();
public abstract Builder id(String id);
public abstract Builder title(String title);
public abstract Builder description(String description);
public abstract Builder source(String source);
public abstract Builder createdAt(DateTime createdAt);
public abstract Builder modifiedAt(DateTime modifiedAt);
}
}