Class ImportConfig

java.lang.Object
de.hybris.platform.servicelayer.impex.ImportConfig

public class ImportConfig extends Object
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
  • Constructor Details

    • ImportConfig

      public ImportConfig()
  • Method Details

    • 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 Boolean 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

      public Boolean 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

      public String getDistributedImpexProcessCode()
    • setDistributedImpexProcessCode

      public void setDistributedImpexProcessCode(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 the setMainScriptWithinArchive(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(String script)
      Sets the import script to use for import as String. This method will build StreamBasedImpExResource object for you and will use setScript(ImpExResource) as normal.
      Parameters:
      script - the import script to use
    • getReferencedData

      public Collection<ImpExResource> getReferencedData()
      Gets the collection of referenced data resources. Default is null.
      Returns:
      the referenced data collection
    • setReferencedData

      public void setReferencedData(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 for MediaDataTranslator (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 for MediaDataTranslator (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 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 is ImportConfig.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 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(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(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 is ImportConfig.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 String getMainScriptWithinArchive()
      Gets the main script within zip archive set as import script. Is only meaningful to set if at setScript(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(String mainScriptWithinArchive)
      Sets the main script within zip archive set as import script. Is only meaningful to set if at setScript(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 Boolean isLegacyMode()
      Checks the local legacy mode setting. Setting this property will override global impex.legacy.mode setting from project.properties file.
    • setLegacyMode

      public void setLegacyMode(Boolean legacyMode)
      Sets the legacy mode setting overriding global impex.legacy.mode setting from project.properties file.
      Parameters:
      legacyMode - the new legacy mode
    • getEnableCodeExecution

      public Boolean getEnableCodeExecution()
      Tells whether the ImpEx job allows execution of code inside the input data. If null the default settings of ImpExImportCronJob are used.
    • setEnableCodeExecution

      public void setEnableCodeExecution(Boolean enableCodeExecution)
      Defines whether the ImpEx job should allow execution of code inside the input data.
    • getNodeGroup

      public 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(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