Class ChangeTable

java.lang.Object
org.bedework.calfacade.util.ChangeTable
All Implemented Interfaces:
Serializable, org.bedework.util.logging.Logged

public class ChangeTable extends Object implements org.bedework.util.logging.Logged, Serializable
Class to track changes to calendar entities. CalDAV (and file uploads) present a new copy of the event. From this we have to figure out what the changes were and apply only those changes.

This is particularly important for multivalued fields where replacement of the entire property can lead to a large number of deletions and reinsertions.

Author:
Mike Douglass
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    ChangeTable(String userHref)
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addValue(org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex index, Object val)
     
    void
    addValues(org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex index, Collection<?> val)
     
    boolean
    changed(org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex index, Object from, Object to)
    Return true if from is not the same as to and set the entry changed flag.
    void
    Clear all changes - will force an update
    void
    Dump the entries.
     
    getEntry(org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex index)
    Get the indexed entry
    org.bedework.util.logging.BwLogger
     
    boolean
     
    boolean
    Get the collection set changed flag - true if any collection had entries added or removed.
     
    boolean
     
    void
    mark the addition or removal of members of a collection
    boolean
    present(org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex index)
    Set the present flag on the named entry.
    void
    processChanges(BwEvent ev, boolean update, boolean attendeeFromOrganizer)
    Go through the change table entries removing fields that were not present in the incoming data.
    boolean
    True if any recurrence property changed.
    boolean
    True if any recurrence rules property changed.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.bedework.util.logging.Logged

    audit, debug, debug, debug, enableAuditLogger, enableErrorLogger, enableMetricsLogger, error, error, error, getLogLevel, info, isAuditLoggerEnabled, isErrorLoggerEnabled, isMetricsDebugEnabled, isMetricsLoggerEnabled, metrics, setLoggerClass, setLoggerClass, trace, trace, trace, warn
  • Constructor Details

    • ChangeTable

      public ChangeTable(String userHref)
      Constructor
      Parameters:
      userHref - principal href
  • Method Details

    • getUserHref

      public String getUserHref()
      Returns:
      user we are acting for
    • clear

      public void clear()
      Clear all changes - will force an update
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if no change information has been added.
    • getSignificantChange

      public boolean getSignificantChange()
      Get the collection set changed flag - true if any collection had entries added or removed.
      Returns:
      boolean false if no change to any collection set
    • getSequenceChangeNeeded

      public boolean getSequenceChangeNeeded()
      Returns:
      true if a change requires the sequence be updated
    • present

      public boolean present(org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex index)
      Set the present flag on the named entry.
      Parameters:
      index - of property
      Returns:
      boolean false if entry not found
    • changed

      public boolean changed(org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex index, Object from, Object to)
      Return true if from is not the same as to and set the entry changed flag.
      Parameters:
      index - - the property index
      from - old value
      to - new value
      Returns:
      boolean true if changed
    • addValue

      public void addValue(org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex index, Object val)
      Parameters:
      index - - the property index
      val - to add
    • addValues

      public void addValues(org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex index, Collection<?> val)
      Parameters:
      index - - the property index
      val - to add
    • getEntry

      public ChangeTableEntry getEntry(org.bedework.util.calendar.PropertyIndex.PropertyInfoIndex index)
      Get the indexed entry
      Parameters:
      index - - the property index
      Returns:
      Entry null if not found
    • getEntries

      public Collection<ChangeTableEntry> getEntries()
      Returns:
      entries added to table.
    • processChanges

      public void processChanges(BwEvent ev, boolean update, boolean attendeeFromOrganizer)
      Go through the change table entries removing fields that were not present in the incoming data. This method is for the traditional update by replacement approach. Do NOT call for the patch or selective update approach as found in e.g. SOAP.
      Parameters:
      ev - to update
      update - true to do update
      attendeeFromOrganizer - true if we are updating an attendee from the organizer message
    • noteCollectionSetChanged

      public void noteCollectionSetChanged()
      mark the addition or removal of members of a collection
    • recurrenceChanged

      public boolean recurrenceChanged()
      True if any recurrence property changed.
      Returns:
      boolean true if changed
    • recurrenceRulesChanged

      public boolean recurrenceRulesChanged()
      True if any recurrence rules property changed.
      Returns:
      boolean true if changed
    • dumpEntries

      public void dumpEntries()
      Dump the entries.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getLogger

      public org.bedework.util.logging.BwLogger getLogger()
      Specified by:
      getLogger in interface org.bedework.util.logging.Logged