Class TNEFWorker
- java.lang.Object
-
- com.levigo.jadice.server.core.NodeWorker<T>
-
- com.levigo.jadice.server.core.StreamWorker<TNEFNode>
-
- com.levigo.jadice.server.javamail.TNEFWorker
-
- All Implemented Interfaces:
QualifiedLogEventReceiver
,WorkerController<TNEFNode>
,Runnable
public class TNEFWorker extends StreamWorker<TNEFNode>
-
-
Constructor Summary
Constructors Constructor Description TNEFWorker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BundledStream
addRTFBodyToOutputBundle(StreamDescriptor sdParent, String rtfBody)
protected net.freeutils.tnef.mime.TNEFMimeMessage
convert(InputStream is, TNEFNode.InputFormat inputFormat)
protected void
extractBodyViaPOI(StreamDescriptor sdParent, com.levigo.jadice.document.io.UncloseableSeekableInputStream uncloseableSeekableInputStream)
protected net.freeutils.tnef.Message
extractStream(InputStream stream, TNEFNode.InputFormat format)
String
getRtfTextBodyCharset()
protected void
replaceRecipientInformation(net.freeutils.tnef.Message msg, javax.mail.internet.MimeMessage mimeMsg)
void
setRtfTextBodyCharset(String rtfTextBodyCharset)
protected void
substituteDateHeaderField(net.freeutils.tnef.Message msg, javax.mail.internet.MimeMessage mimeMsg)
Substitute "Date" header field.protected void
substituteDateHeaderFieldIfEmpty(net.freeutils.tnef.Message msg, javax.mail.internet.MimeMessage mimeMsg)
Substitute "Date" header field if it is empty.protected void
substituteFromHeaderField(net.freeutils.tnef.Message msg, javax.mail.internet.MimeMessage mimeMsg)
Substitute "From" header field.protected void
substituteFromHeaderFieldIfEmpty(net.freeutils.tnef.Message msg, javax.mail.internet.MimeMessage mimeMsg)
Substitute "From" header field if it is empty.protected void
substituteHeaderFields(net.freeutils.tnef.Message msg, javax.mail.internet.MimeMessage mimeMsg)
Creates/Replaces header fields of the target message with a MAPIProp values of the source message.protected void
work(Stream stream)
Implement this method in order to work on a single stream.-
Methods inherited from class com.levigo.jadice.server.core.StreamWorker
accept, reject, work
-
Methods inherited from class com.levigo.jadice.server.core.NodeWorker
abort, abortNow, addInputBundle, addOutputBundle, doAbort, doAbortNow, error, error, error, fail, fail, fail, getController, getInputBundle, getInputBundles, getJob, getLimitSupport, getNode, getOutputBundle, getOutputBundles, getServerJob, getState, getStreamTransportFactory, getTransportSender, initialize, isAbortRequested, postWork, preWork, run, setDescriptor, setJob, toString, warn, warn, warn
-
-
-
-
Method Detail
-
work
protected void work(Stream stream) throws Throwable
Description copied from class:StreamWorker
Implement this method in order to work on a single stream.- Specified by:
work
in classStreamWorker<TNEFNode>
- Parameters:
stream
- theStream
to work on- Throws:
Throwable
- in case of processing failure
-
extractBodyViaPOI
protected void extractBodyViaPOI(StreamDescriptor sdParent, com.levigo.jadice.document.io.UncloseableSeekableInputStream uncloseableSeekableInputStream)
-
addRTFBodyToOutputBundle
protected BundledStream addRTFBodyToOutputBundle(StreamDescriptor sdParent, String rtfBody) throws IOException
- Throws:
IOException
-
convert
protected net.freeutils.tnef.mime.TNEFMimeMessage convert(InputStream is, TNEFNode.InputFormat inputFormat) throws IOException, javax.mail.MessagingException
- Throws:
IOException
javax.mail.MessagingException
-
extractStream
protected net.freeutils.tnef.Message extractStream(InputStream stream, TNEFNode.InputFormat format) throws IOException
- Throws:
IOException
-
substituteHeaderFields
protected void substituteHeaderFields(net.freeutils.tnef.Message msg, javax.mail.internet.MimeMessage mimeMsg) throws IOException, javax.mail.MessagingException
Creates/Replaces header fields of the target message with a MAPIProp values of the source message.- Parameters:
msg
- the source message.mimeMsg
- the target message.- Throws:
IOException
- if MAPIProp values couldn't be read.javax.mail.MessagingException
- if a target message header couldn't be added/changed.
-
replaceRecipientInformation
protected void replaceRecipientInformation(net.freeutils.tnef.Message msg, javax.mail.internet.MimeMessage mimeMsg)
-
substituteFromHeaderFieldIfEmpty
protected void substituteFromHeaderFieldIfEmpty(net.freeutils.tnef.Message msg, javax.mail.internet.MimeMessage mimeMsg) throws javax.mail.MessagingException, IOException
Substitute "From" header field if it is empty. See JS-1667.- Parameters:
msg
- the source message.mimeMsg
- the target message.- Throws:
javax.mail.MessagingException
- if the target header field couldn't be set.IOException
- if MAPIProp values couldn't be read.
-
substituteFromHeaderField
protected void substituteFromHeaderField(net.freeutils.tnef.Message msg, javax.mail.internet.MimeMessage mimeMsg) throws IOException, javax.mail.MessagingException
Substitute "From" header field. See JS-1667.- Parameters:
msg
- the source message.mimeMsg
- the target message.- Throws:
IOException
- if MAPIProp values couldn't be read.javax.mail.MessagingException
- if the target header field couldn't be set.
-
substituteDateHeaderFieldIfEmpty
protected void substituteDateHeaderFieldIfEmpty(net.freeutils.tnef.Message msg, javax.mail.internet.MimeMessage mimeMsg) throws javax.mail.MessagingException, IOException
Substitute "Date" header field if it is empty. See JS-1667. Since version 1.6.0 javax.mail sets the the Date header to the current date if it is empty. But we would prefer the value ofMAPIProp.PR_CLIENT_SUBMIT_TIME
. That's why we check if it is present in the source message and overwrite the Date header set by javax.mail in the target message. See JS-1963.- Parameters:
msg
- the source message.mimeMsg
- the target message.- Throws:
javax.mail.MessagingException
- if the target header field couldn't be set.IOException
- if MAPIProp values couldn't be read.
-
substituteDateHeaderField
protected void substituteDateHeaderField(net.freeutils.tnef.Message msg, javax.mail.internet.MimeMessage mimeMsg) throws IOException
Substitute "Date" header field. See JS-1667.- Parameters:
msg
- the source message.mimeMsg
- the target message.- Throws:
IOException
- if MAPIProp values couldn't be read.
-
getRtfTextBodyCharset
public String getRtfTextBodyCharset()
-
setRtfTextBodyCharset
public void setRtfTextBodyCharset(String rtfTextBodyCharset)
-
-