public class HibernateSerializedObjectDAO extends java.lang.Object implements SerializedObjectDAO
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.logging.Log |
log |
| Modifier and Type | Method and Description |
|---|---|
<T extends OpenmrsObject> |
convertSerializedObject(java.lang.Class<T> clazz,
SerializedObject serializedObject)
Converts a raw SerializedObject to an OpenmrsObject, using the appropriate Serializer
|
<T extends OpenmrsObject> |
getAllObjects(java.lang.Class<T> type)
Retrieves all non-retired objects of the passed type from the database that have been saved
through serialization
|
<T extends OpenmrsObject> |
getAllObjects(java.lang.Class<T> type,
boolean includeRetired)
Retrieves all objects from the database that match the passed type that have been saved
through serialization Returns voided / retired Objects only if includeRetired parameter is
true
|
<T extends OpenmrsMetadata> |
getAllObjectsByName(java.lang.Class<T> type,
java.lang.String name,
boolean exactMatchOnly)
Retrieves all objects from the database that match the passed type and name that have been
saved through serialization
|
java.util.List<SerializedObject> |
getAllSerializedObjects(java.lang.Class<?> type,
boolean includeRetired)
Retrieves all raw Serialized Object from the database that match the passed type and
includeRetired flag
|
java.util.List<SerializedObject> |
getAllSerializedObjectsByName(java.lang.Class<?> type,
java.lang.String name,
boolean exactMatchOnly)
Retrieves all raw Serialized Objects from the database that match the passed type and name
|
static HibernateSerializedObjectDAO |
getInstance()
Singleton Factory method
|
<T extends OpenmrsObject> |
getObject(java.lang.Class<T> baseClass,
java.lang.Integer id)
Retrieves the saved object of the passed type from the database by it's id
|
<T extends OpenmrsObject> |
getObjectByUuid(java.lang.Class<T> baseClass,
java.lang.String uuid)
Retrieves the saved object of the passed type from the database by it's uuid
|
java.lang.Class<? extends OpenmrsObject> |
getRegisteredTypeForObject(OpenmrsObject object)
Returns the registered class for the passed object, or null if none found For example, if the
supportedTypes property contains the CohortDefinition.class interface, and a particular
implementation of that interface is passed in, then this method would return
CohortDefinition.class.
|
SerializedObject |
getSerializedObject(java.lang.Integer id)
Retrieves the raw SerializedObject from the database by id
|
SerializedObject |
getSerializedObjectByUuid(java.lang.String uuid)
Retrieves the raw Serialized Object from the database by uuid
|
java.util.List<java.lang.Class<? extends OpenmrsObject>> |
getSupportedTypes() |
void |
purgeObject(java.lang.Integer id)
Deletes the item from the database with the given primary key id
|
void |
registerSupportedType(java.lang.Class<? extends OpenmrsObject> clazz)
Registers a class as one that should be supported
|
<T extends OpenmrsObject> |
saveObject(T object)
Saves an object to the database in serialized form
|
<T extends OpenmrsObject> |
saveObject(T object,
OpenmrsSerializer serializer)
Saves an object to the database, in serialized form, using the specified
OpenmrsSerializer |
void |
setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Set session factory
|
void |
setSupportedTypes(java.util.List<java.lang.Class<? extends OpenmrsObject>> supportedTypes) |
void |
unregisterSupportedType(java.lang.Class<? extends OpenmrsObject> clazz)
Removes this class as one that should be supported
|
public static HibernateSerializedObjectDAO getInstance()
public SerializedObject getSerializedObject(java.lang.Integer id) throws DAOException
SerializedObjectDAOgetSerializedObject in interface SerializedObjectDAOid - the id to lookupDAOExceptionSerializedObjectDAO.getSerializedObject(Integer)public <T extends OpenmrsObject> T getObject(java.lang.Class<T> baseClass, java.lang.Integer id) throws DAOException
SerializedObjectDAOgetObject in interface SerializedObjectDAObaseClass - The class of the object to retrieveid - The primary key id of the object to retrieveDAOExceptionSerializedObjectDAO.getObject(Class, Integer)public SerializedObject getSerializedObjectByUuid(java.lang.String uuid) throws DAOException
SerializedObjectDAOgetSerializedObjectByUuid in interface SerializedObjectDAOuuid - The UUID of the object to retrieveDAOExceptionSerializedObjectDAO.getSerializedObjectByUuid(String)public <T extends OpenmrsObject> T getObjectByUuid(java.lang.Class<T> baseClass, java.lang.String uuid) throws DAOException
SerializedObjectDAOgetObjectByUuid in interface SerializedObjectDAObaseClass - The class of the object to retrieveuuid - The UUID of the object to retrieveDAOExceptionSerializedObjectDAO.getObjectByUuid(Class, String)public java.util.List<SerializedObject> getAllSerializedObjectsByName(java.lang.Class<?> type, java.lang.String name, boolean exactMatchOnly) throws DAOException
SerializedObjectDAOgetAllSerializedObjectsByName in interface SerializedObjectDAOtype - The class of the object to retrievename - the name of the item to retrieveexactMatchOnly - if true will only return exact matchesDAOExceptionSerializedObjectDAO#getAllObjectsByName(Class, String)public <T extends OpenmrsMetadata> java.util.List<T> getAllObjectsByName(java.lang.Class<T> type, java.lang.String name, boolean exactMatchOnly) throws DAOException
SerializedObjectDAOgetAllObjectsByName in interface SerializedObjectDAOtype - The class of the object to retrievename - the name of the item to retrieveexactMatchOnly - if true will only return exact matchesDAOExceptionSerializedObjectDAO#getAllObjectsByName(Class, String)public java.util.List<SerializedObject> getAllSerializedObjects(java.lang.Class<?> type, boolean includeRetired) throws DAOException
SerializedObjectDAOgetAllSerializedObjects in interface SerializedObjectDAOtype - The class of the object to retrieveincludeRetired - if true includes retired/voided objects, otherwise does notDAOExceptionSerializedObjectDAO.getAllObjects(Class, boolean)public <T extends OpenmrsObject> java.util.List<T> getAllObjects(java.lang.Class<T> type, boolean includeRetired) throws DAOException
SerializedObjectDAOgetAllObjects in interface SerializedObjectDAOtype - The class of the object to retrieveincludeRetired - includeRetired If true, returns voided/retired objects as wellDAOExceptionSerializedObjectDAO.getAllObjects(Class, boolean)public <T extends OpenmrsObject> java.util.List<T> getAllObjects(java.lang.Class<T> type) throws DAOException
SerializedObjectDAOgetAllObjects in interface SerializedObjectDAOtype - The class of the object to retrieveDAOExceptionSerializedObjectDAO.getAllObjects(Class)public <T extends OpenmrsObject> T saveObject(T object) throws DAOException
SerializedObjectDAOsaveObject in interface SerializedObjectDAOobject - The object to saveDAOExceptionSerializedObjectDAO.saveObject(OpenmrsObject)public <T extends OpenmrsObject> T saveObject(T object, OpenmrsSerializer serializer) throws DAOException
SerializedObjectDAOOpenmrsSerializersaveObject in interface SerializedObjectDAOobject - The object to saveserializer - The OpenmrsSerializer to useDAOExceptionSerializedObjectDAO.saveObject(OpenmrsObject, OpenmrsSerializer)public void purgeObject(java.lang.Integer id)
throws DAOException
SerializedObjectDAOpurgeObject in interface SerializedObjectDAOid - The id of the item to delete from the databaseDAOExceptionSerializedObjectDAO.purgeObject(Integer)public void registerSupportedType(java.lang.Class<? extends OpenmrsObject> clazz) throws DAOException
SerializedObjectDAOregisterSupportedType in interface SerializedObjectDAOclazz - The class to registerDAOExceptionSerializedObjectDAO.registerSupportedType(Class)public void unregisterSupportedType(java.lang.Class<? extends OpenmrsObject> clazz) throws DAOException
SerializedObjectDAOunregisterSupportedType in interface SerializedObjectDAOclazz - The class to un-registerDAOExceptionSerializedObjectDAO.unregisterSupportedType(Class)public java.lang.Class<? extends OpenmrsObject> getRegisteredTypeForObject(OpenmrsObject object)
SerializedObjectDAOgetRegisteredTypeForObject in interface SerializedObjectDAOobject - The object to check for the registered typeSerializedObjectDAO.getRegisteredTypeForObject(OpenmrsObject)public <T extends OpenmrsObject> T convertSerializedObject(java.lang.Class<T> clazz, SerializedObject serializedObject) throws DAOException
SerializedObjectDAOconvertSerializedObject in interface SerializedObjectDAOclazz - the OpenmrsObject class to retrieveserializedObject - the raw SerializedObject to deserialize into an OpenmrsObjectDAOExceptionSerializedObjectDAO.convertSerializedObject(Class, SerializedObject)public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
sessionFactory - public java.util.List<java.lang.Class<? extends OpenmrsObject>> getSupportedTypes()
getSupportedTypes in interface SerializedObjectDAOpublic void setSupportedTypes(java.util.List<java.lang.Class<? extends OpenmrsObject>> supportedTypes)
supportedTypes - the supportedTypes to setCopyright © 2018 OpenMRS Inc.. All Rights Reserved.