Class ImpExImportJob
java.lang.Object
de.hybris.platform.util.BridgeAbstraction
de.hybris.platform.jalo.Item
de.hybris.platform.jalo.ExtensibleItem
de.hybris.platform.jalo.c2l.LocalizableItem
de.hybris.platform.jalo.GenericItem
de.hybris.platform.cronjob.jalo.GeneratedJob
de.hybris.platform.cronjob.jalo.Job
de.hybris.platform.impex.jalo.cronjob.GeneratedImpExImportJob
de.hybris.platform.impex.jalo.cronjob.ImpExImportJob
- All Implemented Interfaces:
Serializable,Comparable
- Direct Known Subclasses:
MultiThreadedImpExImportReaderIntegrationTest.TestImpExImportJob
This job imports data given by
ATTENTION: Each default import cronjob uses the same instance of this job. So be assure while extending this job that no state dependent things are used, like member variables.
jobMedia attribute of assigned cronjob using the ImpEx Importer.
For dumping of unresolved lines, the CronJobDumpHandler is used, so the dump file will be hold transient
while each pass and at the end of a pass stored to the unresolvedMedia flag of the cronjob. Additionally
it will be performed a savepoint logic periodically which also stores the transient dump file and saves information
about current state.ATTENTION: Each default import cronjob uses the same instance of this job. So be assure while extending this job that no state dependent things are used, like member variables.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic classCronjob specificImportProcessorwhich extends theDefaultImportProcessorby adding the cronjob code to each saved values message.protected static classstatic classCronjob specificImportProcessorwhich extends theDefaultImportProcessorby adding the cronjob code to each saved values message.Nested classes/interfaces inherited from class de.hybris.platform.cronjob.jalo.Job
Job.JobFileLogContainer, Job.SynchronicityNested 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.impex.jalo.cronjob.GeneratedImpExImportJob
DEFAULT_INITIAL_ATTRIBUTES, MAXTHREADSFields inherited from class de.hybris.platform.cronjob.jalo.Job
CTX_CURRENTCRONJOB, CTX_CURRENTJOBFields inherited from class de.hybris.platform.cronjob.jalo.GeneratedJob
ACTIVE, ALTERNATIVEDATASOURCEID, CHANGERECORDINGENABLED, CODE, CRONJOBS, CRONJOBSHANDLER, EMAILADDRESS, EMAILNOTIFICATIONTEMPLATE, ERRORMODE, LOGLEVELDATABASE, LOGLEVELFILE, LOGTODATABASE, LOGTOFILE, NODEGROUP, NODEID, NUMBEROFRETRIES, PRIORITY, REMOVEONEXIT, REQUESTABORT, REQUESTABORTSTEP, RESTRICTIONS, RESTRICTIONSHANDLER, RETRY, SENDEMAIL, SESSIONCONTEXTVALUES, SESSIONCURRENCY, SESSIONLANGUAGE, SESSIONUSER, SINGLEEXECUTABLE, TRIGGERS, TRIGGERSHANDLER, USEREADONLYDATASOURCEFields 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 voidAborts the job by throwing an exception.protected CSVReaderadjustCSVReader(CSVReader reader, ImpExImportCronJob cronJob) Adjusts the CSV reader to the cronjob specific requirements.protected ImporteradjustImporter(Importer importer, ImpExImportCronJob cronJob) Adjusts the importer to the cronjob specific requirements.protected ImportProcessoradjustImportProcessor(ImportProcessor processor, ImpExImportCronJob cronJob) Adjusts the processor to the cronjob specific requirements.protected ImpExImportReaderadjustImportReader(ImpExImportReader reader, ImpExImportCronJob cronJob) Adjusts the import reader to the cronjob specific requirements.protected booleanReturnstrue, if the specifiedCronJobcan be undone.protected voidcleanup(ImpExImportCronJob importCronJob) Tries to remove all used medias which are marked as to remove.protected CSVReadercreateCSVReader(ImpExImportCronJob cronJob) Creates the csv reader which gives theImpExImportReaderaccess to the source data.protected ImportercreateImporter(ImpExImportCronJob cronJob, ImpExImportReader reader) Creates the importer instance.protected ImportProcessorcreateImportProcessor(ImpExImportCronJob cronJob) Creates the job specificImportProcessor.protected ImpExImportReadercreateImportReader(ImpExImportCronJob cronJob, CSVReader csvReader, ImportProcessor processor) Creates the import reader instance used by theImporter.protected booleandoImport(ImpExImportCronJob cronJob, Importer importer) Performs the import using givenImporterinstance.static intgetDefaultMaxThreads(Tenant tenant) Generated method - Getter of theImpExImportJob.maxThreadsattribute.protected intgetMaxThreads4Run(ImpExImportCronJob cronjob) protected longbooleanisAbortable(CronJob cronJob) Tells whether this currently executed job is abortable.booleanisPerformable(CronJob cronJob) Tests whether the given CronJob instance can be performed.performCronJob(CronJob cronJob) You have to implement this method in yourJob.protected booleanperformJob(ImpExImportCronJob cronJob) Instantiates and configures aImporterinstance and performs the import using it.protected LocaleprepareLocale(ImpExImportCronJob cronJob) Gets the locale setting from the given cronjob and converts it to a realLocaleobject.protected ImpExMediaprepareMedia(ImpExImportCronJob cronJob) Gets the media used as source data.protected voidsaveStats(ImpExImportCronJob cronJob, Importer importer) Saves important statistics for error resolving.voidsetMaxThreads(SessionContext ctx, Integer integer) Generated method - Setter of theImpExImportJob.maxThreadsattribute.Methods inherited from class de.hybris.platform.impex.jalo.cronjob.GeneratedImpExImportJob
getDefaultAttributeModes, getMaxThreads, getMaxThreadsAsPrimitive, getMaxThreadsAsPrimitive, setMaxThreads, setMaxThreads, setMaxThreadsMethods 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, isUndoable, isWarnEnabled, jobIsCurrentlyRunning, log, logToFile, perform, perform, perform, prepareAfterFinishEvent, prepareBeforeStartEvent, remove, saveToLogFile, sendFinishedEvent, sendStartEvent, setCode, setCronJobs, setCurrentLogContainer, setNonInitialAttributes, startOwnSession, stopOwnSession, switchDataSource, undo, undo, undoCronJob, unsetAlternativeDataSource, unsetCurrentLogContainer, warnMethods 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, getNumberOfRetries, getNumberOfRetries, getNumberOfRetriesAsPrimitive, getNumberOfRetriesAsPrimitive, 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, isUseReadOnlyDatasource, isUseReadOnlyDatasource, isUseReadOnlyDatasourceAsPrimitive, isUseReadOnlyDatasourceAsPrimitive, 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, setNumberOfRetries, setNumberOfRetries, setNumberOfRetries, setNumberOfRetries, 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, setUseReadOnlyDatasource, setUseReadOnlyDatasource, setUseReadOnlyDatasource, setUseReadOnlyDatasourceMethods 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, 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, 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, suppressRelation, toString, useTA, writeReplaceMethods inherited from class de.hybris.platform.util.BridgeAbstraction
setTenant
-
Constructor Details
-
ImpExImportJob
public ImpExImportJob()
-
-
Method Details
-
canUndo
Description copied from class:JobReturnstrue, if the specifiedCronJobcan be undone. Overwrite this method of you want to undo your CronJob. Default value isfalse -
isAbortable
Description copied from class:JobTells whether this currently executed job is abortable. As default this method returns false. Override to implement abortable jobs.- Overrides:
isAbortablein classJob- Parameters:
cronJob- the current execution of this job.- Returns:
trueif the cronjob is running and the job supports aborting viaGeneratedCronJob.setRequestAbort(boolean)
-
isPerformable
Description copied from class:JobTests whether the given CronJob instance can be performed. Internal the methodscanPerform( final CronJob cronJob )and canPerformInternal( final CronJob cronJob ) are called. Only if both methods returningtrue, this method also returntrueReturnstrue, if thisJobcan be performed using the specifiedCronjob. Otherwisefalseis returned.- Overrides:
isPerformablein classJob- Parameters:
cronJob- which should be performed- Returns:
true, if thisJobcan be performed using the specifiedCronjob. Otherwisefalseis returned
-
performCronJob
Description copied from class:JobYou have to implement this method in yourJob. Here you can execute the job. You have to return aCronJobResultthat indicates whether theJobwas successfully executed or not.- Specified by:
performCronJobin classJob- Parameters:
cronJob- the CronJob to execute- Returns:
- a
CronJobResultthat indicates whether theJobwas successfully executed or not. - Throws:
AbortCronJobException- See Also:
-
cleanup
Tries to remove all used medias which are marked as to remove.- Parameters:
importCronJob- cronjob instance for accessing the medias
-
performJob
Instantiates and configures aImporterinstance and performs the import using it. For instantiating theImporter, first aCSVReaderholding the source data will be created and configured, second aImportProcessorwill be created and configured and third anImpExImportReaderwill be instantiated and configured.- Parameters:
cronJob- cronjob instance performing this job- Returns:
- true if import was successful, false otherwise
- Throws:
AbortCronJobException- import job was aborted
-
getStatsInverval
protected long getStatsInverval() -
doImport
protected boolean doImport(ImpExImportCronJob cronJob, Importer importer) throws AbortCronJobException Performs the import using givenImporterinstance. If a abort is requested, the import will be aborted.- Parameters:
cronJob- cronjob instance performing this jobimporter- configured importer instance to use for import- Returns:
- true if import was successful, false otherwise
- Throws:
AbortCronJobException- import job was aborted
-
createCSVReader
Creates the csv reader which gives theImpExImportReaderaccess to the source data. As source data the media of thejobMediaattribute of the cronjob is used. Furthermore theencodingattribute is used for defining the encoding of the stream to that media.- Parameters:
cronJob- current cronjob instance to get encoding and source data- Returns:
- CSVReader created csv reader
-
createImportProcessor
Creates the job specificImportProcessor. This processor adds the cronjob code to the saved values message.- Parameters:
cronJob- cronjob instance to get further parameters- Returns:
- created processor instance
-
createImportReader
protected ImpExImportReader createImportReader(ImpExImportCronJob cronJob, CSVReader csvReader, ImportProcessor processor) Creates the import reader instance used by theImporter. Here a cronjob specific reader is used which uses the encoding specified at cronjob for external data medias and an specificImportProcessor. Furthermore a specificImportProcessorcan be specified.- Parameters:
cronJob- current cronjob instance to get parameters like encodingcsvReader- reader holding the source data used for instantiating the import readerprocessor- processor which will be set when instantiating the import reader- Returns:
- ImpExImportReader import reader used by
Importer
-
createImporter
Creates the importer instance. This object performs the import item by item.- Parameters:
cronJob- current cronjob instance to get parameters for instantiationreader- import reader used for instantiating the importer- Returns:
- created importer instance
-
adjustCSVReader
Adjusts the CSV reader to the cronjob specific requirements.- Parameters:
reader- reader instance to configurecronJob- cronjob instance to get further parameters- Returns:
- adjusted reader
-
adjustImportProcessor
protected ImportProcessor adjustImportProcessor(ImportProcessor processor, ImpExImportCronJob cronJob) Adjusts the processor to the cronjob specific requirements.- Parameters:
processor- processor instance to configurecronJob- cronjob instance to get further parameters- Returns:
- adjusted processor
-
adjustImportReader
protected ImpExImportReader adjustImportReader(ImpExImportReader reader, ImpExImportCronJob cronJob) Adjusts the import reader to the cronjob specific requirements.- Parameters:
reader- instance to configurecronJob- cronjob instance to get further parameters- Returns:
- adjusted reader
-
adjustImporter
Adjusts the importer to the cronjob specific requirements.- Parameters:
importer- instance to configurecronJob- cronjob instance to get further parameters- Returns:
- adjusted importer
-
prepareLocale
Gets the locale setting from the given cronjob and converts it to a realLocaleobject.- Parameters:
cronJob- cronjob holding the locale string- Returns:
- locale string converted to
Localeinstance
-
prepareMedia
Gets the media used as source data. Internally this method creates a work media (seeGeneratedImpExImportCronJob.getWorkMedia()) and copies all data from actual impex media.- Parameters:
cronJob- the cronjob holding all settings- Returns:
- media containing source data
- Throws:
ImpExException- error while accessing data of medias
-
saveStats
Saves important statistics for error resolving.- Parameters:
cronJob- cronjob instance for getting further parametersimporter- importer instance which has performed the import
-
abort
Aborts the job by throwing an exception.- Parameters:
cronJob- cronjob instance for getting further parameters- Throws:
AbortCronJobException- exception indicating the abort
-
getMaxThreads4Run
-
setMaxThreads
Description copied from class:GeneratedImpExImportJobGenerated method - Setter of theImpExImportJob.maxThreadsattribute.- Overrides:
setMaxThreadsin classGeneratedImpExImportJobinteger- the maxThreads
-
getMaxThreads
Description copied from class:GeneratedImpExImportJobGenerated method - Getter of theImpExImportJob.maxThreadsattribute.- Overrides:
getMaxThreadsin classGeneratedImpExImportJob- Returns:
- the maxThreads
-
getDefaultMaxThreads
-