Class ImportConfig


  • public class ImportConfig
    extends java.lang.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
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ImportConfig.ValidationMode
      Represents 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
      JobLogLevel getDistributedImpexLogLevel()
      Returns current log level for distributed ImpEx.
      java.lang.String getDistributedImpexProcessCode()  
      java.lang.Boolean getEnableCodeExecution()
      Tells whether the ImpEx job allows execution of code inside the input data.
      java.util.Locale getLocale()
      Gets the configured locale for import.
      java.lang.String getMainScriptWithinArchive()
      Gets the main script within zip archive set as import script.
      int getMaxThreads()
      Gets the number of threads used maximal for import.
      ImpExResource getMediaArchive()
      Gets the resource containing data files used for MediaDataTranslator (mostly media files) packed in a zip archive.
      java.lang.String getNodeGroup()
      Tells, which nodeGroup has been chosen as allowed to execute the import.
      java.util.Collection<ImpExResource> getReferencedData()
      Gets the collection of referenced data resources.
      ImpExResource getScript()
      Gets the configured import script.
      ImportConfig.ValidationMode getValidationMode()
      Gets the configured validation mode of import.
      java.lang.Boolean isDistributedImpexEnabled()
      Checks whether current import config is enabled for distributed ImpEx.
      boolean isDumpingEnabled()
      Checks whether multi pass mechanism (or dumping of unresolved lines for next pass) is enabled.
      boolean isFailOnError()
      Will the import fail on an error or tries to continue? Default is true.
      boolean isHmcSavedValuesEnabled()
      Checks whether saved values will be created at import for each item modification.
      java.lang.Boolean isLegacyMode()
      Checks the local legacy mode setting.
      boolean isRemoveOnSuccess()
      Checks whether the executed import cronjob and it's related media will be removed on successful execution.
      java.lang.Boolean isSldForData()
      Checks whether direct persistence for data is enabled for the import.
      boolean isSynchronous()
      Will the import be executed synchronous? Default is true.
      void setDistributedImpexEnabled​(boolean enabled)
      Enables current import to be executed using distributed ImpEx, which will run import on a cluster.
      void setDistributedImpexLogLevel​(JobLogLevel level)
      Allows to set log level for distributed ImpEx.
      void setDistributedImpexProcessCode​(java.lang.String distributedImpexProcessCode)  
      void setDumpingEnabled​(boolean dumpingEnabled)
      Sets whether multi pass mechanism (or dumping of unresolved lines for next pass) is enabled.
      void setEnableCodeExecution​(java.lang.Boolean enableCodeExecution)
      Defines whether the ImpEx job should allow execution of code inside the input data.
      void setFailOnError​(boolean failOnError)
      Sets whether the export will fail on error or tries to continue execution.
      void setHmcSavedValuesEnabled​(boolean hmcSavedValuesEnabled)
      Sets whether saved values will be created at import for each item modification.
      void setLegacyMode​(java.lang.Boolean legacyMode)
      Sets the legacy mode setting overriding global impex.legacy.mode setting from project.properties file.
      void setLocale​(java.util.Locale locale)
      Sets the locale to use for import.
      void setMainScriptWithinArchive​(java.lang.String mainScriptWithinArchive)
      Sets the main script within zip archive set as import script.
      void setMaxThreads​(int maxThreads)
      Sets the number of threads used maximal for import.
      void setMediaArchive​(ImpExResource mediaArchive)
      Sets the resource containing data files used for MediaDataTranslator (mostly media files) packed in a zip archive.
      void setNodeGroup​(java.lang.String nodeGroup)
      Defines on which cluster node group the import can be executed.
      void setReferencedData​(java.util.Collection<ImpExResource> referencedData)
      Sets a collection of referenced data for import.
      void setRemoveOnSuccess​(boolean removeOnSuccess)
      Sets whether the executed import cronjob and it's related media will be removed on successful execution.
      void setScript​(ImpExResource script)
      Sets the import script to use for import.
      void setScript​(java.lang.String script)
      Sets the import script to use for import as String.
      void setSldForData​(java.lang.Boolean sldForData)
      Sets whether direct persistence for data should be enabled for the import.
      void setSynchronous​(boolean synchronous)
      Sets whether the import be executed synchronous? Default is true.
      void setValidationMode​(ImportConfig.ValidationMode validationMode)
      Sets the validation mode for export.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ImportConfig

        public ImportConfig()
    • 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 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​(java.lang.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 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 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 java.util.Locale getLocale()
        Gets the configured locale for import. Default is the tenant locale.
        Returns:
        the locale
      • 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
      • 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 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​(java.lang.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 java.lang.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​(java.lang.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 java.lang.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​(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