Package de.hybris.platform.impex.jalo
Class BeanShellImporter
- java.lang.Object
-
- de.hybris.platform.impex.jalo.BeanShellImporter
-
- All Implemented Interfaces:
BeanShellImportable
public class BeanShellImporter extends java.lang.Object implements BeanShellImportable
-
-
Constructor Summary
Constructors Constructor Description BeanShellImporter(ImpExReader impExReader, ModelService modelService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
enableBeanShellCodeExecution(boolean enable)
Delegates to underlyingImpExReader
.void
enableBeanShellSyntaxParsing(boolean enable)
Delegates to underlyingImpExReader
.void
enableResolving(boolean enable)
Enables/disables dumping mechanism for the impex.void
enableSLModeForImport(boolean value)
Enables/disables a service layer mode flag for aimporter
context object.ItemModel
getLastImportedData()
Gets last importedItemModel
instance if impex is in 'servicelayer mode' otherwise it returns null.java.util.Locale
getLocale()
void
importFile(java.io.File file, java.lang.String encoding, int linesToSkip)
Creates a new temporary reader with given file and encoding and redirects the main reader to that temporary reader for including external data.void
importMedia(ImpExMedia media, java.lang.Integer columnOffset, java.lang.String encoding, java.lang.Character delimiter, java.lang.Integer linesToSkip)
Delegates to underlyingImpExReader
.void
importQuery(java.lang.String url, java.lang.String user, java.lang.String password, java.lang.String className, java.lang.String sqlStatement)
Delegates to underlyingImpExReader
.void
importStream(java.io.InputStream inputStream, java.lang.String encoding, char[] delimiter, int linesToSkip, int columnOffset)
Creates a new temporary reader with given input stream and encoding and redirects the main reader to that temporary reader for including external data.boolean
isBeanShellCodeExecutionEnabled()
boolean
isBeanShellSyntaxParsingEnabled()
boolean
isResolvingEnabled()
boolean
isSLModeEnabled()
void
setLocale(java.util.Locale locale)
Delegates to underlyingImpExReader
.
-
-
-
Constructor Detail
-
BeanShellImporter
public BeanShellImporter(ImpExReader impExReader, ModelService modelService)
-
-
Method Detail
-
enableSLModeForImport
public void enableSLModeForImport(boolean value)
Description copied from interface:BeanShellImportable
Enables/disables a service layer mode flag for aimporter
context object. This value could be used inside an impex process as marker of pending impex mode.- Specified by:
enableSLModeForImport
in interfaceBeanShellImportable
-
setLocale
public void setLocale(java.util.Locale locale)
Description copied from interface:BeanShellImportable
Delegates to underlyingImpExReader
.- Specified by:
setLocale
in interfaceBeanShellImportable
- See Also:
ImpExReader.setLocale(Locale)
-
importQuery
public void importQuery(java.lang.String url, java.lang.String user, java.lang.String password, java.lang.String className, java.lang.String sqlStatement)
Description copied from interface:BeanShellImportable
Delegates to underlyingImpExReader
.- Specified by:
importQuery
in interfaceBeanShellImportable
- See Also:
ImpExReader.includeSQLData(String, String, String, String, String)
-
importFile
public void importFile(java.io.File file, java.lang.String encoding, int linesToSkip) throws java.io.UnsupportedEncodingException, java.io.FileNotFoundException, ImpExException
Description copied from interface:BeanShellImportable
Creates a new temporary reader with given file and encoding and redirects the main reader to that temporary reader for including external data. So you can include external data within the main reader flow. Reading from temporary reader can be stopped by reaching the end of stream (switches back automatically). The column offset will be set to -1, so normal CSV data is assumed (not in hybris style).- Specified by:
importFile
in interfaceBeanShellImportable
- Parameters:
file
- file which contains external data to be includedencoding
- the encoding used in given filelinesToSkip
- amount of lines the reader of the file will initial skip- Throws:
java.io.UnsupportedEncodingException
- given encoding is unknownjava.io.FileNotFoundException
- given file is not foundImpExException
-
importStream
public void importStream(java.io.InputStream inputStream, java.lang.String encoding, char[] delimiter, int linesToSkip, int columnOffset) throws java.io.UnsupportedEncodingException
Description copied from interface:BeanShellImportable
Creates a new temporary reader with given input stream and encoding and redirects the main reader to that temporary reader for including external data. So you can include external data within the main reader flow.- Specified by:
importStream
in interfaceBeanShellImportable
- Parameters:
inputStream
- input stream from which external data to be included is accessableencoding
- the used encodingdelimiter
- field separators used in external datalinesToSkip
- amount of lines the reader of the stream will initial skipcolumnOffset
- position difference of header columns to data columns. Is data in hybris style, use 0 because data columns positions are exactly the same as in header. In default style use -1, because the data columns do not have a first column with type information. So the header columns have to be shifted one to the left =>-1.- Throws:
java.io.UnsupportedEncodingException
- given encoding is unknown
-
importMedia
public void importMedia(ImpExMedia media, java.lang.Integer columnOffset, java.lang.String encoding, java.lang.Character delimiter, java.lang.Integer linesToSkip) throws java.io.UnsupportedEncodingException
Description copied from interface:BeanShellImportable
Delegates to underlyingImpExReader
.- Specified by:
importMedia
in interfaceBeanShellImportable
- Throws:
java.io.UnsupportedEncodingException
- See Also:
ImpExReader.includeExternalDataMedia(ImpExMedia, String, char, int, int)
-
enableBeanShellCodeExecution
public void enableBeanShellCodeExecution(boolean enable)
Description copied from interface:BeanShellImportable
Delegates to underlyingImpExReader
.- Specified by:
enableBeanShellCodeExecution
in interfaceBeanShellImportable
- See Also:
ImpExReader.enableExternalCodeExecution(boolean)
-
enableBeanShellSyntaxParsing
public void enableBeanShellSyntaxParsing(boolean enable)
Description copied from interface:BeanShellImportable
Delegates to underlyingImpExReader
.- Specified by:
enableBeanShellSyntaxParsing
in interfaceBeanShellImportable
- See Also:
ImpExReader.enableExternalSyntaxParsing(boolean)
-
enableResolving
public void enableResolving(boolean enable)
Description copied from interface:BeanShellImportable
Enables/disables dumping mechanism for the impex. ` *- Specified by:
enableResolving
in interfaceBeanShellImportable
- See Also:
ImpExImportReader.setDumpingAllowed(boolean)
-
getLastImportedData
public ItemModel getLastImportedData()
Description copied from interface:BeanShellImportable
Gets last importedItemModel
instance if impex is in 'servicelayer mode' otherwise it returns null.- Specified by:
getLastImportedData
in interfaceBeanShellImportable
-
isSLModeEnabled
public boolean isSLModeEnabled()
- Returns:
- the sLModeEnabled
-
getLocale
public java.util.Locale getLocale()
- Returns:
- the locale
-
isBeanShellCodeExecutionEnabled
public boolean isBeanShellCodeExecutionEnabled()
- Returns:
- the beanShellCodeExecutionEnabled
-
isBeanShellSyntaxParsingEnabled
public boolean isBeanShellSyntaxParsingEnabled()
- Returns:
- the beanShellSyntaxParsingEnabled
-
isResolvingEnabled
public boolean isResolvingEnabled()
- Returns:
- the resolvingEnabled
-
-