-
Notifications
You must be signed in to change notification settings - Fork 1
mailursubbu/JsonToFlist
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Most of the on premises products expose only proprietary communication interface or SOAP interface for integration with external systems.
Thus, these proven products fall behind the copetition with brand new products developed offlate. Below work provides example of building
JSON based RESTful interface to on-premises products using Oracle BRM as an example.
Oracle BRM is a world class billing and rating system. But, it exposes proprietary communication interface and SOAP interface for
integration with external systems. As the world has moved towards JSON based RESTful interfaces, OBRM is lacking the connectivity
with latest technologies. This project provides the JSON to Flist parser for developing REST adaptor for Oracle BRM.
Below are the few example input and outputs generated from this parser:
Input 1:
{
"FldInheritedInfo":{
"FldCcInfo":[
{
"FldDebitExp":"0905",
"FldDebitNum":"4444111122223333",
"FldName":"Joe Smith"
}
]
}
}
Output 1:
0 PIN_FLD_INHERITED_INFO SUBSTRUCT [0] allocated 1, used 1
1 PIN_FLD_CC_INFO ARRAY [0] allocated 3, used 3
2 PIN_FLD_NAME STR [0] "Joe Smith"
2 PIN_FLD_DEBIT_EXP STR [0] "XXXX"
2 PIN_FLD_DEBIT_NUM STR [0] "XXXX"
Input 2:
{
"FldNameinfo":[
{
"FldSalutation":"Mr.",
"FldFirstName":"Shrihari",
"FldLastName":"Venkatesha"
},
{
"FldSalutation":"Mr.",
"FldFirstName":"Srinivasa",
"FldLastName":"Venkatesha"
},
{
"FldSalutation":"Mr.",
"FldFirstName":"BhaktaVastala",
"FldLastName":"Karunasagar"
}
]
}
Output 2:
0 PIN_FLD_NAMEINFO ARRAY [0] allocated 3, used 3
1 PIN_FLD_LAST_NAME STR [0] "Venkatesha"
1 PIN_FLD_FIRST_NAME STR [0] "Shrihari"
1 PIN_FLD_SALUTATION STR [0] "Mr."
0 PIN_FLD_NAMEINFO ARRAY [1] allocated 3, used 3
1 PIN_FLD_LAST_NAME STR [0] "Venkatesha"
1 PIN_FLD_FIRST_NAME STR [0] "Srinivasa"
1 PIN_FLD_SALUTATION STR [0] "Mr."
0 PIN_FLD_NAMEINFO ARRAY [2] allocated 3, used 3
1 PIN_FLD_LAST_NAME STR [0] "Karunasagar"
1 PIN_FLD_FIRST_NAME STR [0] "BhaktaVastala"
1 PIN_FLD_SALUTATION STR [0] "Mr."
How to run :
Setup:
JRE 8 is used to build and run
JSonFlistAdaptor-1.0.jar can be found in the git repo.
antlr-4.5.3-complete.jar can be found in the git repo.
pcm.jar,pcmext.jar and pcf.jar would need to be downloaded from your BRM installation.
> java -cp .\antlr-4.5.3-complete.jar;.\pcm.jar;.\pcmext.jar;.\pcf.jar;.\JSonFlistAdaptor-1.0.jar;. com.subra.app.ParserApp
{
"FldNameinfo":[
{
"FldSalutation":"Mr.",
"FldFirstName":"Shrihari",
"FldLastName":"Venkatesha"
},
{
"FldSalutation":"Mr.",
"FldFirstName":"Srinivasa",
"FldLastName":"Venkatesha"
},
{
"FldSalutation":"Mr.",
"FldFirstName":"BhaktaVastala",
"FldLastName":"Karunasagar"
}
]
}
<ctrl+Z>
0 PIN_FLD_NAMEINFO ARRAY [0] allocated 3, used 3
1 PIN_FLD_LAST_NAME STR [0] "Venkatesha"
1 PIN_FLD_FIRST_NAME STR [0] "Shrihari"
1 PIN_FLD_SALUTATION STR [0] "Mr."
0 PIN_FLD_NAMEINFO ARRAY [1] allocated 3, used 3
1 PIN_FLD_LAST_NAME STR [0] "Venkatesha"
1 PIN_FLD_FIRST_NAME STR [0] "Srinivasa"
1 PIN_FLD_SALUTATION STR [0] "Mr."
0 PIN_FLD_NAMEINFO ARRAY [2] allocated 3, used 3
1 PIN_FLD_LAST_NAME STR [0] "Karunasagar"
1 PIN_FLD_FIRST_NAME STR [0] "BhaktaVastala"
1 PIN_FLD_SALUTATION STR [0] "Mr."
Currently Supported Data types:
Array
Substruct
Int
String
POID
How to support other data types:
Update PcmAdaptor.getFldType and PcmAdaptor.strToTargetObj to support new data types.
How to Use:
If your BRM REST adaptor is built using Spring, then you may have to make use of message converter to convert incoming JSON to FLIST using this project as the basis. Use Java PCM to talk with BRM. Frame the JSON response by parsing response FLIST. I have not yet created FLIST TO JSON parser. If there is a need, I would work on it, in my free time.
License:
This piece of work comes with no warranty and no support.
For antlr-4.5.3-complete.jar license refer to http://www.antlr.org/license.html.
[The BSD License]
Copyright (c) 2012 Terence Parr and Sam Harwell
All rights reserved.
Design:
Example Array parsing:
{
"FldNameinfo":[{"FldSalutation":"Mr.","FldFirstName":"Srihari","FldLastName":"Venkatesha"},
{"FldSalutation":"Mr.","FldFirstName":"Srihari","FldLastName":"Venkatesha"},
{"FldSalutation":"Mr.","FldFirstName":"Srihari","FldLastName":"Venkatesha"}
]
}
enterAnObject ------------- Top level Flist alocation and push to map
enterPair ------------- push parent flist to map
enterArrayValue ------------ push parent flist to map
enterArrayOfObject --------- Allocate Sparse tree and push to sparse tree map and also push parent flist
enterAnObject --------- Alocate flist and push to map
enterPair --------- push parent flist to map
exitPair --------- get flist from map, string and value.Update the flist with value.
enterPair --------- push parent flist to map
exitPair --------- get flist from map, string and value.Update the flist with value.
enterPair
exitPair
exitAnObject -- do nothing..map has its own flist
enterAnObject --
enterPair
exitPair
enterPair
exitPair
enterPair
exitPair
exitAnObject
enterAnObject
enterPair
exitPair
enterPair
exitPair
enterPair
exitPair
exitAnObject
exitArrayOfObject ---- Populate sparse tree with all the child flist objects
exitArrayValue -- push sparse tree to map from child
exitPair -- get flist from map, string and value.Update the flist with value.
exitAnObject
Example Object parsing:
{
"FldNameinfo":{"FldSalutation":"Mr.","FldFirstName":"Srihari","FldLastName":"Venkatesha"},
"FldNameinfo2":{"FldSalutation":"Mr.","FldFirstName":"Srihari","FldLastName":"Venkatesha"}
}
enterAnObject ------------- Top level Flist alocation
enterPair ------------- Copy top level flist from parent
enterObjectValue ------------- Copy top level flist from parent
enterAnObject ------------- Allocate the new flist for new Object and push it to global var
enterPair ------------- Copy top level flist from parent
exitPair ------------- push String and value pair to parent flist tagged to this node
enterPair ------------- Copy top level flist from parent
exitPair ------------- push String and value pair to parent flist tagged to this node
enterPair ------------- Copy top level flist from parent
exitPair ------------- push String and value pair to parent flist tagged to this node
exitAnObject ------------- Do Nothing as it already has newly allocated flist for object
exitObjectValue ------------- Replace flist pointer with the child object, so that exit pair can use it
exitPair
enterPair
enterObjectValue
enterAnObject
enterPair
exitPair
enterPair
exitPair
enterPair
exitPair
exitAnObject
exitObjectValue
exitPair
exitAnObject
Message Converter example:
https://dzone.com/articles/customizing
About
JSON to BRM FLIST Parser
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published