@Component @Scope(value="prototype") public class ExtExportHelper extends Object
修飾子とタイプ | クラスと説明 |
---|---|
protected static class |
ExtExportHelper.FileWriter<SETTINGS extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF<? extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF.Settings,? extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF.FieldSetting>>
ファイル出力関連機能提供クラス.
|
修飾子とタイプ | フィールドと説明 |
---|---|
protected jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF.Settings |
companySettings
会社設定.
|
protected Map<String,String> |
fileNameMap
Exportファイル名と退避ファイル名を保持.
|
protected AbstractExportJob.Constans.SettingsValue.FileOperation |
fileOperation
既存ファイル操作.
|
protected IdentifierHelper |
identifierHelper
IdentifierHelper.
|
protected Map<String,OutputStream> |
outputStreamMap
出力ストリームMap.
|
protected StorageFileHelper |
storageFileHelper
StorageFileHelper.
|
コンストラクタと説明 |
---|
ExtExportHelper() |
修飾子とタイプ | メソッドと説明 |
---|---|
void |
clearFileNameMap()
Exportファイル名と退避ファイル名を保持しているMAPをクリアする。.
|
void |
closeAllOutputStreamMap()
出力ストリームのクローズ.
|
void |
doErrorEnd()
エラー終了後処理.
|
void |
doNormalEnd()
正常終了後処理.
|
<DTO,SETTINGS extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF<? extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF.Settings,? extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF.FieldSetting>> |
export(String companyCd,
SETTINGS settings,
List<DTO> targetDtoList,
int fileIndex)
出力対象データDTOリストをファイル出力.
|
<DTO,SETTINGS extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF<? extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF.Settings,? extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF.FieldSetting>> |
exportAppend(String companyCd,
SETTINGS settings,
List<DTO> targetDtoList,
int fileIndex,
String pFileName)
出力対象データDTOリストを分割ファイル出力.
|
<DTO,SETTINGS extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF<? extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF.Settings,? extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF.FieldSetting>> |
exportDivision(String companyCd,
SETTINGS settings,
List<DTO> targetDtoList,
int fileIndex,
String pFileName)
出力対象データDTOリストを分割ファイル出力.
|
List<KaidenRuntimeException> |
flushAndCloseAllOutputStreamMap()
出力ストリームを保存してクローズ.
|
void |
initOutputStreamMap()
出力ストリームMapを初期化.
|
void |
setOutputStreamMap(String fileName)
出力ストリームMapに指定ファイルを設定.
|
@Autowired protected StorageFileHelper storageFileHelper
@Autowired protected IdentifierHelper identifierHelper
protected jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF.Settings companySettings
protected AbstractExportJob.Constans.SettingsValue.FileOperation fileOperation
protected Map<String,OutputStream> outputStreamMap
public <DTO,SETTINGS extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF<? extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF.Settings,? extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF.FieldSetting>> String export(String companyCd, SETTINGS settings, List<DTO> targetDtoList, int fileIndex)
当メソッドは引数で受け取ったデータを一括で出力します。
複数回呼ばれることは想定していません。
DTO
- 処理対象DTOの型SETTINGS
- Export設定の型companyCd
- 会社コードsettings
- Export設定targetDtoList
- 出力対象データDTOリストfileIndex
- 出力対象ファイルIndexpublic <DTO,SETTINGS extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF<? extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF.Settings,? extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF.FieldSetting>> String exportDivision(String companyCd, SETTINGS settings, List<DTO> targetDtoList, int fileIndex, String pFileName)
当メソッドは出力データを一定単位で受け取り、出力します。
メモリ消費を抑えることを目的とし、複数回呼ばれることを想定しています。
初回呼び出し時は出力ファイル名にnullを渡してください。
戻り値として出力ファイル名を返却しますので、呼び出し側で保持し、2回目以降はファイル名を渡してください。
処理中にエラーが発生した場合、ファイルを削除する処理を呼び出し側で実装してください。
本メソッドは「 対象ファイルロード -> 出力データをマージ -> ファイルSave」の流れで処理が実行されます。
DTO
- 処理対象DTOの型SETTINGS
- Export設定の型companyCd
- 会社コードsettings
- Export設定targetDtoList
- 出力対象データDTOリストfileIndex
- 出力対象ファイルIndexpFileName
- 出力ファイル名public <DTO,SETTINGS extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF<? extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF.Settings,? extends jp.co.slcs.kaiden.v2.base.foundation.model.xml_schema.generic_ext_export_settings.GenericExportSettingsIF.FieldSetting>> String exportAppend(String companyCd, SETTINGS settings, List<DTO> targetDtoList, int fileIndex, String pFileName) throws IOException
当メソッドは出力データを一定単位で受け取り、OutputStreamを利用して出力します。
初回呼び出し時は出力ファイル名にnullを渡してください。
戻り値として出力ファイル名を返却しますので、呼び出し側で保持し、2回目以降はファイル名を渡してください。
OutputStreamは出力ファイル名をキーとしてMapに格納します。
OutputStream.flush()
やOutputStream.close()
は本メソッド内ではCallしません。 呼び出し側で適切に実装してください。
処理中にエラーが発生した場合、ファイルを削除する処理を呼び出し側で実装してください。
DTO
- 処理対象DTOの型SETTINGS
- Export設定の型companyCd
- 会社コードsettings
- Export設定targetDtoList
- 出力対象データDTOリストfileIndex
- 出力対象ファイルIndexpFileName
- 出力ファイル名IOException
- ファイルIOエラー発生public void initOutputStreamMap()
public void setOutputStreamMap(String fileName)
指定されたファイルがストレージに存在しない場合、出力ストリームをMapに設定しません。
fileName
- ファイル名public void closeAllOutputStreamMap()
outputStreamMap
の総ての出力ストリームに対して、OutputStream#close()を行います。
OutputStream#close()を実行した際に発生した例は無視します。
public List<KaidenRuntimeException> flushAndCloseAllOutputStreamMap()
outputStreamMap
の総ての出力ストリームに対して、OutputStream#flush()実行後にOutputStream#close()を行います。
OutputStream#flush()でIOExceptionが発生した場合、KaidenRuntimeException
のリストとして返却します。
またOutputStream#close()を実行した際に発生した例は無視します。
public void doErrorEnd()
処理中に出力していたファイルを削除します。
出力時にリネームして退避した既存ファイルを元の名前に戻し、出力前の状態にします。
public void doNormalEnd()
分割出力時にリネームして退避した既存ファイルを削除します
public void clearFileNameMap()
Copyright © 2024 Sumitomo Life Information Systems Co., Ltd. All Rights Reserved.