|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ihr.xbrl.mapper.Mapper
public class Mapper
This is the main class responsible of the overall process
| Nested Class Summary | |
|---|---|
static class |
Mapper.PeriodMapping
This is a simple grouping class that is used for packaging information about how to map an XBRLPeriod to information inside the configuration files in order to translate the Periods into generic mappings for reuse over time. |
| Constructor Summary | |
|---|---|
Mapper(java.net.URI configFile,
DTSLoadingBarInterface bar)
Creates a mapping engine object. |
|
Mapper(java.net.URI configFile,
DTSLoadingBarInterface bar,
java.util.Properties dtsProperties)
Creates a mapping engine object. |
|
| Method Summary | |
|---|---|
java.lang.String |
addContext(MapperContext newContext)
|
void |
addFact(Fact newFact)
Adds a new Fact to the end of the Facts container. |
void |
addFactAt(Fact newFact,
int pos)
Adds a new Fact at the position indicated by pos. |
void |
addSection(Section section)
This is called internally when a new Fact is added and the fact contains a section that is not on this file. |
java.lang.String |
addSource(XBRLDataSource ds)
|
java.lang.String |
addUnit(XBRLUnit newUnit)
|
java.util.Vector<java.util.Vector<java.lang.String>> |
checkDuplicates()
Verifies the content of the mapper file and explore possible duplicate mappings (same concept for the same context and unit mapped more than once) If this happens the mapper has to make an election during the instance document generation time. |
static MapperFileSaveInterface |
createConfigFile(XBRLInstance instance,
java.net.URI config,
java.net.URI configConfUri,
java.lang.String scheme,
java.lang.String company,
java.util.ArrayList<Mapper.PeriodMapping> mappingPeriods,
XBRLDataSource dataSource)
This function generates a sample configuration file for a given DTS. |
void |
delFact(Fact fact)
Removes a fact from the container |
void |
delSection(Section section)
|
XBRLInstance |
generateInstance(java.lang.Object[] inputs)
Generates a new instance document obtaining data from data sources and using the information in the configuration file. |
java.util.Vector<Fact> |
getAllFactsForElement(XMLElementDefinition definition)
Return all facts associated with this element definition |
java.util.Vector<java.lang.String> |
getAllMapIdentifiersForElement(XMLElementDefinition definition)
Return all map identifiers associated with this element definition |
java.util.Iterator<Fact> |
getChildrenFacts()
Access to an iterator over the children facts of this object |
java.lang.String |
getCompany()
Access to the generic string that corresponds with the company |
DTSContainer |
getContainer()
Access to the surrounding DTSContainer of this Mapper instance. |
MapperContext |
getContextById(java.lang.String key)
Access to a MapperContext instance using the context ID which is a key for all the MapperContexts that exist on this Mapper |
java.util.Collection<MapperContext> |
getContexts()
Returns a collection of MapperContext objects that will be saved to this new file. |
java.util.Iterator<java.lang.String> |
getContextsKeys()
Returns an iterator over all context keys |
java.lang.String[] |
getDtsURLs()
Access to all URLs that will be part of the DTS file section Note, all strings shall be valid converted to URIs to avoid errors. |
Fact |
getFactFromMapIdentifier(java.lang.String mapIdentifier)
Returns the Fact associated with the mapIdentifier or null if the mapIdentifier is not associated with any Fact |
java.lang.String |
getKeyForSource(XBRLDataSource source)
Returns the key used for this XBRLDataSource. |
java.lang.String |
getMapIdentifierForElement(XMLElementDefinition definition)
Return the first map identifier associated to this element definition. |
java.lang.String |
getNewMapIdentifier(XMLElementDefinition element)
Generates a new identifier for the element used as a parameter. |
HasFacts |
getParent()
Access to the parent element of a Fact. |
java.lang.String |
getScheme()
Access to the generic scheme string for the mapper configuration file Note, as this is a String, this may not be a valid URI. |
Section |
getSectionForKey(java.lang.String key)
|
java.util.Set<java.lang.String> |
getSectionKeys()
|
java.util.Collection<Section> |
getSections()
Access to the collection of sections |
XBRLDataSource |
getSourceForKey(java.lang.String key)
Returns the XBRLDataSource object associated with the specified key |
java.util.Set<java.lang.String> |
getSourceKeys()
Returns the set of keys for data sources for this mapper |
XBRLUnit |
getUnitForKey(java.lang.String key)
Returns the XBRLUnit object associated with the specified key |
java.util.Set<java.lang.String> |
getUnitKeys()
Returns the set of keys for units for this mapper |
java.net.URI |
getUriOfConfigFile()
Access to the file name associated with the mapper configuration file |
MapVersion |
getVersion()
|
java.util.Collection<MapperWarningMessage> |
getWarnings()
In case there where duplicates in the map identifiers warning messages are generated. |
void |
migrateConfigFile(XBRLInstance versioningReport,
java.net.URI outputReportUri,
java.net.URI newConfigFileUri)
Migrates a mapping configuration file to a new release of a DTS Produces a XHTML file in the given URI with information about the migration process. |
void |
registerFact(Fact fact)
Registers a new fact has been added to the container. |
void |
save()
Stores the content of this configuration file on disk using the uriOfConfigFile |
static void |
save(MapperFileSaveInterface mapperFileSave)
|
void |
setURI(java.net.URI newURI)
Changes or sets this URI new config file |
void |
unregisterFact(Fact fact)
Same as HasFacts.registerFact(Fact) but in this case for removing the information stored |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.ihr.xbrl.mapper.HasFacts |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public Mapper(java.net.URI configFile,
DTSLoadingBarInterface bar)
throws MapConfigurationFileException
Typically, next call to the engine will be to the generateInstance method
Mappers are created by the MapEngine. Applications should not create instantiations of the Mapper out of a MapEngine for normal Mapping processing
configFile - bar - DTSLoadingBarInterface
MapConfigurationFileException
public Mapper(java.net.URI configFile,
DTSLoadingBarInterface bar,
java.util.Properties dtsProperties)
throws MapConfigurationFileException
Typically, next call to the engine will be to the generateInstance method
Mappers are created by the MapEngine. Applications should not create instantiations of the Mapper out of a MapEngine for normal Mapping processing
configFile - bar - DTSLoadingBarInterfacedtsProperties - properties for the dts configuration file
MapConfigurationFileException| Method Detail |
|---|
public static MapperFileSaveInterface createConfigFile(XBRLInstance instance,
java.net.URI config,
java.net.URI configConfUri,
java.lang.String scheme,
java.lang.String company,
java.util.ArrayList<Mapper.PeriodMapping> mappingPeriods,
XBRLDataSource dataSource)
throws XBRLSerializationException,
MapConfigurationFileException
Facts are not required in the incoming instance document. They will be read from the DTS. But if the instance contains facts then only facts from the instance will be included in the output template file.
XBRL Dimensions
Prior to 03/02/2011 (Version 2.7), this method did not use XBRL Dimensions. Only plain XBRL 2.1 template files was generated. Now, this method is able to obtain dimensions from the DTS applicable to each fact item in the DTS. If the primary item contains dimensions a new context is created and dimensions are added according to one of the hypercubes selected from the definition linkbase. Please bear in mind that:
instance - an XBRL Instance. May be an empty instance just with the DTS elements (schemaRef and linkbaseRef)config - URI of the template fileconfigConfUri - if the mapper driver requires a configuration file this is the URI of the mapper driver configuration file. Otherwise this is null.scheme - String for the scheme in contexts that uses "_" in the schemecompany - String for company name in contexts that uses "_" in the identifiermappingPeriods - array of PeriodMapping instances. This array will be used to match periods in the XBRL instance with the corresponding period in the instance template (Note they are not the same because the Period in the instance template allow for some variable substitution and formula processing of the dates).dataSource - an instance of the XBRLDataSource class whose class name will be used as the first and unique source of data on this template file. If null then VoidDataSource will be used.
XBRLSerializationException
MapConfigurationFileExceptionpublic DTSContainer getContainer()
Access to this property is provided in order to let the external tools like the Mapper Task Pane to access to the DTS content and properly work with it inside Excel.
getContainer in interface MapperFileSaveInterfacepublic java.lang.String addUnit(XBRLUnit newUnit)
newUnit - public java.lang.String addContext(MapperContext newContext)
newContext - public MapperContext getContextById(java.lang.String key)
getContextById in interface MapperFileSaveInterfacekey - string
public java.util.Iterator<java.lang.String> getContextsKeys()
getContextsKeys in interface MapperFileSaveInterfacepublic java.lang.String addSource(XBRLDataSource ds)
ds -
public java.lang.String getNewMapIdentifier(XMLElementDefinition element)
element -
public void setURI(java.net.URI newURI)
newURI - URI
public void migrateConfigFile(XBRLInstance versioningReport,
java.net.URI outputReportUri,
java.net.URI newConfigFileUri)
versioningReport - XBRLInstance the versioning report where information about the two DTSs existsoutputReportUri - URI the XHTML file generated by this processnewConfigFileUri - URI the new configuration file
public void save()
throws XBRLSerializationException
XBRLSerializationException
public static void save(MapperFileSaveInterface mapperFileSave)
throws XBRLSerializationException
XBRLSerializationExceptionpublic java.util.Set<java.lang.String> getSourceKeys()
getSourceKeys in interface MapperFileSaveInterfacepublic XBRLDataSource getSourceForKey(java.lang.String key)
getSourceForKey in interface MapperFileSaveInterfacekey - string
public java.util.Set<java.lang.String> getUnitKeys()
getUnitKeys in interface MapperFileSaveInterfacepublic XBRLUnit getUnitForKey(java.lang.String key)
getUnitForKey in interface MapperFileSaveInterfacekey - string
public java.lang.String getKeyForSource(XBRLDataSource source)
This method returns null if the source is not found.
source - XBRLDataSource
public java.util.Collection<MapperWarningMessage> getWarnings()
public java.util.Vector<java.util.Vector<java.lang.String>> checkDuplicates()
If two (or more) facts are mapped to income data one of the following may occurs:
public XBRLInstance generateInstance(java.lang.Object[] inputs)
throws MapException
inputs - input parameters to the XBRLDataSources
MapExceptionpublic java.lang.String getMapIdentifierForElement(XMLElementDefinition definition)
definition - XMLElementDefinition
public java.util.Vector<java.lang.String> getAllMapIdentifiersForElement(XMLElementDefinition definition)
definition - XMLElementDefinition
public java.util.Vector<Fact> getAllFactsForElement(XMLElementDefinition definition)
definition - XMLElementDefinition
public Fact getFactFromMapIdentifier(java.lang.String mapIdentifier)
mapIdentifier - string, key unique for each mapIdentifier
public java.util.Iterator<Fact> getChildrenFacts()
HasFacts
getChildrenFacts in interface HasFactsgetChildrenFacts in interface MapperFileSaveInterfacepublic java.lang.String getScheme()
MapperFileSaveInterfaceNote, as this is a String, this may not be a valid URI.
getScheme in interface MapperFileSaveInterfacepublic java.lang.String getCompany()
MapperFileSaveInterface
getCompany in interface MapperFileSaveInterfacepublic HasFacts getParent()
HasFacts
getParent in interface HasFactspublic void addFact(Fact newFact)
HasFactsThis method does not updates the taxonomy URLs.
addFact in interface HasFactsnewFact - the new fact to be added
public void addFactAt(Fact newFact,
int pos)
HasFacts
addFactAt in interface HasFactsnewFact - Fact to be addedpos - integer. Zero basedpublic void registerFact(Fact fact)
HasFacts
registerFact in interface HasFactspublic void addSection(Section section)
It is also possible calling this method for adding sections in advance
Note: if the section already exists, the old section is replaced by the new section
section - Section to be addedpublic void delFact(Fact fact)
HasFacts
delFact in interface HasFactsfact - Fact to removepublic void delSection(Section section)
public void unregisterFact(Fact fact)
HasFactsHasFacts.registerFact(Fact) but in this case for removing the information stored
unregisterFact in interface HasFactspublic MapVersion getVersion()
public java.util.Collection<MapperContext> getContexts()
MapperFileSaveInterface
getContexts in interface MapperFileSaveInterfacepublic java.net.URI getUriOfConfigFile()
MapperFileSaveInterface
getUriOfConfigFile in interface MapperFileSaveInterfacepublic java.lang.String[] getDtsURLs()
MapperFileSaveInterfaceNote, all strings shall be valid converted to URIs to avoid errors.
getDtsURLs in interface MapperFileSaveInterfacepublic java.util.Collection<Section> getSections()
MapperFileSaveInterface
getSections in interface MapperFileSaveInterfacepublic java.util.Set<java.lang.String> getSectionKeys()
public Section getSectionForKey(java.lang.String key)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||