org.openmrs.hl7.db.hibernate
Class HibernateHL7DAO

java.lang.Object
  extended by org.openmrs.hl7.db.hibernate.HibernateHL7DAO
All Implemented Interfaces:
HL7DAO

public class HibernateHL7DAO
extends java.lang.Object
implements HL7DAO

OpenMRS HL7 API database default hibernate implementation This class shouldn't be instantiated by itself. Use the Context

See Also:
HL7Service, HL7DAO

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
HibernateHL7DAO()
           
 
Method Summary
 java.lang.Integer countHL7InError(java.lang.String query)
          Returns the amount of HL7InError items in the database
 java.lang.Integer countHL7InQueue(java.lang.Integer messageState, java.lang.String query)
          Returns the amount of HL7InQueue items in the database
 void deleteHL7InArchive(HL7InArchive hl7InArchive)
           
 boolean deleteHL7InArchiveInFileSystem(java.lang.String uuid)
          Deletes an HL7 archive from the file system
 void deleteHL7InError(HL7InError hl7InError)
           
 void deleteHL7InQueue(HL7InQueue hl7InQueue)
           
 void deleteHL7Source(HL7Source hl7Source)
           
 void garbageCollect()
           
 java.util.List<HL7InArchive> getAllHL7InArchives()
           
 java.util.List<HL7InArchive> getAllHL7InArchives(int maxResultsSetSize)
          Returns hl7 in archives but with a limited resultset size to save memory
 java.util.List<HL7InArchive> getAllHL7InArchivesInFileSystem()
          Retrieves all hl7 in archives from the file system
 java.util.List<HL7InError> getAllHL7InErrors()
           
 java.util.List<HL7InQueue> getAllHL7InQueues()
           
 java.util.List<HL7Source> getAllHL7Sources()
           
 HL7InArchive getHL7InArchive(java.lang.Integer hl7InArchiveId)
           
 java.util.List<HL7InArchive> getHL7InArchiveByState(java.lang.Integer state)
           
 HL7InArchive getHL7InArchiveByUuid(java.lang.String uuid)
           
 HL7InArchive getHL7InArchiveByUuidFromFileSystem(java.lang.String uuid)
          Retrieves an hl7_in_archive with the matching the uuid
 HL7InArchive getHL7InArchiveInFileSystem(java.lang.String uuid)
          Retrieves a single hl7 archive from the file system with the matching archive id
 HL7InError getHL7InError(java.lang.Integer hl7InErrorId)
           
 java.util.List<HL7InError> getHL7InErrorBatch(int start, int length, java.lang.String query)
          Returns hl7s in error based on batch settings and filtered by a query
 HL7InQueue getHL7InQueue(java.lang.Integer hl7InQueueId)
           
 java.util.List<HL7InQueue> getHL7InQueueBatch(int start, int length, int messageState, java.lang.String query)
          Returns hl7s in queue based on batch settings and filtered by a query
 java.util.List<HL7InQueue> getHL7InQueueByState(java.lang.Integer state)
           
 HL7Source getHL7Source(java.lang.Integer hl7SourceId)
           
 HL7Source getHL7SourceByName(java.lang.String name)
           
 HL7InQueue getNextHL7InQueue()
           
 boolean isArchiveMigrationRequired()
           
 void migrateHl7InArchivesToFileSystem(java.util.Map<java.lang.String,java.lang.Integer> progressStatusMap)
           
 HL7InArchive saveHL7InArchive(HL7InArchive hl7InArchive)
           
 HL7InArchive saveHL7InArchiveToFileSystem(HL7InArchive hl7InArchive)
          After archive migration has been done, this method is what gets called by the service layer to write the archive to the file system
 HL7InError saveHL7InError(HL7InError hl7InError)
           
 HL7InQueue saveHL7InQueue(HL7InQueue hl7InQueue)
           
 HL7Source saveHL7Source(HL7Source hl7Source)
           
 void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
          Set session factory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log
Constructor Detail

HibernateHL7DAO

public HibernateHL7DAO()
Method Detail

setSessionFactory

public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Set session factory

Parameters:
sessionFactory -

saveHL7Source

public HL7Source saveHL7Source(HL7Source hl7Source)
                        throws DAOException
Specified by:
saveHL7Source in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.saveHL7Source(org.openmrs.hl7.HL7Source)

getHL7Source

public HL7Source getHL7Source(java.lang.Integer hl7SourceId)
                       throws DAOException
Specified by:
getHL7Source in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.getHL7Source(java.lang.Integer)

getHL7SourceByName

public HL7Source getHL7SourceByName(java.lang.String name)
                             throws DAOException
Specified by:
getHL7SourceByName in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.getHL7SourceByName(java.lang.String)

getAllHL7Sources

public java.util.List<HL7Source> getAllHL7Sources()
                                           throws DAOException
Specified by:
getAllHL7Sources in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.getAllHL7Sources()

deleteHL7Source

public void deleteHL7Source(HL7Source hl7Source)
                     throws DAOException
Specified by:
deleteHL7Source in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.deleteHL7Source(org.openmrs.hl7.HL7Source)

saveHL7InQueue

public HL7InQueue saveHL7InQueue(HL7InQueue hl7InQueue)
                          throws DAOException
Specified by:
saveHL7InQueue in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.saveHL7InQueue(org.openmrs.hl7.HL7InQueue)

getHL7InQueue

public HL7InQueue getHL7InQueue(java.lang.Integer hl7InQueueId)
                         throws DAOException
Specified by:
getHL7InQueue in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.getHL7InQueue(java.lang.Integer)

getAllHL7InQueues

public java.util.List<HL7InQueue> getAllHL7InQueues()
                                             throws DAOException
Specified by:
getAllHL7InQueues in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.getAllHL7InQueues()

getHL7InQueueBatch

public java.util.List<HL7InQueue> getHL7InQueueBatch(int start,
                                                     int length,
                                                     int messageState,
                                                     java.lang.String query)
Description copied from interface: HL7DAO
Returns hl7s in queue based on batch settings and filtered by a query

Specified by:
getHL7InQueueBatch in interface HL7DAO
Returns:
list of hl7s
See Also:
HL7DAO.getHL7InQueueBatch(int, int, int, java.lang.String)

countHL7InQueue

public java.lang.Integer countHL7InQueue(java.lang.Integer messageState,
                                         java.lang.String query)
Description copied from interface: HL7DAO
Returns the amount of HL7InQueue items in the database

Specified by:
countHL7InQueue in interface HL7DAO
Returns:
count of HL7InQueue items
See Also:
HL7DAO.countHL7InQueue(java.lang.Integer, java.lang.String)

getHL7InErrorBatch

public java.util.List<HL7InError> getHL7InErrorBatch(int start,
                                                     int length,
                                                     java.lang.String query)
Description copied from interface: HL7DAO
Returns hl7s in error based on batch settings and filtered by a query

Specified by:
getHL7InErrorBatch in interface HL7DAO
Returns:
See Also:
HL7DAO.getHL7InErrorBatch(int, int, java.lang.String)

countHL7InError

public java.lang.Integer countHL7InError(java.lang.String query)
Description copied from interface: HL7DAO
Returns the amount of HL7InError items in the database

Specified by:
countHL7InError in interface HL7DAO
Returns:
count of HL7InQueue items
See Also:
HL7DAO.countHL7InError(java.lang.String)

getNextHL7InQueue

public HL7InQueue getNextHL7InQueue()
                             throws DAOException
Specified by:
getNextHL7InQueue in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.getNextHL7InQueue()

deleteHL7InQueue

public void deleteHL7InQueue(HL7InQueue hl7InQueue)
                      throws DAOException
Specified by:
deleteHL7InQueue in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.deleteHL7InQueue(org.openmrs.hl7.HL7InQueue)

saveHL7InArchive

public HL7InArchive saveHL7InArchive(HL7InArchive hl7InArchive)
                              throws DAOException
Specified by:
saveHL7InArchive in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.saveHL7InArchive(org.openmrs.hl7.HL7InArchive)

getHL7InArchive

public HL7InArchive getHL7InArchive(java.lang.Integer hl7InArchiveId)
                             throws DAOException
Specified by:
getHL7InArchive in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.getHL7InArchive(java.lang.Integer)

getHL7InArchiveByState

public java.util.List<HL7InArchive> getHL7InArchiveByState(java.lang.Integer state)
                                                    throws DAOException
Specified by:
getHL7InArchiveByState in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.getHL7InArchiveByState(Integer stateId)

getHL7InQueueByState

public java.util.List<HL7InQueue> getHL7InQueueByState(java.lang.Integer state)
                                                throws DAOException
Specified by:
getHL7InQueueByState in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.getHL7InQueueByState(Integer stateId)

getAllHL7InArchives

public java.util.List<HL7InArchive> getAllHL7InArchives()
                                                 throws DAOException
Specified by:
getAllHL7InArchives in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.getAllHL7InArchives()

deleteHL7InArchive

public void deleteHL7InArchive(HL7InArchive hl7InArchive)
                        throws DAOException
Specified by:
deleteHL7InArchive in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.deleteHL7InArchive(org.openmrs.hl7.HL7InArchive)

saveHL7InError

public HL7InError saveHL7InError(HL7InError hl7InError)
                          throws DAOException
Specified by:
saveHL7InError in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.saveHL7InError(HL7InError)

getHL7InError

public HL7InError getHL7InError(java.lang.Integer hl7InErrorId)
                         throws DAOException
Specified by:
getHL7InError in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.getHL7InError(Integer)

getAllHL7InErrors

public java.util.List<HL7InError> getAllHL7InErrors()
                                             throws DAOException
Specified by:
getAllHL7InErrors in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.getAllHL7InErrors()

deleteHL7InError

public void deleteHL7InError(HL7InError hl7InError)
                      throws DAOException
Specified by:
deleteHL7InError in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.deleteHL7InError(HL7InError)

garbageCollect

public void garbageCollect()
Specified by:
garbageCollect in interface HL7DAO
See Also:
HL7DAO.garbageCollect()

migrateHl7InArchivesToFileSystem

public void migrateHl7InArchivesToFileSystem(java.util.Map<java.lang.String,java.lang.Integer> progressStatusMap)
                                      throws DAOException
Specified by:
migrateHl7InArchivesToFileSystem in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.migrateHl7InArchivesToFileSystem(Map)

getHL7InArchiveInFileSystem

public HL7InArchive getHL7InArchiveInFileSystem(java.lang.String uuid)
                                         throws DAOException
Description copied from interface: HL7DAO
Retrieves a single hl7 archive from the file system with the matching archive id

Specified by:
getHL7InArchiveInFileSystem in interface HL7DAO
Parameters:
uuid - uuid of the hl7 in archive to look up
Returns:
the hl7 archive with the matching id otherwise returns null if none found
Throws:
DAOException
See Also:
HL7DAO#getHL7InArchiveInFileSystem(Integer)

getAllHL7InArchivesInFileSystem

public java.util.List<HL7InArchive> getAllHL7InArchivesInFileSystem()
                                                             throws DAOException
Description copied from interface: HL7DAO
Retrieves all hl7 in archives from the file system

Specified by:
getAllHL7InArchivesInFileSystem in interface HL7DAO
Returns:
a list of all hl7 in archives from the file system
Throws:
DAOException
See Also:
HL7DAO.getAllHL7InArchivesInFileSystem()

deleteHL7InArchiveInFileSystem

public boolean deleteHL7InArchiveInFileSystem(java.lang.String uuid)
                                       throws DAOException
Description copied from interface: HL7DAO
Deletes an HL7 archive from the file system

Specified by:
deleteHL7InArchiveInFileSystem in interface HL7DAO
Parameters:
uuid - uuid for the archive to delete
Returns:
true only if the file was successfully deleted from the file system
Throws:
DAOException
See Also:
HL7DAO#deleteHL7InArchiveInFileSystem(Integer)

isArchiveMigrationRequired

public boolean isArchiveMigrationRequired()
                                   throws DAOException
Specified by:
isArchiveMigrationRequired in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.isArchiveMigrationRequired()

getHL7InArchiveByUuid

public HL7InArchive getHL7InArchiveByUuid(java.lang.String uuid)
                                   throws DAOException
Specified by:
getHL7InArchiveByUuid in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.getHL7InArchiveByUuid(java.lang.String)

saveHL7InArchiveToFileSystem

public HL7InArchive saveHL7InArchiveToFileSystem(HL7InArchive hl7InArchive)
                                          throws DAOException
Description copied from interface: HL7DAO
After archive migration has been done, this method is what gets called by the service layer to write the archive to the file system

Specified by:
saveHL7InArchiveToFileSystem in interface HL7DAO
Throws:
DAOException
See Also:
HL7DAO.saveHL7InArchiveToFileSystem(org.openmrs.hl7.HL7InArchive)

getHL7InArchiveByUuidFromFileSystem

public HL7InArchive getHL7InArchiveByUuidFromFileSystem(java.lang.String uuid)
                                                 throws DAOException
Description copied from interface: HL7DAO
Retrieves an hl7_in_archive with the matching the uuid

Specified by:
getHL7InArchiveByUuidFromFileSystem in interface HL7DAO
Returns:
Hl7 in archive if it exists otherwise null
Throws:
DAOException
See Also:
HL7DAO.getHL7InArchiveByUuidFromFileSystem(java.lang.String)

getAllHL7InArchives

public java.util.List<HL7InArchive> getAllHL7InArchives(int maxResultsSetSize)
Description copied from interface: HL7DAO
Returns hl7 in archives but with a limited resultset size to save memory

Specified by:
getAllHL7InArchives in interface HL7DAO
Parameters:
maxResultsSetSize - the maximum number of rows to be returned from the database
Returns:
list of hl7 archives
See Also:
HL7DAO.getAllHL7InArchives(int)

OpenMRS-trunk

Generated Aug 15 2010 10:05 PM. NOTE - these libraries are in active development and subject to change