Package com.nt.udc.io

Class COSARAttrFormatter

java.lang.Object
com.nt.udc.io.COSARAttrFormatter

public class COSARAttrFormatter extends Object
This class provides the formatting mechanism for OSARs, based on lists of OSAR attributes described by means of an id, a type and a value obtained by evaluating an expression containing reference to values obtained from an external source of type IAttrSource.
  • Field Details

    • m_debugLevel

      protected static int m_debugLevel
    • UNKNOWN_ATTR_IGNORE_NO_WARNING

      public static final int UNKNOWN_ATTR_IGNORE_NO_WARNING
      These constants are used in conjunction with the next field.
      See Also:
    • UNKNOWN_ATTR_IGNORE_WARNING

      public static final int UNKNOWN_ATTR_IGNORE_WARNING
      See Also:
    • UNKNOWN_ATTR_ERROR

      public static final int UNKNOWN_ATTR_ERROR
      See Also:
  • Constructor Details

    • COSARAttrFormatter

      public COSARAttrFormatter() throws Exception
      Throws:
      Exception
    • COSARAttrFormatter

      public COSARAttrFormatter(ILogger iLogger) throws Exception
      Parameters:
      iLogger - - Object implementing ILogger interface - used for logging errors, warnings, etc.
      Throws:
      Exception
  • Method Details

    • getDebugLevel

      public int getDebugLevel()
    • getUnknownAttrHandling

      public int getUnknownAttrHandling()
    • setDebugLevel

      public void setDebugLevel(int debugLevel)
    • setUnknownAttrHandling

      public void setUnknownAttrHandling(int unknownAttrHandling)
    • loadFromFile

      public boolean loadFromFile(String filename)
      This function is used for loading the descriptions of OSAR attributes, consisting of: an OSAR attribute id + type and string keys, stored in a file.
      Parameters:
      filename - - Filename containing the mappings

      Format: '['record:']' { }*

      Returns:
      true if successful, false otherwise
    • loadFromVector

      public boolean loadFromVector(Vector cfgMapping)
      This function is used for loading the descriptions of OSAR attributes, consisting of: an OSAR attribute id + type and string keys, stored in a HashMap.
      Parameters:
      cfgMapping - - matrix containing the mappings

      Matrix line format:

      Returns:
      true if successful, false otherwise
    • toString

      public String toString()
      This function prints out a description of the mapping between String keys and OSAR attributes
      Overrides:
      toString in class Object
    • getOSARAttr

      public COSARAttr getOSARAttr(String recordType, String key)
    • hasRulesFor

      public boolean hasRulesFor(String recordType)
      Returns:
      true if there are any mapping-rules (a layout) associated with the record type, false otherwise.
    • getOSAR

      public COSAR getOSAR(String recordType, IAttrSource attrSource)
      This function returns a new OSAR created from the layout associated with the specified record-type.
    • getOSAR

      public COSAR getOSAR(String recordType, IAttrSource attrSource, IAttrCallback callbackObj)
      This function returns a new OSAR created from the layout associated with the specified record-type. A callback may be passed in for evaluating custom function calls.
    • getOSAR

      public COSAR getOSAR(IAttrSource attrSource)
      This function returns a new OSAR created from the layout associated with the default record-type.
    • error

      protected void error(String fName, String msg)
    • warning

      protected void warning(String fName, String msg)
    • debug

      protected void debug(String fName, String msg)