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
BulkStatusdelta
- Since:
- 10.2
-
-
Field Summary
Fields Modifier and Type Field Description protected BulkCommandcommandprotected Map<String,BulkCommand>commandsprotected BulkStatusdeltaprotected static StringSELECT_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 voidcompute(CoreSession session, List<String> ids, Map<String,Serializable> properties)voidendBucket(ComputationContext context, BulkStatus delta)Can be overridden to write to downstream computation or add results to statusprotected DurationgetBatchTransactionTimeout()protected BulkCommandgetCommand(String commandId)BulkCommandgetCurrentCommand()protected booleanisAbortedCommand(String commandId)DocumentModelListloadDocuments(CoreSession session, List<String> documentIds)Helper to load a list of documents.DocumentModelListloadDocumentsOneByOne(CoreSession session, List<String> documentIds)protected NuxeoLoginContextloginSystemOrUser(String username)protected voidprocessBatchOfDocuments(List<String> batch)voidprocessFailure(ComputationContext context, Throwable failure)voidprocessRecord(ComputationContext context, String inputStreamName, Record record)Process an incoming record on one of the computation's input streams.voidstartBucket(String bucketKey)Can be overridden to init stuff before processing the bucketstatic voidupdateStatus(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:ComputationProcess 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:ComputationCalled 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:
processFailurein interfaceComputation- Overrides:
processFailurein 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)
-
-