Class SimpleDatum

java.lang.Object
net.solarnetwork.domain.BasicIdentity<net.solarnetwork.domain.datum.DatumId>
net.solarnetwork.domain.datum.GeneralDatum
net.solarnetwork.node.domain.datum.SimpleDatum
All Implemented Interfaces:
Serializable, Cloneable, Comparable<net.solarnetwork.domain.datum.DatumId>, net.solarnetwork.domain.datum.Datum, net.solarnetwork.domain.datum.DatumSamplesContainer, net.solarnetwork.domain.datum.DatumSamplesOperations, net.solarnetwork.domain.datum.MutableDatum, net.solarnetwork.domain.datum.MutableDatumSamplesOperations, net.solarnetwork.domain.Differentiable<net.solarnetwork.domain.datum.DatumSamplesOperations>, net.solarnetwork.domain.Identity<net.solarnetwork.domain.datum.DatumId>, MutableNodeDatum, NodeDatum
Direct Known Subclasses:
SimpleAtmosphericDatum, SimpleDayDatum, SimpleEnergyDatum, SimpleEnergyStorageDatum, SimpleNodeControlInfoDatum, SimplePriceDatum

public class SimpleDatum extends net.solarnetwork.domain.datum.GeneralDatum implements NodeDatum, MutableNodeDatum, Cloneable
Abstract base class for NodeDatum implementations.
Since:
2.0
Version:
1.0
Author:
matt
See Also:
  • Field Summary

    Fields inherited from interface net.solarnetwork.domain.datum.Datum

    DATUM_TYPE_PROPERTY, DATUM_TYPES_PROPERTY, OP_STATE, OP_STATES, REVERSE_ACCUMULATING_SUFFIX_KEY, SOURCE_ID, TIMESTAMP

    Fields inherited from interface net.solarnetwork.node.domain.datum.NodeDatum

    TIMESTAMP_UPLOAD
  • Constructor Summary

    Constructors
    Constructor
    Description
    SimpleDatum(net.solarnetwork.domain.datum.DatumId id, net.solarnetwork.domain.datum.DatumSamples samples)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    Public clone method.
    copyWithId(net.solarnetwork.domain.datum.DatumId id)
    Get a copy of this datum with a new ID
    copyWithSamples(net.solarnetwork.domain.datum.DatumSamplesOperations samples)
    Create a copy of this instance with the sample properties replaced by a given samples instance.
    Get the date this object was uploaded to SolarNet.
    locationDatum(Long locationId, String sourceId, Instant timestamp)
    Create a location datum.
    locationDatum(Long locationId, String sourceId, Instant timestamp, net.solarnetwork.domain.datum.DatumSamples samples)
    Create a location datum.
    nodeDatum(String sourceId)
    Create a node datum.
    nodeDatum(String sourceId, Instant timestamp)
    Create a node datum.
    nodeDatum(String sourceId, Instant timestamp, net.solarnetwork.domain.datum.DatumSamples samples)
    Create a node datum.
    void
    setUploaded(Instant uploaded)
    Set the uploaded date.

    Methods inherited from class net.solarnetwork.domain.datum.GeneralDatum

    addTag, asMutableSampleOperations, asSampleOperations, asSimpleMap, clear, createSimpleMap, datumTypes, findSampleValue, getKind, getObjectId, getSampleBigDecimal, getSampleData, getSampleData, getSampleDouble, getSampleFloat, getSampleInteger, getSampleLong, getSamples, getSampleString, getSampleValue, getSourceId, getTags, getTimestamp, hasSampleValue, hasSampleValue, hasTag, isEmpty, nodeDatum, putSampleValue, removeTag, setSampleData, setTags, toString

    Methods inherited from class net.solarnetwork.domain.BasicIdentity

    compareTo, equals, getId, hashCode

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.lang.Comparable

    compareTo

    Methods inherited from interface net.solarnetwork.domain.datum.Datum

    asSampleOperations, asSimpleMap, getKind, getObjectId, getSampleData, getSourceId, getTimestamp

    Methods inherited from interface net.solarnetwork.domain.datum.DatumSamplesOperations

    differsFrom

    Methods inherited from interface net.solarnetwork.domain.Identity

    getId, hasId

    Methods inherited from interface net.solarnetwork.domain.datum.MutableDatum

    asMutableSampleOperations

    Methods inherited from interface net.solarnetwork.domain.datum.MutableDatumSamplesOperations

    copyFrom, mergeFrom, mergeFrom, removeTag
  • Constructor Details

    • SimpleDatum

      public SimpleDatum(net.solarnetwork.domain.datum.DatumId id, net.solarnetwork.domain.datum.DatumSamples samples)
      Constructor.
      Parameters:
      id - the ID
      samples - the samples; if null a new instance will be created
  • Method Details

    • nodeDatum

      public static SimpleDatum nodeDatum(String sourceId)
      Create a node datum.

      The nodeId property will be set to null and presumed to be equal to the ID of the running node. The timestamp will be set to the system time. A new samples instance will be created.

      Parameters:
      sourceId - the source ID
      Returns:
      the new instance
    • nodeDatum

      public static SimpleDatum nodeDatum(String sourceId, Instant timestamp)
      Create a node datum.

      The nodeId property will be set to null and presumed to be equal to the ID of the running node. A new samples instance will be created.

      Parameters:
      sourceId - the source ID
      timestamp - the timestamp
      Returns:
      the new instance
    • nodeDatum

      public static SimpleDatum nodeDatum(String sourceId, Instant timestamp, net.solarnetwork.domain.datum.DatumSamples samples)
      Create a node datum.

      The nodeId property will be set to null and presumed to be equal to the ID of the running node.

      Parameters:
      sourceId - the source ID
      timestamp - the timestamp
      samples - the samples
      Returns:
      the new instance
    • locationDatum

      public static SimpleDatum locationDatum(Long locationId, String sourceId, Instant timestamp)
      Create a location datum.

      A new samples instance will be created.

      Parameters:
      locationId - the location ID
      sourceId - the source ID
      timestamp - the timestamp
      Returns:
      the new instance
    • locationDatum

      public static SimpleDatum locationDatum(Long locationId, String sourceId, Instant timestamp, net.solarnetwork.domain.datum.DatumSamples samples)
      Create a location datum.
      Parameters:
      locationId - the location ID
      sourceId - the source ID
      timestamp - the timestamp
      samples - the samples
      Returns:
      the new instance
    • clone

      public SimpleDatum clone()
      Description copied from interface: NodeDatum
      Public clone method.
      Specified by:
      clone in interface MutableNodeDatum
      Specified by:
      clone in interface NodeDatum
      Overrides:
      clone in class net.solarnetwork.domain.datum.GeneralDatum
      Returns:
      a copy of this instance
    • copyWithSamples

      public SimpleDatum copyWithSamples(net.solarnetwork.domain.datum.DatumSamplesOperations samples)
      Description copied from interface: NodeDatum
      Create a copy of this instance with the sample properties replaced by a given samples instance.
      Specified by:
      copyWithSamples in interface net.solarnetwork.domain.datum.Datum
      Specified by:
      copyWithSamples in interface NodeDatum
      Overrides:
      copyWithSamples in class net.solarnetwork.domain.datum.GeneralDatum
      Parameters:
      samples - the samples to use for the copy
      Returns:
      a new copy of this instance
    • copyWithId

      public SimpleDatum copyWithId(net.solarnetwork.domain.datum.DatumId id)
      Description copied from interface: NodeDatum
      Get a copy of this datum with a new ID
      Specified by:
      copyWithId in interface net.solarnetwork.domain.datum.Datum
      Specified by:
      copyWithId in interface NodeDatum
      Overrides:
      copyWithId in class net.solarnetwork.domain.datum.GeneralDatum
      Returns:
      the copy with the given ID
    • getUploaded

      public Instant getUploaded()
      Description copied from interface: NodeDatum
      Get the date this object was uploaded to SolarNet.
      Specified by:
      getUploaded in interface NodeDatum
      Returns:
      the upload date
    • setUploaded

      public void setUploaded(Instant uploaded)
      Set the uploaded date.
      Parameters:
      uploaded - the date to set