T
- 後続で実行されるビジネスロジックに適した型public abstract class AbstractTemplateEngineOnMessageHub<T> extends Object implements TemplateEngine<T>
getInputStreamOfRawTemplate(TemplateSearchCondition)
: テンプレートファイルを解決し、その内容を InputStream で返却する。replace(InputStream, TemplateContext, String, String)
: 1.の結果と、TemplateContextを用いて、変換処理を行う。convertToSuitableLogic(InputStream)
: 2.の変換処理結果を、後続で実行されるビジネスロジックに適した型に変換する。コンストラクタと説明 |
---|
AbstractTemplateEngineOnMessageHub() |
修飾子とタイプ | メソッドと説明 |
---|---|
protected abstract T |
convertToSuitableLogic(InputStream in)
後続で実行されるビジネスロジックに適した型に変換します。
|
void |
destory()
テンプレートエンジンが破棄されるタイミングで呼ばれます。
|
protected String |
escape(String str)
replaceLine(String, TemplateContext, String, String) にて行うXMLエスケープ処理を実装します。 |
protected InputStream |
getInputStreamOfRawTemplate(TemplateSearchCondition templateSearchCondition)
引数に渡された情報を元にテンプレートファイルを検索し、その内容を InputStream で返却します。
|
protected String |
getPlaceHolderPrefix()
プレースホルダの接頭辞を取得します。
|
protected String |
getPlaceHolderSuffix()
プレースホルダの接尾辞を取得します。
|
void |
init()
テンプレートエンジンを初期化します。
|
boolean |
isSupported(Object templateSearchCondition)
引数に指定された「テンプレートを特定するための情報」をサポートするかどうかを返却します。
|
T |
process(Object templateSearchCondition,
TemplateContext templateContext)
テンプレートを利用した変換処理を行います。
|
protected String |
removeCharacter(String str)
replaceLine(String, TemplateContext, String, String) にて行う違反文字削除処理を実装します。 |
protected InputStream |
replace(InputStream in,
TemplateContext templateContext,
String placeHolderPrefix,
String placeHolderSuffix)
テンプレートの変換処理を行います。
|
protected String |
replaceLine(String line,
TemplateContext templateContext,
String placeHolderPrefix,
String placeHolderSuffix)
一行分の文字列を含んだ 引数「line」を変換します。
|
public void destory()
TemplateEngine
destory
インタフェース内 TemplateEngine<T>
public void init()
TemplateEngine
init
インタフェース内 TemplateEngine<T>
public boolean isSupported(Object templateSearchCondition)
TemplateEngine
isSupported
インタフェース内 TemplateEngine<T>
templateSearchCondition
- テンプレートを特定するための情報public T process(Object templateSearchCondition, TemplateContext templateContext) throws TemplateSearchException, TemplateReplaceException
TemplateEngine
TemplateContext
に格納された情報を用いて変換する。process
インタフェース内 TemplateEngine<T>
templateSearchCondition
- テンプレートを特定するための情報templateContext
- テンプレートコンテキストTemplateSearchException
- テンプレートが解決できなかった場合。TemplateReplaceException
- テンプレートエンジンによる変換処理が失敗した場合。protected abstract T convertToSuitableLogic(InputStream in)
in
- テンプレートファイルの変換処理結果protected String escape(String str)
replaceLine(String, TemplateContext, String, String)
にて行うXMLエスケープ処理を実装します。str
- 元文字列protected InputStream getInputStreamOfRawTemplate(TemplateSearchCondition templateSearchCondition) throws TemplateSearchException
PublicStorage
配下にあるテンプレートファイルを以下の順番で検索します。getFilePathIfIncludeInList(List, String, Locale, String)
を参照してください)
${im_template_root} | TEMPLATE_DIRECTORY_ROOT_PATH の 値 |
---|---|
${media} | 引数に渡された TemplateSearchCondition 内の配信先メディアID |
${event} | 引数に渡された TemplateSearchCondition 内のイベントID |
${locale} | 引数に渡された TemplateSearchCondition 内のロケールID |
templateSearchCondition
- テンプレートを特定するための情報TemplateSearchException
- テンプレートファイルの検索に失敗した場合protected String getPlaceHolderPrefix()
protected String getPlaceHolderSuffix()
protected String removeCharacter(String str)
replaceLine(String, TemplateContext, String, String)
にて行う違反文字削除処理を実装します。str
- 元文字列StringUtil.removeControlCharacterWithoutTCL(String)
protected InputStream replace(InputStream in, TemplateContext templateContext, String placeHolderPrefix, String placeHolderSuffix) throws TemplateReplaceException
in
- テンプレートファイルの内容templateContext
- テンプレートコンテキストplaceHolderPrefix
- プレースホルダの接頭辞placeHolderSuffix
- プレースホルダの接尾辞TemplateReplaceException
- 変換処理が失敗した場合protected String replaceLine(String line, TemplateContext templateContext, String placeHolderPrefix, String placeHolderSuffix)
TemplateContext#get(プレースホルダ名)
の値で変換。ReplaceEventHandler.onReplace(TemplateContext, String, Object, String...)
を順番に実行し、変換処理を繰り返す。line
- 一行分の文字列templateContext
- テンプレートコンテキストplaceHolderPrefix
- プレースホルダの接頭辞placeHolderSuffix
- プレースホルダの接尾辞Copyright © 2012 NTT DATA INTRAMART CORPORATION