public class MetadataDocumentCopier extends MessageCopier
MessageSplitter
which creates multiple instances of the same document based on a metadata key.
The split messages will always contain the entire document, the metadata key containing the number of documents to generate.
In the adapter configuration file this class is aliased as metadata-document-copier which is the preferred alternative to the fully qualified classname when building your configuration.
MessageCopier.MessageCallback, MessageCopier.MessageCopierIterator
MessageSplitterImp.SplitMessageIterator
logR
Constructor and Description |
---|
MetadataDocumentCopier() |
MetadataDocumentCopier(java.lang.String key) |
MetadataDocumentCopier(java.lang.String key,
java.lang.String indexKey) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getIndexMetadataKey() |
java.lang.String |
getMetadataKey() |
void |
setIndexMetadataKey(java.lang.String s)
The metadata key storing the current index of the message from
setMetadataKey(String)
will be stored (zero based index). |
void |
setMetadataKey(java.lang.String key)
Set the metadata key to use to for generating msgs.
|
CloseableIterable<AdaptrisMessage> |
splitMessage(AdaptrisMessage msg)
Splits an
AdaptrisMessage into some number of AdaptrisMessage objects. |
duplicateWithPayload, toInteger
copyMetadata, getCopyMetadata, getCopyObjectMetadata, getMessageFactory, selectFactory, setCopyMetadata, setCopyObjectMetadata, setMessageFactory
public MetadataDocumentCopier()
public MetadataDocumentCopier(java.lang.String key)
public MetadataDocumentCopier(java.lang.String key, java.lang.String indexKey)
public CloseableIterable<AdaptrisMessage> splitMessage(AdaptrisMessage msg) throws CoreException
MessageSplitter
Splits an AdaptrisMessage
into some number of AdaptrisMessage objects. Preservation of metadata is down to the
implementation.
If this method returns a CloseableIterable
, it must be closed by the caller! This contract cannot be clearly
expressed in Java code without breaking the API in uncomfortable ways for things just returning a List, which is why
this method is only declared to return Iterable.
msg
- the msg to splitIterable
of AdaptrisMessage
CoreException
- wrapping any other exceptionpublic void setMetadataKey(java.lang.String key)
key
- the metadata keypublic java.lang.String getMetadataKey()
public java.lang.String getIndexMetadataKey()
public void setIndexMetadataKey(java.lang.String s)
setMetadataKey(String)
will be stored (zero based index).s
- the index metadata key to set