public abstract class XBRLDocument extends XMLDocumentURI
Modifier and Type | Class and Description |
---|---|
static class |
XBRLDocument.LockInfo
The Class LockInfo.
|
static class |
XBRLDocument.XBRLDocumentType
The Enum XBRLDocumentType.
|
XBRLValidation.Direction
Modifier and Type | Method and Description |
---|---|
void |
addComment(java.lang.String commentValue)
Adds the comment.
|
boolean |
addIdOfElement(XMLFragment newElement)
Adds the id of newElement to the set of IDs stored in this document.
|
boolean |
addIdOfElement(XMLFragment newElement,
java.lang.String id)
Adds the id of newElement to the set of IDs stored in this document.
|
void |
addParent(XBRLDocument parent)
Add a new XBRLDocument as parent of this document.
|
void |
changeElementId(XMLFragment newEl,
java.lang.String oldId,
java.lang.String newId)
Changes the key of an element in the internal itemsById hashtable but does not
change the id on the target element.
|
void |
checkCleanDocumentInfo()
Check clean document info.
|
void |
clear()
Clear.
|
static XMLDocumentURI |
createDocument(DTSContainer dts,
java.lang.Integer resolvedURI,
javax.xml.transform.Source source,
boolean addToCache,
XBRLDTSDocument parent)
Creates a Document, (instance, taxonomy or linkbase)
by accessing the root element and looking at the document type
if the document is not a linkbase, schema or xbrl instance returns null.
|
static XMLDocumentURI |
createDocument(DTSContainer dts,
java.net.URI resolvedURI,
javax.xml.transform.Source source,
boolean addToCache,
XBRLDTSDocument parent)
Creates a Document, (instance, taxonomy or linkbase)
by accessing the root element and looking at the document type
if the document is not a linkbase, schema or xbrl instance returns null.
|
static XMLDocumentURI |
createDocument(XMLDocumentURI node,
boolean addToCache)
Transforms the XMLDocumentURI in the node parameter into a XBRLDocument
Linkbase, Taxonomy or Instance depending on the root node .
|
static XMLDocumentURI |
createDynamicDocument(DTSContainer dts,
java.net.URI resolvedURI,
javax.xml.transform.Source source,
boolean addToCache,
XBRLDTSDocument parent)
Same as createDocument().
|
void |
delParent(XBRLDocument parent)
Del parent.
|
abstract void |
discoverDTS(XBRLDTSDocument parent)
All derived classes MUST implement this method and provide the functionality according to section 3.2 of the
XBRL 2.1 specification
|
boolean |
equals(java.lang.Object oe)
Equals.
|
abstract XMLDocumentImpl |
generateDocNode()
This class has to be implemented by objects derived from XBRLDocument
and must return a XMLDocumentImpl node with the content
of this XBRLDocument object.
|
java.lang.String |
generateId()
Generates a new id that is not an existing key in the itemasById
internal map.
|
java.util.Iterator<java.lang.String> |
getAllUsedIds()
This method returns an iterator over all ids used by elements in this document.
|
java.util.Collection<java.lang.String> |
getComments()
Access to the comments in the file.
|
XBRLDocumentInfo |
getDocumentInfo()
Deprecated.
|
void |
getDTS()
Launches the rules for DTSDiscovery process that will eventually add more objects to the DTSContainer.
|
abstract XBRLDocument.XBRLDocumentType |
getDTSDocumentType()
Returns the type of DTS Document.
|
abstract java.lang.String |
getDTSDocumentTypeName()
Gets the DTS document type name.
|
XMLFragment |
getElementById(java.lang.String id)
This method returns the XMLFragment associated to the id received as
a parameter.
|
java.util.Map<java.lang.String,net.sf.saxon.om.NodeInfo> |
getElementsById()
Gets the elements by id.
|
static java.util.HashMap<java.lang.String,net.sf.saxon.om.NodeInfo> |
getOrCreateTableId(net.sf.saxon.om.DocumentInfo doc)
Used internally by the API to obtain the idTable table in the
DocumentInfo using reflection.
|
java.util.Iterator<XBRLDocument> |
getParents()
Access to the [Parents] property.
|
XBRLRoleRef |
getRoleRef(java.lang.String roleURI)
Gets the role ref.
|
static net.sf.saxon.om.TreeModel |
getTreeModel()
Gets the tree model.
|
int |
hashCode()
Hash code.
|
boolean |
isContentModified()
Returns true if the document content has been modified.
|
boolean |
isDynamic()
Returns true when the document is created programatically.
|
boolean |
isIdUsed(java.lang.String id)
This method returns true if the id indicated as a parameter corresponds to
an XMLFragment in this XBRLDocument.
|
static int |
isOfficialURI(java.net.URI uri)
Returns true if the uri passed in as a parameter corresponds with an XBRL document
referenced (explicitly or implicitly) in the XBRL 2.1 specification and
the uri is not exactly the one indicated in the XBRL 2.1 specification.
|
void |
lock()
Implements a lock mechanism to avoid multiple threads to modify content of
XBRLDocument during validation in a multi-thread environment.
|
abstract void |
readInfoset()
Read all structures that builds the infoset.
|
void |
registerChangeIdListener()
Register change id listener.
|
void |
registerChangeIdListener(XBRLDocumentRootNode rootNode)
Register change id listener.
|
void |
release()
Release.
|
void |
removeComments()
Removes the comments.
|
void |
removeIdOfElement(java.lang.String key,
XMLFragment element)
Used internally to remove multiple ids pointing to the same resource.
|
void |
removeIdOfElement(XMLFragment element)
Removes the id of element.
|
static java.net.URI |
resolveURI(java.net.URI base,
java.net.URI href)
We need a common method to normalize and resolve absolute URIs from a base URI
and a relative URI.
|
void |
save()
Save the file to the indicated document URI
Directories in the path of the file name are created automatically .
|
void |
save(java.io.OutputStream os)
Save the file to the indicated OutputStream.
|
void |
save(java.io.OutputStream os,
boolean withOptimizations)
Save the file to the indicated OutputStream.
|
void |
setComments(java.util.Collection<java.lang.String> fileComments)
Sets a new collection of comments for this file.
|
static void |
setLockInfo(int timeout,
java.lang.Runnable callback)
when lock will be called by a thread, it might be the case the lock shall not wait
for longer than a specific amount of time and it might be required to call a method
when the time expires and cancel or continue with the operation.
|
void |
setModified(boolean state)
Sets the modified.
|
void |
setReadingInfoset(boolean value)
Called by parent objects when the infoset is being read.
|
java.lang.String |
toString()
To string.
|
void |
unregisterChangeIdListener()
Unregister change id listener.
|
static void |
unsetLockInfo()
resets the default behaviour of lock for the caller thread.
|
boolean |
updateXML()
Updates the XML content of the XBRLDocument so the next call to save or to XdmNode getDocument() will
obtain a fresh copy with all changes made in the object library.
|
addChild, delChild, evaluateList, getBase, getChildren, getContainer, getDocument, getDocumentRootNode, getDocumentURI, getDocumentURICode, getDTSDiscoveryInfo, getDTSKey, getFriendlyName, getLocalFile, getOldDocument, getPackageName, getPackageVersion, getPrefix, getPrefixes, getValidationReport, getXBRLDocumentInfo, getXPathToRoot, invalidate, invalidate, isInDTS, isOnValidation, setContainer, setDocumentURICode, setDTSDiscoveryInfo, setDTSKey, setNodeName, setRootNode, setURI, setXBRLDocumentInfo, validate
public void unregisterChangeIdListener()
public void registerChangeIdListener()
public void registerChangeIdListener(XBRLDocumentRootNode rootNode)
rootNode
- the root nodepublic void checkCleanDocumentInfo()
public boolean equals(java.lang.Object oe)
equals
in class XMLDocumentURI
oe
- the oepublic int hashCode()
hashCode
in class XMLDocumentURI
public static java.net.URI resolveURI(java.net.URI base, java.net.URI href)
base
- the basehref
- the hrefpublic static XMLDocumentURI createDocument(DTSContainer dts, java.net.URI resolvedURI, javax.xml.transform.Source source, boolean addToCache, XBRLDTSDocument parent) throws DTSDiscoveryException, com.rs.lic.LicenseVerificationException
The Document may not be part of any DTS.
The Document is first obtained from the cache. If it is not there, then it is loaded from the URI and stored into the cache.
the source parameter is an javax.xml.transform.Source object from which the document will be generated
dts
- the dtsresolvedURI
- the resolved urisource
- the sourceaddToCache
- the boolean add to cacheparent
- the parentDTSDiscoveryException
- the DTS discovery exceptioncom.rs.lic.LicenseVerificationException
- the license verification exceptionpublic static XMLDocumentURI createDynamicDocument(DTSContainer dts, java.net.URI resolvedURI, javax.xml.transform.Source source, boolean addToCache, XBRLDTSDocument parent) throws DTSDiscoveryException, com.rs.lic.LicenseVerificationException, XBRLValidationException
dts
- the dtsresolvedURI
- the resolved urisource
- the sourceaddToCache
- the boolean add to cacheparent
- the parentDTSDiscoveryException
- the DTS discovery exceptioncom.rs.lic.LicenseVerificationException
- the license verification exceptionXBRLValidationException
- the XBRL validation exceptionpublic static XMLDocumentURI createDocument(DTSContainer dts, java.lang.Integer resolvedURI, javax.xml.transform.Source source, boolean addToCache, XBRLDTSDocument parent) throws DTSDiscoveryException, com.rs.lic.LicenseVerificationException
The Document may not be part of any DTS.
The Document is first obtained from the cache. If it is not there, then it is loaded from the URI and stored into the cache.
the source parameter is an javax.xml.transform.Source object from which the document will be generated
dts
- the dtsresolvedURI
- the resolved urisource
- the sourceaddToCache
- the add to cacheparent
- the parentDTSDiscoveryException
- the DTS discovery exceptioncom.rs.lic.LicenseVerificationException
- the license verification exceptionpublic static int isOfficialURI(java.net.URI uri)
This method is used internally to generate a warning when an official document is not loaded from the official location.
uri
- the uripublic static XMLDocumentURI createDocument(XMLDocumentURI node, boolean addToCache) throws com.rs.lic.LicenseVerificationException, DTSDiscoveryException
node
- the XMLDocumentURI object to transformaddToCache
- true if the document MUST be added to the cachecom.rs.lic.LicenseVerificationException
- the license verification exceptionDTSDiscoveryException
- the DTS discovery exceptionpublic abstract XBRLDocument.XBRLDocumentType getDTSDocumentType()
public abstract java.lang.String getDTSDocumentTypeName()
public abstract void discoverDTS(XBRLDTSDocument parent) throws DTSDiscoveryException, com.rs.lic.LicenseVerificationException
discoverDTS
in interface XBRLDTSDocument
discoverDTS
in class XMLDocumentURI
parent
- the parentDTSDiscoveryException
- the DTS discovery exceptioncom.rs.lic.LicenseVerificationException
- the license verification exceptionpublic abstract void readInfoset() throws XBRLValidationException
XBRLValidationException
- the XBRL validation exceptionpublic void getDTS() throws DTSDiscoveryException, com.rs.lic.LicenseVerificationException
DTSDiscoveryException
- the DTS discovery exceptioncom.rs.lic.LicenseVerificationException
- the license verification exceptionpublic java.util.Iterator<XBRLDocument> getParents()
public void addParent(XBRLDocument parent)
parent
- the parentpublic void delParent(XBRLDocument parent)
parent
- the parentpublic boolean addIdOfElement(XMLFragment newElement)
Don't call this method from inside XMLFragment.getId() or methods overridden by subclasses. Call
the addIdOfElement(XMLFragment, String)
method instead.
newElement
- element from which the ID will be obtainedpublic boolean addIdOfElement(XMLFragment newElement, java.lang.String id)
newElement
- element to be added. The ID will not be obtained from the nodeid
- to be set for this XMLFragment. The ID must be the real id set on this element node in the id attributepublic void removeIdOfElement(XMLFragment element)
element
- the elementpublic void removeIdOfElement(java.lang.String key, XMLFragment element)
key
- the keyelement
- the elementpublic void changeElementId(XMLFragment newEl, java.lang.String oldId, java.lang.String newId) throws XBRLInconsistentDTSException
newEl
- element definitionoldId
- the old idnewId
- the new ID of the element in the tableXBRLInconsistentDTSException
- the XBRL inconsistent dts exceptionpublic void setReadingInfoset(boolean value)
value
- the new reading infosetpublic java.util.Map<java.lang.String,net.sf.saxon.om.NodeInfo> getElementsById()
public static java.util.HashMap<java.lang.String,net.sf.saxon.om.NodeInfo> getOrCreateTableId(net.sf.saxon.om.DocumentInfo doc)
doc
- the docpublic java.util.Iterator<java.lang.String> getAllUsedIds()
public boolean isIdUsed(java.lang.String id)
id
- Stringpublic XMLFragment getElementById(java.lang.String id)
Subclasses of this class may contain methods that returns the appropriate object for an id. Use this method as a last resort if you don't know or you don't care about the returned object type.
id
- string, the id of the element to retrievepublic void save() throws XBRLSerializationException
XBRLSerializationException
- the XBRL serialization exceptionpublic void save(java.io.OutputStream os) throws java.io.IOException, XBRLSerializationException
XMLDocumentURI.getDocumentURI()
method.
When a call to XMLDocumentURI.setURI(URI)
is made, all absolute URIs in xlink:href
attributes will be converted to relative URIs.
The save()
method (with no arguments) ensures the OutputStream
corresponds with the file set in the call to XMLDocumentURI.setURI(URI)
. But this
method does not perform that check. Therefore, it is responsibility of the caller
to properly set every document URI if this method is used. The advantage of this method
is that it will generate no physical file content and can be used in environments where
physical files are not desiredos
- the OutputStream where the document will be written to.java.io.IOException
- Signals that an I/O exception has occurred.XBRLSerializationException
- the XBRL serialization exceptionpublic void save(java.io.OutputStream os, boolean withOptimizations) throws java.io.IOException, XBRLSerializationException
XMLDocumentURI.getDocumentURI()
method.
When a call to XMLDocumentURI.setURI(URI)
is made, all absolute URIs in xlink:href
attributes will be converted to relative URIs.
The save()
method (with no arguments) ensures the OutputStream
corresponds with the file set in the call to XMLDocumentURI.setURI(URI)
. But this
method does not perform that check. Therefore, it is responsibility of the caller
to properly set every document URI if this method is used. The advantage of this method
is that it will generate no physical file content and can be used in environments where
physical files are not desiredos
- the OutputStream where the document will be written to.withOptimizations
- the with optimizationsjava.io.IOException
- Signals that an I/O exception has occurred.XBRLSerializationException
- the XBRL serialization exceptionpublic void setModified(boolean state)
state
- the new modifiedpublic boolean isContentModified()
When the content is modified the surrounding XML document might not
be in sync with the object model. A call to updateXML()
will synchronize both models.
updateXML()
public boolean updateXML() throws XBRLSerializationException
XBRLSerializationException
- the XBRL serialization exceptionpublic static net.sf.saxon.om.TreeModel getTreeModel()
public abstract XMLDocumentImpl generateDocNode() throws XBRLSerializationException
XBRLSerializationException
- the XBRL serialization exceptionpublic void removeComments()
public java.util.Collection<java.lang.String> getComments()
public void setComments(java.util.Collection<java.lang.String> fileComments)
fileComments
- Collection<String>public void addComment(java.lang.String commentValue)
commentValue
- the comment valuepublic void clear() throws java.lang.Throwable
clear
in interface XBRLDTSDocument
clear
in class XMLDocumentURI
java.lang.Throwable
- the throwablepublic XBRLRoleRef getRoleRef(java.lang.String roleURI)
roleURI
- the role URI@Deprecated public XBRLDocumentInfo getDocumentInfo()
Use XMLDocumentURI.getXBRLDocumentInfo()
instead
public static void setLockInfo(int timeout, java.lang.Runnable callback)
This methos stores information in a ThreadLocal variable that controls what lock will do depending on the thread calling lock. The most evident use case is the AWT thread calling lock but not blocking the AWT thread for a long time. The AWT thread might postpone the operation and keep processing other events in the meantime.
timeout
- amount of time the lock will wait after calling callback or deciding to cancel execution.
if this value is negative, the information about how lock will operate on this thread will be
reset to the default behavior that is to wait until lock can be acquiredcallback
- if not null, if timeout expires, this method will be called on the caller threadpublic static void unsetLockInfo()
public void lock()
A call to lock
must be followed by a call to release
preferebly in a try - finally block as follows:
doc.lock(); try { ... some code with doc ... } finally { doc.release(); }This ensures the document will not remain locked forever
public void release()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isDynamic()
public java.lang.String generateId()
Copyright 2006-2015 Reporting Standard S.L., C/ Torrecilla del Puerto 1, 28043, Madrid, Espaņa