Class InvokeOrderGeneratorTask
java.lang.Object
ch.tocco.nice2.tasks.api.quartz.AbstractJob
ch.tocco.nice2.tasks.api.quartz.AbstractInterruptableJob
ch.tocco.nice2.optional.order.api.action.invoice.tasks.InvokeOrderGeneratorTask
- All Implemented Interfaces:
org.quartz.InterruptableJob
,org.quartz.Job
- Direct Known Subclasses:
BillingPositionInvoiceActionServiceImpl.BillingPositionInvokeOrderGeneratorTask
,DefaultInvoiceActionServiceImpl.DefaultInvokeOrderGeneratorTask
,DirectInvoiceActionServiceImpl.DirectInvokeOrderGeneratorTask
Task that invokes the
OrderGeneratorService
for a selection of entities.
Different contexts are used for every batch of entities to avoid high memory usage.
However before the selection can be split up into batches, the selection must be grouped by recipient so that the orders can be merged together within the same transaction.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected final CommandExecutor
protected final ContextManager
protected final DataModel
protected final OrderGeneratorService
protected final QueryBuilderFactory
protected final RebindService
protected final EntityExplorerActionSelectionService
protected final TextResources
protected final ValidationResultPrinter
Fields inherited from class ch.tocco.nice2.tasks.api.quartz.AbstractJob
businessUnitManager, l10N, logger, principalManager, securityManager
-
Constructor Summary
ConstructorDescriptionInvokeOrderGeneratorTask
(ContextManager contextManager, RebindService rebindService, OrderGeneratorService orderGeneratorService, TextResources textResources, ValidationResultPrinter validationResultPrinter, CommandExecutor commandExecutor, DataModel dataModel, EntityExplorerActionSelectionService selectionService, QueryBuilderFactory queryBuilderFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected List
<OrderGeneratorBean> createOrderGeneratorBeans
(com.google.common.collect.Multimap<InvokeOrderGeneratorTask.Recipient, EntityId> recipients, Context newContext) protected void
doExecute
(org.quartz.JobExecutionContext context, JobDataMapReader jobDataMapReader) protected List
<OrderGeneratorBean> generateOrders
(JobDataMapReader jobDataMapReader, com.google.common.collect.Multimap<InvokeOrderGeneratorTask.Recipient, EntityId> recipients, Context newContext) getBillingPositions
(Entity source) Returns all billing positions for a given source entity.protected abstract List
<PrimaryKeyList> getSourceEntities
(EntityList selection, int maxTxSize) The selected entities for which the action should be performed.protected List
<PrimaryKeyList> getSourceEntities
(JobDataMapReader jobDataMapReader, int maxTxSize) The selected entities for which the action should be performed.protected void
newContextEnded
(Context context) Hook for subclasses to perform cleanup before a context is closed.protected void
newContextStarted
(Context context, JobDataMapReader jobData) Hook for subclasses to perform initialization for a new context.Methods inherited from class ch.tocco.nice2.tasks.api.quartz.AbstractInterruptableJob
interrupt, isCancelled
Methods inherited from class ch.tocco.nice2.tasks.api.quartz.AbstractJob
execute, getProgress, getProgressLog, setBusinessUnitManager, setConverters, setL10N, setLogger, setPrincipalManager, setProgressPersistenceManager, setRuleProviderService, setSecurityManager
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.quartz.Job
execute
-
Field Details
-
contextManager
-
rebindService
-
orderGeneratorService
-
textResources
-
validationResultPrinter
-
commandExecutor
-
dataModel
-
selectionService
-
queryBuilderFactory
-
-
Constructor Details
-
InvokeOrderGeneratorTask
public InvokeOrderGeneratorTask(ContextManager contextManager, RebindService rebindService, OrderGeneratorService orderGeneratorService, TextResources textResources, ValidationResultPrinter validationResultPrinter, CommandExecutor commandExecutor, DataModel dataModel, EntityExplorerActionSelectionService selectionService, QueryBuilderFactory queryBuilderFactory)
-
-
Method Details
-
doExecute
- Specified by:
doExecute
in classAbstractJob
-
generateOrders
protected List<OrderGeneratorBean> generateOrders(JobDataMapReader jobDataMapReader, com.google.common.collect.Multimap<InvokeOrderGeneratorTask.Recipient, EntityId> recipients, Context newContext) throws UnresolvableUriException, UriStoreException, URISyntaxException, RebindException -
createOrderGeneratorBeans
protected List<OrderGeneratorBean> createOrderGeneratorBeans(com.google.common.collect.Multimap<InvokeOrderGeneratorTask.Recipient, EntityId> recipients, Context newContext) -
newContextStarted
Hook for subclasses to perform initialization for a new context.- Throws:
Exception
-
newContextEnded
Hook for subclasses to perform cleanup before a context is closed.- Throws:
Exception
-
getSourceEntities
The selected entities for which the action should be performed. -
getSourceEntities
The selected entities for which the action should be performed. -
getBillingPositions
Returns all billing positions for a given source entity.
-