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 FlexibleSearchQuerygetFetchQuery(CronJobModel cronJob)java.lang.StringgetType()Must return an existing subtype ofServicelayerJobModelas String.PerformResultperform(CronJobModel cronJob)The execution body for aServicelayerJob.abstract voidprocess(java.util.List<ItemModel> elements, CronJobModel cronJob)voidsetAbortOnError(boolean abort)If set to true the job will abort by the first thrown exception.voidsetModelResolver(ItemObjectResolver modelResolver)voidsetPageSize(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:JobPerformableThe 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:
performin interfaceJobPerformable<CronJobModel>- Specified by:
performin classAbstractJobPerformable<CronJobModel>- Parameters:
cronJob- the related CronJob in whose context the execution will be performed.- Returns:
- a
PerformResultthat indicates whether theexecutionwas 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:TypeAwareJobPerformableMust return an existing subtype ofServicelayerJobModelas String.- Specified by:
getTypein interfaceTypeAwareJobPerformable
-
-