Interface ListMessage
- All Superinterfaces:
Message
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 Summary
Modifier and TypeMethodDescriptionvoidaddElement(String rowId) Adds an element with the given rowId to the list.voidAdds row data to the list for the given rowIdGets a list of list operations.Gets a list of list rowsvoidinsertElement(String rowId, int position) Inserts an element with the given rowId at the given position within the list.voidremoveElement(String rowId, boolean clear) Removes an element with the given rowId from the list.Methods inherited from interface com.caplin.datasource.messaging.Message
getMessageType, getSubject, isImage, setImage
-
Method Details
-
addElement
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
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
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
Adds row data to the list for the given rowId- Parameters:
rowId- The rowId of the datafields- a map of the fieldsimage- 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 ofSubscriptionListener.- Returns:
- The list operations.
-
getRowData
List<ListRowData> getRowData()Gets a list of list rows
-