Package de.hybris.platform.jobs
Class AbstractMaintenanceJobPerformable
- java.lang.Object
-
- de.hybris.platform.servicelayer.cronjob.AbstractJobPerformable<CronJobModel>
-
- de.hybris.platform.jobs.AbstractMaintenanceJobPerformable
-
- All Implemented Interfaces:
JobPerformable<CronJobModel>
,TypeAwareJobPerformable
- Direct Known Subclasses:
DynamicMaintenanceJobPerformable
,GenericMaintenanceJobPerformable
public abstract class AbstractMaintenanceJobPerformable extends AbstractJobPerformable<CronJobModel> implements TypeAwareJobPerformable
Job Performable which executes a givenMaintenanceCleanupStrategy
. With the given Search result fromMaintenanceCleanupStrategy.createFetchQuery(CronJobModel)
the job pages throught the resultlist (list of PKs, small) and for each sublist (100 elements as default, modify withsetPageSize(int)
) theMaintenanceCleanupStrategy.process(List)
is executed. IfsetAbortOnError(boolean)
is set to true this performable will stop when duringMaintenanceCleanupStrategy.process(List)
an exception is thrown and the performable stops with an error/aborted. When set to false (default) the exception is just logged.
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.servicelayer.cronjob.AbstractJobPerformable
flexibleSearchService, modelService, sessionService
-
-
Constructor Summary
Constructors Constructor Description AbstractMaintenanceJobPerformable()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract FlexibleSearchQuery
getFetchQuery(CronJobModel cronJob)
java.lang.String
getType()
Must return an existing subtype ofServicelayerJobModel
as String.PerformResult
perform(CronJobModel cronJob)
The execution body for aServicelayerJob
.abstract void
process(java.util.List<ItemModel> elements, CronJobModel cronJob)
void
setAbortOnError(boolean abort)
If set to true the job will abort by the first thrown exception.void
setModelResolver(ItemObjectResolver modelResolver)
void
setPageSize(int pagesize)
Sets the page size for the removing part.-
Methods inherited from class de.hybris.platform.servicelayer.cronjob.AbstractJobPerformable
clearAbortRequestedIfNeeded, isAbortable, isPerformable, setFlexibleSearchService, setModelService, setSessionService
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.servicelayer.cronjob.TypeAwareJobPerformable
createDefaultJob
-
-
-
-
Method Detail
-
getFetchQuery
public abstract FlexibleSearchQuery getFetchQuery(CronJobModel cronJob)
-
process
public abstract void process(java.util.List<ItemModel> elements, CronJobModel cronJob)
- See Also:
MaintenanceCleanupStrategy.process(List)
-
perform
public final PerformResult perform(CronJobModel cronJob)
Description copied from interface:JobPerformable
The execution body for aServicelayerJob
. Implement here your execution logic. It can be called synchronous or asynchronous. So be aware of thread-safety. Method will return a result object saying if the execution has reached end and if it was successful.- Specified by:
perform
in interfaceJobPerformable<CronJobModel>
- Specified by:
perform
in classAbstractJobPerformable<CronJobModel>
- Parameters:
cronJob
- the related CronJob in whose context the execution will be performed.- Returns:
- a
PerformResult
that indicates whether theexecution
was successfully executed or not and has finished or not.
-
setModelResolver
public void setModelResolver(ItemObjectResolver modelResolver)
-
setPageSize
public void setPageSize(int pagesize)
Sets the page size for the removing part. Default is 100. If set to 80 the elements list inprocess(List, CronJobModel)
will contain 80 elements or less.
-
setAbortOnError
public void setAbortOnError(boolean abort)
If set to true the job will abort by the first thrown exception. When set to false (default) the exception is just logged.
-
getType
public java.lang.String getType()
Description copied from interface:TypeAwareJobPerformable
Must return an existing subtype ofServicelayerJobModel
as String.- Specified by:
getType
in interfaceTypeAwareJobPerformable
-
-