Class ImportConfig
java.lang.Object
de.hybris.platform.servicelayer.impex.ImportConfig
Class for configuring an import using the
ImportService. If specific setter are not called, default values
will be set (mentioned at setter methods). The import script is a mandatory parameter for import, so do not forget to
call setScript(ImpExResource) method.- Since:
- 4.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the validation modes available for import. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns current log level for distributed ImpEx.Tells whether the ImpEx job allows execution of code inside the input data.Gets the configured locale for import.Gets the main script within zip archive set as import script.intGets the number of threads used maximal for import.Gets the resource containing data files used forMediaDataTranslator(mostly media files) packed in a zip archive.Tells, which nodeGroup has been chosen as allowed to execute the import.Gets the collection of referenced data resources.Gets the configured import script.Gets the configured validation mode of import.Checks whether current import config is enabled for distributed ImpEx.booleanChecks whether multi pass mechanism (or dumping of unresolved lines for next pass) is enabled.booleanWill the import fail on an error or tries to continue? Default is true.booleanChecks whether saved values will be created at import for each item modification.Checks the local legacy mode setting.booleanChecks whether the executed import cronjob and it's related media will be removed on successful execution.Checks whether the executed distributed import cronjob, distributedProcess and it's related items will be removed on successful execution.Checks whether direct persistence for data is enabled for the import.booleanWill the import be executed synchronous? Default is true.voidsetDistributedImpexEnabled(boolean enabled) Enables current import to be executed using distributed ImpEx, which will run import on a cluster.voidAllows to set log level for distributed ImpEx.voidsetDistributedImpexProcessCode(String distributedImpexProcessCode) voidsetDumpingEnabled(boolean dumpingEnabled) Sets whether multi pass mechanism (or dumping of unresolved lines for next pass) is enabled.voidsetEnableCodeExecution(Boolean enableCodeExecution) Defines whether the ImpEx job should allow execution of code inside the input data.voidsetFailOnError(boolean failOnError) Sets whether the export will fail on error or tries to continue execution.voidsetHmcSavedValuesEnabled(boolean hmcSavedValuesEnabled) Sets whether saved values will be created at import for each item modification.voidsetLegacyMode(Boolean legacyMode) Sets the legacy mode setting overriding globalimpex.legacy.modesetting fromproject.propertiesfile.voidSets the locale to use for import.voidsetMainScriptWithinArchive(String mainScriptWithinArchive) Sets the main script within zip archive set as import script.voidsetMaxThreads(int maxThreads) Sets the number of threads used maximal for import.voidsetMediaArchive(ImpExResource mediaArchive) Sets the resource containing data files used forMediaDataTranslator(mostly media files) packed in a zip archive.voidsetNodeGroup(String nodeGroup) Defines on which cluster node group the import can be executed.voidsetReferencedData(Collection<ImpExResource> referencedData) Sets a collection of referenced data for import.voidsetRemoveOnSuccess(boolean removeOnSuccess) Sets whether the executed import cronjob and it's related media will be removed on successful execution.voidsetRemoveOnSuccessForDistributedImpex(boolean removeOnSuccessForDistributedImpex) Sets whether the executed distributed import cronjob, distributedProcess and it's related items will be removed on successful execution.voidsetScript(ImpExResource script) Sets the import script to use for import.voidSets the import script to use for import as String.voidsetSldForData(Boolean sldForData) Sets whether direct persistence for data should be enabled for the import.voidsetSynchronous(boolean synchronous) Sets whether the import be executed synchronous? Default is true.voidsetValidationMode(ImportConfig.ValidationMode validationMode) Sets the validation mode for export.
-
Constructor Details
-
ImportConfig
public ImportConfig()
-
-
Method Details
-
setDistributedImpexLogLevel
Allows to set log level for distributed ImpEx. -
getDistributedImpexLogLevel
Returns current log level for distributed ImpEx. -
setDistributedImpexEnabled
public void setDistributedImpexEnabled(boolean enabled) Enables current import to be executed using distributed ImpEx, which will run import on a cluster. -
isDistributedImpexEnabled
Checks whether current import config is enabled for distributed ImpEx. -
setRemoveOnSuccessForDistributedImpex
public void setRemoveOnSuccessForDistributedImpex(boolean removeOnSuccessForDistributedImpex) Sets whether the executed distributed import cronjob, distributedProcess and it's related items will be removed on successful execution. Attention: if enabled the cronjob is not existent anymore after execution and with that you can not get a log or so anymore.- Parameters:
removeOnSuccessForDistributedImpex- true if the cronjob, distributedProcess and it's related items will be removed on successful execution
-
isRemoveOnSuccessForDistributedImpex
Checks whether the executed distributed import cronjob, distributedProcess and it's related items will be removed on successful execution. Attention: if enabled the cronjob, is not existent anymore after execution and with that you can not get a log or so anymore.- Returns:
- true if the cronjob, distributedProcess and it's related items will be removed on successful execution
-
getDistributedImpexProcessCode
-
setDistributedImpexProcessCode
-
getScript
Gets the configured import script. This is a mandatory field.- Returns:
- the export script
-
setScript
Sets the import script to use for import. This parameter is mandatory and has no default value. If you set a resource referencing a zip-archive you have to call thesetMainScriptWithinArchive(String)method for specifying the main script within the zip archive (except it has the default naming convention "importscript.impex".- Parameters:
script- the import script to use
-
setScript
Sets the import script to use for import as String. This method will buildStreamBasedImpExResourceobject for you and will usesetScript(ImpExResource)as normal.- Parameters:
script- the import script to use
-
getReferencedData
Gets the collection of referenced data resources. Default is null.- Returns:
- the referenced data collection
-
setReferencedData
Sets a collection of referenced data for import. Default is null. The data files/media of this collection can be referenced by the import script by using an include statement with the code of one of the resources.- Parameters:
referencedData- the collection of referenced data to set
-
getMediaArchive
Gets the resource containing data files used forMediaDataTranslator(mostly media files) packed in a zip archive. Default is null.- Returns:
- the media archive resource
-
setMediaArchive
Sets the resource containing data files used forMediaDataTranslator(mostly media files) packed in a zip archive. Default is null.- Parameters:
mediaArchive- the media archive resource to set
-
getMaxThreads
public int getMaxThreads()Gets the number of threads used maximal for import. Default is -1, so the number configured at project.properties is used. If number is 1 the import will not be executed multithreaded.- Returns:
- the maximal amount of threads used for import
-
isRemoveOnSuccess
public boolean isRemoveOnSuccess()Checks whether the executed import cronjob and it's related media will be removed on successful execution. Default is true. Attention: if enabled the cronjob is not existent anymore after execution and with that you can not get a log or so anymore.- Returns:
- true if the cronjob will be removed on successful execution
-
isHmcSavedValuesEnabled
public boolean isHmcSavedValuesEnabled()Checks whether saved values will be created at import for each item modification. Default is false. Enabling this option will cause a lower performance.- Returns:
- true if saved values will be created
-
getLocale
Gets the configured locale for import. Default is the tenant locale.- Returns:
- the locale
-
getValidationMode
Gets the configured validation mode of import. Default isImportConfig.ValidationMode.STRICT.- Returns:
- the validationMode used for import
-
isDumpingEnabled
public boolean isDumpingEnabled()Checks whether multi pass mechanism (or dumping of unresolved lines for next pass) is enabled. Default is true.- Returns:
- true if dumping is enabled
-
isFailOnError
public boolean isFailOnError()Will the import fail on an error or tries to continue? Default is true.- Returns:
- true if import will fail on error
-
isSynchronous
public boolean isSynchronous()Will the import be executed synchronous? Default is true.- Returns:
- true if import will be executed synchronous
-
isSldForData
Checks whether direct persistence for data is enabled for the import.- Returns:
- true if direct persistence for data is enabled
-
setSldForData
Sets whether direct persistence for data should be enabled for the import.- Parameters:
sldForData- if true - direct persistence will be enabled
-
setMaxThreads
public void setMaxThreads(int maxThreads) Sets the number of threads used maximal for import. Default is -1, so the number configured at project.properties is used. If number is 1 the import will not be executed multithreaded.- Parameters:
maxThreads- the maximal amount of threads used for import
-
setRemoveOnSuccess
public void setRemoveOnSuccess(boolean removeOnSuccess) Sets whether the executed import cronjob and it's related media will be removed on successful execution. Default is true. Attention: if enabled the cronjob is not existent anymore after execution and with that you can not get a log or so anymore.- Parameters:
removeOnSuccess- true if the cronjob will be removed on successful execution
-
setHmcSavedValuesEnabled
public void setHmcSavedValuesEnabled(boolean hmcSavedValuesEnabled) Sets whether saved values will be created at import for each item modification. Default is false. Enabling this option will cause a lower performance.- Parameters:
hmcSavedValuesEnabled- true if saved values will be created
-
setSynchronous
public void setSynchronous(boolean synchronous) Sets whether the import be executed synchronous? Default is true.- Parameters:
synchronous- true if import will be executed synchronous
-
setLocale
Sets the locale to use for import. Default is the tenant locale.- Parameters:
locale- the locale to set
-
setValidationMode
Sets the validation mode for export. Default isImportConfig.ValidationMode.STRICT.- Parameters:
validationMode- the validation mode to set
-
setDumpingEnabled
public void setDumpingEnabled(boolean dumpingEnabled) Sets whether multi pass mechanism (or dumping of unresolved lines for next pass) is enabled. Default is true.- Parameters:
dumpingEnabled- true if dumping is enabled
-
setFailOnError
public void setFailOnError(boolean failOnError) Sets whether the export will fail on error or tries to continue execution. Default is true.- Parameters:
failOnError- true if it should fail on error
-
getMainScriptWithinArchive
Gets the main script within zip archive set as import script. Is only meaningful to set if atsetScript(ImpExResource)a zip archive is set as resource. Default is null.- Returns:
- the name of file within import zip archive which contains the main script
-
setMainScriptWithinArchive
Sets the main script within zip archive set as import script. Is only meaningful to set if atsetScript(ImpExResource)a zip archive is set as resource. Default is null.- Parameters:
mainScriptWithinArchive- the name of file within import zip archive which contains the main script
-
isLegacyMode
Checks the local legacy mode setting. Setting this property will override globalimpex.legacy.modesetting fromproject.propertiesfile. -
setLegacyMode
Sets the legacy mode setting overriding globalimpex.legacy.modesetting fromproject.propertiesfile.- Parameters:
legacyMode- the new legacy mode
-
getEnableCodeExecution
Tells whether the ImpEx job allows execution of code inside the input data. Ifnullthe default settings ofImpExImportCronJobare used. -
setEnableCodeExecution
Defines whether the ImpEx job should allow execution of code inside the input data. -
getNodeGroup
Tells, which nodeGroup has been chosen as allowed to execute the import. Only for distributed impex.- Returns:
- the chosen nodeGroup
-
setNodeGroup
Defines on which cluster node group the import can be executed. Only for distributed impex. If not set - the import can be executed on any node.- Parameters:
nodeGroup- the node group
-