Package org.graylog2.rest.bulk
Class SequentialBulkExecutor<T,C extends HasUser>
java.lang.Object
org.graylog2.rest.bulk.SequentialBulkExecutor<T,C>
- All Implemented Interfaces:
BulkExecutor<T,
C>
public class SequentialBulkExecutor<T,C extends HasUser>
extends Object
implements BulkExecutor<T,C>
Implementation of
BulkExecutor
that executes bulk operation on entities sequentially, one at a time, using provided SingleEntityOperationExecutor
.
It is meant for those type of operations on entities that are very hard to be executed with single MongoDB query in a single request,
as many additional checks are to be performed on the fetched entity in order to decide if it is legal to remove it at all.
It is unfortunate that it introduces a (N+1) problem, but preparing more complex solution would require extreme changes to current architecture.-
Constructor Summary
ConstructorDescriptionSequentialBulkExecutor
(SingleEntityOperationExecutor<T, C> singleEntityOperationExecutor, AuditEventSender auditEventSender, com.fasterxml.jackson.databind.ObjectMapper objectMapper) SequentialBulkExecutor
(SingleEntityOperationExecutor<T, C> singleEntityOperationExecutor, AuditEventSender auditEventSender, SuccessContextCreator<T> successAuditLogContextCreator, FailureContextCreator failureAuditLogContextCreator) -
Method Summary
Modifier and TypeMethodDescriptionexecuteBulkOperation
(BulkOperationRequest bulkOperationRequest, C userContext, AuditParams params) Executes bulk operation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.graylog2.rest.bulk.BulkExecutor
getAuditActor, getUserName
-
Constructor Details
-
SequentialBulkExecutor
public SequentialBulkExecutor(SingleEntityOperationExecutor<T, C> singleEntityOperationExecutor, AuditEventSender auditEventSender, com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
SequentialBulkExecutor
public SequentialBulkExecutor(SingleEntityOperationExecutor<T, C> singleEntityOperationExecutor, AuditEventSender auditEventSender, SuccessContextCreator<T> successAuditLogContextCreator, FailureContextCreator failureAuditLogContextCreator)
-
-
Method Details
-
executeBulkOperation
public BulkOperationResponse executeBulkOperation(BulkOperationRequest bulkOperationRequest, C userContext, AuditParams params) Executes bulk operation.- Specified by:
executeBulkOperation
in interfaceBulkExecutor<T,
C extends HasUser> - Parameters:
bulkOperationRequest
- Information about entities that are a subject of execution.userContext
- Necessary information about a user.params
- Information needed to create audit log. If null, no audit log will be created.- Returns:
BulkOperationResponse
containing the outcome of the bulk operation
-