public class StorageService extends XBRLDatabaseAccessApp implements HasEnableDisableOpenMenus, StorageEventListener
The idea is that a job to store a DTS is created by an external application and submitted to this service. The service creates a new thread in order to deal with the database.
This class contains handlers for all required interfaces during the storage phase
| Modifier and Type | Class and Description | 
|---|---|
| static class  | StorageService.StorageStatusThe Enum StorageStatus. | 
| Constructor and Description | 
|---|
| StorageService(DatabaseManagerBase dbm,
              RegisterExtraClasses[] extra,
              java.util.Properties props,
              boolean hasGUI)It must be public because of the way it should be initialized due to the 
 HasURIResolverParameter interface. | 
| StorageService(RegisterExtraClasses[] extra,
              java.util.Properties props,
              boolean hasGUI)It must be public because of the way it should be initialized due to the 
 HasURIResolverParameter interface. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | clear()Releases memory in the caches reserved by the surrounding processors. | 
| void | disableOpen()Called when menus has to be set to "disabled" state. | 
| void | documentStoredEvent(StorageEvent evt)Document stored event. | 
| void | doStoreDTS(java.lang.String instanceUriOnDatabase,
          XBRLDocument document,
          org.hibernate.Session parameter,
          boolean inNewThread,
          boolean bForUpdate,
          org.apache.log4j.Level logLevel,
          StorageEventListener[] listeners)Starts the storage of a DTS into the database in an unattended new thread. | 
| void | doStoreDTS(java.net.URI[] uris,
          java.lang.String dtsName,
          DbUtil dbUtil,
          HasStoreUserQuestions app,
          HasEnableDisableOpenMenus appEnableDisable,
          HasLoadingBar appLoadingBar,
          HasErrorsHandler errHandler,
          HasLogPanel appLogPanel,
          boolean inNewThread,
          boolean bForUpdate,
          StorageEventListener[] listeners)Starts the storage of a DTS into the database in an unattended new thread. | 
| void | doStoreDTS(XBRLDocument document,
          org.hibernate.Session parameter,
          boolean inNewThread,
          boolean bForUpdate,
          org.apache.log4j.Level logLevel,
          StorageEventListener[] listeners)Starts the storage of a DTS into the database in an unattended new thread. | 
| void | enableOpen()Called when menus has to be set to "enables" state. | 
| java.lang.String | getLastMessage(StoreXBRLThread th)Gets the last message. | 
| float | getPercentage(StoreXBRLThread th)Gets the percentage. | 
| static StorageService | getService(RegisterExtraClasses[] extra,
          java.util.Properties props,
          boolean hasGUI)Obtains the instance of the static service class that manages storage of information into the XBRL database. | 
| java.lang.String | getStackTrace(StoreXBRLThread th)Gets the stack trace. | 
| StorageService.StorageStatus | getStatus(StoreXBRLThread th)Gets the status. | 
| java.util.Collection<StoreXBRLThread> | getStorageThreads()Access to the collection of active threads. | 
| java.lang.String | getTooltipMessage(StoreXBRLThread th)Gets the tooltip message. | 
| boolean | isStored(java.net.URI uri,
        org.hibernate.Session dbSession)Returns true if the document with URI is already stored in the database. | 
getDbUtil, getStatus, showDbSettingspublic StorageService(RegisterExtraClasses[] extra, java.util.Properties props, boolean hasGUI)
extra - is an array of RegisterExtraClasses objectsprops - additional Properties object for the connection to the databasehasGUI - this is true if the service can open a window to the end user. false otherwise.RegisterExtraClassespublic StorageService(DatabaseManagerBase dbm, RegisterExtraClasses[] extra, java.util.Properties props, boolean hasGUI)
dbm - the database manager base to use with alternate configuration to connect to the databaseextra - is an array of RegisterExtraClasses objectsprops - additional Properties object for the connection to the database and to the pojo generarion processhasGUI - this is true if the service can open a window to the end user. false otherwise.RegisterExtraClassespublic static StorageService getService(RegisterExtraClasses[] extra, java.util.Properties props, boolean hasGUI)
The parameters are optional and both can be null.
extra - array of RegisterExtraClasses instances. The RegisterExtraClasses interface allows for extending the database model for additional objectsprops - extra properties that will be added to the connection to the database and to the pojo generarion processhasGUI - this is true if the service can open a window to the end user. false otherwise.RegisterExtraClassespublic void doStoreDTS(XBRLDocument document, org.hibernate.Session parameter, boolean inNewThread, boolean bForUpdate, org.apache.log4j.Level logLevel, StorageEventListener[] listeners)
NOTE: The second parameter is the database session. It MUST be configured with Flush.COMMIT in order to work properly. typically you would do:
        Session session = StorageService.getService(null,null).getDbUtil().getSessionFactory(null).openSession();
        session.setFlushMode(FlushMode.COMMIT);
        StorageService.getService(null,null).doStoreDTS(instance,session,true,false);
 document - XBRLDocument to be storedparameter - the database session already openedinNewThread - if this argument is false, the storage will not create a new threadbForUpdate - if this parameter is true and the document already exists in the database, the document content will be updated. (only for XBRL reports)logLevel - the log levellisteners - the listenerspublic void doStoreDTS(java.lang.String instanceUriOnDatabase,
                       XBRLDocument document,
                       org.hibernate.Session parameter,
                       boolean inNewThread,
                       boolean bForUpdate,
                       org.apache.log4j.Level logLevel,
                       StorageEventListener[] listeners)
NOTE: The second parameter is the database session. It MUST be configured with Flush.COMMIT in order to work properly. typically you would do:
        Session session = StorageService.getService(null,null).getDbUtil().getSessionFactory(null).openSession();
        session.setFlushMode(FlushMode.COMMIT);
        StorageService.getService(null,null).doStoreDTS(instance,session,true,false);
 instanceUriOnDatabase - this is the URI of the instance document in the database. Also, the URI will be used as base uri for transformation of locally referenced taxonomies and linkbasesdocument - XBRLDocument to be storedparameter - the database session already openedinNewThread - if this argument is false, the storage will not create a new threadbForUpdate - if this parameter is true and the document already exists in the database, the document content will be updated. (only for XBRL reports)logLevel - the log levellisteners - the listenerspublic void doStoreDTS(java.net.URI[] uris,
                       java.lang.String dtsName,
                       DbUtil dbUtil,
                       HasStoreUserQuestions app,
                       HasEnableDisableOpenMenus appEnableDisable,
                       HasLoadingBar appLoadingBar,
                       HasErrorsHandler errHandler,
                       HasLogPanel appLogPanel,
                       boolean inNewThread,
                       boolean bForUpdate,
                       StorageEventListener[] listeners)
NOTE: The second parameter is the database session. It MUST be configured with Flush.COMMIT in order to work properly. typically you would do:
        Session session = StorageService.getService(null,null).getDbUtil().getSessionFactory(null).openSession();
        session.setFlushMode(FlushMode.COMMIT);
        StorageService.getService(null,null).doStoreDTS(instance,session,true,false);
 uris - this is an array of URIs of documents to store. Also, the URI will be used as base uri for transformation of locally referenced taxonomies and linkbasesdtsName - the dts namedbUtil - instance of the DbUtil to useapp - implementation of the HasStoreUserQuestions interfaceappEnableDisable - implementation of the HasEnableDisableOpenMenus interfaceappLoadingBar - implementation of the HasLoadingBar interfaceerrHandler - implementation of the HasErrorsHandler interfaceappLogPanel - implementation of the HasLogPanel interfaceinNewThread - if this argument is false, the storage will not create a new threadbForUpdate - if this parameter is true and the document already exists in the database, the document content will be updated. (only for XBRL reports)listeners - the listenerspublic void clear()
clear in class XBRLDatabaseAccessApppublic void disableOpen()
HasEnableDisableOpenMenusdisableOpen in interface HasEnableDisableOpenMenuspublic void enableOpen()
HasEnableDisableOpenMenusenableOpen in interface HasEnableDisableOpenMenuspublic void documentStoredEvent(StorageEvent evt)
StorageEventListenerdocumentStoredEvent in interface StorageEventListenerevt - the evtpublic boolean isStored(java.net.URI uri,
                        org.hibernate.Session dbSession)
uri - the uridbSession - the db sessionpublic java.util.Collection<StoreXBRLThread> getStorageThreads()
public StorageService.StorageStatus getStatus(StoreXBRLThread th)
th - the thpublic java.lang.String getStackTrace(StoreXBRLThread th)
th - the thpublic java.lang.String getLastMessage(StoreXBRLThread th)
th - the thpublic java.lang.String getTooltipMessage(StoreXBRLThread th)
th - the thpublic float getPercentage(StoreXBRLThread th)
th - the thCopyright 2006-2015 Reporting Standard S.L., C/ Torrecilla del Puerto 1, 28043, Madrid, Espaņa