Class ImportConfig
- java.lang.Object
-
- de.hybris.platform.servicelayer.impex.ImportConfig
-
public class ImportConfig extends java.lang.ObjectClass for configuring an import using theImportService. 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 callsetScript(ImpExResource)method.- Since:
- 4.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImportConfig.ValidationModeRepresents the validation modes available for import.
-
Constructor Summary
Constructors Constructor Description ImportConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JobLogLevelgetDistributedImpexLogLevel()Returns current log level for distributed ImpEx.java.lang.StringgetDistributedImpexProcessCode()java.lang.BooleangetEnableCodeExecution()Tells whether the ImpEx job allows execution of code inside the input data.java.util.LocalegetLocale()Gets the configured locale for import.java.lang.StringgetMainScriptWithinArchive()Gets the main script within zip archive set as import script.intgetMaxThreads()Gets the number of threads used maximal for import.ImpExResourcegetMediaArchive()Gets the resource containing data files used forMediaDataTranslator(mostly media files) packed in a zip archive.java.lang.StringgetNodeGroup()Tells, which nodeGroup has been chosen as allowed to execute the import.java.util.Collection<ImpExResource>getReferencedData()Gets the collection of referenced data resources.ImpExResourcegetScript()Gets the configured import script.ImportConfig.ValidationModegetValidationMode()Gets the configured validation mode of import.java.lang.BooleanisDistributedImpexEnabled()Checks whether current import config is enabled for distributed ImpEx.booleanisDumpingEnabled()Checks whether multi pass mechanism (or dumping of unresolved lines for next pass) is enabled.booleanisFailOnError()Will the import fail on an error or tries to continue? Default is true.booleanisHmcSavedValuesEnabled()Checks whether saved values will be created at import for each item modification.java.lang.BooleanisLegacyMode()Checks the local legacy mode setting.booleanisRemoveOnSuccess()Checks whether the executed import cronjob and it's related media will be removed on successful execution.java.lang.BooleanisSldForData()Checks whether direct persistence for data is enabled for the import.booleanisSynchronous()Will 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.voidsetDistributedImpexLogLevel(JobLogLevel level)Allows to set log level for distributed ImpEx.voidsetDistributedImpexProcessCode(java.lang.String distributedImpexProcessCode)voidsetDumpingEnabled(boolean dumpingEnabled)Sets whether multi pass mechanism (or dumping of unresolved lines for next pass) is enabled.voidsetEnableCodeExecution(java.lang.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(java.lang.Boolean legacyMode)Sets the legacy mode setting overriding globalimpex.legacy.modesetting fromproject.propertiesfile.voidsetLocale(java.util.Locale locale)Sets the locale to use for import.voidsetMainScriptWithinArchive(java.lang.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(java.lang.String nodeGroup)Defines on which cluster node group the import can be executed.voidsetReferencedData(java.util.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.voidsetScript(ImpExResource script)Sets the import script to use for import.voidsetScript(java.lang.String script)Sets the import script to use for import as String.voidsetSldForData(java.lang.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.
-
-
-
Method Detail
-
setDistributedImpexLogLevel
public void setDistributedImpexLogLevel(JobLogLevel level)
Allows to set log level for distributed ImpEx.
-
getDistributedImpexLogLevel
public JobLogLevel 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
public java.lang.Boolean isDistributedImpexEnabled()
Checks whether current import config is enabled for distributed ImpEx.
-
getDistributedImpexProcessCode
public java.lang.String getDistributedImpexProcessCode()
-
setDistributedImpexProcessCode
public void setDistributedImpexProcessCode(java.lang.String distributedImpexProcessCode)
-
getScript
public ImpExResource getScript()
Gets the configured import script. This is a mandatory field.- Returns:
- the export script
-
setScript
public void setScript(ImpExResource script)
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
public void setScript(java.lang.String script)
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
public java.util.Collection<ImpExResource> getReferencedData()
Gets the collection of referenced data resources. Default is null.- Returns:
- the referenced data collection
-
setReferencedData
public void setReferencedData(java.util.Collection<ImpExResource> referencedData)
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
public ImpExResource 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
public void setMediaArchive(ImpExResource mediaArchive)
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
public java.util.Locale getLocale()
Gets the configured locale for import. Default is the tenant locale.- Returns:
- the locale
-
getValidationMode
public ImportConfig.ValidationMode 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
public java.lang.Boolean isSldForData()
Checks whether direct persistence for data is enabled for the import.- Returns:
- true if direct persistence for data is enabled
-
setSldForData
public void setSldForData(java.lang.Boolean sldForData)
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
public void setLocale(java.util.Locale locale)
Sets the locale to use for import. Default is the tenant locale.- Parameters:
locale- the locale to set
-
setValidationMode
public void setValidationMode(ImportConfig.ValidationMode validationMode)
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
public java.lang.String 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
public void setMainScriptWithinArchive(java.lang.String mainScriptWithinArchive)
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
public java.lang.Boolean isLegacyMode()
Checks the local legacy mode setting. Setting this property will override globalimpex.legacy.modesetting fromproject.propertiesfile.
-
setLegacyMode
public void setLegacyMode(java.lang.Boolean legacyMode)
Sets the legacy mode setting overriding globalimpex.legacy.modesetting fromproject.propertiesfile.- Parameters:
legacyMode- the new legacy mode
-
getEnableCodeExecution
public java.lang.Boolean getEnableCodeExecution()
Tells whether the ImpEx job allows execution of code inside the input data. Ifnullthe default settings ofImpExImportCronJobare used.
-
setEnableCodeExecution
public void setEnableCodeExecution(java.lang.Boolean enableCodeExecution)
Defines whether the ImpEx job should allow execution of code inside the input data.
-
getNodeGroup
public java.lang.String getNodeGroup()
Tells, which nodeGroup has been chosen as allowed to execute the import. Only for distributed impex.- Returns:
- the chosen nodeGroup
-
setNodeGroup
public void setNodeGroup(java.lang.String nodeGroup)
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
-
-