Breadcrumb
- Sabre Red 360 Software Development Kit Help
- Web Red Apps
- Web Modules
- Data Services and Command Flow
- Data Types and Serialization
Data Types and Serialization
-
Create POJO class/classes with JAXB Mappings. This can be done in two ways as described below
-
First, create POJO classes and add JAXB Mapping later as shown in this example. Then, create ObjectFactory.java class in the same package, where POJO classes are present.
-
(or) If you have XSD which describes the structure, use XJC Java Tool to generate JAXB Mappings. Refer to Generating_JAXB_classes_from_XSD.
-

-
Implement hashCode and equals methods in your data model classes. Those methods can be generated by IDE, JAXB or written by hand. TIPS:
-
Namespace is required in order to provide mapping information to JAXB transformer (Refer step 2.)
-
Do not alter ObjectFactory.java file. Below is the code for ObjectFactory.java
-

-
Next, provide JAXB Mapping to the Transformer which is responsible for converting Java object to JSON. Create transformer.properties file in src directory with package and namespace details as shown below.
pkg.com_sabre_redapp_example3_desktop_template=template 1
ns.com_sabre_redapp_example3_desktop_template=http://redapp.sabre.com/example3/desktop/template 2
TIPS:
o Package name should be same where JAXB Mapping classes are provided. Key should be in the format of key.<plugin-name-with-underscores>.
o Namespace value should be the same as the one which is provided in JAXB mapping classes. Key should be in the format of ns.<plugin-name-with-underscores>.
-
Update MANIFEST.MF file with dependencies and other configurations.

TIPS:
-
Add com.sabre.edge.dynamo.transformer to bothRequire-BundleandEclipse-RegisterBuddy. This is required for the pre-load JAXB Mappings.
Add any other require bundle from target platform that are required for compilation.
-
UpdateBundle-Activatorwith plugins Activator class including package as shown above.
-
Add com.sabre.edge.dynamo.ext.cdm, 'com.sabre.edge.dynamo.services.impl','com.sabre.edge.dynamo.services.common' toRequire-Bundle.
Add any other require bundle from target platform that are required for compilation.
-
Add callback service definition ‘OSGI-INF/TemplateFlowExtensionPointService.xml’ to Service-Component.