Interface ListMessage

All Superinterfaces:
Message

public interface ListMessage extends Message
An instance of ListMessage represents an update to a list.

 

You do not have to implement this interface yourself. An instance can be constructed using the MessageFactory.createListMessage(String) method of the MessageFactory that is available on the Publisher interface.

 

If you make a subscription to a namespace and receive a ListMessage via the SubscriptionListener.listUpdated(com.caplin.datasource.subscription.Subscription, com.caplin.datasource.Peer, ListMessage) callback method on your implementation of SubscriptionListener then there are two ways to process the incoming message, a basic approach and a model-based approach. For details, see getOperations().

Note: After publishing a message, do not reuse the message (e.g. change the content, republish) as this can cause issues.

  • Method Details

    • addElement

      void addElement(String rowId)
      Adds an element with the given rowId to the list.

       

      The element is added to the end of the list. For example, if there are three elements already in the list at positions 0, 1, and 2 respectively, adding a fourth element places it at position 3.

       

      Use this method when building a list message to send via a Publisher.

      Parameters:
      rowId - The rowId of the element to add.
    • removeElement

      void removeElement(String rowId, boolean clear)
      Removes an element with the given rowId from the list.

       

      Use this method when building a list message to send using a Publisher.

      Parameters:
      rowId - The rowId of the element to be to removed.
      clear - if set the underlying row data is removed
    • insertElement

      void insertElement(String rowId, int position)
      Inserts an element with the given rowId at the given position within the list.

       

      Use this method when building a list message to send using a Publisher.

      Parameters:
      rowId - The rowId of the element to be inserted.
      position - The position at which to insert the element. The first element in a list is at position 0.
    • addRow

      void addRow(String rowId, Map<String,String> fields, boolean image)
      Adds row data to the list for the given rowId
      Parameters:
      rowId - The rowId of the data
      fields - a map of the fields
      image - set to true if this update is an image update
    • getOperations

      List<ListOperation> getOperations()
      Gets a list of list operations. The order of the operations is significant.

       

      Use this method to examine the contents of a list message when you receive it via the callback method SubscriptionListener.listUpdated(com.caplin.datasource.subscription.Subscription, com.caplin.datasource.Peer, ListMessage) on your implementation of SubscriptionListener.

      Returns:
      The list operations.
    • getRowData

      List<ListRowData> getRowData()
      Gets a list of list rows