Serialization XStream Module
Overview
At the heart of OpenMRS is a series of medically related domain objects. These domain objects often need to be converted into serialized data when developers are interested in creating functionalities which communicate between other applications. For example, a developer might want to create a web service to expose patient demographic or observational information, or create a standards-based messaging infrastructure (such as one that creates IXF, CCD messages, or normal XML). Currently, many serialization approaches are included within the core application, but we lack a rationalized, consistent approach to serialization. A serialization service is being built into the core of OpenMRS and designed abstractly using the strategy pattern so that different serialization strategies (whether serializing or deserializing of objects) could be used dynamically. Each different format (ixf, ccd, xml) would be a new class that implements OpenmrsSerializer to do the conversion from object to text and text to object.
In this module, we implemented one serialization/deserialization strategy using the XStream library.
Download
Download the omod from the module repository:Â https://addons.openmrs.org/#/show/org.openmrs.module.serialization-xstream
View/download the source code from github: https://github.com/openmrs/openmrs-module-serialization.xstream/
Usage
Current Serialization XStream Module supports two strategies to serialize/deserialize objects.
Learn how to serialize/deserialize objects from the page Description about how to serialize/deserialize.
Depending on XStream the Module
Build the dependencies on the XStream Serialization Module as the page Module Dependencies says when you want to use serialization framework in your module.
Release Notes
0.2.8
Updated to work with hibernate 4
0.2.7
0.2.5
Added ability to use custom XStream objects. Needed for Reporting 0.5.2+ if you are using OpenMRS version 1.6+.
0.2.2
Fixed compilation error found in the released 0.2.1
0.2.1
Fixed minimum version to be 1.6.0
0.2
Fixed ConceptSource.voided bug for OpenRMS 1.6
0.1.8.3
Added ability to use custom XStream objects. Needed for Reporting 0.5.2+ if you are using OpenMRS version 1.5.
0.1.8.1
Removed the "root" log4j appender from within the module (again)
0.1.8
Added a short converter for the Form object to prevent infinite recursion (#1866)
0.1.3
Removed the "root" log4j appender from within the module
0.1.2
Removed defaultSerializer reference in module because openmrs now uses a global property
0.1.1
Initial release. Contains Serializer and ShortSerializer
Resources
Developer's Blog: Zhuangwei Lu