|
XBRLAPIA Java API for XBRL |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.xbrlapi.impl.XMLImpl
org.xbrlapi.impl.FragmentImpl
public class FragmentImpl
Implements the functionality that is common to all types of XBRL fragments.
| Field Summary |
|---|
| Fields inherited from class org.xbrlapi.impl.XMLImpl |
|---|
logger |
| Constructor Summary | |
|---|---|
FragmentImpl()
|
|
| Method Summary | ||
|---|---|---|
void |
appendElementSchemeXPointer(String expression)
Add an element Scheme XPointer Expression to the metadata. |
|
void |
appendID(String id)
Add an ID (used in XPointer resolution) to the metadata. |
|
List<Fragment> |
getAllChildren()
Gets all child fragments. |
|
Set<String> |
getAllChildrenIndices()
|
|
Fragment |
getAncestorOrSelf(String type)
Gets the ancestor (or self) fragment with the specified fragment type. |
|
Fragment |
getChild(String type,
int index)
Get a specific child fragment. |
|
|
getChildren(Class<?> requiredClass)
Gets the child fragments with the specified fragment type. |
|
|
getChildren(String type)
Gets the child fragments with the specified fragment type. |
|
Set<String> |
getChildrenIndices(String type)
|
|
Element |
getDataRootElement()
Get the root element of the fragment data. |
|
String |
getElementSchemeXPointerExpression()
|
|
String |
getIDXPointerExpression()
|
|
List<LabelResource> |
getLabels()
|
|
List<LabelResource> |
getLabels(List<String> languages,
List<URI> resourceRoles)
|
|
List<LabelResource> |
getLabels(List<String> languages,
List<URI> labelRoles,
List<URI> linkRoles)
|
|
List<LabelResource> |
getLabelsWithLanguage(String language)
|
|
List<LabelResource> |
getLabelsWithLanguageAndResourceRole(String language,
URI role)
|
|
List<LabelResource> |
getLabelsWithLanguageAndResourceRoleAndLinkRole(String language,
URI resourceRole,
URI linkRole)
|
|
List<LabelResource> |
getLabelsWithResourceRole(URI role)
|
|
String |
getLanguage()
|
|
String |
getLanguage(Node node)
Algorithm is as follows: If the node is an attribute, redo with the parent node. If the node is a XBRLAPI metadata element redo with right node in parent fragment. If the node is an element in the fragment data: Try to find the XML lang attribute and use its value. If that fails, redo the search using the parent node. |
|
String |
getLanguageName(List<String> languages)
|
|
String |
getLanguageName(String language)
|
|
String |
getLocalname()
Get the local name of the fragment's root element |
|
String |
getLocalnameFromQName(String qname)
Returns the local name for a QName |
|
URI |
getNamespace()
Get the namespace of the fragment root element. |
|
URI |
getNamespaceFromQName(String qname,
Node node)
Algorithm is as follows: If the node is an attribute, redo with the parent node. If the node is a XBRLAPI metadata element redo with right node in parent fragment. If the node is an element in the fragment data: Generate namespace declaration attribute name - 'xmlns:...' to search for. Try to match the QName prefix to the element's prefix to see if the element namespace is appropriate to return. Try to find the attribute doing the namespace declaration on the element and use that. If that fails, redo the search using the parent node. |
|
Fragment |
getParent()
Get the parent fragment of this fragment or null if there is none. |
|
Element |
getParentElement(Element parentDataRootElement)
This method operates as follows: If the sequence to the parent element indicates that the data root element is the parent - use that. Loop through the sequence to the parent element. |
|
String |
getParentIndex()
Get the index of the parent fragment or null if the fragment does not have a parent fragment. |
|
String |
getPrefixFromQName(String qname)
Returns the Namespace prefix for a QName |
|
List<ReferenceResource> |
getReferences()
|
|
List<ReferenceResource> |
getReferencesWithLanguage(String language)
|
|
List<ReferenceResource> |
getReferencesWithLanguageAndResourceRoleAndLinkRole(String language,
URI resourceRole,
URI linkRole)
|
|
List<ReferenceResource> |
getReferencesWithLanguageAndRole(String language,
URI role)
|
|
List<ReferenceResource> |
getReferencesWithResourceRole(String role)
|
|
List<Locator> |
getReferencingLocators()
Retrieves a list of all locators that target this fragment. |
|
String[] |
getSequenceToParentElement()
Get the sequence of steps through the parent fragment DOM to the parent element. |
|
String |
getSequenceToParentElementAsString()
|
|
List<SimpleLink> |
getSimpleLinks()
|
|
URI |
getURI()
Get the URI of the document containing this fragment. |
|
String |
getXPath()
Get the XPath to the element in the parent fragment that is the parent element of this fragment's root element. |
|
String |
getXPointerExpression()
|
|
boolean |
isAncestorOf(Fragment descendant)
|
|
boolean |
isChild()
|
|
boolean |
isNewFragment()
Tests if a fragment is new in the sense that it does not have a root data element. |
|
boolean |
isRoot()
|
|
void |
setParentIndex(String index)
Set the index of the parent fragment. |
|
void |
setSequenceToParentElement(Fragment parent)
Specifies the set of ancestor elements of the element in the parent fragment that is the insertion point for this fragment's root element. |
|
void |
setURI(URI uri)
Set the URI of the fragment's document. |
|
| Methods inherited from class org.xbrlapi.impl.XMLImpl |
|---|
appendMetadataElement, compareTo, equals, finalize, getBuilder, getDocumentNode, getIndex, getMetaAttribute, getMetadataRootElement, getStore, getType, hashCode, hasMetaAttribute, isa, isa, removeMetaAttribute, removeMetadataElement, serialize, serialize, serialize, setBuilder, setIndex, setMetaAttribute, setResource, setStore, updateInStore |
| Methods inherited from class java.lang.Object |
|---|
clone, getClass, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.xbrlapi.XML |
|---|
appendMetadataElement, equals, getBuilder, getDocumentNode, getIndex, getMetaAttribute, getMetadataRootElement, getStore, getType, hashCode, hasMetaAttribute, isa, isa, removeMetaAttribute, removeMetadataElement, serialize, serialize, serialize, setBuilder, setIndex, setMetaAttribute, setResource, setStore, updateInStore |
| Methods inherited from interface java.lang.Comparable |
|---|
compareTo |
| Constructor Detail |
|---|
public FragmentImpl()
| Method Detail |
|---|
public Fragment getAncestorOrSelf(String type)
throws XBRLException
Fragment
getAncestorOrSelf in interface Fragmenttype - The required fragment type of the ancestor (or self).
XBRLException - if no such ancestor fragment exists.Fragment.getAncestorOrSelf(String)
public <F extends Fragment> List<F> getChildren(String type)
throws XBRLException
Fragment
getChildren in interface Fragmenttype - The required fragment type of the child.
EG: If a list of
org.xbrlapi.impl.ReferenceArcImpl fragments is required then
this parameter would have a value of "ReferenceArc".
Note that if the parameter contains full stops, then it is used directly
as the value for the fragment type, enabling fragment extensions to exploit this
method without placing fragment implementations in the org.xbrlapi package.
XBRLExceptionFragment.getChildren(String)
public <F extends Fragment> List<F> getChildren(Class<?> requiredClass)
throws XBRLException
Fragment
getChildren in interface FragmentrequiredClass - The required fragment class of the child fragments.
XBRLExceptionFragment.getChildren(Class)
public Set<String> getChildrenIndices(String type)
throws XBRLException
getChildrenIndices in interface Fragmenttype - The fragment type
XBRLExceptionFragment.getChildrenIndices(String)
public List<SimpleLink> getSimpleLinks()
throws XBRLException
getSimpleLinks in interface FragmentXBRLExceptionFragment.getSimpleLinks()
public List<Fragment> getAllChildren()
throws XBRLException
Fragment
getAllChildren in interface FragmentXBRLExceptionFragment.getAllChildren()
public Set<String> getAllChildrenIndices()
throws XBRLException
getAllChildrenIndices in interface FragmentXBRLExceptionFragment.getAllChildrenIndices()
public Fragment getChild(String type,
int index)
throws XBRLException
Fragment
getChild in interface Fragmenttype - The fragment type of the required childindex - The index of the required child fragment (among other children of the same type)
with the first child being at index 0.
XBRLException - if the index is out of boundsFragment.getChild(String, int)
public Element getDataRootElement()
throws XBRLException
Fragment
getDataRootElement in interface FragmentXBRLException - if the fragment does not have fragment data.Fragment.getDataRootElement()
public boolean isNewFragment()
throws XBRLException
Fragment
isNewFragment in interface FragmentXBRLExceptionFragment.isNewFragment()
public URI getURI()
throws XBRLException
Fragment
getURI in interface FragmentXBRLExceptionFragment.getURI()
public void setURI(URI uri)
throws XBRLException
Fragment
setURI in interface Fragmenturi - The string value of the document's absolute URI
XBRLExceptionFragment.setURI(URI)
public List<Locator> getReferencingLocators()
throws XBRLException
Fragment
getReferencingLocators in interface FragmentXBRLExceptionFragment.getReferencingLocators()
public List<LabelResource> getLabels()
throws XBRLException
getLabels in interface FragmentXBRLExceptionFragment.getLabels()
public List<LabelResource> getLabelsWithResourceRole(URI role)
throws XBRLException
getLabelsWithResourceRole in interface Fragmentrole - The XLink role value
XBRLExceptionFragment.getLabelsWithResourceRole(URI)
public List<LabelResource> getLabels(List<String> languages,
List<URI> resourceRoles)
throws XBRLException
getLabels in interface Fragmentlanguages - the list of language codes in order of preference from most preferred to least
preferred, eventually allowing any language if no explicit preference match.resourceRoles - the list of label resource roles in order of preference from most preferred
to least preferred, eventually allowing any resource role.
XBRLExceptionFragment.getLabels(List, List)
public List<LabelResource> getLabels(List<String> languages,
List<URI> labelRoles,
List<URI> linkRoles)
throws XBRLException
getLabels in interface Fragmentlanguages - the list of language codes in order of preference from most
preferred to least preferred, eventually allowing any language
if no explicit preference match.labelRoles - the list of label resource roles in order of preference from
most preferred to least preferred, eventually allowing any
resource role.linkRoles - the list of extended link roles in order of preference from
most preferred to least preferred, eventually allowing any
link role.
XBRLExceptionFragment.getLabels(List, List, List)
public List<ReferenceResource> getReferencesWithResourceRole(String role)
throws XBRLException
getReferencesWithResourceRole in interface Fragmentrole - The XLink role value
XBRLExceptionFragment.getReferencesWithResourceRole(String)
public List<LabelResource> getLabelsWithLanguage(String language)
throws XBRLException
getLabelsWithLanguage in interface Fragmentlanguage - The xml:lang language codevalue
XBRLExceptionFragment.getLabelsWithLanguage(String)
public List<LabelResource> getLabelsWithLanguageAndResourceRole(String language,
URI role)
throws XBRLException
getLabelsWithLanguageAndResourceRole in interface Fragmentlanguage - The xml:lang language code valuerole - The XLink role value
XBRLExceptionFragment.getLabelsWithLanguageAndResourceRole(String, URI)
public List<LabelResource> getLabelsWithLanguageAndResourceRoleAndLinkRole(String language,
URI resourceRole,
URI linkRole)
throws XBRLException
getLabelsWithLanguageAndResourceRoleAndLinkRole in interface Fragmentlanguage - The xml:lang language code value or null if not used as
a a label selection criterion.resourceRole - The XLink resource role value on the label or null if not used as
a a label selection criterion.linkRole - The XLink extended link role value on the
extended link containing the label or null if not used as
a a label selection criterion..
XBRLExceptionFragment.getLabelsWithLanguageAndResourceRole(String, URI)
public List<ReferenceResource> getReferences()
throws XBRLException
getReferences in interface FragmentXBRLExceptionFragment.getReferences()
public List<ReferenceResource> getReferencesWithLanguage(String language)
throws XBRLException
getReferencesWithLanguage in interface Fragmentlanguage - The xml:lang language code value
XBRLExceptionFragment.getReferencesWithLanguage(String)
public List<ReferenceResource> getReferencesWithLanguageAndRole(String language,
URI role)
throws XBRLException
getReferencesWithLanguageAndRole in interface Fragmentlanguage - The xml:lang language code valuerole - The XLink role value
XBRLExceptionFragment.getReferencesWithLanguageAndRole(String, URI)
public List<ReferenceResource> getReferencesWithLanguageAndResourceRoleAndLinkRole(String language,
URI resourceRole,
URI linkRole)
throws XBRLException
getReferencesWithLanguageAndResourceRoleAndLinkRole in interface Fragmentlanguage - The xml:lang language code valueresourceRole - The XLink resource role value on the referencelinkRole - The XLink extended link role value on the
extended link containing the reference.
XBRLExceptionFragment.getReferencesWithLanguageAndResourceRoleAndLinkRole(String, URI, URI)
public String getParentIndex()
throws XBRLException
Fragment
getParentIndex in interface FragmentXBRLException - if the parent fragment index is not available.Fragment.getParentIndex()
public boolean isChild()
throws XBRLException
isChild in interface FragmentXBRLExceptionFragment.isChild()
public boolean isAncestorOf(Fragment descendant)
throws XBRLException
isAncestorOf in interface Fragmentdescendant - The candidate descendant fragment.
XBRLExceptionFragment.isAncestorOf(Fragment)
public boolean isRoot()
throws XBRLException
isRoot in interface FragmentXBRLExceptionFragment.isRoot()
public void setParentIndex(String index)
throws XBRLException
Fragment
setParentIndex in interface Fragmentindex - The index of the parent fragment.
XBRLException - if the parent fragment index cannot be set.Fragment.setParentIndex(String)
public String getXPath()
throws XBRLException
Fragment
getXPath in interface FragmentXBRLExceptionFragment.getXPath()
public void setSequenceToParentElement(Fragment parent)
throws XBRLException
Fragment
setSequenceToParentElement in interface Fragmentparent - The parent fragment.
XBRLExceptionFragment.setSequenceToParentElement(Fragment)
public String[] getSequenceToParentElement()
throws XBRLException
Fragment
getSequenceToParentElement in interface FragmentXBRLExceptionFragment.getSequenceToParentElement()
public String getSequenceToParentElementAsString()
throws XBRLException
getSequenceToParentElementAsString in interface FragmentXBRLExceptionFragment.getSequenceToParentElementAsString()
public void appendID(String id)
throws XBRLException
Fragment
appendID in interface Fragmentid - The value of the ID.
XBRLExceptionTODO Eliminate the ID metadata element given the existence of the xptr elements.
public void appendElementSchemeXPointer(String expression)
throws XBRLException
Fragment
appendElementSchemeXPointer in interface Fragmentexpression - The XPointer expression
XBRLExceptionFragment.appendElementSchemeXPointer(String)
public URI getNamespace()
throws XBRLException
Fragment
getNamespace in interface FragmentXBRLException - if there is no data element
in the fragment.Fragment.getNamespace()
public String getLocalname()
throws XBRLException
Fragment
getLocalname in interface FragmentXBRLExceptionFragment.getLocalname()public String getPrefixFromQName(String qname)
Fragment
getPrefixFromQName in interface Fragmentqname - The qName value to resolve
Fragment.getPrefixFromQName(String)
public URI getNamespaceFromQName(String qname,
Node node)
throws XBRLException
getNamespaceFromQName in interface Fragmentqname - The qName value to resolvenode - The node in the fragment data (as a DOM representation) to start QName resolution from.
XBRLException - if the namespace is not declaredFragment.getNamespaceFromQName(String, Node)
public String getLanguage(Node node)
throws XBRLException
getLanguage in interface Fragmentnode - The XML node to get the XML language fragment for.
XBRLExceptionFragment.getLanguage(Node)
public String getLanguage()
throws XBRLException
getLanguage in interface FragmentXBRLExceptionFragment.getLanguage(),
Fragment.getLanguage(Node)
public String getLanguageName(String language)
throws XBRLException
getLanguageName in interface Fragmentlanguage - The language encoding of the language name, available
in the data store in the form of a Language XML resource.
XBRLExceptionFragment.getLanguageName(String)
public String getLanguageName(List<String> languages)
throws XBRLException
getLanguageName in interface FragmentXBRLExceptionFragment.getLanguageName(List)
public Fragment getParent()
throws XBRLException
Fragment
getParent in interface FragmentXBRLExceptionFragment.getParent()
public Element getParentElement(Element parentDataRootElement)
throws XBRLException
getParentElement in interface FragmentparentDataRootElement - The root element of the parent fragment's data.
XBRLExceptionFragment.getParentElement(Element)public String getLocalnameFromQName(String qname)
Fragment
getLocalnameFromQName in interface Fragmentqname - The qName value to resolve
Fragment.getLocalnameFromQName(String)
public String getXPointerExpression()
throws XBRLException
getXPointerExpression in interface FragmentXBRLExceptionFragment.getXPointerExpression()
public String getElementSchemeXPointerExpression()
throws XBRLException
getElementSchemeXPointerExpression in interface FragmentXBRLExceptionFragment.getElementSchemeXPointerExpression()
public String getIDXPointerExpression()
throws XBRLException
getIDXPointerExpression in interface FragmentXBRLExceptionFragment.getIDXPointerExpression()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||