public abstract class Step extends GeneratedStep
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.BatchJob,
Job,
Serialized FormGenericItem.GenericItemImplLocalizableItem.LocalizableItemImplExtensibleItem.ExtensibleItemImplItem.AttributeFilter, Item.AttributeMode, Item.CachedGetter, Item.CachedSetter, Item.ItemAttributeMap, Item.ItemConstraint, Item.ItemImpl, Item.JaloCachedComputationExceptionBATCHJOB, CODE, CRONJOBPENDINGSTEPSRELATION_MARKMODIFIED, CRONJOBPENDINGSTEPSRELATION_SRC_ORDERED, CRONJOBPENDINGSTEPSRELATION_TGT_ORDERED, CRONJOBPROCESSEDSTEPSRELATION_MARKMODIFIED, CRONJOBPROCESSEDSTEPSRELATION_SRC_ORDERED, CRONJOBPROCESSEDSTEPSRELATION_TGT_ORDERED, DEFAULT_INITIAL_ATTRIBUTES, ERRORMODE, PENDINGCRONJOBS, PROCESSEDCRONJOBS, SEQUENCENUMBER, SYNCHRONOUSLANGUAGE_FALLBACK_ENABLED_CREATION_TIME_INTERNAL, _MODIFIED_TIME_INTERNAL, accessorLog, CREATION_TIME, DISABLE_ATTRIBUTE_CHECK, DISABLE_ITEMCHECK_BEFORE_REMOVABLE, EVEN, FEATURE_ACCESSMAP_QUALIFIER, INITIAL_CREATION_FLAG, isJaloOnly, MODIFIED_TIME, NEGATIVE, NOT_FOUND, OWNER, PK, POSITIVE, SAVE_FROM_SERVICE_LAYER, staticTransientObjects, TYPEimpl, tenant| Constructor and Description |
|---|
Step() |
| Modifier and Type | Method and Description |
|---|---|
protected ChangeDescriptor |
addChange(CronJob cronJob,
String changeType,
Item changedItem,
String description)
Creates a new
ChangeDescriptor for the specified CronJob with the specified changeType,
changedItem and description. |
protected abstract boolean |
canPerform(CronJob cronJob)
Returns
true, if this Step can be performed for the specified CronJob. |
protected boolean |
canUndo(CronJob cronJob)
Returns
true, if this Step is undoable for the specified CronJob. |
protected Item |
createItem(SessionContext ctx,
ComposedType type,
Item.ItemAttributeMap allAttributes)
Has to be implemented for each concrete subtype of item.
|
void |
debug(String message) |
void |
error(String message) |
void |
fatal(String message) |
protected Collection<ChangeDescriptor> |
getChanges(CronJob cronJob)
Returns a
Collection of ChangeDescriptors, which were created by this Step. |
protected Collection<ChangeDescriptor> |
getChanges(CronJob cronJob,
int start,
int count)
Returns a
Collection of ChangeDescriptors, which were created by this Step. |
protected Collection<ChangeDescriptor> |
getChanges(CronJob cronJob,
String changeType)
Returns a
Collection of ChangeDescriptors of the specified changeType, which were
created by this Step. |
protected Collection<ChangeDescriptor> |
getChanges(CronJob cronJob,
String changeType,
int start,
int count)
Returns a
Collection of ChangeDescriptors of the specified changeType, which were
created by this Step. |
EnumerationValue |
getFailErrorMode()
Returns the EnumerationValue
GeneratedCronJobConstants.Enumerations.ErrorMode.FAIL. |
EnumerationValue |
getIgnoreErrorMode()
Returns the EnumerationValue
GeneratedCronJobConstants.Enumerations.ErrorMode.IGNORE. |
protected ChangeDescriptor |
getMostRecentChange(CronJob cronJob,
String changeType)
Returns the most recent
ChangeDescriptor for this Step and the specified
CronJob. |
protected Item.ItemAttributeMap |
getNonInitialAttributes(SessionContext ctx,
Item.ItemAttributeMap allAttributes)
The default implementation of
GenericItem.getNonInitialAttributes(SessionContext, Item.ItemAttributeMap ) assures
that the 'registered initial' properties GenericItem.getInitialProperties(JaloSession, Item.ItemAttributeMap ) will
be removed from the 'non initial map'. |
EnumerationValue |
getPauseErrorMode()
Returns the EnumerationValue
GeneratedCronJobConstants.Enumerations.ErrorMode.PAUSE. |
protected boolean |
hasChanges(CronJob cronJob,
String changeType)
|
void |
info(String message) |
boolean |
isAbortable()
Returns
true, if this Step is abortable. |
boolean |
isDebugEnabled() |
boolean |
isErrorEnabled() |
boolean |
isInfoEnabled() |
boolean |
isWarnEnabled() |
void |
log(String message,
Level level) |
protected abstract void |
performStep(CronJob cronJob)
Executes this Step using the specified
CronJob. |
void |
setNonInitialAttributes(SessionContext ctx,
Item item,
Item.ItemAttributeMap nonInitialAttributes)
Sets all attributes which could not be set during
Item.createItem(SessionContext, ComposedType, ItemAttributeMap). |
String |
toString()
Returns the
String representation of a Step. |
protected abstract void |
undoStep(CronJob cronJob)
Starts the undo processing for this
Step and the specified CronJob. |
void |
warn(String message) |
getBatchJob, getBatchJob, getCode, getCode, getDefaultAttributeModes, getErrorMode, getErrorMode, getSequenceNumber, getSequenceNumber, getSequenceNumberAsPrimitive, getSequenceNumberAsPrimitive, isSynchronous, isSynchronous, isSynchronousAsPrimitive, isSynchronousAsPrimitive, setBatchJob, setBatchJob, setCode, setCode, setErrorMode, setErrorMode, setSequenceNumber, setSequenceNumber, setSequenceNumber, setSequenceNumber, setSynchronous, setSynchronous, setSynchronous, setSynchronousgetInitialPropertiesgetAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllValuesSessionContext, getLocalizedProperty, getLocalizedProperty, getLocalizedPropertyInternal, getLocalizedPropertyNames, getLocalizedPropertyNames, hasLanguage, isEmptyValue, isFallbackEnabled, removeLocalizedProperty, removeLocalizedProperty, setAllLocalizedProperties, setAllLocalizedProperties, setLocalizedProperty, setLocalizedPropertycreateNonClassAccessor, getAllProperties, getAllProperties, getProperty, getProperty, getPropertyNames, getPropertyNames, removeProperty, removeProperty, setAllProperties, setAllProperties, setProperty, setPropertyaddLinkedItems, 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, 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, readResolve, refreshRemote, 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, useTA, writeReplacegetImplementation, setTenantprotected Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) throws JaloBusinessException
ItemComposedType.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; }
createItem in class GenericItemctx - 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 )JaloBusinessException - indicates an error during creation - any changes will be rollbackedprotected Item.ItemAttributeMap getNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes)
GenericItemGenericItem.getNonInitialAttributes(SessionContext, Item.ItemAttributeMap ) assures
that the 'registered initial' properties GenericItem.getInitialProperties(JaloSession, Item.ItemAttributeMap ) will
be removed from the 'non initial map'.getNonInitialAttributes in class GenericItemctx - session context with language = NULLallAttributes - a ItemAttributeMap contaning attribute values.ItemAttributeMap containing all attribute values, which belong to non-initial attributes.public void setNonInitialAttributes(SessionContext ctx, Item item, Item.ItemAttributeMap nonInitialAttributes) throws JaloBusinessException
ItemItem.createItem(SessionContext, ComposedType, ItemAttributeMap). as default this method just iterates over all
attribute mappings and sets the value by invoking Item.setAttribute(SessionContext, String, Object).setNonInitialAttributes in class Itemctx - session context with language = NULLitem - the newly created itemnonInitialAttributes - the non-initial attributed obtained via
Item.getNonInitialAttributes(SessionContext, ItemAttributeMap)JaloBusinessExceptionpublic void log(String message, Level level)
public void debug(String message)
public void info(String message)
public void warn(String message)
public void error(String message)
public void fatal(String message)
public boolean isDebugEnabled()
public boolean isInfoEnabled()
public boolean isWarnEnabled()
public boolean isErrorEnabled()
protected Collection<ChangeDescriptor> getChanges(CronJob cronJob)
Collection of ChangeDescriptors, which were created by this Step.
These ChangeDescriptors normally are created during execution by using
addChange(CronJob, String, Item, String).cronJob - the CronJob which is used by this Step for executionCollection of ChangeDescriptors, which were created by this Stepprotected Collection<ChangeDescriptor> getChanges(CronJob cronJob, String changeType)
Collection of ChangeDescriptors of the specified changeType, which were
created by this Step. These ChangeDescriptors normally are created during execution by
using addChange(CronJob, String, Item, String).cronJob - the CronJob which is used by the Step for executionchangeType - specifes which kind of changes should be consideredCollection of ChangeDescriptors, which were created by this Stepprotected Collection<ChangeDescriptor> getChanges(CronJob cronJob, int start, int count)
Collection of ChangeDescriptors, which were created by this Step.
The collection contains a ChangeDescriptors which belong to the specified range (start -> start + count).
These ChangeDescriptors normally are created during execution by using
addChange(CronJob, String, Item, String).cronJob - the CronJob which is used by this Step for executionstart - the index of the first ChangeDescriptor of the rangecount - the number of ChangeDescriptors in the rangeCollection of ChangeDescriptors of the specified changeType, which were
created by this Stepprotected Collection<ChangeDescriptor> getChanges(CronJob cronJob, String changeType, int start, int count)
Collection of ChangeDescriptors of the specified changeType, which were
created by this Step. The collection contains a ChangeDescriptors which belong to the specified range
(start -> start + count).
These ChangeDescriptors normally are created during execution by using
addChange(CronJob, String, Item, String).cronJob - the CronJob which is used by this Step for executionchangeType - specifes which kind of changes should be consideredstart - the index of the first ChangeDescriptor of the rangecount - the number of ChangeDescriptors in the rangeCollection of ChangeDescriptors of the specified changeType, which were
created by this Stepprotected ChangeDescriptor addChange(CronJob cronJob, String changeType, Item changedItem, String description)
ChangeDescriptor for the specified CronJob with the specified changeType,
changedItem and description.cronJob - the CronJob which is used for executionchangeType - specifes which type of change (create, delete, modify...)changedItem - the changed item (optional)description - a description (optional)ChangeDescriptorprotected boolean hasChanges(CronJob cronJob, String changeType)
true, if there are ChangeDescriptors for this Step and
the specified CronJob. Otherwise false is returned.cronJob - the CronJob which is used for executionchangeType - specifes which type of change should be considered. This parameter is optional, if null is
specified, all ChangeDescriptors will be consideredtrue, if there are ChangeDescriptors for this Step and
the specified CronJobprotected ChangeDescriptor getMostRecentChange(CronJob cronJob, String changeType)
ChangeDescriptor for this Step and the specified
CronJob. Optionally the changeType can be specified.cronJob - the CronJob which is used for executionchangeType - specifes which kind of changes should be consideredChangeDescriptor for this Step and the specified
CronJobprotected boolean canUndo(CronJob cronJob)
true, if this Step is undoable for the specified CronJob. Otherwise
false is returned.
If one step of a CronJob returns false the whole CronJob will stop the undo process. The default
implementation returns false. If your subclass of Step supports the undo-feature,
override this method and return true.cronJob - the CronJob which is used for executiontrue, if this Step is undoable for the specified CronJobundoStep(CronJob)protected abstract void undoStep(CronJob cronJob)
Step and the specified CronJob. cronJob - the CronJob which is used for executioncanUndo(CronJob)protected abstract boolean canPerform(CronJob cronJob)
true, if this Step can be performed for the specified CronJob.
Otherwise false is returned.cronJob - the CronJob which is used for executiontrue, if this Step can be performed for the specified CronJobprotected abstract void performStep(CronJob cronJob) throws AbortCronJobException
CronJob.
Implement this method in your Step subclass and add the logic here.cronJob - the CronJob which is used for executionAbortCronJobException - if the execution is aborted due to an errorcanPerform(CronJob)public EnumerationValue getFailErrorMode()
GeneratedCronJobConstants.Enumerations.ErrorMode.FAIL.GeneratedCronJobConstants.Enumerations.ErrorMode.FAILpublic EnumerationValue getPauseErrorMode()
GeneratedCronJobConstants.Enumerations.ErrorMode.PAUSE.GeneratedCronJobConstants.Enumerations.ErrorMode.PAUSEpublic EnumerationValue getIgnoreErrorMode()
GeneratedCronJobConstants.Enumerations.ErrorMode.IGNORE.GeneratedCronJobConstants.Enumerations.ErrorMode.IGNOREpublic String toString()
String representation of a Step. The representation has the following
structure:
BatchJob.CODE -> Step.CODE[ sync|async, Step.ERRORMODE]
public boolean isAbortable()
true, if this Step is abortable.
The default implementation returns always false. To mark your Step subclass as
abortable, override this method and return true.true, if this Step is abortableCopyright © 2017 SAP SE. All Rights Reserved.