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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CommandExecutorprotected final ContextManagerprotected final DataModelprotected final OrderGeneratorServiceprotected final QueryBuilderFactoryprotected final RebindServiceprotected final EntityExplorerActionSelectionServiceprotected final TextResourcesprotected final ValidationResultPrinterFields inherited from class ch.tocco.nice2.tasks.api.quartz.AbstractJob
businessUnitManager, l10N, logger, principalManager, securityManager -
Constructor Summary
ConstructorsConstructorDescriptionInvokeOrderGeneratorTask(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 voiddoExecute(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 voidnewContextEnded(Context context) Hook for subclasses to perform cleanup before a context is closed.protected voidnewContextStarted(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, isCancelledMethods inherited from class ch.tocco.nice2.tasks.api.quartz.AbstractJob
execute, getProgress, getProgressLog, setBusinessUnitManager, setConverters, setL10N, setLogger, setPrincipalManager, setProgressPersistenceManager, setRuleProviderService, setSecurityManagerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
doExecutein 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.
-