Package de.hybris.platform.impex.jalo
Class ScriptValidationReader
- java.lang.Object
-
- de.hybris.platform.impex.jalo.ImpExReader
-
- de.hybris.platform.impex.jalo.ScriptValidationReader
-
public class ScriptValidationReader extends ImpExReader
This reader can be used for validating an script. At the moment you can only validate the first until the first header definition. Just use it like a normalImpExReader
by callingreadLine
for one time. If the call passes all is OK.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.impex.jalo.ImpExReader
ImpExReader.ResultSetCSVReader
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.impex.jalo.ImpExReader
FIRST
-
-
Constructor Summary
Constructors Constructor Description ScriptValidationReader(CSVReader reader, EnumerationValue mode)
ScriptValidationReader(CSVReader reader, EnumerationValue mode, DocumentIDRegistry docIdRegistry)
Creates a new validator using the given reader.ScriptValidationReader(CSVReader reader, java.lang.String mode)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
readLine()
Fetches the next line, parses it and returns it encapsulated in aHeaderDescriptor
if the line was a header definition or aValueLine
if it was a data row.void
validateScript()
static void
validateScript(CSVReader reader)
Validates a script using the given reader.static void
validateScript(java.io.InputStream inputStream, java.lang.String encoding)
Validates a script using the given stream.-
Methods inherited from class de.hybris.platform.impex.jalo.ImpExReader
addDefinition, addExternalDataMedia, addExternalDataMedias, addHeaderExceptionInfoAsComment, addHeaderReplacementRule, addToBeanShellContext, adjustLineIndexes, applyHeaderReplacements, assureBeanShellLoaded, checkDefinitonKey, close, createCodeLine, createCodeLineLegacyWay, createCodeLineModernWay, createInvalidHeader, createNewHeader, createValueLine, debug, debug, enableCodeExecution, enableExternalCodeExecution, enableExternalDataCodeExecution, enableExternalImpExSyntaxParsing, enableExternalSyntaxParsing, enterIfBlock, error, error, execute, execute, exitIfBlock, findExternalDataMedia, findExternalDataMedia, findMarker, getAllExternalDataMediaCodes, getAttributeConstraintFilter, getBeforeEachCode, getCellDecorators, getCSVReader, getCurrentHeader, getCurrentLocation, getCurrentReader, getDefaultReplacements, getDocumentIDRegistry, getFromBeanShellContext, getInvalidHeaderPolicy, getLineSize, getLocale, getScriptExecutionContext, getStrictMode, getValidationMode, gotInsertedLines, hasCellDecorators, includeExternalData, includeExternalData, includeExternalData, includeExternalData, includeExternalData, includeExternalData, includeExternalData, includeExternalData, includeExternalData, includeExternalData, includeExternalDataMedia, includeExternalDataMedia, includeExternalDataMedia, includeExternalDataMedia, includeExternalDataMedia, includeExternalDataMedia, includeExternalDataMedia, includeExternalDataMedia, includeExternalDataMedia, includeExternalDataMedia, includeSQLData, includeSQLData, includeSQLData, info, info, initDatabase, insertLine, isCodeExecutionEnabled, isCodeLine, isCombinedSearchEnabled, isCommentLine, isDebugEnabled, isDefinition, isEmptyLine, isEndUserRights, isExternalCodeExecutionEnabled, isExternalSyntaxParsingEnabled, isHeaderLine, isIncludingExternalData, isInfoEnabled, isNotInInactiveIfBlock, isStartUserRights, legacyExecute, lineToList, modernExecute, parseHeader, parseHeader, parseHeader, parseHeader, processCodeLine, processMarkerCodeLine, readNextCSVLine, removeExternalDataMedia, removeExternalDataMedias, replaceDefinitions, setAttributeConstraintFilter, setBeanShellContext, setBeforeEachCode, setCellDecorators, setCurrentHeader, setCurrentHeader, setInvalidHeaderPolicy, setLocale, setRelaxedMode, setRelaxedMode, setValidationMode, setValidationMode, sortRulesList, splitDefinitonCell, storeUserRightsLine, warn, warn, writeUserRightsLines
-
-
-
-
Constructor Detail
-
ScriptValidationReader
public ScriptValidationReader(CSVReader reader, java.lang.String mode)
-
ScriptValidationReader
public ScriptValidationReader(CSVReader reader, EnumerationValue mode)
-
ScriptValidationReader
public ScriptValidationReader(CSVReader reader, EnumerationValue mode, DocumentIDRegistry docIdRegistry)
Creates a new validator using the given reader.- Parameters:
reader
- reader from which the script will be read
-
-
Method Detail
-
readLine
public java.lang.Object readLine() throws ImpExException
Description copied from class:ImpExReader
Fetches the next line, parses it and returns it encapsulated in aHeaderDescriptor
if the line was a header definition or aValueLine
if it was a data row.- Overrides:
readLine
in classImpExReader
- Returns:
- either
HeaderDescriptor
orValueLine
instances or null if end of data is reached. - Throws:
ImpExException
- if a header could not be parsed properly
-
validateScript
public static void validateScript(CSVReader reader) throws ImpExException
Validates a script using the given reader. The call will pass if the script is valid.- Parameters:
reader
- reader holding the stream to check.- Throws:
ImpExException
- script is not valid
-
validateScript
public static void validateScript(java.io.InputStream inputStream, java.lang.String encoding) throws ImpExException
Validates a script using the given stream. The call will pass if the script is valid.- Parameters:
inputStream
- stream to scriptencoding
- used encoding- Throws:
ImpExException
- script is not valid
-
validateScript
public void validateScript() throws ImpExException
- Throws:
ImpExException
-
-