Class AfterSaveEventUtils


  • public class AfterSaveEventUtils
    extends java.lang.Object
    Utility class to encode the entity changes.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Collection<AfterSaveEvent> createEventsFromChanges​(byte[][] changes)
      Creates the effective set of AfterSaveEvent objects from a array of encoded changes ( which are byte arrays as well).
      static java.util.Collection<AfterSaveEvent> createEventsFromChanges​(byte[][] changes, boolean removeUnnecessaryTypes)
      Creates the effective set of AfterSaveEvent objects from a array of encoded changes ( which are byte arrays as well).
      static int decodeChangeTypes​(byte[] encodedChanges)
      Decoded changes from encoded changes byte array.
      static PK decodePK​(byte[] encodedChanges)
      Decoded PK from encoded changes byte array.
      static byte[] encodeChanges​(PK pk, int types)
      Encodes several changes of one PK into a byte array.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AfterSaveEventUtils

        public AfterSaveEventUtils()
    • Method Detail

      • encodeChanges

        public static byte[] encodeChanges​(PK pk,
                                           int types)
        Encodes several changes of one PK into a byte array.
        Returns:
        a byte array and its length is 9. The first eight bytes store the long value of PK, and the last one contains the type information.
        See Also:
        decodeChangeTypes(byte[]), decodePK(byte[])
      • decodePK

        public static PK decodePK​(byte[] encodedChanges)
        Decoded PK from encoded changes byte array.
        Returns:
        the decoded PK from the byte array.
        See Also:
        encodeChanges(PK, int)
      • decodeChangeTypes

        public static int decodeChangeTypes​(byte[] encodedChanges)
        Decoded changes from encoded changes byte array.
        Returns:
        the type change information
        See Also:
        encodeChanges(PK, int)
      • createEventsFromChanges

        public static java.util.Collection<AfterSaveEvent> createEventsFromChanges​(byte[][] changes)
        Creates the effective set of AfterSaveEvent objects from a array of encoded changes ( which are byte arrays as well).

        Please note that unnecessary change types are silently removed.

        Returns:
        all AfterSaveEvents
      • createEventsFromChanges

        public static java.util.Collection<AfterSaveEvent> createEventsFromChanges​(byte[][] changes,
                                                                                   boolean removeUnnecessaryTypes)
        Creates the effective set of AfterSaveEvent objects from a array of encoded changes ( which are byte arrays as well).
        Parameters:
        removeUnnecessaryTypes - if true change types that are considered unnecessary are not translated into events. These are: any UPDATE which has a matching REMOVE; any UPDATE that has a matching CREATE and no REMOVE.
        Returns:
        all AfterSaveEvents