Class AggregateDatumId

java.lang.Object
net.solarnetwork.domain.BaseId
net.solarnetwork.central.domain.AggregateDatumId
All Implemented Interfaces:
Serializable, Cloneable, Comparable<AggregateDatumId>

public class AggregateDatumId extends net.solarnetwork.domain.BaseId implements Cloneable, Serializable, Comparable<AggregateDatumId>
A general aggregate datum identifier.
See Also:
  • Constructor Details

    • AggregateDatumId

      public AggregateDatumId(net.solarnetwork.domain.datum.ObjectDatumKind kind, Long objectId, String sourceId, Instant timestamp, net.solarnetwork.domain.datum.Aggregation aggregation)
      Constructor.
      Parameters:
      kind - the kind
      objectId - the stream object ID
      sourceId - ID the stream source ID
      timestamp - the time stamp
      aggregation - the aggregation
  • Method Details

    • nodeId

      public static AggregateDatumId nodeId(Long nodeId, String sourceId, Instant timestamp, net.solarnetwork.domain.datum.Aggregation aggregation)
      Create a new node aggregate datum ID.
      Parameters:
      nodeId - the node ID
      sourceId - the source ID
      timestamp - the timestamp
      aggregation - the aggregation
      Returns:
      the new instance
    • locationId

      public static AggregateDatumId locationId(Long locationId, String sourceId, Instant timestamp, net.solarnetwork.domain.datum.Aggregation aggregation)
      Create a new location datum stream ID.
      Parameters:
      locationId - the node ID
      sourceId - the source ID
      timestamp - the timestamp
      aggregation - the aggregation
      Returns:
      the new instance
    • clone

      public AggregateDatumId clone()
      Overrides:
      clone in class net.solarnetwork.domain.BaseId
    • populateIdValue

      protected void populateIdValue(StringBuilder buf)
      Specified by:
      populateIdValue in class net.solarnetwork.domain.BaseId
    • populateStringValue

      protected void populateStringValue(StringBuilder buf)
      Specified by:
      populateStringValue in class net.solarnetwork.domain.BaseId
    • compareTo

      public int compareTo(AggregateDatumId o)
      Specified by:
      compareTo in interface Comparable<AggregateDatumId>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • isValidObjectId

      public boolean isValidObjectId(net.solarnetwork.domain.datum.ObjectDatumKind expectedKind)
      Test if this object ID is fully specified.
      Parameters:
      expectedKind - the kind to match
      Returns:
      true if expectedKind is the same as this object's kind and objectId, sourceId, timestamp are all non-null and non-empty
    • isValidAggregateObjectId

      public boolean isValidAggregateObjectId(net.solarnetwork.domain.datum.ObjectDatumKind expectedKind)
      Test if this object ID is fully specified as an aggregate.
      Parameters:
      expectedKind - the kind to match
      Returns:
      true if isValidObjectId(ObjectDatumKind) returns true and aggregation is non-null
      See Also:
    • getKind

      public net.solarnetwork.domain.datum.ObjectDatumKind getKind()
      Get the kind.
      Returns:
      the kind
    • getObjectId

      public Long getObjectId()
      Get the object ID.
      Returns:
      the object ID
    • getSourceId

      public String getSourceId()
      Get the source ID.
      Returns:
      the source ID
    • getTimestamp

      public Instant getTimestamp()
      Get the timestamp.
      Returns:
      the timestamp
    • getAggregation

      public net.solarnetwork.domain.datum.Aggregation getAggregation()
      Get the aggregation.
      Returns:
      the aggregation