public class CSVDataSource extends java.lang.Object implements MapeableDataSource, HasDataFile, HasSomethingToSay
Constructor and Description |
---|
CSVDataSource() |
Modifier and Type | Method and Description |
---|---|
void |
addMap(java.lang.String mapIdentifier,
java.lang.String columName,
java.util.Properties props)
This method must be implemented by XBRLDataSource interfaces that are capable to
read information collected during the processing of representable forms and generate
a sample conversion file for the surrounding data format .
|
void |
createConfigFileContent()
This function is used by the GUI during the generation of a new mapper.
|
void |
endOfDocument(XBRLInstance instance)
Called by the MapEngine when a new instance is finished
Can be used to close connections to data sources.
|
void |
endOfFact(java.lang.String mapIdenfifier,
javax.xml.namespace.QName factName)
Called by the MapEngine when a new fact is finalized
returns nothing.
|
java.util.Collection<ApiHistoricalEventImpl> |
getApiMessages()
This is the method that must be implemented by classes that provides historical information.
|
java.net.URI |
getConfigFile()
Access to the name of the configuration file.
|
XBRLContext |
getContext(java.lang.String mapIdentifier,
int index,
XBRLContext context)
Each data item has mapIdentifier string each used concept in the taxonomy
has at least one mapIdentifier
returns the XBRLContext to be used for the fact item.
|
java.lang.String |
getDataFile()
Access to the name of the data file.
|
java.lang.Object |
getFootnote(java.lang.String mapIdentifier,
int index,
XBRLFact fact)
After a fact is produced the data source is asked for a footnote to be
added to the instance document by doing a call to this method.
|
java.lang.String |
getFootnoteLang(java.lang.String mapIdentifier,
int index,
XBRLFact fact,
java.lang.Object footnoteContent)
Every footnote MUST have an xml:lang attribute.
|
XBRLNumber.ExactitudeMode |
getFormat(java.lang.String mapIdentifier,
int index,
XBRLContext context,
XBRLUnit localUnit)
Ask the driver for the preferred serialization for the numeric data.
|
java.lang.String |
getFormatValue(java.lang.String mapIdentifier,
int index,
XBRLContext context,
XBRLUnit localUnit)
Returns the value (as string) for the data format.
|
HistoricalEventInterface |
getHistoricalMessage()
This is the method that must be implemented by classes that provides historical information.
|
java.util.Map<java.lang.String,java.lang.String> |
getMap()
Access to the map information.
|
java.lang.Object[] |
getMapIdentifierReferences(java.lang.String mapIdentifier)
This method is used to automatically generate loader files from mapper files.
|
int |
getNumberOfValues(java.lang.String mapIdentifier,
MapperFact fact)
Each data item has mapIdentifier string, each used concept in the taxonomy
has at least one mapIdentifier
This method returns the number of facts in the source that corresponds to the
mapIdentifier string.
|
java.lang.Object |
getSampleData(java.lang.Object data)
This method is used by the mapper editor during test cycles of the mapper
The implemented class should use the incoming data to produce an object that
the mapper can use later to produce an instance document .
|
java.lang.String |
getSourceReference(java.lang.String mapIdentifier,
int index,
XBRLContext localContext,
net.sf.saxon.type.SimpleType theType)
Returns a string that describes the source of data for a specific mapIdentifier, index, localContext and data type
This method is used in order to build an error message that takes into consideration where the data comes from
so the user can better track the path the data is following inside the tools.
|
java.lang.String |
getTooltip()
This is the method that must be implemented by classes that provides the tooltip
historical information.
|
XBRLUnit |
getUnit(java.lang.String mapIdentifier,
int index,
XBRLContext localContext,
XBRLUnit unit)
Each time a numeric concept is created this function is called to request or change the required
unit.
|
net.sf.saxon.value.AtomicValue |
getValue(java.lang.String mapIdentifier,
int index,
XBRLContext context,
net.sf.saxon.type.SimpleType type)
Each data item has mapIdentifier string each used concept in the taxonomy
has at least one mapIdentifier
returns the Value to be sent to the fact item. null is allowed and will
be considered as no input data available
|
void |
init()
Called by the mapping engine once the object is created.
|
boolean |
isConfigfileRequired()
Returns true if the configuration file is required for this
XBRLDataSource.
|
boolean |
isInputFileRequired()
Returns true if this driver requires an input file.
|
boolean |
isNil(java.lang.String mapIdentifier,
int index,
XMLElementDefinition concept)
Return true if the concept content is xsi:nil so there will be no request for a value.
|
boolean |
isTupleSourceRequired()
Returns a boolean value indicating if the source format has a meaning to indicate the
number of occurrences of a tuple.
|
void |
resetMapEntries()
Clears the content of the map entries.
|
void |
save(MapperFileSaveInterface mapperFileSave)
Save the content of the configuration file to disk.
|
void |
setConfigFile(java.net.URI configFile)
Sets the configuration file for this XBRLDataSource.
|
void |
setDataFile(java.lang.String dataFile)
Sets the data name file for this XBRLDataSource.
|
void |
setFormat(XBRLNumber.ExactitudeMode newFormat)
Changes the format of this CSVDataSource.
|
void |
setFormatValue(java.lang.String newFormatValue)
Changes the format value of this CSVDataSource.
|
void |
startOfDocument(XBRLInstance instance,
java.lang.Object[] inputs,
DTSLoadingBarInterface bar)
Called by the MapEngine when a new instance that requires this data source is
going to be created.
|
void |
startOfFact(java.lang.String mapIdentifier,
javax.xml.namespace.QName factName)
Called by the MapEngine when a new fact is about to be started
Return nothing.
|
boolean |
verifyRule(MapperSection section)
Checks the current driver for a rule for section passed in in the parameter.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, hashCode
public void endOfDocument(XBRLInstance instance)
XBRLDataSource
endOfDocument
in interface XBRLDataSource
instance
- this is the XBRLInstance document.public void endOfFact(java.lang.String mapIdenfifier, javax.xml.namespace.QName factName)
XBRLDataSource
endOfFact
in interface XBRLDataSource
mapIdenfifier
- the map identifierfactName
- the fact namepublic java.net.URI getConfigFile()
XBRLDataSource
getConfigFile
in interface XBRLDataSource
public XBRLContext getContext(java.lang.String mapIdentifier, int index, XBRLContext context)
XBRLDataSource
getContext
in interface XBRLDataSource
mapIdentifier
- Stringindex
- intcontext
- XBRLContext the context proposed by the mapping engine. If the context is modified
it will be modified for all concepts using this context. So if the context requires modifications
for a specified fact it would be better to clone the context before modifications are performed.public java.lang.Object getFootnote(java.lang.String mapIdentifier, int index, XBRLFact fact)
XBRLDataSource
getFootnote
in interface XBRLDataSource
mapIdentifier
- Stringindex
- intfact
- XBRLFactItempublic java.lang.String getFootnoteLang(java.lang.String mapIdentifier, int index, XBRLFact fact, java.lang.Object footnoteContent)
XBRLDataSource
getFootnoteLang
in interface XBRLDataSource
mapIdentifier
- the map identifierindex
- the indexfact
- the factfootnoteContent
- the footnote contentpublic XBRLNumber.ExactitudeMode getFormat(java.lang.String mapIdentifier, int index, XBRLContext context, XBRLUnit localUnit)
XBRLDataSource
getFormat
in interface XBRLDataSource
mapIdentifier
- the map identifierindex
- the indexcontext
- the contextlocalUnit
- the local unitpublic java.lang.String getFormatValue(java.lang.String mapIdentifier, int index, XBRLContext context, XBRLUnit localUnit)
XBRLDataSource
getFormatValue
in interface XBRLDataSource
mapIdentifier
- the map identifierindex
- the indexcontext
- the contextlocalUnit
- the local unitpublic void setFormat(XBRLNumber.ExactitudeMode newFormat)
newFormat
- integer constant XBRLNumericValue.DECIMALS or XBRLNumericValue.PRECISIONpublic void setFormatValue(java.lang.String newFormatValue)
newFormatValue
- String representation of the new valuepublic void addMap(java.lang.String mapIdentifier, java.lang.String columName, java.util.Properties props)
HasAddMap
public void resetMapEntries()
public int getNumberOfValues(java.lang.String mapIdentifier, MapperFact fact)
XBRLDataSource
getNumberOfValues
in interface XBRLDataSource
mapIdentifier
- the map identifierfact
- the factpublic XBRLUnit getUnit(java.lang.String mapIdentifier, int index, XBRLContext localContext, XBRLUnit unit)
XBRLDataSource
getUnit
in interface XBRLDataSource
mapIdentifier
- String codeindex
- int indicating which value we are working onlocalContext
- the context for the new dataunit
- the proposed unit. Can be changedpublic net.sf.saxon.value.AtomicValue getValue(java.lang.String mapIdentifier, int index, XBRLContext context, net.sf.saxon.type.SimpleType type) throws MapException
XBRLDataSource
getValue
in interface XBRLDataSource
mapIdentifier
- Stringindex
- intcontext
- XBRLContext the XBRL Context for the fact being reported. The context
should not be modified here.type
- This is that target schema type obtained from the element definitionMapException
- the map exceptionpublic void init() throws MapConfigurationFileException
XBRLDataSource
init
in interface XBRLDataSource
MapConfigurationFileException
- the map configuration file exceptionpublic boolean isNil(java.lang.String mapIdentifier, int index, XMLElementDefinition concept)
XBRLDataSource
isNil
in interface XBRLDataSource
mapIdentifier
- the map identifierindex
- the indexconcept
- the conceptpublic void setConfigFile(java.net.URI configFile)
XBRLDataSource
setConfigFile
in interface XBRLDataSource
configFile
- the new config filepublic void startOfDocument(XBRLInstance instance, java.lang.Object[] inputs, DTSLoadingBarInterface bar) throws MapException
XBRLDataSource
startOfDocument
in interface XBRLDataSource
instance
- this is the XBRLInstance document.inputs
- Input parameters, they are different objects for each driver.bar
- this is an optional parameter, if not null, the driver can send messages to inform about the initialization processMapException
- the map exceptionpublic void startOfFact(java.lang.String mapIdentifier, javax.xml.namespace.QName factName)
XBRLDataSource
startOfFact
in interface XBRLDataSource
mapIdentifier
- StringfactName
- QNamepublic java.lang.Object getSampleData(java.lang.Object data) throws MapException
XBRLDataSource
getSampleData
in interface XBRLDataSource
data
- objectMapException
- in the case the input object cannot be usedpublic void createConfigFileContent()
XBRLDataSource
createConfigFileContent
in interface XBRLDataSource
public boolean isConfigfileRequired()
XBRLDataSource
isConfigfileRequired
in interface XBRLDataSource
public void save(MapperFileSaveInterface mapperFileSave) throws MapException
XBRLDataSource
This method is called by the GUI when the mapper has changes in the configuration and the configuration requires to be serialized to disk.
save
in interface XBRLDataSource
mapperFileSave
- optional parameter, if the configuration file content is
empty, and the mapperFileSave parameter is not null, the driver can use the
parameter to prepare a sample configuration file. Note not all drivers can
do this, for example the Excel data source driver cannot, but the SQL Data
source can prepare a kind of virtual table from which the data would eventually
comeMapException
- in the event of problems like IOExceptionpublic boolean isInputFileRequired()
XBRLDataSource
isInputFileRequired
in interface XBRLDataSource
public java.util.Map<java.lang.String,java.lang.String> getMap()
This driver holds a map between mapIdentifiers and CSV column names. Map keys are CSV column names. Map values are mapIdentifiers.
public boolean isTupleSourceRequired()
XBRLDataSource
This information is used during the algorithm for generating a template file automatically.
Excel Data Source, for example, does not provides a meaning to indicate the number of occurrences of a tuple. The number of occurrences will be indicated in the instance document template itself. SQL Data Source, is on the other side. The SQL Driver and the source format may have information to provide the number of occurrences for a tuple.
Note, once a template has been automatically generated. it is up to the team to change the generated template into something different if this is required by the project.
isTupleSourceRequired
in interface XBRLDataSource
public java.lang.String getSourceReference(java.lang.String mapIdentifier, int index, XBRLContext localContext, net.sf.saxon.type.SimpleType theType)
XBRLDataSource
This method is used in order to build an error message that takes into consideration where the data comes from so the user can better track the path the data is following inside the tools.
getSourceReference
in interface XBRLDataSource
mapIdentifier
- current map identifierindex
- current index for the map identifierlocalContext
- XBRL context for the generated facttheType
- data type as SimpleTypepublic boolean verifyRule(MapperSection section)
XBRLDataSource
This method is called only if the fact contains a sectionRef and the sectionRef contains a rule.
The algorithm to determine the output value is driver dependant and there is no default value.
If the return value is true, the fact will be included to the output instance and all files in the section will be added to the DTS. If the return value is false, the fact will be skipped.
verifyRule
in interface XBRLDataSource
section
- the sectionpublic java.lang.Object[] getMapIdentifierReferences(java.lang.String mapIdentifier)
XBRLDataSource
getMapIdentifierReferences
in interface XBRLDataSource
mapIdentifier
- the map identifierpublic HistoricalEventInterface getHistoricalMessage()
HasSomethingToSay
getHistoricalMessage
in interface HasSomethingToSay
public java.lang.String getDataFile()
HasDataFile
getDataFile
in interface HasDataFile
public void setDataFile(java.lang.String dataFile)
HasDataFile
setDataFile
in interface HasDataFile
dataFile
- the new data name filepublic java.lang.String getTooltip()
HasSomethingToSay
getTooltip
in interface HasSomethingToSay
public java.util.Collection<ApiHistoricalEventImpl> getApiMessages()
HasSomethingToSay
getApiMessages
in interface HasSomethingToSay
Copyright 2006-2015 Reporting Standard S.L., C/ Torrecilla del Puerto 1, 28043, Madrid, Espaņa