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

com.geotab.model.entity.device.UntrackedAsset Maven / Gradle / Ivy

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

package com.geotab.model.entity.device;

import com.geotab.model.entity.group.Group;
import com.geotab.model.entity.worktime.WorkTime;
import com.geotab.model.enumeration.DevicePlan;
import com.geotab.model.enumeration.DeviceType;
import com.geotab.util.DeviceDefaultsUtil;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

/**
 * An untracked asset that is used in MyGeotab without a serial number. This is used for
 * extensibility and is based on the {@link Device} object.
 */
@NoArgsConstructor
@Getter
@Setter
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class UntrackedAsset extends Device implements OdometerAdjustmentProviderAware,
    EngineHoursAdjustmentProviderAware, LicensableAware {

  /**
   * Vehicle Identification Number (VIN) of the vehicle associated with the device. Maximum length
   * [50] Default [""].
   */
  private String vehicleIdentificationNumber;

  /**
   * Engine Vehicle Identification Number from the engine of the vehicle associated with the
   * device.
   */
  private String engineVehicleIdentificationNumber;

  /**
   * The Odometer for the device.
   */
  private Double odometer;

  /**
   * Value used to correct the odometer value received from the engine. Default [1].
   */
  private Float odometerFactor;

  /**
   * The offset to be applied odometer reported by the engine computer. Default [0].
   */
  private Double odometerOffset;

  /**
   * The Engine Hours for the device. Default [0].
   */
  private Double engineHours;

  /**
   * The offset to be applied engine hours data reported by the engine computer. Default [0].
   */
  private Integer engineHourOffset;

  /**
   * The vehicle license plate details of the vehicle associated with the device. Maximum length
   * [50] Default [""].
   */
  private String licensePlate;

  /**
   * The state or province of the vehicle associated with the device. Maximum length [50] Default
   * [""].
   */
  private String licenseState;

  @Builder(builderMethodName = "untrackedAssetBuilder")
  public UntrackedAsset(String id, String name, Long version,
      DeviceType deviceType,
      LocalDateTime ignoreDownloadsUntil, String serialNumber, Integer productId,
      Duration timeToDownload, WorkTime workTime,
      List groups,
      List devicePlans,
      String timeZoneId, Float maxSecondsBetweenLogs, LocalDateTime activeFrom,
      LocalDateTime activeTo, String comment,
      DeviceFlags deviceFlags, Map customFeatures,
      String vehicleIdentificationNumber, String engineVehicleIdentificationNumber,
      Double odometer, Float odometerFactor, Double odometerOffset, Double engineHours,
      Integer engineHourOffset, String licensePlate, String licenseState) {
    super(id, name, version, deviceType, ignoreDownloadsUntil, serialNumber, productId,
        timeToDownload, workTime, groups, devicePlans, timeZoneId, maxSecondsBetweenLogs,
        activeFrom,
        activeTo, comment, deviceFlags, customFeatures);
    this.vehicleIdentificationNumber = vehicleIdentificationNumber;
    this.engineVehicleIdentificationNumber = engineVehicleIdentificationNumber;
    this.odometer = odometer;
    this.odometerFactor = odometerFactor;
    this.odometerOffset = odometerOffset;
    this.engineHours = engineHours;
    this.engineHourOffset = engineHourOffset;
    this.licensePlate = licensePlate;
    this.licenseState = licenseState;
  }

  @Override
  public void populateDefaults() {
    super.populateDefaults();
    productId = Optional.ofNullable(productId).orElse(UNTRACKED_ASSET_PRODUCT_ID);
    vehicleIdentificationNumber = Optional.ofNullable(vehicleIdentificationNumber).orElse("");
    engineVehicleIdentificationNumber = Optional.ofNullable(engineVehicleIdentificationNumber)
        .orElse("?");
    DeviceDefaultsUtil.addOdometerAdjustmentProviderDefaults(this);
    DeviceDefaultsUtil.addEngineHoursAdjustmentProviderDefaults(this);
    DeviceDefaultsUtil.addLicensableDefaults(this);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy