public interface TransformerData extends DSData, TransformerFlags
Represents an update for a particular object. An update may be
received by a Transformer module if it has subscribed to some data
using either the Subscriber.addSubscriptionListener(String, SubscriptionListener)
or the Subscriber.addSubscriptionListener(ObjectType, SubscriptionListener)
methods. Alternatively, the Transformer module can create an update
using one of the DSFactory.createTransformerData(java.lang.String, com.caplin.transformer.module.ObjectType)
methods, and can send the update to the Transformer core for
processing.
The option to create instances of a TransformerData is vital for
any Transformer module that wants to act as a DataProvider
,
or to process an update for one DataSource object, and publish the
results of the processing on a different DataSource object.
As soon as the update is sent, its memory is freed by the
Transformer core. Any further attempts to use the object will
result in IllegalStateExceptions being thrown. If the update needs
to be sent, then further changes made to the object, the
DSFactory.createTransformerData(TransformerData)
method should be used to create a copy of the object before the
update is sent.
DSFactory
CONTAINER_TYPE, F_AUTH_UPDATE, F_AUTHGLOBAL, F_CHANGEDFIELDS, F_CLEAR_PERMISSIONS, F_CLEAR_TYPE2, F_CLEAR_TYPE3, F_CREATEOBJECT, F_CREATEPARENT, F_DELETE_PERMISSION, F_FILTER_TYPE2, F_FILTER_TYPE3, F_IMAGE, F_NONACTIVE, GENERIC_TYPE, NEWS_TYPE, PAGE_TYPE, PERMISSION_TYPE, RECORD_TYPE, STORY_TYPE, TYPE2_RECORD_TYPE, TYPE3_RECORD_TYPE, UNKNOWN_TYPE
MAINTAIN_TIMESTAMP, NO_FLAGS, NO_PERSISTENCE, PUBLISH_TO_PEERS, SILENT_SEND, STORE_IN_CACHE
Modifier and Type | Method and Description |
---|---|
long |
getDSDataPointer()
Gets the pointer to the C ds_data struct that holds the state
information for the update.
|
ObjectType |
getObjectType()
Gets the update's object type.
|
int |
getSequenceNumber()
Gets the update's sequence number.
|
int |
merge(TransformerData transformerDataToMerge)
Merges the fields from the specified TransformerData with those
in this TransformerData.
|
void |
send(int flags)
Sends the update to the Transformer core.
|
void |
setType(ObjectType objectType)
Sets the update's object type to the specified type.
|
addBinaryData, addBinaryData, addBinaryData, addBinaryData, addBinaryData, addBinaryData, addBinaryData, addBinaryData, addData, addData, addData, addData, addData, addData, addData, addData, clearFields, count, elements, getFieldByFieldNumber, getFieldByFieldNumber, getFlags, getKeys, getSubject, getType, getValues, iterator, removeField, setFlags, setSubject, setType, updateData, updateData
send, sendDirect, sendToPeer
toBytes
long getDSDataPointer()
Gets the pointer to the C ds_data struct that holds the state information for the update. This method is used internally by the TransformerData.
Once the update has been sent, pointer is nulled down, and this method will throw a IllegalStateException.
IllegalStateException
- If the update has already been sent
using either the DSPacket.send()
or send(int)
methods.void setType(ObjectType objectType)
Sets the update's object type to the specified type.
objectType
- The type of object.NullPointerException
- If the objectType is null.ObjectType getObjectType()
Gets the update's object type.
int getSequenceNumber()
Gets the update's sequence number.
int merge(TransformerData transformerDataToMerge)
Merges the fields from the specified TransformerData with those in this TransformerData. If a field does not exist within this TransformerData then the field will be added to it. If the field already exists, then its value will be updated.
If a field exists multiple times (as occurs with type 2 and type 3 records), only the first occurrence will be merged.
transformerDataToMerge
- The TransformerData from which the
fields should be merged from.void send(int flags)
Sends the update to the Transformer core. The specified flags will determine what the core does with the update.
As soon as the update is sent, its memory is freed by the
Transformer core. Any further attempts to use the object will
result in IllegalStateExceptions being thrown. If the update needs
to be sent, then further changes made to the object, the
DSFactory.createTransformerData(TransformerData)
method should be used to create a copy of the object before the
update is sent.
The valid flags are:
flags
- The flags that should be passed to the Transformer
core to tell it how to process the update.IllegalStateException
- If the update has already been sent.Please send bug reports and comments to Caplin support