Class Step
- All Implemented Interfaces:
Serializable,Comparable
- Direct Known Subclasses:
GeneratedMediaProcessorStep
Step implements one part of the logic of a complex / modular task and is part of a
BatchJob, a subclass of Job. The BatchJob supplies the logic to manage
multiple steps.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class de.hybris.platform.jalo.GenericItem
GenericItem.GenericItemImplNested classes/interfaces inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LocalizableItem.LocalizableItemImplNested classes/interfaces inherited from class de.hybris.platform.jalo.ExtensibleItem
ExtensibleItem.ExtensibleItemImplNested 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.GeneratedStep
BATCHJOB, CODE, CRONJOBPENDINGSTEPSRELATION_MARKMODIFIED, CRONJOBPENDINGSTEPSRELATION_SRC_ORDERED, CRONJOBPENDINGSTEPSRELATION_TGT_ORDERED, CRONJOBPROCESSEDSTEPSRELATION_MARKMODIFIED, CRONJOBPROCESSEDSTEPSRELATION_SRC_ORDERED, CRONJOBPROCESSEDSTEPSRELATION_TGT_ORDERED, DEFAULT_INITIAL_ATTRIBUTES, ERRORMODE, PENDINGCRONJOBS, PROCESSEDCRONJOBS, SEQUENCENUMBER, SYNCHRONOUSFields inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LANGUAGE_FALLBACK_ENABLEDFields 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, TYPEFields inherited from class de.hybris.platform.util.BridgeAbstraction
impl, tenant -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ChangeDescriptorCreates a newChangeDescriptorfor the specifiedCronJobwith the specified changeType, changedItem and description.protected abstract booleancanPerform(CronJob cronJob) Returnstrue, if thisStepcan be performed for the specifiedCronJob.protected booleanReturnstrue, if thisStepis undoable for the specifiedCronJob.protected ItemcreateItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) Has to be implemented for each concrete subtype of item.voidvoidvoidprotected Collection<ChangeDescriptor>getChanges(CronJob cronJob) Returns aCollectionofChangeDescriptors, which were created by thisStep.protected Collection<ChangeDescriptor>getChanges(CronJob cronJob, int start, int count) Returns aCollectionofChangeDescriptors, which were created by thisStep.protected Collection<ChangeDescriptor>getChanges(CronJob cronJob, String changeType) Returns aCollectionofChangeDescriptorsof the specified changeType, which were created by thisStep.protected Collection<ChangeDescriptor>getChanges(CronJob cronJob, String changeType, int start, int count) Returns aCollectionofChangeDescriptorsof the specified changeType, which were created by thisStep.Returns the EnumerationValueGeneratedCronJobConstants.Enumerations.ErrorMode.FAIL.Returns the EnumerationValueGeneratedCronJobConstants.Enumerations.ErrorMode.IGNORE.protected ChangeDescriptorgetMostRecentChange(CronJob cronJob, String changeType) Returns the most recentChangeDescriptorfor thisStepand the specifiedCronJob.protected Item.ItemAttributeMapgetNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes) The default implementation ofGenericItem.getNonInitialAttributes(SessionContext, Item.ItemAttributeMap)assures that the 'registered initial' propertiesGenericItem.getInitialProperties(JaloSession, Item.ItemAttributeMap)will be removed from the 'non initial map'.Returns the EnumerationValueGeneratedCronJobConstants.Enumerations.ErrorMode.PAUSE.protected booleanhasChanges(CronJob cronJob, String changeType) voidbooleanReturnstrue, if thisStepis abortable.booleanbooleanbooleanbooleanvoidprotected abstract voidperformStep(CronJob cronJob) Executes this Step using the specifiedCronJob.voidsetNonInitialAttributes(SessionContext ctx, Item item, Item.ItemAttributeMap nonInitialAttributes) Sets all attributes which could not be set duringItem.createItem(SessionContext, ComposedType, ItemAttributeMap).toString()Returns theStringrepresentation of aStep.protected abstract voidStarts the undo processing for thisStepand the specifiedCronJob.voidMethods inherited from class de.hybris.platform.cronjob.jalo.GeneratedStep
getBatchJob, getBatchJob, getCode, getCode, getDefaultAttributeModes, getErrorMode, getErrorMode, getSequenceNumber, getSequenceNumber, getSequenceNumberAsPrimitive, getSequenceNumberAsPrimitive, isMarkModifiedDisabled, isSynchronous, isSynchronous, isSynchronousAsPrimitive, isSynchronousAsPrimitive, setBatchJob, setBatchJob, setCode, setCode, setErrorMode, setErrorMode, setSequenceNumber, setSequenceNumber, setSequenceNumber, setSequenceNumber, setSynchronous, setSynchronous, setSynchronous, setSynchronousMethods inherited from class de.hybris.platform.jalo.GenericItem
getImplementation, getInitialProperties, getRelatedItems, getRelatedItems, setRelatedItemsMethods 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, setLocalizedPropertyMethods inherited from class de.hybris.platform.jalo.ExtensibleItem
createNonClassAccessor, getAllProperties, getAllProperties, getProperty, getProperty, getPropertyNames, getPropertyNames, removeProperty, removeProperty, setAllProperties, setAllProperties, setProperty, setPropertyMethods 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, checkRemovable, 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, getPartOfRemovedSessionMarker, 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, isRelationLocalizationFallbackEnabled, newInstance, notifyExtensionsAfterItemCreation, notifyExtensionsBeforeItemCreation, notifyItemRemoval, notifyManagerAboutItemRemoval, readResolve, registerAccessFor, registerAccessFor, registerJaloInvalidationListeners, remove, 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, suppressRelation, useTA, writeReplaceMethods inherited from class de.hybris.platform.util.BridgeAbstraction
setTenant
-
Constructor Details
-
Step
public Step()
-
-
Method Details
-
createItem
protected Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) throws JaloBusinessException Description copied from class:ItemHas to be implemented for each concrete subtype of item. This method is responsible for creating a new item instance ( by calling managers, ejb homes, etc. ) duringComposedType.newInstance(Map).In case this method uses any of the attribute values during creation it is required to override
Item.getNonInitialAttributes(SessionContext, ItemAttributeMap)too.
Sn example:public static final String MY_ATTRIBUTE = "someAttribute"; ... protected Item createItem(SessionContext ctx, ComposedType type, Map allAttributes ) throws JaloBusinessException { MyManager man = ... return man.createMyItem( (String)allAttributes.get(MY_ATTRIBUTE) ); // here MY_ATTRIBUTE is used for creation, so it must not be set again } protected Map getNonInitialAttributes( SessionContext ctx, Map allAttributes ) { // let superclass remove its own initial attributes Map ret = super.getNonInitialAttributes( ctx, allAttributes ); // remove MY_ATTRIBUTE from all attributes since if has already been set ret.remove(MY_ATTRIBUTE); return ret; }- Overrides:
createItemin classGenericItem- Parameters:
ctx- the current session context which this item is created withintype- the actual item type ( since subtypes may not provide a own jalo class this may be different from the type which this method was implemented for )- Returns:
- the new item instance
- Throws:
JaloBusinessException- indicates an error during creation - any changes will be rollbacked
-
getNonInitialAttributes
protected Item.ItemAttributeMap getNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes) Description copied from class:GenericItemThe default implementation ofGenericItem.getNonInitialAttributes(SessionContext, Item.ItemAttributeMap)assures that the 'registered initial' propertiesGenericItem.getInitialProperties(JaloSession, Item.ItemAttributeMap)will be removed from the 'non initial map'.- Overrides:
getNonInitialAttributesin classGenericItem- Parameters:
ctx- session context with language = NULLallAttributes- aItemAttributeMapcontaning attribute values.- Returns:
- a
ItemAttributeMapcontaining all attribute values, which belong to non-initial attributes.
-
setNonInitialAttributes
public void setNonInitialAttributes(SessionContext ctx, Item item, Item.ItemAttributeMap nonInitialAttributes) throws JaloBusinessException Description copied from class:ItemSets all attributes which could not be set duringItem.createItem(SessionContext, ComposedType, ItemAttributeMap). as default this method just iterates over all attribute mappings and sets the value by invokingItem.setAttribute(SessionContext, String, Object).- Overrides:
setNonInitialAttributesin classItem- Parameters:
ctx- session context with language = NULLitem- the newly created itemnonInitialAttributes- the non-initial attributed obtained viaItem.getNonInitialAttributes(SessionContext, ItemAttributeMap)- Throws:
JaloBusinessException
-
log
-
debug
-
info
-
warn
-
error
-
fatal
-
isDebugEnabled
public boolean isDebugEnabled() -
isInfoEnabled
public boolean isInfoEnabled() -
isWarnEnabled
public boolean isWarnEnabled() -
isErrorEnabled
public boolean isErrorEnabled() -
getChanges
Returns aCollectionofChangeDescriptors, which were created by thisStep. TheseChangeDescriptorsnormally are created during execution by usingaddChange(CronJob, String, Item, String).- Parameters:
cronJob- theCronJobwhich is used by thisStepfor execution- Returns:
- a
CollectionofChangeDescriptors, which were created by thisStep
-
getChanges
Returns aCollectionofChangeDescriptorsof the specified changeType, which were created by thisStep. TheseChangeDescriptorsnormally are created during execution by usingaddChange(CronJob, String, Item, String).- Parameters:
cronJob- theCronJobwhich is used by theStepfor executionchangeType- specifes which kind of changes should be considered- Returns:
- a
CollectionofChangeDescriptors, which were created by thisStep
-
getChanges
Returns aCollectionofChangeDescriptors, which were created by thisStep. The collection contains a ChangeDescriptors which belong to the specified range (start -> start + count).These
ChangeDescriptorsnormally are created during execution by usingaddChange(CronJob, String, Item, String).- Parameters:
cronJob- theCronJobwhich is used by thisStepfor executionstart- the index of the firstChangeDescriptorof the rangecount- the number ofChangeDescriptorsin the range- Returns:
- a
CollectionofChangeDescriptorsof the specified changeType, which were created by thisStep
-
getChanges
protected Collection<ChangeDescriptor> getChanges(CronJob cronJob, String changeType, int start, int count) Returns aCollectionofChangeDescriptorsof the specified changeType, which were created by thisStep. The collection contains a ChangeDescriptors which belong to the specified range (start -> start + count).These
ChangeDescriptorsnormally are created during execution by usingaddChange(CronJob, String, Item, String).- Parameters:
cronJob- theCronJobwhich is used by thisStepfor executionchangeType- specifes which kind of changes should be consideredstart- the index of the firstChangeDescriptorof the rangecount- the number ofChangeDescriptorsin the range- Returns:
- a
CollectionofChangeDescriptorsof the specified changeType, which were created by thisStep
-
addChange
protected ChangeDescriptor addChange(CronJob cronJob, String changeType, Item changedItem, String description) Creates a newChangeDescriptorfor the specifiedCronJobwith the specified changeType, changedItem and description.- Parameters:
cronJob- theCronJobwhich is used for executionchangeType- specifes which type of change (create, delete, modify...)changedItem- the changed item (optional)description- a description (optional)- Returns:
- the new
ChangeDescriptor
-
hasChanges
Returnstrue, if there areChangeDescriptorsfor thisStepand the specifiedCronJob. Otherwisefalseis returned.- Parameters:
cronJob- theCronJobwhich is used for executionchangeType- specifes which type of change should be considered. This parameter is optional, ifnullis specified, allChangeDescriptorswill be considered- Returns:
true, if there areChangeDescriptorsfor thisStepand the specifiedCronJob
-
getMostRecentChange
Returns the most recentChangeDescriptorfor thisStepand the specifiedCronJob. Optionally the changeType can be specified.- Parameters:
cronJob- theCronJobwhich is used for executionchangeType- specifes which kind of changes should be considered- Returns:
- Returns the most recent
ChangeDescriptorfor thisStepand the specifiedCronJob
-
canUndo
Returnstrue, if thisStepis undoable for the specifiedCronJob. Otherwisefalseis returned.If one step of a CronJob returns
falsethe whole CronJob will stop the undo process. The default implementation returnsfalse. If your subclass ofStepsupports the undo-feature, override this method and returntrue.- Parameters:
cronJob- theCronJobwhich is used for execution- Returns:
true, if thisStepis undoable for the specifiedCronJob- See Also:
-
undoStep
Starts the undo processing for thisStepand the specifiedCronJob.
Add your undo logic here to support the undo feature.- Parameters:
cronJob- theCronJobwhich is used for execution- See Also:
-
canPerform
Returnstrue, if thisStepcan be performed for the specifiedCronJob. Otherwisefalseis returned.- Parameters:
cronJob- theCronJobwhich is used for execution- Returns:
true, if thisStepcan be performed for the specifiedCronJob
-
performStep
Executes this Step using the specifiedCronJob.Implement this method in your
Stepsubclass and add the logic here.- Parameters:
cronJob- theCronJobwhich is used for execution- Throws:
AbortCronJobException- if the execution is aborted due to an error- See Also:
-
getFailErrorMode
Returns the EnumerationValueGeneratedCronJobConstants.Enumerations.ErrorMode.FAIL.- Returns:
- the EnumerationValue
GeneratedCronJobConstants.Enumerations.ErrorMode.FAIL
-
getPauseErrorMode
Returns the EnumerationValueGeneratedCronJobConstants.Enumerations.ErrorMode.PAUSE.- Returns:
- the EnumerationValue
GeneratedCronJobConstants.Enumerations.ErrorMode.PAUSE
-
getIgnoreErrorMode
Returns the EnumerationValueGeneratedCronJobConstants.Enumerations.ErrorMode.IGNORE.- Returns:
- the EnumerationValue
GeneratedCronJobConstants.Enumerations.ErrorMode.IGNORE
-
toString
Returns theStringrepresentation of aStep. The representation has the following structure:BatchJob.CODE -> Step.CODE[ sync|async, Step.ERRORMODE] -
isAbortable
public boolean isAbortable()Returnstrue, if thisStepis abortable.The default implementation returns always
false. To mark yourStepsubclass as abortable, override this method and returntrue.- Returns:
true, if thisStepis abortable
-