Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Stardust/Knowledge Base/Integration/Camel/JSON FILE TO IPP DATA
< Stardust | Knowledge Base | Integration | Camel
Revision as of 04:48, 16 August 2013 by Vikash.pandey.sungard.com (Talk | contribs) (New page: == Requirements == #I need to write a process which should be triggered when a file arrives at a particular folder. #It should pick the file content (which happens to contain JSON Strin...)
Requirements
- I need to write a process which should be triggered when a file arrives at a particular folder.
- It should pick the file content (which happens to contain JSON Strings).
- I need to convert the JSON string into IPP Data Structure and present it to users for editing the IPP data.
- Once edited, i need to convert the IPP data back to JSON string.
Steps:
- Create a RAD project and copy the xpdl into it. Copy all the source files as per its package structure.
- Download jackson-core-asl-1.9.10.jar and jackson-mapper-asl-1.9.10.jar and put it in WEB-INF/lib of the RAD project.
- Built the project, deploy the model.
- Place a file with itxt as extension in the designated folder which is being monitored by Camel Trigger (in thsi case its C:\temp).
File Content is:
{"Name":"Tanmoy Roy","EmpID":"1002345","DoJ":1376332200000,"Salary":54433.0, "Phones":[{"Home":"11111111","Mobile":"111111111","Office":"33333333333"}, {"Home":"2222222","Mobile":"2222222","Office":"34444444"}], "dependents":[{"Name":"T1","Relation":"TR1","Age":21}, {"Name":"T2","Relation":"TR2","Age":43}]}
Results:
As soon as the file is placed the process gets started and You will see it as below after completing Display File Contents activity:
Next activity screen will present the data for read/write, make changes to it and complete the activity.
You will get JSON String out of edited data as shown below:
{"Phones":[{"Home":"11111111","Mobile":"111111111","Office":"33333333333"}, {"Home":"2222222","Mobile":"2222222","Office":"34444444"},{"Home":"6666666","Mobile":"6666666","Office":"66666666"}], "Name":"Tanmoy Roy","dependents":[{"Name":"T1","Relation":"TR1","Age":21}, {"Name":"T2","Relation":"TR2","Age":43}, {"Name":"T3","Relation":"TR3","Age":56}], "EmpID":"1002345","DoJ":1376332200000,"Salary":54433.0}