Class FlistToJson

java.lang.Object
com.portal.pcm.FlistToJson

public class FlistToJson extends Object
Class implementation to convert from FList format to JSON.
  • Method Details

    • getInstance

      public static FlistToJson getInstance()
      Public method to instantiate this class. The constructor has been made private.
      Returns:
      FlistToJson object.
    • getInstance

      public static FlistToJson getInstance(Map<String,String> fieldMap)
      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

      public void convert(FList flist) throws EBufException
      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

      protected String getMappedFieldName(String pinFldName)
      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

      public String toJSONString() throws com.fasterxml.jackson.core.JsonProcessingException
      Method to convert the JSON Object to string.
      Returns:
      String representation of JSON Object.
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • toJSONStringCompact

      public String toJSONStringCompact() throws com.fasterxml.jackson.core.JsonProcessingException
      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

      public JsonNode getJsonObject()
      Method to get the Root JSON Object node.
      Returns:
      Root Json Object Node.
    • serializeToFile

      public void serializeToFile(File file) throws IOException
      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.JsonProcessingException
      Method to dump the JSON object to standard out.
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • main

      public static void main(String[] args)
      Main method to test this class independently.
      Parameters:
      args - Filename with input flist.