Class AbstractBulkComputation
- java.lang.Object
-
- org.nuxeo.lib.stream.computation.AbstractComputation
-
- org.nuxeo.ecm.core.bulk.action.computation.AbstractBulkComputation
-
- All Implemented Interfaces:
Computation
- Direct Known Subclasses:
AbstractAutomationBulkAction.AutomationComputation
,AbstractBulkMigrator.MigrationComputation
,CSVProjectionComputation
,DeletionAction.DeletionComputation
,DocumentRoutingEscalationAction.DocumentRoutingEscalationComputation
,ExtractBinaryFulltextAction.ExtractBinaryFulltextComputation
,FireGroupUpdatedEventAction.FireGroupUpdatedEventComputation
,GarbageCollectOrphanBlobsAction.GarbageCollectOrphanBlobsComputation
,GarbageCollectOrphanVersionsAction.GarbageCollectOrphanVersionsComputation
,GarbageCollectRoutesAction.GarbageCollectRoutesComputation
,IndexRequestComputation
,RecomputeThumbnailsAction.RecomputeThumbnailsComputation
,RecomputeTranscodedVideosComputation
,RecomputeVideoInfoComputation
,RecomputeViewsAction.RecomputeViewsComputation
,RemoveProxyAction.RemoveProxyComputation
,RetentionExpiredAction.RetentionExpiredComputation
,S3SetBlobLengthAction.SetBlobLengthComputation
,SetPropertiesAction.SetPropertyComputation
,SetSystemPropertiesAction.SetSystemPropertyComputation
,TrashAction.TrashComputation
,UpdateReadAclsAction.UpdateReadAclsComputation
public abstract class AbstractBulkComputation extends AbstractComputation
Base class for bulk action computation.Inputs:
- i1: Reads
BulkBucket
- o1: Writes
BulkStatus
delta
- Since:
- 10.2
-
-
Field Summary
Fields Modifier and Type Field Description protected BulkCommand
command
protected Map<String,BulkCommand>
commands
protected BulkStatus
delta
protected static String
SELECT_DOCUMENTS_IN
-
Fields inherited from class org.nuxeo.lib.stream.computation.AbstractComputation
INPUT_1, INPUT_2, INPUT_3, INPUT_NULL, metadata, OUTPUT_1, OUTPUT_2, OUTPUT_3, OUTPUT_4
-
-
Constructor Summary
Constructors Constructor Description AbstractBulkComputation(String name)
AbstractBulkComputation(String name, int nbOutputStreams)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
compute(CoreSession session, List<String> ids, Map<String,Serializable> properties)
void
endBucket(ComputationContext context, BulkStatus delta)
Can be overridden to write to downstream computation or add results to statusprotected Duration
getBatchTransactionTimeout()
protected BulkCommand
getCommand(String commandId)
BulkCommand
getCurrentCommand()
protected boolean
isAbortedCommand(String commandId)
DocumentModelList
loadDocuments(CoreSession session, List<String> documentIds)
Helper to load a list of documents.DocumentModelList
loadDocumentsOneByOne(CoreSession session, List<String> documentIds)
protected NuxeoLoginContext
loginSystemOrUser(String username)
protected void
processBatchOfDocuments(List<String> batch)
void
processFailure(ComputationContext context, Throwable failure)
void
processRecord(ComputationContext context, String inputStreamName, Record record)
Process an incoming record on one of the computation's input streams.void
startBucket(String bucketKey)
Can be overridden to init stuff before processing the bucketstatic void
updateStatus(ComputationContext context, BulkStatus delta)
-
Methods inherited from class org.nuxeo.lib.stream.computation.AbstractComputation
init, metadata, processRetry, processTimer
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.lib.stream.computation.Computation
destroy, signalStop
-
-
-
-
Field Detail
-
SELECT_DOCUMENTS_IN
protected static final String SELECT_DOCUMENTS_IN
- See Also:
- Constant Field Values
-
commands
protected Map<String,BulkCommand> commands
-
command
protected BulkCommand command
-
delta
protected BulkStatus delta
-
-
Method Detail
-
processRecord
public void processRecord(ComputationContext context, String inputStreamName, Record record)
Description copied from interface:Computation
Process an incoming record on one of the computation's input streams.- Parameters:
context
- The computation context object provided by the system.inputStreamName
- Name of the input stream that provides the record.record
- The record.
-
isAbortedCommand
protected boolean isAbortedCommand(String commandId)
-
getCommand
protected BulkCommand getCommand(String commandId)
-
getCurrentCommand
public BulkCommand getCurrentCommand()
-
getBatchTransactionTimeout
protected Duration getBatchTransactionTimeout()
- Returns:
- the transaction timeout to use to process the bucket, <= 0 for the default
-
loginSystemOrUser
protected NuxeoLoginContext loginSystemOrUser(String username) throws LoginException
- Throws:
LoginException
-
startBucket
public void startBucket(String bucketKey)
Can be overridden to init stuff before processing the bucket
-
endBucket
public void endBucket(ComputationContext context, BulkStatus delta)
Can be overridden to write to downstream computation or add results to status
-
processFailure
public void processFailure(ComputationContext context, Throwable failure)
Description copied from interface:Computation
Called whenComputation.processRecord(org.nuxeo.lib.stream.computation.ComputationContext, java.lang.String, org.nuxeo.lib.stream.computation.Record)
orComputation.processTimer(org.nuxeo.lib.stream.computation.ComputationContext, java.lang.String, long)
fails and cannot be retried.- Specified by:
processFailure
in interfaceComputation
- Overrides:
processFailure
in classAbstractComputation
-
updateStatus
public static void updateStatus(ComputationContext context, BulkStatus delta)
-
compute
protected abstract void compute(CoreSession session, List<String> ids, Map<String,Serializable> properties)
-
loadDocuments
public DocumentModelList loadDocuments(CoreSession session, List<String> documentIds)
Helper to load a list of documents. Documents without read access or that does not exists are not returned.
-
loadDocumentsOneByOne
public DocumentModelList loadDocumentsOneByOne(CoreSession session, List<String> documentIds)
-
-