|
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.data.BaseStoreImpl
public abstract class BaseStoreImpl
Abstract base implementation of the data store providing all methods of the store interface that do not depend on the nature of the underlying data store implementation.
| Field Summary | |
|---|---|
protected static org.apache.log4j.Logger |
logger
|
protected Matcher |
matcher
Resource matcher |
protected HashMap<String,String> |
namespaceBindings
Namespace bindings |
protected Document |
storeDOM
The DOM document used to construct DOM representations of subtrees of documents in the store. |
| Constructor Summary | |
|---|---|
BaseStoreImpl()
|
|
| Method Summary | ||
|---|---|---|
void |
clearFilteringURIs()
Specify that the data store is not to filter query results to only come from a specified set of URIs. |
|
void |
close()
Close the data store. |
|
void |
deleteDocument(String uri)
This deletion method does not ensure that all other documents that link to the document being deleted are also deleted. |
|
void |
deleteRelatedDocuments(String uri)
This deletion method ensures that all related documents are also deleted from the data store. |
|
protected String |
DOM2String(Element element)
Convert a DOM element (and its descendents) to a string. |
|
Document |
formCompositeDocument()
Get all data in the store as a single XML DOM object including the annotations used in the XBRLComposer project. |
|
|
getChildFragments(String interfaceName,
String parentIndex)
|
|
Element |
getDocumentAsDOM(String uri)
Get a single document in the store as a DOM. |
|
String |
getDocumentId(String document)
|
|
List<URI> |
getDocumentsToDiscover()
|
|
FragmentList<Fact> |
getFacts()
|
|
FragmentList<Fact> |
getFacts(URI uri)
|
|
List<String> |
getFilteringURIs()
|
|
protected Element |
getFollowingSibling(Element parentElement,
int precedingSiblings)
Get the following sibling of this fragment's root in the parent fragment's data. |
|
|
getFragments(String interfaceName)
Utility method to return a list of fragments in a data store that have a type corresponding to the specified fragment interface name. |
|
|
getFragmentsFromDocument(URI uri,
String interfaceName)
Utility method to return a list of fragments in a data store that have a type corresponding to the specified fragment interface name and that are in the document with the specified URI. |
|
FragmentList<Item> |
getItems()
|
|
FragmentList<Item> |
getItems(URI uri)
|
|
Language |
getLanguage(String encoding,
String code)
|
|
FragmentList<Language> |
getLanguages(String code)
|
|
Matcher |
getMatcher()
|
|
Networks |
getNetworks(String arcRole)
|
|
Networks |
getNetworks(String linkrole,
String arcrole)
|
|
String |
getNextFragmentId()
Get the next fragment ID to use when extending a DTS, instead of starting at 1 again and corrupting the DTS data store with duplicate fragment IDs. |
|
List<String> |
getReferencedDocuments(String uri)
Override this method in a data store implementation if the data store implementation supports XQuery (rather than XPath). |
|
List<String> |
getReferencingDocuments(String uri)
Override this method in a data store implementation if the data store implementation supports XQuery (rather than XPath). |
|
|
getRootFragmentForDocument(String uri)
|
|
|
getRootFragments()
|
|
Document |
getStoreAsDOM()
Get all documents in the store as a single DOM. |
|
Networks |
getStoredNetworks()
|
|
List<String> |
getStoredURIs()
Get a list of the URIs that have been stored. |
|
Fragment |
getStub(String uri)
|
|
FragmentList<Fragment> |
getStubs()
|
|
Element |
getSubtree(Fragment f)
Returns the root element of the subtree starting with the fragment with the specified index. |
|
protected String |
getURIFilteringQueryClause()
|
|
boolean |
hasDocument(String uri)
Test if a particular URI is already in the data store. |
|
boolean |
hasStoredNetworks()
|
|
boolean |
isFilteringByURIs()
|
|
void |
removeStub(String stubId)
|
|
void |
saveDocuments(File destination)
Saves the individual documents in the data store into a directory structure that is placed into the specified directory. |
|
void |
saveDocuments(File destination,
String uriPrefix)
Serializes those documents in the data store with a URI that begins with the specified URI prefix. |
|
void |
saveStoreAsSingleDocument(File file)
Creates a single DOM structure from all documents in the data store and saves this single XML structure in the specified file. |
|
void |
serialize(Element what)
Serialize the specified XML DOM to System.out. |
|
void |
serialize(Element what,
File destination)
Serialize the specified XML DOM to the specified destination. |
|
void |
serialize(Element what,
OutputStream destination)
Serialize the specified XML DOM to the specified destination. |
|
void |
serialize(Element what,
String destination)
Serialize the specified XML DOM to the specified destination file. |
|
void |
serialize(Fragment fragment)
Serialize the specified fragment. |
|
String |
serializeToString(Element what)
Serialize the specified XML DOM node. |
|
void |
setFilteringURIs(List<String> uris)
|
|
void |
setMatcher(Matcher matcher)
Sets the matcher for the store to use. |
|
void |
setNamespaceBinding(String namespace,
String prefix)
|
|
void |
setStoredNetworks(Networks networks)
|
|
void |
storeLoaderState(List<String> documents)
Stores the state of the document discovery process. |
|
void |
storeStub(String document)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.xbrlapi.data.Store |
|---|
delete, getFragment, hasFragment, query, queryForIndices, removeFragment, storeFragment |
| Field Detail |
|---|
protected static org.apache.log4j.Logger logger
protected Document storeDOM
protected Matcher matcher
protected HashMap<String,String> namespaceBindings
| Constructor Detail |
|---|
public BaseStoreImpl()
| Method Detail |
|---|
public void setMatcher(Matcher matcher)
throws XBRLException
Store
setMatcher in interface Storematcher - the matcher to use to identify identical resources.
XBRLException - if the matcher is null;Store.setMatcher(Matcher)public Matcher getMatcher()
getMatcher in interface StoreStore.getMatcher()
public void setNamespaceBinding(String namespace,
String prefix)
throws XBRLException
setNamespaceBinding in interface Storenamespace - The namespace to bind a prefix to for queryingprefix - The prefix to bind to the namespace for querying
XBRLException - if either argument is null.Store.setNamespaceBinding(String,String)public void setFilteringURIs(List<String> uris)
setFilteringURIs in interface Storeuris - The list of URIs to restrict query results to coming from.Store.setFilteringURIs(List)public List<String> getFilteringURIs()
getFilteringURIs in interface StoreStore.getFilteringURIs()public void clearFilteringURIs()
Store
clearFilteringURIs in interface StoreStore.clearFilteringURIs()public boolean isFilteringByURIs()
isFilteringByURIs in interface StoreStore.isFilteringByURIs()protected String getURIFilteringQueryClause()
public void close()
throws XBRLException
close in interface StoreXBRLException
public void storeLoaderState(List<String> documents)
throws XBRLException
Store
storeLoaderState in interface Storedocuments - The list of URIs of the documents remaining to be
discovered.
XBRLExceptionStore.storeLoaderState(List)
public void storeStub(String document)
throws XBRLException
storeStub in interface Storedocument - The document to store a stub for.
XBRLExceptionStore.storeStub(String)
public String getDocumentId(String document)
throws XBRLException
getDocumentId in interface Storedocument - The string representation of the document content.
XBRLExceptionStore.getDocumentId(String)
public void serialize(Element what,
OutputStream destination)
throws XBRLException
serialize in interface Storewhat - the root element of the DOM to be serialised.destination - The destination output stream to be serialised to.
XBRLException - if the DOM cannot be serialised
because the destination cannot be written to or some other
different problem occurs during serialisation.
public void serialize(Element what)
throws XBRLException
serialize in interface Storewhat - the root element of the DOM to be serialised.
XBRLException
public void serialize(Fragment fragment)
throws XBRLException
serialize in interface Storefragment - The fragment to be serialised.
XBRLException
public String serializeToString(Element what)
throws XBRLException
serializeToString in interface Storewhat - the root element of the DOM to be serialised.
XBRLException
public void deleteDocument(String uri)
throws XBRLException
Store
deleteDocument in interface Storeuri - The URI of the document to delete from the data store.
XBRLExceptionStore.deleteDocument(String)
public void deleteRelatedDocuments(String uri)
throws XBRLException
Store
deleteRelatedDocuments in interface Storeuri - The URI of the document to delete.
XBRLException
public List<String> getReferencingDocuments(String uri)
throws XBRLException
Store
getReferencingDocuments in interface Storeuri - The URI of the referenced document.
XBRLException - if the list of referencing documents cannot be populated.Store.getReferencingDocuments(String)
public List<String> getReferencedDocuments(String uri)
throws XBRLException
Store
getReferencedDocuments in interface Storeuri - The URI of the referencing document.
XBRLException - if the list of referenced documents cannot be populated.Store.getReferencedDocuments(String)
public void serialize(Element what,
File destination)
throws XBRLException
serialize in interface Storewhat - the root element of the DOM to be serialised.destination - The destination file to be serialised to.
XBRLException - if the DOM cannot be serialised
because the destination cannot be written to or some other
different problem occurs during serialisation.
public void serialize(Element what,
String destination)
throws XBRLException
serialize in interface Storewhat - the root element of the DOM to be serialised.destination - The destination file to be serialised to.
XBRLException - if the DOM cannot be serialised
because the destination cannot be written to or some other
different problem occurs during serialisation.
public List<String> getStoredURIs()
throws XBRLException
getStoredURIs in interface StoreXBRLException - if the list cannot be constructed.
public boolean hasDocument(String uri)
throws XBRLException
Store
hasDocument in interface Storeuri - the string representation of the URI to be tested for.
XBRLException - if the document cannot be constructed as a DOM.Store.hasDocument(String)
public Element getDocumentAsDOM(String uri)
throws XBRLException
getDocumentAsDOM in interface Storeuri - The string representation of the URI of the
document to be retrieved.
XBRLException - if the document cannot be constructed as a DOM.
public Element getSubtree(Fragment f)
throws XBRLException
getSubtree in interface Storef - The fragment at the root of the subtree.
XBRLException - if the subtree cannot be constructed.
protected Element getFollowingSibling(Element parentElement,
int precedingSiblings)
parentElement - The parent element in the parent fragment's data.precedingSiblings - The number of sibling elements preceding the element of interest.
public Document getStoreAsDOM()
throws XBRLException
getStoreAsDOM in interface StoreXBRLException - if the DOM cannot be constructed.
public Document formCompositeDocument()
throws XBRLException
formCompositeDocument in interface StoreXBRLException - if the composed data store cannot be constructed.
public String getNextFragmentId()
throws XBRLException
Store
getNextFragmentId in interface StoreXBRLExceptionStore.getNextFragmentId()
public FragmentList<Fragment> getStubs()
throws XBRLException
getStubs in interface StoreXBRLExceptionStore.getStubs()
public Fragment getStub(String uri)
throws XBRLException
getStub in interface Storeuri - The string value of the URI of the document to get the stub for.
XBRLException - if there is more than one stub.Store.getStub(String)
public void removeStub(String stubId)
throws XBRLException
removeStub in interface StorestubId - The URI of the document for which
the stub fragment is to be removed from the data store.
XBRLExceptionStore.getStub(String stubId)
public List<URI> getDocumentsToDiscover()
throws XBRLException
getDocumentsToDiscover in interface StoreXBRLException - if any of the document URIs are malformed.Store.getDocumentsToDiscover()
public void saveDocuments(File destination)
throws XBRLException
saveDocuments in interface Storedestination - The folder in which the directory structure and
the documents in the data store are to be saved.
XBRLException - If the root folder does not exist or
is not a directory or if the documents in the store cannot
be saved to the local file system.
public void saveDocuments(File destination,
String uriPrefix)
throws XBRLException
saveDocuments in interface Storedestination - The folder in which the directory structure and
the documents in the data store are to be saved.uriPrefix - All documents in the data store with a URI that begins
with the string specified by uriPrefix will be saved to the local
file system.
XBRLException - If the root folder does not exist or
is not a directory or if the documents in the store cannot
be saved to the local file system.
public void saveStoreAsSingleDocument(File file)
throws XBRLException
saveStoreAsSingleDocument in interface Storefile - The file to save the Store content to.
XBRLException - if the documents in the store cannot be
saved to the single file.protected String DOM2String(Element element)
element - The element to convert to a string.
XBRLException - if an IO exception occurs.
public <F extends Fragment> FragmentList<F> getFragments(String interfaceName)
throws XBRLException
Store
getFragments in interface StoreinterfaceName - The name of the interface. 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.
XBRLExceptionStore.getFragments(String)
public <F extends Fragment> FragmentList<F> getChildFragments(String interfaceName,
String parentIndex)
throws XBRLException
getChildFragments in interface StoreinterfaceName - The name of the interface. EG: If a list of
org.xbrlapi.impl.ReferenceArcImpl fragments is required then
this parameter would have a value of "ReferenceArc".
Note that this method does not yet recognise fragment subtypes so
a request for an Arc would not return all ReferenceArcs as well as other
types of arcs.parentIndex - The index of the parent fragment.
XBRLExceptionStore.getChildFragments(String, String)
public Networks getNetworks(String arcRole)
throws XBRLException
getNetworks in interface StorearcRole - The XLink arcrole value.
XBRLExceptionStore.getNetworks(String)
public Networks getNetworks(String linkrole,
String arcrole)
throws XBRLException
getNetworks in interface Storelinkrole - The linkrole of the networks.arcrole - The arcrole of the networks.
XBRLExceptionStore.getNetworks(String,String)
public <F extends Fragment> FragmentList<F> getFragmentsFromDocument(URI uri,
String interfaceName)
throws XBRLException
getFragmentsFromDocument in interface Storeuri - The URI of the document to get the fragments from.interfaceName - The name of the interface. EG: If a list of
org.xbrlapi.impl.ReferenceArcImpl fragments is required then
this parameter would have a value of "ReferenceArc".
Note that this method does not yet recognise fragment subtypes so
a request for an Arc would not return all ReferenceArcs as well as other
types of arcs.
XBRLExceptionArcImpl
public FragmentList<Fact> getFacts()
throws XBRLException
XBRLException
public FragmentList<Item> getItems()
throws XBRLException
XBRLException
public FragmentList<Fact> getFacts(URI uri)
throws XBRLException
uri - The URI of the document to get the facts from.
XBRLException
public FragmentList<Item> getItems(URI uri)
throws XBRLException
uri - The URI of the document to get the items from.
XBRLException
public <F extends Fragment> F getRootFragmentForDocument(String uri)
throws XBRLException
getRootFragmentForDocument in interface StoreF - The fragment extension classuri - The URI of the document to get the root fragment for.
XBRLException - if more than one root fragment is found in the data store.Store.getRootFragmentForDocument(String)
public <F extends Fragment> FragmentList<F> getRootFragments()
throws XBRLException
getRootFragments in interface StoreF - The fragment extension class
XBRLException - if more than one root fragment is found in the data store.Store.getRootFragments()
public Language getLanguage(String encoding,
String code)
throws XBRLException
getLanguage in interface Storeencoding - The code identifying the language that the name of the
language is expressed in.code - The code that identifies the language being named.
XBRLException - if either parameter equals null.Store.getLanguage(String, String)
public FragmentList<Language> getLanguages(String code)
throws XBRLException
getLanguages in interface Storecode - The language code to get the language fragments for. The code
is converted to upper case before processing.
XBRLException - if the language code is null.Store.getLanguages(String)public Networks getStoredNetworks()
getStoredNetworks in interface StoreStore.getStoredNetworks()public boolean hasStoredNetworks()
hasStoredNetworks in interface StoreStore.hasStoredNetworks()public void setStoredNetworks(Networks networks)
setStoredNetworks in interface Storenetworks - The networks to incorporate into the data
store object.Store.setStoredNetworks(org.xbrlapi.networks.Networks)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||