Class FList

All Implemented Interfaces:
Externalizable, Serializable, Cloneable, Map<Field,Object>

public class FList extends Hashtable<Field,Object> implements Externalizable
The FList class is the Java expression of the Portal flist (field list) structure and associated functions. An flist is a collection of 'Field - Value' pairs. The field is a predefined constant, and the value is of a type determined by the field. Flists are used by opcodes to pass data from the application to the database. For more information and examples of flists, see Understanding Oracle BRM Flists and Storable classes in the Oracle BRM online documentation.
See Also:
  • Field Details

    • nullObj

      public static Object nullObj
    • NEWLINE

      protected static final String NEWLINE
  • Constructor Details

    • FList

      public FList()
      Constructs an empty instance of FList.
  • Method Details

    • deepClone

      public FList deepClone(int proto_vers) throws EBufException
      Copies all levels of an FList, including array elements and substructures. The copied fields and their values are duplicated, so no memory is shared between the two FLists.
      Parameters:
      proto_vers - - The version of protocol
      Returns:
      The duplicate FList.
      Throws:
      EBufException
    • deepClone

      public FList deepClone() throws EBufException
      Copies all levels of an FList, including array elements and substructures. The copied fields and their values are duplicated, so no memory is shared between the two FLists.
      Returns:
      The duplicate FList.
      Throws:
      EBufException - results when an error occurs. Assumes caller is using 15.0 protocol version
    • append

      public void append(FList list) throws EBufException
      Appends the FList passed in onto the current FList. Matching fields will be overwritten.
      Parameters:
      list - An FList to append. It cannot be null.
      Throws:
      EBufException - thrown if an error occurs
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Implements the java.io.Externalizable interface. This method writes the contents of this class to the output stream, which makes it available for future use. It's unlikely you will need to use this method.
      Specified by:
      writeExternal in interface Externalizable
      Parameters:
      out - The destination for the output.
      Throws:
      IOException - thrown when an error occurs.
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Implements the java.io.Externalizable interface. This method reads the contents of this class saved by the writeExternal method. It's unlikely you will need to use this method.
      Specified by:
      readExternal in interface Externalizable
      Parameters:
      in - The object containing the saved data.
      Throws:
      IOException - thrown when an error occurs.
      ClassNotFoundException - thrown when the class can't be found.
    • removeAllFields

      public void removeAllFields()
      Clears the FList by removing all contained objects.
    • remove

      public void remove(Field field)
      Removes a single field from an FList. Subfields cannot be removed, only whole arrays or substruct fields.
      Parameters:
      field - The field to remove.
    • getFields

      public Enumeration<Field> getFields()
      Deprecated.
      see getAllFields()
      Returns an enumeration of the fields in the FList.
      Returns:
      An enumeration of the fields.
    • getValues

      public Enumeration<Object> getValues()
      Deprecated.
      see getAllValues()
      Returns an enumeration of the values in the FList.
      Returns:
      An enumeration of the values.
    • getAllFields

      public Set<Field> getAllFields()
      Returns a set of the fields in the FList.
      Returns:
      A Set of the fields.
    • getAllValues

      public Collection<Object> getAllValues()
      Returns a collection of the values in the FList.
      Returns:
      A collection of the values.
    • getSize

      public int getSize()
      Returns the number of fields in the FList. Subfields are not counted.
      Returns:
      The number of fields in FList.
    • hasField

      public boolean hasField(Field field)
      Checks the FList keys for a specified field.
      Parameters:
      field - The field being requested.
      Returns:
      true if the FList contains the specified field, even if the field has a null value.
    • set

      public void set(Field field)
      Adds a field to the FList and assigns it a null value. This method must be used to add a field that does not yet have a value. Specify the field name and type in the field object.
      Parameters:
      field - The field to add.
    • set

      public void set(IntField field, int value)
      Adds an IntField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's int type value. This value cannot be null.
    • set

      public void set(UIntField field, int value)
      Deprecated.
      Uint is no longer supported.
      Adds a UIntField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's int type value. This value cannot be null.
    • set

      public void set(EnumField field, int value)
      Adds an EnumField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's int type value. This value cannot be null.
    • set

      public void set(IntField field, Integer value)
      Adds an IntField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's Integer type value. This value cannot be null.
    • set

      public void set(UIntField field, Integer value)
      Deprecated.
      Uint is no longer supported.
      Adds a UIntField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's Integer type value. This value cannot be null.
    • set

      public void set(EnumField field, Integer value)
      Adds an EnumField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's Integer type value. This value cannot be null.
    • set

      public void set(NumField field, double value)
      Deprecated.
      Num is no longer supported.
      Adds a NumField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's double type value. This value cannot be null.
    • set

      public void set(NumField field, Double value)
      Deprecated.
      Num is no longer supported.
      Adds a NumField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's Double type value. This value cannot be null.
    • set

      public void set(StrField field, String value)
      Adds a StrField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's String type value. This value cannot be null.
    • set

      public void set(BufField field, Buffer value)
      Adds a BufField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's Buffer type value. This value cannot be null.
    • set

      public void set(PoidField field, Poid value)
      Adds a PoidField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's Poid type value. This value cannot be null.
    • set

      public void set(TStampField field, Date value)
      Adds a TStampField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's Date type value. This value cannot be null.
    • set

      public void set(Int64Field field, Long value)
      Adds an Int64Field and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's Long type value. This value cannot be null.
    • set

      public void set(Int64Field field, long value)
      Adds an Int64Field and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's long type value.
    • set

      public void set(ArrayField field, SparseArray value)
      Adds an ArrayField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's SparseArray type value. This value cannot be null.
    • setElement

      public void setElement(ArrayField field, int elementID, FList value)
      Adds an element to an ArrayField in the FList.
      Parameters:
      field - The field to add.
      elementID - The element ID of the field to add to the array.
      value - The new element's FList type value. This value cannot be null.
    • setElement

      public void setElement(ArrayField field, int elementID)
      Adds a null element to an ArrayField in the FList.
      Parameters:
      field - The field to add.
      elementID - The element ID of the field to add to the array.
    • set

      public void set(SubStructField field, FList value)
      Adds a SubStructField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's FList type value. This value cannot be null.
    • set

      public void set(ObjField field, Poid value)
      Adds a ObjField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's Poid type value. This value cannot be null.
    • set

      public void set(BinStrField field, byte[] value)
      Adds a BinStrField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's byte[] type value. This value cannot be null.
    • set

      public void set(ErrField field, EBufException value)
      Adds a ErrField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's EBufException type value. This value cannot be null.
    • set

      public void set(DecimalField field, BigDecimal value)
      Adds a DecimalField and its value to the FList.
      Parameters:
      field - The field to add.
      value - The new field's BigDecimal type value. This value cannot be null.
    • get

      public Integer get(IntField field) throws EBufException
      Returns the Integer value associated with a field of type IntField.
      Parameters:
      field - The field to look up.
      Returns:
      The value associated with the field object. It can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • get

      public Integer get(UIntField field) throws EBufException
      Deprecated.
      Uint is no longer supported.
      Returns the Integer value associated with a field of type UIntField.
      Parameters:
      field - The field to look up.
      Returns:
      The value associated with the field object. It can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • get

      public Integer get(EnumField field) throws EBufException
      Returns the Integer value associated with a field of type EnumField.
      Parameters:
      field - The field to look up.
      Returns:
      The value associated with the field object. It can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • get

      public Double get(NumField field) throws EBufException
      Deprecated.
      Num is no longer supported.
      Returns the Double value associated with a field of type NumField.
      Parameters:
      field - The field to look up.
      Returns:
      The value associated with the field object. It can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • get

      public String get(StrField field) throws EBufException
      Returns the String value associated with a field of type StrField.
      Parameters:
      field - The field to look up.
      Returns:
      The value associated with the field object. It can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • get

      public Buffer get(BufField field) throws EBufException
      Returns the Buffer value associated with a field of type BufField.
      Parameters:
      field - The field to look up.
      Returns:
      The value associated with the field object. It can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • get

      public Poid get(PoidField field) throws EBufException
      Returns the Poid value associated with a field of type PoidField.
      Parameters:
      field - The field to look up.
      Returns:
      The value associated with the field object. It can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • get

      public Date get(TStampField field) throws EBufException
      Returns the Date value associated with a field of type TStampField.
      Parameters:
      field - The field to look up.
      Returns:
      The value associated with the field object. It can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • get

      public Long get(Int64Field field) throws EBufException
      Returns the Long value associated with a field of type Int64Field.
      Parameters:
      field - The field to look up.
      Returns:
      The value associated with the field object. It can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • get

      public SparseArray get(ArrayField field) throws EBufException
      Returns the SparseArray value associated with a field of type ArrayField.
      Parameters:
      field - The field to look up.
      Returns:
      The value associated with the field object. It can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • getElement

      public FList getElement(ArrayField field, int elementID) throws EBufException
      Returns an element associated with an array of type ArrayField.
      Parameters:
      field - The ArrayField object from which to retrieve the element.
      elementID - The array element ID of the element to retrieve.
      Returns:
      An FList associated with the field name and element ID. Its value can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • get

      public FList get(SubStructField field) throws EBufException
      Returns an FList value associated with a field of type Substruct.
      Parameters:
      field - The field to look up.
      Returns:
      The value associated with the field object. It can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • get

      public Poid get(ObjField field) throws EBufException
      Returns a Poid value associated with a field of type ObjField.
      Parameters:
      field - The field to look up.
      Returns:
      The value associated with the field object. It can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • get

      public byte[] get(BinStrField field) throws EBufException
      Returns a byte[] value associated with a field of type BinStrField.
      Parameters:
      field - The field to look up.
      Returns:
      The value associated with the field object. It can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • get

      public EBufException get(ErrField field) throws EBufException
      Returns an EBufException value associated with a field of type ErrField.
      Parameters:
      field - The field to look up.
      Returns:
      The value associated with the field object. It can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • get

      public BigDecimal get(DecimalField field) throws EBufException
      Returns a BigDecimal value associated with a field of type DecimalField.
      Parameters:
      field - The field to look up.
      Returns:
      The value associated with the field object. It can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • getField

      public Object getField(Field field) throws EBufException
      Returns an Object value associated with a field of type field.
      Parameters:
      field - The field to look up.
      Returns:
      The value associated with the field object. It can be null.
      Throws:
      EBufException - occurs when the field doesn't exist.
    • setField

      public void setField(Field field, Object value)
      Deprecated.
      This method is public to ensure operability. It's for internal use only as it provides no type protection.
      Sets the value of an arbitrary field.
      Parameters:
      field - The field to set.
      value - The value of the field.
    • setField

      public void setField(Field fld, int elementID, FList value)
      Deprecated.
      This method is public to ensure operability. It's for internal use only as it provides no type protection.
      Sets the value of an arbitrary element in an array object.
      Parameters:
      fld - The field to set.
      elementID - The element to set.
      value - The value of the field.
    • createFromXML

      public static FList createFromXML(InputStream is) throws EBufException
      Deprecated.
      As of 6.5SP2_EBF - this does not properly support
      Converts the XML in the given stream into an FList
      Parameters:
      is - The input stream containing an XML representation of an FList
      Returns:
      The FList represented by the given XML string
      Throws:
      EBufException - double byte characters. Use the Reader form of the method instead.
    • createFromXML

      public static FList createFromXML(Reader reader) throws EBufException
      Converts the XML in the given stream into an FList
      Parameters:
      reader - - The Reader object containing the XML representation of an FList
      Returns:
      The FList represented by the given XML string
      Throws:
      EBufException
    • toXMLString

      public String toXMLString() throws EBufException
      This method allows you to obtain this FList as an XML string
      Returns:
      The FList as an XML string
      Throws:
      EBufException
    • toXMLString

      public String toXMLString(Map<String,String> fieldMap) throws EBufException
      This method allows you to obtain this FList as an XML string
      Parameters:
      fieldMap - A mapping between PIN_FLD names and custom names. To be used during XML transformation.
      Returns:
      The FList as an XML string
      Throws:
      EBufException
    • toXMLString

      public String toXMLString(int xmlType, boolean newStyle) throws EBufException
      An extended toXMLString method to support multiple XML formats.
      Parameters:
      xmlType - The possible values are PIN_XML_TYPE, PIN_XML_BY_SHORT_NAME and PIN_XML_NOTIFICATION.
      newStyle - If yes, the fields are represented in Hungarian/Cammel Case notation. i.e BillInfo else the fields are represented as BILL_INFO
      Returns:
      Returns XML in String representation in a String object.
      Throws:
      EBufException - of different types.
    • toXMLString

      public String toXMLString(int xmlType, boolean newStyle, Map<String,String> fieldMap) throws EBufException
      An extended toXMLString method to support multiple XML formats.
      Parameters:
      xmlType - The possible values are PIN_XML_TYPE, PIN_XML_BY_SHORT_NAME and PIN_XML_NOTIFICATION.
      newStyle - If yes, the fields are represented in Hungarian/Cammel Case notation. i.e BillInfo else the fields are represented as BILL_INFO
      fieldMap - A mapping between PIN_FLD names and custom names. To be used during XML transformation.
      Returns:
      Returns XML in String representation in a String object.
      Throws:
      EBufException - of different types.
    • toXMLDocument

      public Document toXMLDocument() throws EBufException
      This method allows you to obtain this FList as an XML Document
      Returns:
      The FList as an XML Document
      Throws:
      EBufException
    • toXMLDocument

      public Document toXMLDocument(Map<String,String> fieldMap) throws EBufException
      This method allows you to obtain this FList as an XML Document
      Parameters:
      fieldMap - A mapping between PIN_FLD names and custom names. To be used during XML transformation.
      Returns:
      The FList as an XML Document
      Throws:
      EBufException
    • toXMLDocument

      public Document toXMLDocument(int xmlType, boolean newStyle) throws EBufException
      An extended toXMLDocument method to support multiple XML formats.
      Parameters:
      xmlType - The possible values are PIN_XML_TYPE, PIN_XML_BY_SHORT_NAME and PIN_XML_NOTIFICATION.
      newStyle - If yes, the fields are represented in Hungarian/Cammel Case notation. i.e BillInfo else the fields are represented as BILL_INFO
      Returns:
      Returns XML in String representation in a String object.
      Throws:
      EBufException - of different types.
    • toXMLDocument

      public Document toXMLDocument(int xmlType, boolean newStyle, Map<String,String> fieldMap) throws EBufException
      An extended toXMLDocument method to support multiple XML formats.
      Parameters:
      xmlType - The possible values are PIN_XML_TYPE, PIN_XML_BY_SHORT_NAME and PIN_XML_NOTIFICATION.
      newStyle - If yes, the fields are represented in Hungarian/Cammel Case notation. i.e BillInfo else the fields are represented as BILL_INFO
      fieldMap - A mapping between PIN_FLD names and custom names. To be used during XML transformation.
      Returns:
      Returns XML in String representation in a String object.
      Throws:
      EBufException - of different types.
    • createFromJsonString

      public FList createFromJsonString(String jsonString) throws EBufException
      This method allows you to obtain FList from JSON String.
      Parameters:
      jsonString - Input json string.
      Returns:
      The FList object converted from JSON String.
      Throws:
      EBufException
    • createFromJsonObject

      public FList createFromJsonObject(JsonNode jsonNode) throws EBufException
      This method allows you to obtain FList from JsonNode Object.
      Parameters:
      jsonNode - Input JsonNode object representing flist.
      Returns:
      The FList object converted from JSON String.
      Throws:
      EBufException
    • toJsonString

      public String toJsonString() throws EBufException
      This method allows you to obtain this FList as a JSON beautified string.
      Returns:
      The FList as an JSOn String.
      Throws:
      EBufException
    • toJsonString

      public String toJsonString(Map<String,String> fieldMap) throws EBufException
      This method allows you to obtain this FList as a JSON beautified string.
      Parameters:
      fieldMap - A mapping between PIN_FLD names and custom names. To be used during XML transformation.
      Returns:
      The FList as an JSOn String.
      Throws:
      EBufException
    • toJsonStringCompact

      public String toJsonStringCompact() throws EBufException
      This method allows you to obtain this FList as a JSON compact string.
      Returns:
      The FList as an JSON String.
      Throws:
      EBufException
    • toJsonStringCompact

      public String toJsonStringCompact(Map<String,String> fieldMap) throws EBufException
      This method allows you to obtain this FList as a JSON compact string.
      Parameters:
      fieldMap - A mapping between PIN_FLD names and custom names. To be used during XML transformation.
      Returns:
      The FList as an JSON String.
      Throws:
      EBufException
    • toJsonObject

      public JsonNode toJsonObject() throws EBufException
      This method allows you to obtain this FList as a JSON object.
      Returns:
      The FList as an JSON String.
      Throws:
      EBufException
    • toJsonObject

      public JsonNode toJsonObject(Map<String,String> fieldMap) throws EBufException
      This method allows you to obtain this FList as a JSON object.
      Parameters:
      fieldMap - A mapping between PIN_FLD names and custom names. To be used during XML transformation.
      Returns:
      The FList as an JSON String.
      Throws:
      EBufException
    • toString

      public String toString()
      Deprecated.
      use asString() in stead.
      Creates a string representation of the FList. This method can be restricted not to convert FList to String by providing the entry infranet.flist.tostring.enable=false in Infranet.properties file
      Overrides:
      toString in class Hashtable<Field,Object>
      Returns:
      A String representation of this FList.
    • asString

      public String asString()
      Creates a string representation of the FList. This is un-restricted in the way if called it will return String conversion of FList.
      Returns:
      A String representation of this FList.
    • createFromString

      public static FList createFromString(String str) throws EBufException
      Creates a new FList from a string representation.
      Parameters:
      str - A string descriptions of an flist. For example:
       0 PIN_FLD_POID             POID [0] 0.0.0.1 /account -1 0
       0 PIN_FLD_LAST_NAME         STR [0] "Mouse"
       0 PIN_FLD_FIRST_NAME        STR [0] "Mickey"
       0 PIN_FLD_INT_VAL           INT [0] 42
        ...
                  
      Returns:
      An FList with the key/value pairs specified in the string.
      Throws:
      EBufException - results when an error occurs.
    • createFromString

      public static FList createFromString(String str, long defDB) throws EBufException
      Creates a new FList from a string representation.
      Parameters:
      str - A String description of an FList. Specify the database portion of the string as '$DB' if you want to use the defDB parameter.
      defDB - A specific database number. If the str parameter contains the substring '$DB', the database number specified in this parameter replaces it and the FList returned contains the database number. If the str parameter contains a database number, the defDB parameter is ignored.
      Returns:
      An FList with the key/value pairs specified in the string.
      Throws:
      EBufException - results when an error occurs.
      See Also:
    • dump

      public void dump()
      Displays the FList to the standard output.
    • parseBigDecimalNum

      public static String parseBigDecimalNum(String valStr) throws ParseException
      Parse the input string which is required by BigDecimal
      Throws:
      ParseException
    • formatBigDecimalNum

      public static String formatBigDecimalNum(BigDecimal val)
      Formats BigDecimal To string