Class AfterSaveEventUtils

java.lang.Object
de.hybris.platform.tx.AfterSaveEventUtils

public class AfterSaveEventUtils extends Object
Utility class to encode the entity changes.
  • Constructor Details

    • AfterSaveEventUtils

      public AfterSaveEventUtils()
  • Method Details

    • 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:
    • decodePK

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

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

      public static 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 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