Package de.hybris.platform.cronjob.jalo
Class BatchJob
- java.lang.Object
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable
public class BatchJob extends GeneratedBatchJob
ABatchJob
is a subclass ofJob
, which divides the task which should be performed into severalSteps
. Thus a complex task (for example a BMECat import) can be divided into several small steps (for example article, media and price import) which are assigned to oneBatchJob
. TheperformCronJob(CronJob)
implementation of theBatchJob
iterates over all pending steps and executes eachStep
.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.cronjob.jalo.Job
Job.JobFileLogContainer, Job.Synchronicity
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.GenericItem
GenericItem.GenericItemImpl
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LocalizableItem.LocalizableItemImpl
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.ExtensibleItem
ExtensibleItem.ExtensibleItemImpl
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.Item
Item.AttributeFilter, Item.AttributeMode, Item.CachedGetter, Item.CachedSetter, Item.ItemAttributeMap, Item.ItemConstraint, Item.ItemImpl, Item.JaloCachedComputationException
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.cronjob.jalo.GeneratedBatchJob
DEFAULT_INITIAL_ATTRIBUTES, STEPS
-
Fields inherited from class de.hybris.platform.cronjob.jalo.Job
CTX_CURRENTCRONJOB, CTX_CURRENTJOB
-
Fields inherited from class de.hybris.platform.cronjob.jalo.GeneratedJob
ACTIVE, ALTERNATIVEDATASOURCEID, CHANGERECORDINGENABLED, CODE, CRONJOBS, CRONJOBSHANDLER, EMAILADDRESS, EMAILNOTIFICATIONTEMPLATE, ERRORMODE, LOGLEVELDATABASE, LOGLEVELFILE, LOGTODATABASE, LOGTOFILE, NODEGROUP, NODEID, PRIORITY, REMOVEONEXIT, REQUESTABORT, REQUESTABORTSTEP, RESTRICTIONS, RESTRICTIONSHANDLER, RETRY, SENDEMAIL, SESSIONCONTEXTVALUES, SESSIONCURRENCY, SESSIONLANGUAGE, SESSIONUSER, SINGLEEXECUTABLE, TRIGGERS, TRIGGERSHANDLER
-
Fields inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LANGUAGE_FALLBACK_ENABLED
-
Fields inherited from class de.hybris.platform.jalo.Item
_CREATION_TIME_INTERNAL, _MODIFIED_TIME_INTERNAL, accessorLog, CREATION_TIME, DISABLE_ATTRIBUTE_CHECK, DISABLE_ITEMCHECK_BEFORE_REMOVABLE, EVEN, FEATURE_ACCESSMAP_QUALIFIER, HJMPTS, INITIAL_CREATION_FLAG, isJaloOnly, MODIFIED_TIME, NEGATIVE, NOT_FOUND, OWNER, PK, POSITIVE, SAVE_FROM_SERVICE_LAYER, staticTransientObjects, TYPE
-
Fields inherited from class de.hybris.platform.util.BridgeAbstraction
impl, tenant
-
-
Constructor Summary
Constructors Constructor Description BatchJob()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Step
addStep()
Step
addStep(ComposedType stepType)
Adds aStep
of the specified type to theBatchJob
and returns it.Step
addStep(ComposedType stepType, java.util.Map additionalAttributes)
Adds aStep
of the specified type to theBatchJob
and returns it.protected boolean
canUndo(CronJob cronJob)
Returnstrue
, if theBatchJob
can be undone using the specifiedCronJob
.java.util.Collection<Step>
getAllPreviousSteps(Step step)
Returns aCollection
of all predecessorSteps
of the specifiedStep
.java.util.Collection<Step>
getAllPreviousSteps(SessionContext ctx, Step step)
Returns aCollection
of all predecessorSteps
of the specifiedStep
.protected static Step
getCurrentlyExecutingStep()
Step
getFirstStep()
Returns the firstStep
.Step
getFirstStep(SessionContext ctx)
Returns the firstStep
.Step
getLastStep()
Returns the lastStep
.Step
getLastStep(SessionContext ctx)
Returns the lastStep
.protected java.lang.Integer
getNextSequenceNumber()
Returns the next sequence number.protected java.lang.Integer
getNextSequenceNumber(SessionContext ctx)
Returns the next sequence number.java.util.List<Step>
getSteps()
Returns aList
of allSteps
of theBatchJob
.java.util.List<Step>
getSteps(int start, int count)
Returns aList
containing the specified range ofSteps
of theBatchJob
.java.util.List<Step>
getSteps(SessionContext ctx)
Returns aList
of allSteps
of theBatchJob
.java.util.List<Step>
getSteps(SessionContext ctx, int start, int count)
Returns aList
containing the specified range ofSteps
of theBatchJob
.protected static boolean
hasCurrentlyExecutingStep()
boolean
isAbortable(CronJob cronJob)
Is abortable if the current step supports abort (seeStep.isAbortable()
.protected CronJob.CronJobResult
performCronJob(CronJob cronJob)
Performs theBatchJob
using the specifiedCronJob
.void
remove(SessionContext ctx)
First all assignedCronJobs
were removed, than theJob
itself.protected static void
setCurrentlyExecutingStep(Step step)
void
setSteps(SessionContext ctx, java.util.List<Step> steps)
Sets theSteps
of theBatchJob
and deletes allSteps
which were assigned before and which are not part of the specifiedCollection
.protected CronJob.CronJobResult
undoCronJob(CronJob cronJob)
Starts the undo-process of theBatchJob
for the specifiedCronJob
.protected static void
unsetCurrentlyExecutingStep()
-
Methods inherited from class de.hybris.platform.cronjob.jalo.GeneratedBatchJob
getDefaultAttributeModes, setSteps
-
Methods inherited from class de.hybris.platform.cronjob.jalo.Job
canPerform, checkRemovable, configureCronjob, createItem, createLogContext, debug, error, fatal, getConfigAttributes, getCronJobsByCode, getCronJobsByCode, getCurrentLogContainer, getEffectiveLogLevel, getNonInitialAttributes, info, isDebugEnabled, isEnabledFor, isErrorEnabled, isInfoEnabled, isPerformable, isPerformable, isUndoable, isWarnEnabled, jobIsCurrentlyRunning, log, logToFile, perform, perform, perform, prepareAfterFinishEvent, prepareBeforeStartEvent, saveToLogFile, sendFinishedEvent, sendStartEvent, setCode, setCronJobs, setCurrentLogContainer, setNonInitialAttributes, startOwnSession, stopOwnSession, switchDataSource, undo, undo, unsetAlternativeDataSource, unsetCurrentLogContainer, warn
-
Methods inherited from class de.hybris.platform.cronjob.jalo.GeneratedJob
addToRestrictions, addToRestrictions, addToTriggers, addToTriggers, getAlternativeDataSourceID, getAlternativeDataSourceID, getCode, getCode, getCronJobs, getCronJobs, getEmailAddress, getEmailAddress, getEmailNotificationTemplate, getEmailNotificationTemplate, getErrorMode, getErrorMode, getLogLevelDatabase, getLogLevelDatabase, getLogLevelFile, getLogLevelFile, getNodeGroup, getNodeGroup, getNodeID, getNodeID, getNodeIDAsPrimitive, getNodeIDAsPrimitive, getPriority, getPriority, getPriorityAsPrimitive, getPriorityAsPrimitive, getRestrictions, getRestrictions, getSessionCurrency, getSessionCurrency, getSessionLanguage, getSessionLanguage, getSessionUser, getSessionUser, getTriggers, getTriggers, isActive, isActive, isActiveAsPrimitive, isActiveAsPrimitive, isChangeRecordingEnabled, isChangeRecordingEnabled, isChangeRecordingEnabledAsPrimitive, isChangeRecordingEnabledAsPrimitive, isLogToDatabase, isLogToDatabase, isLogToDatabaseAsPrimitive, isLogToDatabaseAsPrimitive, isLogToFile, isLogToFile, isLogToFileAsPrimitive, isLogToFileAsPrimitive, isRemoveOnExit, isRemoveOnExit, isRemoveOnExitAsPrimitive, isRemoveOnExitAsPrimitive, isRequestAbort, isRequestAbort, isRequestAbortAsPrimitive, isRequestAbortAsPrimitive, isRequestAbortStep, isRequestAbortStep, isRequestAbortStepAsPrimitive, isRequestAbortStepAsPrimitive, isRetry, isRetry, isRetryAsPrimitive, isRetryAsPrimitive, isSendEmail, isSendEmail, isSendEmailAsPrimitive, isSendEmailAsPrimitive, isSingleExecutable, isSingleExecutable, isSingleExecutableAsPrimitive, isSingleExecutableAsPrimitive, removeFromRestrictions, removeFromRestrictions, removeFromTriggers, removeFromTriggers, setActive, setActive, setActive, setActive, setAlternativeDataSourceID, setAlternativeDataSourceID, setChangeRecordingEnabled, setChangeRecordingEnabled, setChangeRecordingEnabled, setChangeRecordingEnabled, setCode, setEmailAddress, setEmailAddress, setEmailNotificationTemplate, setEmailNotificationTemplate, setErrorMode, setErrorMode, setLogLevelDatabase, setLogLevelDatabase, setLogLevelFile, setLogLevelFile, setLogToDatabase, setLogToDatabase, setLogToDatabase, setLogToDatabase, setLogToFile, setLogToFile, setLogToFile, setLogToFile, setNodeGroup, setNodeGroup, setNodeID, setNodeID, setNodeID, setNodeID, setPriority, setPriority, setPriority, setPriority, setRemoveOnExit, setRemoveOnExit, setRemoveOnExit, setRemoveOnExit, setRequestAbort, setRequestAbort, setRequestAbort, setRequestAbort, setRequestAbortStep, setRequestAbortStep, setRequestAbortStep, setRequestAbortStep, setRestrictions, setRestrictions, setRetry, setRetry, setRetry, setRetry, setSendEmail, setSendEmail, setSendEmail, setSendEmail, setSessionCurrency, setSessionCurrency, setSessionLanguage, setSessionLanguage, setSessionUser, setSessionUser, setSingleExecutable, setSingleExecutable, setSingleExecutable, setSingleExecutable, setTriggers, setTriggers
-
Methods inherited from class de.hybris.platform.jalo.GenericItem
getImplementation, getInitialProperties, getRelatedItems, setRelatedItems
-
Methods inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
getAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllValuesSessionContext, getLocalizedProperty, getLocalizedProperty, getLocalizedPropertyInternal, getLocalizedPropertyNames, getLocalizedPropertyNames, hasLanguage, isEmptyValue, isFallbackEnabled, removeLocalizedProperty, removeLocalizedProperty, setAllLocalizedProperties, setAllLocalizedProperties, setLocalizedProperty, setLocalizedProperty
-
Methods inherited from class de.hybris.platform.jalo.ExtensibleItem
createNonClassAccessor, getAllProperties, getAllProperties, getProperty, getProperty, getPropertyNames, getPropertyNames, removeProperty, removeProperty, setAllProperties, setAllProperties, setProperty, setProperty
-
Methods inherited from class de.hybris.platform.jalo.Item
addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addNegativePermission, addPermission, addPositivePermission, assureExtensionsLoaded, changeTypeAfterCreation, checkConstraint, checkItemPermission, checkMandatoryAttribute, checkMandatoryAttribute, checkPermission, checkPermission, clearPermission, compareTo, ctx, doAfterRemove, doBeforeRemove, equals, getAccessorFor, getAllAttributes, getAllAttributes, getAllAttributes, getAllAttributes, getAllAttributesInternal, getAllLinkedItems, getAndCheckCacheBoundItem, getAttribute, getAttribute, getCacheBoundItem, getComposedType, getComposedTypePK, getCreationTime, getCurrentlyRemovingCount, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItemsCount, getLinkedItemsCount, getLinkedItemsCount, getModificationTime, getNegativePermissions, getOwner, getPermissionMap, getPermissions, getPersistenceVersion, getPK, getPositivePermissions, getRestrictedPrincipals, getSession, getSyncObject, getTenant, getTransientObject, getTransientObjectMap, hashCode, hasRegisteredClassAccessorFor, internal_registerClassAccessorFor, internal_registerNonClassAccessorFor, invalidateLocalCaches, isAlive, isCacheBound, isCurrentlyRemoving, isCurrentlyRemoving, isEmptyRelationValue, isInCreate, isInstanceOf, isItemCheckBeforeRemoveableDisabled, isMarkModifiedDisabled, isRelationLocalizationFallbackEnabled, newInstance, notifyExtensionsAfterItemCreation, notifyExtensionsBeforeItemCreation, notifyItemRemoval, notifyManagerAboutItemRemoval, readResolve, registerAccessFor, registerAccessFor, registerJaloInvalidationListeners, remove, removeItemCollection, removeItemCollection, removeLinkedItems, removeLinkedItems, removeLinkedItems, removeLinkedItems, removeLinks, removePartOfItems, removePartOfItems, setAllAttributes, setAllAttributes, setAllAttributesInternal, setAllLinkedItems, setAllLinkedItems, setAllLinkedItems, setAllLinkedItems, setAttribute, setAttribute, setAttributeFromString, setAttributeFromString, setCacheBound, setComposedType, setCreationTime, setImplementation, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setModificationTime, setOwner, setPermissionsByMap, setTransientObject, setUseTA, toString, useTA, writeReplace
-
Methods inherited from class de.hybris.platform.util.BridgeAbstraction
setTenant
-
-
-
-
Method Detail
-
remove
public void remove(SessionContext ctx) throws ConsistencyCheckException
Description copied from class:Job
First all assignedCronJobs
were removed, than theJob
itself.- Overrides:
remove
in classJob
- Parameters:
ctx
- A SessionContext object- Throws:
ConsistencyCheckException
- if this item could not be removed for some reason- See Also:
Item.remove(de.hybris.platform.jalo.SessionContext)
-
setCurrentlyExecutingStep
protected static final void setCurrentlyExecutingStep(Step step)
-
unsetCurrentlyExecutingStep
protected static final void unsetCurrentlyExecutingStep()
-
getCurrentlyExecutingStep
protected static final Step getCurrentlyExecutingStep()
-
hasCurrentlyExecutingStep
protected static final boolean hasCurrentlyExecutingStep()
-
isAbortable
public boolean isAbortable(CronJob cronJob)
Is abortable if the current step supports abort (seeStep.isAbortable()
.- Overrides:
isAbortable
in classJob
- Parameters:
cronJob
- the current execution of this job.- Returns:
true
if the cronjob is running and the job supports aborting viaGeneratedCronJob.setRequestAbort(boolean)
- See Also:
Job.isAbortable(de.hybris.platform.cronjob.jalo.CronJob)
-
setSteps
public void setSteps(SessionContext ctx, java.util.List<Step> steps)
Sets theSteps
of theBatchJob
and deletes allSteps
which were assigned before and which are not part of the specifiedCollection
.- Specified by:
setSteps
in classGeneratedBatchJob
- Parameters:
ctx
- 123steps
- theList
of the newSteps
-
getSteps
public java.util.List<Step> getSteps()
Returns aList
of allSteps
of theBatchJob
.- Overrides:
getSteps
in classGeneratedBatchJob
- Returns:
- a
List
of allSteps
of theBatchJob
-
getSteps
public java.util.List<Step> getSteps(SessionContext ctx)
Returns aList
of allSteps
of theBatchJob
.- Specified by:
getSteps
in classGeneratedBatchJob
- Parameters:
ctx
- 123- Returns:
- a
List
of allSteps
of theBatchJob
-
getSteps
public java.util.List<Step> getSteps(int start, int count)
Returns aList
containing the specified range ofSteps
of theBatchJob
. (Range: start -> (start + count))- Parameters:
start
- the start index of the rangecount
- the number of steps in the range- Returns:
- a
List
containing the specified range ofSteps
of theBatchJob
-
getSteps
public java.util.List<Step> getSteps(SessionContext ctx, int start, int count)
Returns aList
containing the specified range ofSteps
of theBatchJob
. (Range: start -> (start + count))- Parameters:
ctx
- 123start
- the start index of the rangecount
- the number of steps in the range- Returns:
- a
List
containing the specified range ofSteps
of theBatchJob
-
getFirstStep
public Step getFirstStep()
Returns the firstStep
.- Returns:
- the first
Step
-
getFirstStep
public Step getFirstStep(SessionContext ctx)
Returns the firstStep
.- Parameters:
ctx
-- Returns:
- the first
Step
-
getLastStep
public Step getLastStep()
Returns the lastStep
.- Returns:
- the last
Step
-
getLastStep
public Step getLastStep(SessionContext ctx)
Returns the lastStep
.- Parameters:
ctx
-- Returns:
- the last
Step
-
getAllPreviousSteps
public java.util.Collection<Step> getAllPreviousSteps(Step step)
Returns aCollection
of all predecessorSteps
of the specifiedStep
.- Parameters:
step
- theStep
whose predecessorSteps
should be returned- Returns:
- a
Collection
of all predecessorSteps
of the specifiedStep
-
getAllPreviousSteps
public java.util.Collection<Step> getAllPreviousSteps(SessionContext ctx, Step step)
Returns aCollection
of all predecessorSteps
of the specifiedStep
.- Parameters:
ctx
- 123step
- theStep
whose predecessorSteps
should be returned- Returns:
- a
Collection
of all predecessorSteps
of the specifiedStep
-
getNextSequenceNumber
protected java.lang.Integer getNextSequenceNumber()
Returns the next sequence number.- Returns:
- the next sequence number
-
getNextSequenceNumber
protected java.lang.Integer getNextSequenceNumber(SessionContext ctx)
Returns the next sequence number.- Parameters:
ctx
- 123- Returns:
- the next sequence number
-
addStep
protected Step addStep()
-
addStep
public Step addStep(ComposedType stepType)
Adds aStep
of the specified type to theBatchJob
and returns it.- Parameters:
stepType
- theComposedType
of theStep
, which will be added- Returns:
- the new
Step
which have been added to theBatchJob
-
addStep
public Step addStep(ComposedType stepType, java.util.Map additionalAttributes)
Adds aStep
of the specified type to theBatchJob
and returns it.- Parameters:
stepType
- theComposedType
of theStep
, which will be addedadditionalAttributes
- additionalAttributes, which will be used to the create the specifiedStep
type- Returns:
- the new
Step
which have been added to theBatchJob
-
undoCronJob
protected CronJob.CronJobResult undoCronJob(CronJob cronJob)
Starts the undo-process of theBatchJob
for the specifiedCronJob
.- Overrides:
undoCronJob
in classJob
- Parameters:
cronJob
- theCronJob
, which is used for the undo-process- Returns:
- CronJob.CronJobResult the result of the undo-process
-
performCronJob
protected CronJob.CronJobResult performCronJob(CronJob cronJob)
Performs theBatchJob
using the specifiedCronJob
. TheBatchJob
will execute all pendingSteps
in the given order. If oneStep
cannot be performed, the execution of theBatchJob
is paused.- Specified by:
performCronJob
in classJob
- Parameters:
cronJob
- theCronJob
, which should used for execution- Returns:
- CronJob.CronJobResult the result of the execution
- See Also:
CronJob.getFinishedResult(boolean)
,CronJob.getAbortResult()
-
canUndo
protected boolean canUndo(CronJob cronJob)
Returnstrue
, if theBatchJob
can be undone using the specifiedCronJob
.- Overrides:
canUndo
in classJob
- Parameters:
cronJob
- the CronJob to undo changes for- Returns:
true
, if theBatchJob
can be undone using the specifiedCronJob
- See Also:
Job.canUndo(de.hybris.platform.cronjob.jalo.CronJob)
-
-