com.rs.xbrl
Class TaxonomyBuilder

java.lang.Object
  extended by com.rs.xbrl.TaxonomyBuilder

public class TaxonomyBuilder
extends java.lang.Object

Generates an XBRL DTS executing all the instructions available in one excel sheet prepared specifically for this purpose. Read the documentation about the taxonomyBuilder in order to know more about the available instructions.

Process:

  1. Create an instance of the TaxonomyBuilder using the Excel URI and the name of the sheet with the instructions.
  2. Call generate()
The process will be logged to the logger. See log4j and initialize the logger property accordingly.

Author:
Ignacio

Field Summary
static java.lang.String DTS_BUILDER_EXTENDED_LINKS_POLICY
          The property DTS_BUILDER_EXTENDED_LINKS_POLICY defines how the tool creates new extended links inside linkbase containers.
static java.lang.String DTS_BUILDER_EXTENDED_LINKS_POLICY_CREATE_NEW
          This value of the Extended Links Policy indicates that a every instruction in the DTS Definition Language generates a new extended link within the parent container
static java.lang.String DTS_BUILDER_EXTENDED_LINKS_POLICY_REUSE_EXISTING
          This value of the Extended Links Policy indicates that a every instruction in the DTS Definition Language generates will try to reuse existing extended links already created in the parent container.
static java.lang.String DTS_BUILDER_TARGET_OUT_OF_CURRENT_FILE_MESSAGE
          This property control what message level is assigned to the event that occurs when, during the creation of an arc, a resource referenced in the from or to (source or target of the relationship) is out of the file where the arc is created but the ID of the target resource exists on another file.
static java.lang.String LOGGER_NAME
          This is the logger name where this Taxonomy Builder sends logs to.
static java.lang.String PROPERTY_VALUE_ERROR
          Property value for error messages
static java.lang.String PROPERTY_VALUE_IGNORE
          Property value for ignore messages
static java.lang.String PROPERTY_VALUE_TRACE
          Property value for trace messages
static java.lang.String PROPERTY_VALUE_WARN
          Property value for warning messages
 
Constructor Summary
TaxonomyBuilder()
          Creates a new TaxonomyBuilder instance.
TaxonomyBuilder(java.net.URI excelURI, java.lang.String sheetInstructions)
          Creates a new TaxonomyBuilder instance.
 
Method Summary
static void addToSchemaLocation(java.lang.String namespace, java.lang.String absoluteURL, GenerationContext gc)
           
static java.util.Properties createDefaultProperties()
           
static XMLFragment findResourceOrConceptById(java.lang.String token, GenerationContext gc)
           
 void generate()
          Generates the new DTS using default values for all properties
 void generate(GenerationContext gc)
          Generates the new DTS using the properties indicated and the workbook form the GenerationContext. the instructions sheet will be taken from the constructor of this class
 java.net.URI getExcelURI()
           
 GenerationContext getGenerationContext()
          Generates the new DTS using the properties indicated
 GenerationContext getGenerationContext(java.util.Properties props)
          Generates the new DTS using the properties indicated
 org.apache.log4j.Logger getLogger()
          Access to the logger on this class
 javax.xml.namespace.QName getQNameAtPoint(DTSContainer dts, SheetPoint qnamePoint, boolean bIsConcept)
          Reads a concept reference as defined in the Taxonomy Builder documentation The cell pointed to by the qnamePoint parameter is the concept prefix.
 javax.xml.namespace.QName getQNameConcept(DTSContainer dts, java.lang.String conceptPrefix, java.lang.String conceptName)
          Returns the QName of a concept already defined in one of the taxonomies in the DTS.
static XBRLXSDTypeDefinition getTypeDefinitionAtPoint(GenerationContext gc, SheetPoint typePoint)
           
static void main(java.lang.String[] args)
           
 javax.xml.namespace.QName putGlobalName(java.lang.String name, javax.xml.namespace.QName q)
          Adds an entry to the global table of names to QNames.
static void registerInstructionsFactory(java.lang.String clazz)
          Instantiates and registers a new factory class for instructions.
 void setExcelURI(java.net.URI excelURI)
           
 void setSheetInstructions(java.lang.String sheetInstructions)
           
 void setVersion(int version)
          Sets the excel source version to version 1 or version 2.
static void usage()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DTS_BUILDER_EXTENDED_LINKS_POLICY

public static final java.lang.String DTS_BUILDER_EXTENDED_LINKS_POLICY
The property DTS_BUILDER_EXTENDED_LINKS_POLICY defines how the tool creates new extended links inside linkbase containers. Possible values for this property are:

"create-new": see DTS_BUILDER_EXTENDED_LINKS_POLICY_CREATE_NEW

"reuse-existing": see DTS_BUILDER_EXTENDED_LINKS_POLICY_REUSE_EXISTING (default)

See Also:
Constant Field Values

DTS_BUILDER_EXTENDED_LINKS_POLICY_CREATE_NEW

public static final java.lang.String DTS_BUILDER_EXTENDED_LINKS_POLICY_CREATE_NEW
This value of the Extended Links Policy indicates that a every instruction in the DTS Definition Language generates a new extended link within the parent container

See Also:
Constant Field Values

DTS_BUILDER_EXTENDED_LINKS_POLICY_REUSE_EXISTING

public static final java.lang.String DTS_BUILDER_EXTENDED_LINKS_POLICY_REUSE_EXISTING
This value of the Extended Links Policy indicates that a every instruction in the DTS Definition Language generates will try to reuse existing extended links already created in the parent container. If no extended links exist a new one will be created. This is the default value for the Extended links policy.

See Also:
Constant Field Values

DTS_BUILDER_TARGET_OUT_OF_CURRENT_FILE_MESSAGE

public static final java.lang.String DTS_BUILDER_TARGET_OUT_OF_CURRENT_FILE_MESSAGE
This property control what message level is assigned to the event that occurs when, during the creation of an arc, a resource referenced in the from or to (source or target of the relationship) is out of the file where the arc is created but the ID of the target resource exists on another file. During the taxonomy generation this can be either a warning (property value is 'warn'), or nor reported at all (property value is 'ignore'). The default value is PROPERTY_VALUE_WARN.

See Also:
Constant Field Values

PROPERTY_VALUE_WARN

public static final java.lang.String PROPERTY_VALUE_WARN
Property value for warning messages

See Also:
Constant Field Values

PROPERTY_VALUE_ERROR

public static final java.lang.String PROPERTY_VALUE_ERROR
Property value for error messages

See Also:
Constant Field Values

PROPERTY_VALUE_IGNORE

public static final java.lang.String PROPERTY_VALUE_IGNORE
Property value for ignore messages

See Also:
Constant Field Values

PROPERTY_VALUE_TRACE

public static final java.lang.String PROPERTY_VALUE_TRACE
Property value for trace messages

See Also:
Constant Field Values

LOGGER_NAME

public static final java.lang.String LOGGER_NAME
This is the logger name where this Taxonomy Builder sends logs to. For historical reasons this is not the same as the class name. This may be changed in the future.

See Also:
Constant Field Values
Constructor Detail

TaxonomyBuilder

public TaxonomyBuilder(java.net.URI excelURI,
                       java.lang.String sheetInstructions)
                throws com.rs.lic.LicenseVerificationException
Creates a new TaxonomyBuilder instance. After the creation of the object, an invocation to the generate() method will execute the instructions in the sheet indicated in the sheetInstructions parameter.

Parameters:
excelURI2 - URI of the Excel file to process
sheetInstructions - name of the sheet with instructions to execute
Throws:
com.rs.lic.LicenseVerificationException - if the user does not have rights to use this class or any problem with the license has occurred

TaxonomyBuilder

public TaxonomyBuilder()
                throws com.rs.lic.LicenseVerificationException
Creates a new TaxonomyBuilder instance. After the creation of the object, an invocation to the generate() method will execute the instructions in the sheet indicated in the sheetInstructions parameter.

Parameters:
excelURI2 - URI of the Excel file to process
sheetInstructions - name of the sheet with instructions to execute
Throws:
com.rs.lic.LicenseVerificationException - if the user does not have rights to use this class or any problem with the license has occurred
Method Detail

setExcelURI

public void setExcelURI(java.net.URI excelURI)
Parameters:
excelURI - the excelURI to set

getExcelURI

public java.net.URI getExcelURI()
Returns:
the excelURI

setSheetInstructions

public void setSheetInstructions(java.lang.String sheetInstructions)
Parameters:
sheetInstructions - the sheetInstructions to set

setVersion

public void setVersion(int version)
Sets the excel source version to version 1 or version 2. See the documentation for the differences between the two versions. This method is called by the VERSION instruction

Parameters:
version -

registerInstructionsFactory

public static void registerInstructionsFactory(java.lang.String clazz)
                                        throws XBRLInitializationException
Instantiates and registers a new factory class for instructions.

Parameters:
clazz -
Throws:
XBRLInitializationException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Parameters:
args -
Throws:
java.lang.Exception

generate

public void generate()
              throws TaxonomyBuilderException
Generates the new DTS using default values for all properties

Throws:
TaxonomyBuilderException

getLogger

public org.apache.log4j.Logger getLogger()
Access to the logger on this class

Returns:
Logger

getGenerationContext

public GenerationContext getGenerationContext()
                                       throws TaxonomyBuilderException
Generates the new DTS using the properties indicated

Throws:
TaxonomyBuilderException

getGenerationContext

public GenerationContext getGenerationContext(java.util.Properties props)
                                       throws TaxonomyBuilderException
Generates the new DTS using the properties indicated

Throws:
TaxonomyBuilderException

createDefaultProperties

public static java.util.Properties createDefaultProperties()
Returns:

generate

public void generate(GenerationContext gc)
              throws TaxonomyBuilderException
Generates the new DTS using the properties indicated and the workbook form the GenerationContext. the instructions sheet will be taken from the constructor of this class

Throws:
TaxonomyBuilderException

addToSchemaLocation

public static void addToSchemaLocation(java.lang.String namespace,
                                       java.lang.String absoluteURL,
                                       GenerationContext gc)
Parameters:
namespace -
absoluteURL -

getTypeDefinitionAtPoint

public static XBRLXSDTypeDefinition getTypeDefinitionAtPoint(GenerationContext gc,
                                                             SheetPoint typePoint)
Parameters:
typePoint -
Returns:
Throws:
SheetPointAccessException

putGlobalName

public javax.xml.namespace.QName putGlobalName(java.lang.String name,
                                               javax.xml.namespace.QName q)
Adds an entry to the global table of names to QNames. This function is used by the Name2QName instruction.

Parameters:
name - as string, this is the key for the QName
q - as QName this is the QName the key refers to.
Returns:
the previously assigned QName if any or null.

findResourceOrConceptById

public static XMLFragment findResourceOrConceptById(java.lang.String token,
                                                    GenerationContext gc)
Parameters:
token -
Returns:

getQNameAtPoint

public javax.xml.namespace.QName getQNameAtPoint(DTSContainer dts,
                                                 SheetPoint qnamePoint,
                                                 boolean bIsConcept)
                                          throws SheetPointAccessException
Reads a concept reference as defined in the Taxonomy Builder documentation

The cell pointed to by the qnamePoint parameter is the concept prefix. The following cell is the element name in the namespace defined by the prefix.

The method searches loaded namespaces for a namespace that corresponds to the prefix. Once one is found, a new QName is created on that namespace for that prefix using the name found in the following cell.

Parameters:
dts - the DTSContainer on which namespaces will be investigated. Global namespaces will be used too.
qnamePoint - the cell where the prefix is defined
Returns:
QName of the concept, new concept or existing concept
Throws:
SheetPointAccessException - in case of problems reading the parameters

getQNameConcept

public javax.xml.namespace.QName getQNameConcept(DTSContainer dts,
                                                 java.lang.String conceptPrefix,
                                                 java.lang.String conceptName)
Returns the QName of a concept already defined in one of the taxonomies in the DTS. The taxonomy is identified by the prefix. if the prefix is not unique, all taxonomies for the same prefix are used to search for the conceptName, if both taxonomies with the same prefix contains the same conceptName the result is unpredictable

Parameters:
dts -
conceptPrefix -
conceptName -
Returns:
a QName or null if not found

usage

public static void usage()


Copyright 2006-2009 Reporting Standard S.L., C/ Torrecilla del Puerto 1, 28043, Madrid, Espaņa