Class ExportConfig
- java.lang.Object
-
- de.hybris.platform.servicelayer.impex.ExportConfig
-
public class ExportConfig extends java.lang.Object
Class for configuring an export using theExportService
. If specific setter are not called, default values will be set (mentioned at setter methods). The export script is a mandatory parameter for export, so do not forget to callsetScript(ImpExResource)
method.- Since:
- 4.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExportConfig.ValidationMode
Represents the validation modes available for export.
-
Constructor Summary
Constructors Constructor Description ExportConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description char
getCommentCharacter()
Gets the used comment character for commenting lines within the export csv files.java.lang.String
getEncoding()
Gets the encoding used for creating export files.java.lang.String
getExportedDataCode()
Gets the code of the export media (containing the data).java.lang.String
getExportedMediaCode()
Gets the code of the export media (containing the media files).char
getFieldSeparator()
Gets the used field separator for separating the fields within the export csv files.char
getQuoteCharacter()
Gets the used field separator for escaping the fields within the export csv files.ImpExResource
getScript()
Gets the configured export script.EmployeeModel
getSessionUser()
ExportConfig.ValidationMode
getValidationMode()
Gets the configured validation mode of export.boolean
isFailOnError()
Will the export fail on an error or tries to continue? Default is true.boolean
isSingleFile()
Will the exported data be located within one csv file or separated using one file per header.boolean
isSynchronous()
Will the export be executed synchronous? Default is true.void
setCommentCharacter(char commentCharacter)
Sets character for commenting lines within the export csv files.void
setEncoding(java.lang.String encoding)
Sets the encoding used for export file creation.void
setExportedDataCode(java.lang.String exportedDataCode)
Sets the code of the export media (containing the data).void
setExportedMediaCode(java.lang.String exportedMediaCode)
Sets the code of the export media (containing the media files).void
setFailOnError(boolean failOnError)
Sets whether the export will fail on error or tries to continue execution.void
setFieldSeparator(char fieldSeparator)
void
setQuoteCharacter(char quoteCharacter)
void
setScript(ImpExResource script)
Sets the export script to use for export.void
setSessionUser(EmployeeModel sessionUser)
void
setSingleFile(boolean singleFile)
Sets whether the exported data will be located in one csv file.void
setSynchronous(boolean synchronous)
Sets whether the export will be executed synchronous.void
setValidationMode(ExportConfig.ValidationMode validationMode)
Sets the validation mode for export.
-
-
-
Method Detail
-
getScript
public ImpExResource getScript()
Gets the configured export script. This is a mandatory field.- Returns:
- the export script
-
setScript
public void setScript(ImpExResource script)
Sets the export script to use for export. This parameter is mandatory and has no default value.- Parameters:
script
- the export script to use
-
getValidationMode
public ExportConfig.ValidationMode getValidationMode()
Gets the configured validation mode of export. Default isExportConfig.ValidationMode.STRICT
.- Returns:
- the validationMode used for export
-
isFailOnError
public boolean isFailOnError()
Will the export fail on an error or tries to continue? Default is true.- Returns:
- true if export will fail on error
-
isSynchronous
public boolean isSynchronous()
Will the export be executed synchronous? Default is true.- Returns:
- true if export will be executed synchronous
-
getFieldSeparator
public char getFieldSeparator()
Gets the used field separator for separating the fields within the export csv files. Default is separator configured at "csv.fieldseparator" property which is by default the ';' sign.- Returns:
- the used fieldseparator
-
getQuoteCharacter
public char getQuoteCharacter()
Gets the used field separator for escaping the fields within the export csv files. Default is character configured at "csv.quotecharacter" property which is by default the '"' sign.- Returns:
- the used quotecharacter
-
getCommentCharacter
public char getCommentCharacter()
Gets the used comment character for commenting lines within the export csv files. Default is character configured at "csv.commentcharacter" property which is by default the '#' sign.- Returns:
- the used comment character
-
isSingleFile
public boolean isSingleFile()
Will the exported data be located within one csv file or separated using one file per header. Default is false.- Returns:
- true if the export is done in one file
-
setValidationMode
public void setValidationMode(ExportConfig.ValidationMode validationMode)
Sets the validation mode for export. Default isExportConfig.ValidationMode.STRICT
.- Parameters:
validationMode
- the validation mode to set
-
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
-
setSynchronous
public void setSynchronous(boolean synchronous)
Sets whether the export will be executed synchronous. Default is true.- Parameters:
synchronous
- true if execution will be synchronous
-
setFieldSeparator
public void setFieldSeparator(char fieldSeparator)
- Parameters:
fieldSeparator
- the fieldSeparator to set
-
setQuoteCharacter
public void setQuoteCharacter(char quoteCharacter)
- Parameters:
quoteCharacter
- the quoteCharacter to set
-
setCommentCharacter
public void setCommentCharacter(char commentCharacter)
Sets character for commenting lines within the export csv files. Default is character configured at "csv.commentcharacter" property which is by default the '#' sign.- Parameters:
commentCharacter
- the comment character to set
-
setSingleFile
public void setSingleFile(boolean singleFile)
Sets whether the exported data will be located in one csv file. Default is false.- Parameters:
singleFile
- true if the data will be located in one file
-
getEncoding
public java.lang.String getEncoding()
Gets the encoding used for creating export files. Default is UTF-8- Returns:
- the encoding used for export
-
setEncoding
public void setEncoding(java.lang.String encoding)
Sets the encoding used for export file creation. Default is UTF-8.- Parameters:
encoding
- the encoding to set
-
getExportedDataCode
public java.lang.String getExportedDataCode()
Gets the code of the export media (containing the data). Default is null, so that a random code is created.- Returns:
- the code of the export media (containing the data)
-
setExportedDataCode
public void setExportedDataCode(java.lang.String exportedDataCode)
Sets the code of the export media (containing the data). Default is null, so that a random code is created.- Parameters:
exportedDataCode
- the code of the export media (containing the data) to set
-
getExportedMediaCode
public java.lang.String getExportedMediaCode()
Gets the code of the export media (containing the media files). Default is null, so that a random code is created.- Returns:
- the code of the export media (containing the media files)
-
setExportedMediaCode
public void setExportedMediaCode(java.lang.String exportedMediaCode)
Sets the code of the export media (containing the media files). Default is null, so that a random code is created.- Parameters:
exportedMediaCode
- the code of the export media (containing the media files) to set
-
getSessionUser
public EmployeeModel getSessionUser()
-
setSessionUser
public void setSessionUser(EmployeeModel sessionUser)
-
-