Class BwLastMod<T extends BwDbentity,T1>

Type Parameters:
T - type we are a lastmod for
T1 - the actual class.
All Implemented Interfaces:
Serializable, Comparable<T1>, org.bedework.util.logging.Logged
Direct Known Subclasses:
BwCollectionLastmod

public class BwLastMod<T extends BwDbentity,T1> extends BwUnversionedDbentity<T1>
This is used to store the last modification times for some entities. We do this to avoid the overhead and errors caused by versioning when not needed.

For example, we frequently update a calendar collections last mod when events are changed. We need this lastmod to flag collection that have changed, on the other hand we don't need the possibility of StaleStateExceptions.

The touch method will update this object only and save it avoiding most of tha overhead.

Version:
1.0
Author:
Mike Douglass
See Also:
  • Constructor Details

    • BwLastMod

      public BwLastMod(T dbEntity)
      No date constructor
      Parameters:
      dbEntity - related db entity
    • BwLastMod

      public BwLastMod(T dbEntity, Date dt)
      Constructor to set last mod
      Parameters:
      dbEntity - related db entity
      dt - datetime
  • Method Details

    • setId

      public void setId(int val)
      Overrides:
      setId in class BwUnversionedDbentity<T1>
      Parameters:
      val - the id
    • getId

      public int getId()
      Overrides:
      getId in class BwUnversionedDbentity<T1>
      Returns:
      int id
    • setDbEntity

      public void setDbEntity(T val)
      Parameters:
      val - related db entity
    • getDbEntity

      public T getDbEntity()
      Returns:
      T
    • setTimestamp

      public void setTimestamp(String val)
      Parameters:
      val - timestamp of change
    • getTimestamp

      public String getTimestamp()
      Returns:
      String lastmod
    • setSequence

      public void setSequence(int val)
      Set the sequence
      Parameters:
      val - sequence number
    • getSequence

      public int getSequence()
      Get the sequence
      Returns:
      int the sequence
    • unsaved

      public boolean unsaved()
      Overrides:
      unsaved in class BwUnversionedDbentity<T1>
      Returns:
      true if this entity is not saved.
    • setHref

      public void setHref(String val)
      Set the href - ignored
      Overrides:
      setHref in class BwUnversionedDbentity<T1>
      Parameters:
      val - String href
    • getHref

      public String getHref()
      Overrides:
      getHref in class BwUnversionedDbentity<T1>
      Returns:
      non null unique href for the entity
    • updateLastmod

      public void updateLastmod(Timestamp val)
      Update last mod fields
      Parameters:
      val - timestamp of change
    • getTagValue

      public String getTagValue()
      Return a value that can be used for etag and ctag support
      Returns:
      String tag value
    • getTagValue

      public static String getTagValue(String timestamp, int sequence)
      Return a value that can be used for etag and ctag support
      Parameters:
      timestamp - of change
      sequence - to allow sub microsec precision
      Returns:
      String tag value
    • toStringSegment

      protected void toStringSegment(org.bedework.util.misc.ToString ts)
      Add our stuff to the StringBuilder
      Overrides:
      toStringSegment in class BwUnversionedDbentity<T1>
      Parameters:
      ts - for result
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class BwUnversionedDbentity<T1>