All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.intelie.liverig.plugin.widgets.AutoAnalysisAnnotation Maven / Gradle / Ivy

The newest version!
package net.intelie.liverig.plugin.widgets;

import com.google.gson.Gson;
import net.intelie.live.plugins.annotations.api.AnnotationData;

import java.util.Map;

public class AutoAnalysisAnnotation {
    private String uid;

    private String message;
    private String color;

    private Long begin;
    private Long end;
    private Long createdAt;

    private String dashboard;
    private Integer dashboardId;
    private String dashboardSpan;

    private Integer authorId;
    private String authorName;

    private AutoAnalysisAnnotationExtra extra;

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public Long getBegin() {
        return begin;
    }

    public void setBegin(Long begin) {
        this.begin = begin;
    }

    public Long getEnd() {
        return end;
    }

    public void setEnd(Long end) {
        this.end = end;
    }

    public Long getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Long createdAt) {
        this.createdAt = createdAt;
    }

    public String getDashboard() {
        return dashboard;
    }

    public void setDashboard(String dashboard) {
        this.dashboard = dashboard;
    }

    public Integer getDashboardId() {
        return dashboardId;
    }

    public void setDashboardId(Integer dashboardId) {
        this.dashboardId = dashboardId;
    }

    public String getDashboardSpan() {
        return dashboardSpan;
    }

    public void setDashboardSpan(String dashboardSpan) {
        this.dashboardSpan = dashboardSpan;
    }

    public Integer getAuthorId() {
        return authorId;
    }

    public void setAuthorId(Integer authorId) {
        this.authorId = authorId;
    }

    public String getAuthorName() {
        return authorName;
    }

    public void setAuthorName(String authorName) {
        this.authorName = authorName;
    }

    public AutoAnalysisAnnotationExtra getExtra() {
        return extra;
    }

    public void setExtra(AutoAnalysisAnnotationExtra extra) {
        this.extra = extra;
    }

    public void setExtra(Map extra) {
        Gson GSON = new Gson();
        this.extra = GSON.fromJson(GSON.toJson(extra), AutoAnalysisAnnotationExtra.class);
    }

    public AnnotationData toAnnotationData() {
        AnnotationData annotationData = new AnnotationData();

        annotationData.setDashboard(dashboard);
        annotationData.setDashboardId(dashboardId);
        annotationData.setDashboardSpan(dashboardSpan);

        annotationData.setAuthor(authorName);
        annotationData.setAuthorId(authorId);

        annotationData.setBegin(begin);
        annotationData.setEnd(end);
        annotationData.setCreatedAt(createdAt);

        annotationData.setColor(color);
        annotationData.setSource("auto-analysis");
        annotationData.setExtra(extra);

        if (message != null && !message.isEmpty()) {
            annotationData.setMessage(message);
        }

        return annotationData;
    }

    public boolean hasInsufficientFields() {
        return authorId == null ||
                authorName == null || authorName.isEmpty() ||
                begin == null || begin < 0 ||
                end == null || end < 0 ||
                end < begin ||
                dashboard == null || dashboard.isEmpty() ||
                dashboardId == null ||
                color == null || color.isEmpty() ||
                createdAt == null || createdAt < 0 ||
                extra == null ||
                extra.getQualifier() == null || extra.getQualifier().isEmpty() ||
                extra.getAsset() == null || extra.getAsset().isEmpty();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy