|
Collaboration API Documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.filenet.bso.api.collaboration.TextTemplate
The TextTemplate
class uses a text template and a map of parameters, interprets
the template looking for special template instructions, and returns the result either as a stream,
string or message.
To use it, use code like this
// set up parameters for template HashMap params = new HashMap(); params.put("doc", doc); params.put("folder", folder); params.put("time", time()); TextTemplate tt = new TextTemplate(store, null, null); // interpret the template InputStream in = tt.getStream("mytemplate", params);
The application ID and time zone information are not required; if not available, the application ID is determined from the store's session and the time zone from either the application ID, or, if not found, from the server. Normally, the application ID affects which localized template file is selected and both the locale and the time zone affect some formatting, but certain installations might all be in the same locale and time zone or the template might be written in such a way that this is not significant.
Constructor Summary | |
TextTemplate(com.filenet.wcm.api.ObjectStore store,
java.lang.String applicationID,
java.util.TimeZone timeZone)
Construct a TextTemplate instance. |
Method Summary | |
java.lang.String |
getApplicationID()
Return the current application ID. |
BsoByteArrayWithCharset |
getInclude(java.lang.String name,
java.lang.String applicationID)
Return a byte array representing the text of a template include. |
boolean |
getIsDebug()
Return whether debugging mode is currently set or not. |
byte[] |
getMessageBytes()
Return an array of bytes for the raw form of the message. |
com.filenet.wcm.api.TransportInputStream |
getStream()
Return a JavaAPI TransportInputStream for a recently parsed template. |
com.filenet.wcm.api.TransportInputStream |
getStream(int templateCode,
java.util.Map parameters)
Return a JavaAPI TransportInputStream representing the interpretation of a
template given its template code and parameters. |
com.filenet.wcm.api.TransportInputStream |
getStream(java.lang.String templateName,
java.util.Map parameters)
Return a JavaAPI TransportInputStream representing the interpretation of a
template given its template name and parameters. |
java.lang.String |
getString()
Return a string from the parsed template. |
java.lang.String |
getString(int templateCode,
java.util.Map parameters)
Return a string created using a template code and parameters. |
java.lang.String |
getString(java.lang.String templateName,
java.util.Map parameters)
Return a string created using a template name and parameters. |
void |
parse(BsoByteArrayWithCharset templ,
java.lang.String templateName,
java.util.Map parameters,
java.util.Map extra,
java.util.TimeZone timeZone,
java.util.Map appMap)
Parse the template given its byte array. |
void |
parse(int templateCode,
java.util.Map parameters,
java.util.Map extra,
java.util.TimeZone timeZone,
java.util.Map appMap)
Parse the template represented by a template code. |
void |
parse(java.lang.String templateName,
java.util.Map parameters,
java.util.Map extra,
java.util.TimeZone timeZone,
java.util.Map appMap)
Parse the template given its name. |
void |
setApplicationID(java.lang.String applicationID)
Set the application ID, which is used in looking up the correct template and also to find "localized" versions of the same application for locale lookups. |
void |
setIsDebug(boolean isDebug)
Set or clear debugging mode. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TextTemplate(com.filenet.wcm.api.ObjectStore store, java.lang.String applicationID, java.util.TimeZone timeZone)
TextTemplate
instance.store
- the object store where collaboration email information can be foundapplicationID
- the name of the application. This will also be used to find different
localized versions of the same application. This may be null
, in which case the
appID of the store
's JavaAPI session is used instead.Method Detail |
public java.lang.String getApplicationID()
public void setApplicationID(java.lang.String applicationID)
null
, then the
appID of the object store's JavaAPI session is used instead.applicationID
- the new application ID to usepublic boolean getIsDebug()
true
if in debugging mode, false
otherwisepublic void setIsDebug(boolean isDebug)
isDebug
- if true
, sets debugging mode; if false
,
resets itpublic BsoByteArrayWithCharset getInclude(java.lang.String name, java.lang.String applicationID)
getInclude
in interface com.filenet.bso.api.collaboration.impl.templates.TemplateInclude
name
- the name of the include/template fileapplicationID
- the name of the application (used during template lookup)public void parse(int templateCode, java.util.Map parameters, java.util.Map extra, java.util.TimeZone timeZone, java.util.Map appMap) throws TemplateException
getString
,
getStream
or getMessage
to retrieve the parsed template.templateCode
- the code number for the template (see Collaboration
are a list of the codes)parameters
- the parameters to use with the templateextra
- extra parameters that will be combined with parameters
(may be null
)timeZone
- the time zone to use (may be null
if the default should be used)appMap
- the application map to use (may be null
)public void parse(java.lang.String templateName, java.util.Map parameters, java.util.Map extra, java.util.TimeZone timeZone, java.util.Map appMap) throws TemplateException
getString
,
getStream
or getMessage
to retrieve the parsed template.templateName
- the code number for the template (see Collaboration
are a list of the codes)parameters
- the parameters to use with the templateextra
- extra parameters that will be combined with parameters
(may be null
)timeZone
- the time zone to use (may be null
)appMap
- the application map to use (may be null
)public void parse(BsoByteArrayWithCharset templ, java.lang.String templateName, java.util.Map parameters, java.util.Map extra, java.util.TimeZone timeZone, java.util.Map appMap) throws TemplateException
getString
,
getStream
or getMessage
to retrieve the parsed template.templ
- the byte array for this template with its charset, if knowntemplateName
- the name of the template (may be null
)parameters
- the parameters to use with the templateextra
- extra parameters that will be combined with parameters
(may be null
)timeZone
- the time zone to use (may be null
)appMap
- the application map to use (may be null
)public com.filenet.wcm.api.TransportInputStream getStream(int templateCode, java.util.Map parameters)
TransportInputStream
representing the interpretation of a
template given its template code and parameters. This is a convenience routine
that first calls parse
before getting the stream.templateCode
- the code for this templateparameters
- values to use when interpreting the templateTemplateException
- if anything goes awrypublic com.filenet.wcm.api.TransportInputStream getStream(java.lang.String templateName, java.util.Map parameters)
TransportInputStream
representing the interpretation of a
template given its template name and parameters. This is a convenience routine
that first calls parse
before getting the stream.templateName
- the name of the template on the CEparameters
- values to use when interpreting the templateTemplateException
- if anything goes awrypublic com.filenet.wcm.api.TransportInputStream getStream()
TransportInputStream
for a recently parsed template. One of the
parse
methods must be called before calling this method. The template must only
generate a single section (plain, HTML or attachment) or an exception will be thrown.TemplateException
- if anything goes awrypublic java.lang.String getString(int templateCode, java.util.Map parameters)
parse
before getting the string.templateCode
- the template code to useparameters
- values to use when interpreting the templatepublic java.lang.String getString(java.lang.String templateName, java.util.Map parameters)
parse
before getting the string.templateName
- the name of the template to useparameters
- values to use when interpreting the templatepublic java.lang.String getString()
parse
methods must be called
before using this method. The template must only
generate a single section (plain, HTML or attachment) or an exception will be thrown.public byte[] getMessageBytes()
from
and message-id
headers will be filled in, but the to
, cc
, date
, reply-to
and possibly the subject
mail headers will not be set in this raw message. One of the
parse
methods should be called before calling this method.
|
Collaboration API Documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |