Class FieldConfig


  • public class FieldConfig
    extends ConfigBase
    This class holds the definition of fields for the database table to work with. The definition was read from the configuration XML file.
    Author:
    faessler
    • Field Summary

      • Fields inherited from class de.julielab.costosys.configuration.ConfigBase

        LOG
    • Constructor Summary

      Constructors 
      Constructor Description
      FieldConfig​(byte[] configData, java.lang.String schemaName)  
      FieldConfig​(java.util.List<java.util.Map<java.lang.String,​java.lang.String>> fields, java.lang.String forEachXPath, java.lang.String schemaName)  
    • Constructor Detail

      • FieldConfig

        public FieldConfig​(byte[] configData,
                           java.lang.String schemaName)
                    throws com.ximpleware.VTDException
        Throws:
        com.ximpleware.VTDException
      • FieldConfig

        public FieldConfig​(java.util.List<java.util.Map<java.lang.String,​java.lang.String>> fields,
                           java.lang.String forEachXPath,
                           java.lang.String schemaName)
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns:
        the name
      • getFields

        public java.util.List<java.util.Map<java.lang.String,​java.lang.String>> getFields()
      • getField

        public java.util.Map<java.lang.String,​java.lang.String> getField​(java.lang.String fieldName)
      • getForEachXPath

        public java.lang.String getForEachXPath()
      • setForEachXPath

        public void setForEachXPath​(java.lang.String forEachXPath)
      • isKnownType

        public static boolean isKnownType​(java.lang.String type)
      • isBinaryDataType

        public static boolean isBinaryDataType​(java.lang.String type)
      • isStringTypeArray

        public static boolean isStringTypeArray​(java.lang.String type)
        Parameters:
        type -
        Returns:
      • isXmlType

        public static boolean isXmlType​(java.lang.String type)
      • isBooleanType

        public static boolean isBooleanType​(java.lang.String type)
        Parameters:
        type -
        Returns:
      • isTimestampWithoutTZType

        public static boolean isTimestampWithoutTZType​(java.lang.String type)
        Returns true if the string type equals the SQL "timestamp without time zone" type.
        Parameters:
        type - String to test.
        Returns:
        True if type denotes a timestamp type without timezone information.
      • isOfTimestampWithoutTZType

        public boolean isOfTimestampWithoutTZType​(java.lang.String fieldName)
      • isStringType

        public static boolean isStringType​(java.lang.String type)
      • isIntegerType

        public static boolean isIntegerType​(java.lang.String type)
        Parameters:
        type -
        Returns:
      • isOfStringType

        public boolean isOfStringType​(java.lang.String fieldName)
      • isOfStringType

        public boolean isOfStringType​(java.util.Map<java.lang.String,​java.lang.String> field)
      • isOfIntegerType

        public boolean isOfIntegerType​(java.util.Map<java.lang.String,​java.lang.String> field)
      • isOfBinaryDataType

        public boolean isOfBinaryDataType​(java.util.Map<java.lang.String,​java.lang.String> field)
      • getPrimaryKey

        public java.lang.String[] getPrimaryKey()
        Returns:
        - An Array with the names off all primary keys
      • getPrimaryKeyFields

        public java.util.stream.Stream<java.util.Map<java.lang.String,​java.lang.String>> getPrimaryKeyFields()
      • getPrimaryKeyFieldNumbers

        public java.util.List<java.lang.Integer> getPrimaryKeyFieldNumbers()
        Returns:
        - The indices of those fields which are primary keys, beginning with 0
      • getColumnsToRetrieve

        public java.lang.String[] getColumnsToRetrieve()
      • getFieldsToRetrieve

        public java.util.List<java.util.Map<java.lang.String,​java.lang.String>> getFieldsToRetrieve()
      • getPrimaryKeyString

        public java.lang.String getPrimaryKeyString()
        Returns the names of the columns forming the primary key in a CSV format.

        This method calls getPrimaryKey() to obtain the list of primary key column names. It then builds a string consisting of these names separated by commas and returns this string.

        Example: If the primary key columns are "pmid" and "systemID", the string returned would be "pmid,systemID".

        Returns:
        A comma separated list of the column names which form the primary key in this table scheme.
      • expandPKNames

        public java.lang.String[] expandPKNames​(java.lang.String[] fmtStrs)
        Takes an array of format strings according to String.format(String, Object...) with a single %s symbol. The number of format string must be equal to the number of primary key elements of this table schema definition. Then, for the ith format string, the ith primary key element is applied.
        Parameters:
        fmtStrs - The format string to fill with primary key elements, one format string per primary key element.
        Returns:
        An array of strings corresponding to the format strings filled with the primary key elements.
      • expandPKNames

        public java.lang.String[] expandPKNames​(java.lang.String fmtStr)
        Applies each primary key element to the format string and returns the results as array. Each result element corresponds to one primary key element applied to the format string.
        Parameters:
        fmtStr - The format string to be filled with the primary key elements.
        Returns:
        All results corresponding to applying each primary key element once to the given format string.
      • getTimestampFieldName

        public java.lang.String getTimestampFieldName()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getConfigText

        public java.lang.String getConfigText()
      • getColumns

        public java.lang.String[] getColumns()
      • createField

        public static java.util.Map<java.lang.String,​java.lang.String> createField​(java.lang.String... configuration)