Package com.portal.pcm
Class FlistToJson
java.lang.Object
com.portal.pcm.FlistToJson
Class implementation to convert from
FList format to JSON.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Root method to convert the FList input to JSON Objectvoid
Method to dump the JSON object to standard out.static FlistToJson
Public method to instantiate this class.static FlistToJson
getInstance
(Map<String, String> fieldMap) Public method to instantiate this class.Method to get the Root JSON Object node.protected String
getMappedFieldName
(String pinFldName) This method checks to see if the given field is specified in a mapstatic void
Main method to test this class independently.void
serializeToFile
(File file) Utility function to write the current JSOn object to file.Method to convert the JSON Object to string.Method to convert the JSON Object to string in a compact form.
-
Method Details
-
getInstance
Public method to instantiate this class. The constructor has been made private.- Returns:
- FlistToJson object.
-
getInstance
Public method to instantiate this class. The constructor has been made private.- Parameters:
fieldMap
- A mapping between PIN_FLD names and custom names. To be used during XML transformation.- Returns:
- FlistToJson object.
-
convert
Root method to convert the FList input to JSON Object- Parameters:
flist
- The FList object that needs conversion.- Throws:
EBufException
- Throws generic portal exception.
-
getMappedFieldName
This method checks to see if the given field is specified in a map- Parameters:
pinFldName
- Field name of the form PIN_FLD_XXXX.- Returns:
- Returns the mapped tag for the input PIN_FLD field name.
-
toJSONString
Method to convert the JSON Object to string.- Returns:
- String representation of JSON Object.
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
toJSONStringCompact
Method to convert the JSON Object to string in a compact form.- Returns:
- String representation of JSON Object in compact form.
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getJsonObject
Method to get the Root JSON Object node.- Returns:
- Root Json Object Node.
-
serializeToFile
Utility function to write the current JSOn object to file.- Parameters:
file
- File handle to which the JSON object needs to written to.- Throws:
IOException
- IO Exception
-
dumpJsonObject
public void dumpJsonObject() throws com.fasterxml.jackson.core.JsonProcessingExceptionMethod to dump the JSON object to standard out.- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
main
Main method to test this class independently.- Parameters:
args
- Filename with input flist.
-