|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openmrs.api.db.hibernate.HibernateSerializedObjectDAO
public class HibernateSerializedObjectDAO
Hibernate specific database access methods for serialized objects
Field Summary | |
---|---|
protected org.apache.commons.logging.Log |
log
|
Method Summary | ||
---|---|---|
|
convertSerializedObject(java.lang.Class<T> clazz,
SerializedObject serializedObject)
Converts a raw SerializedObject to an OpenmrsObject, using the appropriate Serializer |
|
|
getAllObjects(java.lang.Class<T> type)
Retrieves all non-retired objects of the passed type from the database that have been saved through serialization |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
saveObject(T object)
Saves an object to the database in serialized form |
|
|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.apache.commons.logging.Log log
Method Detail |
---|
public static HibernateSerializedObjectDAO getInstance()
public SerializedObject getSerializedObject(java.lang.Integer id) throws DAOException
SerializedObjectDAO
getSerializedObject
in interface SerializedObjectDAO
id
- the id to lookup
DAOException
SerializedObjectDAO.getSerializedObject(Integer)
public <T extends OpenmrsObject> T getObject(java.lang.Class<T> baseClass, java.lang.Integer id) throws DAOException
SerializedObjectDAO
getObject
in interface SerializedObjectDAO
baseClass
- The class of the object to retrieveid
- The primary key id of the object to retrieve
DAOException
SerializedObjectDAO.getObject(Class, Integer)
public SerializedObject getSerializedObjectByUuid(java.lang.String uuid) throws DAOException
SerializedObjectDAO
getSerializedObjectByUuid
in interface SerializedObjectDAO
uuid
- The UUID of the object to retrieve
DAOException
SerializedObjectDAO.getSerializedObjectByUuid(String)
public <T extends OpenmrsObject> T getObjectByUuid(java.lang.Class<T> baseClass, java.lang.String uuid) throws DAOException
SerializedObjectDAO
getObjectByUuid
in interface SerializedObjectDAO
baseClass
- The class of the object to retrieveuuid
- The UUID of the object to retrieve
DAOException
SerializedObjectDAO.getObjectByUuid(Class, String)
public java.util.List<SerializedObject> getAllSerializedObjectsByName(java.lang.Class<?> type, java.lang.String name, boolean exactMatchOnly) throws DAOException
SerializedObjectDAO
getAllSerializedObjectsByName
in interface SerializedObjectDAO
type
- The class of the object to retrievename
- the name of the item to retrieveexactMatchOnly
- if true will only return exact matches
DAOException
SerializedObjectDAO#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
SerializedObjectDAO
getAllObjectsByName
in interface SerializedObjectDAO
type
- The class of the object to retrievename
- the name of the item to retrieveexactMatchOnly
- if true will only return exact matches
DAOException
SerializedObjectDAO#getAllObjectsByName(Class, String)
public java.util.List<SerializedObject> getAllSerializedObjects(java.lang.Class<?> type, boolean includeRetired) throws DAOException
SerializedObjectDAO
getAllSerializedObjects
in interface SerializedObjectDAO
type
- The class of the object to retrieveincludeRetired
- if true includes retired/voided objects, otherwise does not
DAOException
SerializedObjectDAO.getAllObjects(Class, boolean)
public <T extends OpenmrsObject> java.util.List<T> getAllObjects(java.lang.Class<T> type, boolean includeRetired) throws DAOException
SerializedObjectDAO
getAllObjects
in interface SerializedObjectDAO
type
- The class of the object to retrieveincludeRetired
- includeRetired If true, returns voided/retired objects as well
DAOException
SerializedObjectDAO.getAllObjects(Class, boolean)
public <T extends OpenmrsObject> java.util.List<T> getAllObjects(java.lang.Class<T> type) throws DAOException
SerializedObjectDAO
getAllObjects
in interface SerializedObjectDAO
type
- The class of the object to retrieve
DAOException
SerializedObjectDAO.getAllObjects(Class)
public <T extends OpenmrsObject> T saveObject(T object) throws DAOException
SerializedObjectDAO
saveObject
in interface SerializedObjectDAO
object
- The object to save
DAOException
SerializedObjectDAO.saveObject(OpenmrsObject)
public <T extends OpenmrsObject> T saveObject(T object, OpenmrsSerializer serializer) throws DAOException
SerializedObjectDAO
OpenmrsSerializer
saveObject
in interface SerializedObjectDAO
object
- The object to saveserializer
- The OpenmrsSerializer
to use
DAOException
SerializedObjectDAO.saveObject(OpenmrsObject, OpenmrsSerializer)
public void purgeObject(java.lang.Integer id) throws DAOException
SerializedObjectDAO
purgeObject
in interface SerializedObjectDAO
id
- The id of the item to delete from the database
DAOException
SerializedObjectDAO.purgeObject(Integer)
public void registerSupportedType(java.lang.Class<? extends OpenmrsObject> clazz) throws DAOException
SerializedObjectDAO
registerSupportedType
in interface SerializedObjectDAO
clazz
- The class to register
DAOException
SerializedObjectDAO.registerSupportedType(Class)
public void unregisterSupportedType(java.lang.Class<? extends OpenmrsObject> clazz) throws DAOException
SerializedObjectDAO
unregisterSupportedType
in interface SerializedObjectDAO
clazz
- The class to un-register
DAOException
SerializedObjectDAO.unregisterSupportedType(Class)
public java.lang.Class<? extends OpenmrsObject> getRegisteredTypeForObject(OpenmrsObject object)
SerializedObjectDAO
getRegisteredTypeForObject
in interface SerializedObjectDAO
object
- The object to check for the registered type
SerializedObjectDAO.getRegisteredTypeForObject(OpenmrsObject)
public <T extends OpenmrsObject> T convertSerializedObject(java.lang.Class<T> clazz, SerializedObject serializedObject) throws DAOException
SerializedObjectDAO
convertSerializedObject
in interface SerializedObjectDAO
clazz
- the OpenmrsObject class to retrieveserializedObject
- the raw SerializedObject to deserialize into an OpenmrsObject
DAOException
SerializedObjectDAO.convertSerializedObject(Class, SerializedObject)
public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
sessionFactory
- public java.util.List<java.lang.Class<? extends OpenmrsObject>> getSupportedTypes()
getSupportedTypes
in interface SerializedObjectDAO
public void setSupportedTypes(java.util.List<java.lang.Class<? extends OpenmrsObject>> supportedTypes)
supportedTypes
- the supportedTypes to set
|
OpenMRS-1.7.x | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |