Package org.iplass.mtp.entity.bulkupdate
Class CSVFormattedEntityStream
java.lang.Object
org.iplass.mtp.entity.bulkupdate.CSVFormattedEntityStream
- All Implemented Interfaces:
AutoCloseable,Iterable<BulkUpdateEntity>,BulkUpdatable
CSV形式で記述されたStreamをソースとして実行するBulkUpdatable。
CSVデータストリームはヘッダー行と、各Entityを1行のCSVデータで表現する複数行のデータとして構成されている前提。 CSVデータストリームの例
CSVデータストリームはヘッダー行と、各Entityを1行のCSVデータで表現する複数行のデータとして構成されている前提。 CSVデータストリームの例
_useCtrl,oid,name,propA,propB[0],propB[1],propC,refX,... I,,"hoge,hoge",15,a,b,"2014-12-11 13:24:00.000","100234.0,100235.0",... U,2012,"fuga",15,a,b,"2014-12-12 10:00:00.000","100531.0",... : :
_useCtrl列
_useCtrl列は、制御フラグ列。
| フラグ | 説明 |
|---|---|
| I | 追加(BulkUpdateEntity.UpdateMethod.INSERT) |
| U | 更新(BulkUpdateEntity.UpdateMethod.UPDATE) |
| D | 削除(BulkUpdateEntity.UpdateMethod.DELETE) |
| M | マージ(BulkUpdateEntity.UpdateMethod.MERGE) |
※_useCtrl列が存在しない場合は、oidがある行は、MERGE、oidがない行はINSERTと判断され処理される。
多重度が複数のプロパティ(参照型除く)
多重度複数の場合は、プロパティ名の後に配列添え字[n]を指定する。
Select型は、value(コード)値を指定。
日時型は、yyyy-MM-dd HH:mm:ss.SSS形式。
日付型は、yyyy-MM-dd形式。
時間型は、HH:mm:ss形式。
※現状、BinaryReference未対応
参照型のプロパティ
[oid].[version]の形式で1参照を表す。
複数Entityへの参照を示す場合は、カンマで区切る(CSVの要素となるので、全体を"で囲う)。
例:
1Entityへの参照の表現:1234.0
複数Entityへの参照の表現:"1234.0,1235.0,1236.0"
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCSVFormattedEntityStream(String definitionName, InputStream inputStream) 文字コードUTF-8でCSVFormattedEntityStreamを構築。CSVFormattedEntityStream(String definitionName, InputStream inputStream, String charset) 指定の文字コードで、CSVFormattedEntityStreamを構築。CSVFormattedEntityStream(String definitionName, Reader reader) 指定のReaderで、CSVFormattedEntityStreamを構築。CSVFormattedEntityStream(String definitionName, List<String> updateProperties, InputStream inputStream) 文字コードUTF-8、更新時の更新対象updatePropertiesでCSVFormattedEntityStreamを構築。CSVFormattedEntityStream(String definitionName, List<String> updateProperties, InputStream inputStream, String charset) CSVFormattedEntityStream(String definitionName, List<String> updateProperties, Reader reader) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()BulkUpdatableのクローズ処理を記述。バルク更新対象のEntity定義名を返却するように実装。バルク更新(UPDATEおよびMERGEで更新と判断された場合)の際の更新対象のプロパティを指定する。 未指定(null)の場合は全項目を更新対象と判断。booleanバルク更新(INSERT時)の際、EntityにcreateBy,createDate,updateBy,updateDateの値を 指定してその値のまま登録する場合にtrueを指定します。 デフォルトはfalseです。 このフラグを利用する場合、 当該処理を呼び出すユーザーがadmin権限を保持している必要があります。iterator()voidsetEnableAuditPropertySpecification(boolean enableAuditPropertySpecification) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.iplass.mtp.entity.bulkupdate.BulkUpdatable
updatedMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
CTRL_CODE_KEY
制御フラグのヘッダー項目名- See Also:
-
CTRL_INSERT
制御フラグ、追加を示す値。- See Also:
-
CTRL_UPDATE
制御フラグ、更新を示す値。- See Also:
-
CTRL_DELETE
制御フラグ、削除を示す値。- See Also:
-
CTRL_MERGE
制御フラグ、マージ(追加更新)を示す値。- See Also:
-
-
Constructor Details
-
CSVFormattedEntityStream
文字コードUTF-8でCSVFormattedEntityStreamを構築。- Parameters:
definitionName-inputStream-
-
CSVFormattedEntityStream
指定の文字コードで、CSVFormattedEntityStreamを構築。- Parameters:
definitionName-inputStream-charset-
-
CSVFormattedEntityStream
指定のReaderで、CSVFormattedEntityStreamを構築。- Parameters:
definitionName-reader-
-
CSVFormattedEntityStream
public CSVFormattedEntityStream(String definitionName, List<String> updateProperties, InputStream inputStream) 文字コードUTF-8、更新時の更新対象updatePropertiesでCSVFormattedEntityStreamを構築。- Parameters:
definitionName-updateProperties-inputStream-
-
CSVFormattedEntityStream
public CSVFormattedEntityStream(String definitionName, List<String> updateProperties, InputStream inputStream, String charset) -
CSVFormattedEntityStream
-
-
Method Details
-
iterator
- Specified by:
iteratorin interfaceIterable<BulkUpdateEntity>
-
getDefinitionName
Description copied from interface:BulkUpdatableバルク更新対象のEntity定義名を返却するように実装。- Specified by:
getDefinitionNamein interfaceBulkUpdatable- Returns:
-
close
public void close()Description copied from interface:BulkUpdatableBulkUpdatableのクローズ処理を記述。- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceBulkUpdatable
-
getUpdateProperties
Description copied from interface:BulkUpdatableバルク更新(UPDATEおよびMERGEで更新と判断された場合)の際の更新対象のプロパティを指定する。 未指定(null)の場合は全項目を更新対象と判断。- Specified by:
getUpdatePropertiesin interfaceBulkUpdatable- Returns:
-
isEnableAuditPropertySpecification
public boolean isEnableAuditPropertySpecification()Description copied from interface:BulkUpdatableバルク更新(INSERT時)の際、EntityにcreateBy,createDate,updateBy,updateDateの値を 指定してその値のまま登録する場合にtrueを指定します。 デフォルトはfalseです。 このフラグを利用する場合、 当該処理を呼び出すユーザーがadmin権限を保持している必要があります。- Specified by:
isEnableAuditPropertySpecificationin interfaceBulkUpdatable- Returns:
-
setEnableAuditPropertySpecification
public void setEnableAuditPropertySpecification(boolean enableAuditPropertySpecification)
-