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

com.geotab.model.entity.statusdata.StatusData Maven / Gradle / Ivy

/*
 *
 * 2020 Copyright (C) Geotab Inc. All rights reserved.
 */

package com.geotab.model.entity.statusdata;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.geotab.model.entity.EntityWithVersion;
import com.geotab.model.entity.controller.Controller;
import com.geotab.model.entity.controller.NoController;
import com.geotab.model.entity.device.Device;
import com.geotab.model.entity.diagnostic.Diagnostic;
import com.geotab.model.serialization.StatusDataDeserializer;
import java.time.LocalDateTime;
import java.util.Optional;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

/**
 * A record that represents an engine status record from the engine system of the specific {@link
 * Device}.
 */
@NoArgsConstructor
@Getter
@Setter
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@JsonDeserialize(using = StatusDataDeserializer.class)
public class StatusData extends EntityWithVersion {

  /**
   * The recorded value of the diagnostic parameter.
   */
  private Double data;

  /**
   * The date and time of the logged event.
   */
  private LocalDateTime dateTime;

  /**
   * Sets the StatusData for the {@link Device} specified.
   */
  private Device device;

  /**
   * The {@link Diagnostic} for the {@link Device} specified.
   */
  private Diagnostic diagnostic;

  /**
   * The {@link Controller} for the {@link Device} specified.
   */
  private Controller controller = NoController.getInstance();

  @Builder(builderMethodName = "statusDataBuilder")
  public StatusData(String id, Long version, Double data, LocalDateTime dateTime,
      Device device, Diagnostic diagnostic, Controller controller) {
    super(id, version);
    this.data = data;
    this.dateTime = dateTime;
    this.device = device;
    this.diagnostic = diagnostic;
    this.controller = Optional.ofNullable(controller).orElse(NoController.getInstance());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy