Interface UnitOfWorkBuilder


public interface UnitOfWorkBuilder

Builder for UnitOfWork.

See Also: DataApi.newUnitOfWorkBuilder()

Method Summary

Modifier and TypeMethodDescription
UnitOfWorkbuild()Returns a new and immutable UnitOfWork instance based on the information stored in this builder.
ReferenceIdregisterCreate(Record record)Registers a record creation for the UnitOfWork and returns a ReferenceId that can be used to refer to the created record in subsequent operations in this UnitOfWork.
ReferenceIdregisterDelete(java.lang.String type, java.lang.String id)Registers a deletion of an existing record of the given type and id.
ReferenceIdregisterUpdate(Record record)Registers a record update for the UnitOfWork and returns a ReferenceId that can be used to refer to the updated record in subsequent operations in this UnitOfWork.

Method Details

registerCreate

@Nonnull ReferenceId registerCreate​(Record record)

Registers a record creation for the UnitOfWork and returns a ReferenceId that can be used to refer to the created record in subsequent operations in this UnitOfWork.

Parameters: record - The record to create. Returns: The ReferenceId for the created record. Throws: java.lang.IllegalArgumentException - If the Record instance wasn't created by a RecordBuilder obtained from same DataApi instance this UnitOfWorkBuilder was obtained from.

registerUpdate

@Nonnull ReferenceId registerUpdate​(Record record)

Registers a record update for the UnitOfWork and returns a ReferenceId that can be used to refer to the updated record in subsequent operations in this UnitOfWork.

Parameters: record - The record to update. Returns: The ReferenceId for the updated record. Throws: java.lang.IllegalArgumentException - If the Record instance wasn't created by a RecordBuilder obtained from same DataApi instance this UnitOfWorkBuilder was obtained from.

registerDelete

@Nonnull ReferenceId registerDelete​(java.lang.String type, java.lang.String id)

Registers a deletion of an existing record of the given type and id.

Parameters: type - The object type of the record to delete. id - The id of the record to delete. Returns: The ReferenceId for the deleted record.

build

@Nonnull UnitOfWork build()

Returns a new and immutable UnitOfWork instance based on the information stored in this builder.

Returns: The new UnitOfWork instance.