public abstract class CSVFromAbstractRule extends AbstractRule
Modifier and Type | Field and Description |
---|---|
protected java.io.File |
csvFile |
protected java.lang.String |
enclosingCharacter
The enclosing character for a data item.
|
protected java.lang.String |
encoding |
protected java.util.HashSet<java.lang.String> |
excludedNames |
protected java.lang.String |
filename
The name of the file.
|
protected int |
fromLine
The line where to start reading
|
protected java.lang.String |
headerLine
The header line
|
protected int |
headerLineNo
The number of the header line.
|
protected java.util.HashSet<java.lang.String> |
includedNames |
protected java.util.logging.Logger |
messenger
The messenger
|
protected java.lang.String |
separatorFile
The separator character for the file.
|
protected java.lang.String |
separatorHeaderLine
The separator character for the headerline.
|
protected int |
toLine
The line where to read to
|
loggerName, postMethods, preMethods, sessionRef
arguments, ctx, descriptor, NEW_LINE
Constructor and Description |
---|
CSVFromAbstractRule() |
Modifier and Type | Method and Description |
---|---|
void |
execute()
The execute method, nothing to do.
|
protected java.util.Vector<java.lang.String> |
getDataLines(int fromLine,
int toLine)
Read the data lines from the CSV file.
|
protected java.lang.String |
getHeaderLine()
Get the header line.
|
protected NameValueUnit[][] |
getRowLines(java.lang.String[] hdrWords,
java.util.Vector<java.lang.String> dataLines,
int headerRowNo)
Get the lines of the dataset from the row oriented lines from then CSV file.
|
void |
init()
The init method, get the element name and the reference from the PACReturnWriter from the context.
|
static void |
main(java.lang.String[] argv) |
void |
setValue(NameValueUnit[][] nvu)
The setValue, create
|
protected java.lang.String[] |
splitLineWithHandlingEnclosing(java.lang.String line,
java.lang.String seperator)
This method splits the passed string.
|
void |
terminate()
The terminate method reset the private variables.
|
execute, executePostMethods, executePreMethods, getAoSessionFromContextWithSessionRef, getId, getOdsCache, getPointTo, getSessionRef, getType, isPedantic, setGathermode, setId, setPointTo, setPostMethods, setPreMethods, setSessionRef, setType, toString, toString, toString
addAttributesToNameValueUnitArray, addAttributeToNameValueUnitArray, addStringValueToNameValueUnitArray, checkDirectoy, checkDirectoy, checkDirectoy, checkFile, checkFile, checkFile, checkIntValue, checkStringValue, compressNvuArray, createMessageFromPropertyFile, createMessageFromPropertyFile, createMessageFromPropertyFile, createTsUnionFromObject, deleteRowWithAttributes, getArguments, getContext, getDescriptor, getListFromProperty, getMandatoryProperty, getMandatoryProperty, getMandatoryPropertyAsInt, getMandatoryPropertyAsList, getMandatoryPropertyWithRuleException, getNvuArrayFromMap, getNvuArrayFromMap, getNvuObjectWithName, getNvuObjectWithName, getNvuObjectWithName, getOdsCacheFromProperty, getOptioanlPropertyAsInt, getOptionalProperty, getOptionalProperty, getOptionalProperty, getOptionalProperty, getOptionalPropertyAsBoolean, getOptionalPropertyAsBoolean, getOptionalPropertyAsBoolean, getOptionalPropertyAsList, makeUpperCaseKeyword, removeAttributeFromNameValueUnitArray, removeAttributeFromNameValueUnitArray, setArguments, setContext, setDescriptor
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getContext, getDescriptor, setArguments, setContext, setDescriptor
protected java.util.logging.Logger messenger
protected java.lang.String filename
protected java.io.File csvFile
protected java.lang.String encoding
protected java.lang.String separatorFile
protected java.lang.String separatorHeaderLine
protected java.lang.String enclosingCharacter
protected java.lang.String headerLine
protected int fromLine
protected int toLine
protected int headerLineNo
protected java.util.HashSet<java.lang.String> includedNames
protected java.util.HashSet<java.lang.String> excludedNames
protected java.util.Vector<java.lang.String> getDataLines(int fromLine, int toLine) throws RuleException
fromLine
- the first line to read.toLine
- the last line to read (0 -> until the ent of the file)RuleException
protected java.lang.String getHeaderLine() throws RuleException
RuleException
- any occurring Rule exception.public void setValue(NameValueUnit[][] nvu)
nvu
- The name value of the rule.RuleIF.setValue(org.asam.ods.NameValueUnit[][])
public void init() throws InitializationFailedException
init
in interface ImplementationIF
init
in class AbstractImplementation
InitializationFailedException
- if the initialization fails.AbstractImplementation.init()
protected NameValueUnit[][] getRowLines(java.lang.String[] hdrWords, java.util.Vector<java.lang.String> dataLines, int headerRowNo)
hdrWords
- the header words or names of the value.dataLines
- the lines with data from the CSV file.headerRowNo
- the row number where the header is stored. O means the headers is given in the parameter hdrWords.public void execute() throws ExecutableException
execute
in interface ExecutableIF
execute
in class AbstractRule
ExecutableException
- if execution fails.AbstractRule.execute()
public void terminate() throws TerminationException
terminate
in interface ExecutableIF
terminate
in class AbstractRule
TerminationException
- if termination fails.AbstractRule.terminate()
protected java.lang.String[] splitLineWithHandlingEnclosing(java.lang.String line, java.lang.String seperator)
line
- - the String to splitseperator
- - the separator stringpublic static void main(java.lang.String[] argv)