Class XMLTable

java.lang.Object
overit.geocall.xml.XMLTable

public class XMLTable extends Object
This class implements an object that represents an xml version of a table. It can be used to transform a data node of an XMLTree to obtain a DBView, or to do the opposite transformation.
  • Field Details

  • Constructor Details

    • XMLTable

      public XMLTable(XMLTree xmlt)
      Creates an XMLTable starting from the XMLTree passed as parameter
      Parameters:
      xmlt - The XMLTree used to create the XMLTable
    • XMLTable

      public XMLTable(XMLTree xmlt, SimpleDateFormat sdf)
      Creates an XMLTable starting from the XMLTree and the SimpleDateFormat passed as parameters
      Parameters:
      xmlt - The XMLTree used to create the XMLTable
      sdf - The SimpleDateFormat used to format the date values
    • XMLTable

      public XMLTable(XMLTree xmlt, SimpleDateFormat sdf, String timeZone)
      Creates an XMLTable starting from the XMLTree and the SimpleDateFormat passed as parameters
      Parameters:
      xmlt - The XMLTree used to create the XMLTable
      sdf - The SimpleDateFormat used to format the date values
      timeZone - The time zone of the date
    • XMLTable

      public XMLTable(DBView dbv, String dataformat)
      Creates an XMLTable starting from the DBView and the format passed as parameters
      Parameters:
      dbv - The DBView used to create the XMLTree
      dataformat - One of DATA_FORMAT_COMPACT, DATA_FORMAT_EXTENDED or DATA_FORMAT_SHORT
    • XMLTable

      public XMLTable(DBView dbv, String dataformat, String timeZone)
      Creates an XMLTable starting from the DBView and the format passed as parameters
      Parameters:
      dbv - The DBView used to create the XMLTree
      dataformat - One of DATA_FORMAT_COMPACT, DATA_FORMAT_EXTENDED or DATA_FORMAT_SHORT
      timeZone - The time zone of the date
  • Method Details

    • classCode

      protected static String classCode(Class c)
    • codeObject

      public static Object codeObject(String code, String value)
      Transforms the string value passed as parameter in the Object of the correct type depending on the code
      Parameters:
      code - String that defines the code, used to create the Object of the correct type. It can be S (String), D (Double), L (Long), T (Date), B (Boolean), E (Euro). If it is null, X or F it will be returned the String object that corresponds to the value
      value - The string that represents the value
      Returns:
      The Object with the desired format and value
    • codeObject

      public static Object codeObject(String code, String value, SimpleDateFormat sdf)
      Transforms the string value passed as parameter in the Object of the correct type depending on the code (and the SimpleDateFormat for the date values)
      Parameters:
      code - String that defines the code, used to create the Object of the correct type. It can be S (String), D (Double), L (Long), T (Date), B (Boolean), E (Euro). If it is null, X or F or W it will be returned the String object that corresponds to the value
      value - The string that represents the value
      sdf - The SimpleDateFormat used to format the date values
      Returns:
      The Object with the desired format and value
    • codeObject

      public static Object codeObject(String code, String value, SimpleDateFormat sdf, Getter attributes, String timeZone)
      Transforms the string value passed as parameter in the Object of the correct type depending on the code (and the SimpleDateFormat for the date values)
      Parameters:
      code - String that defines the code, used to create the Object of the correct type. It can be S (String), D (Double), L (Long), T (Date), B (Boolean), E (Euro). If it is null, X or F or W it will be returned the String object that corresponds to the value
      value - The string that represents the value
      sdf - The SimpleDateFormat used to format the date values
      attributes - The attribute of the date (i.e "central")
      timeZone - String defining the time zone
      Returns:
      The Object with the desired format and value
    • setDateFormat

      public void setDateFormat(SimpleDateFormat sdf)
      Sets the SimpleDateFormat that will be used to format the date values
      Parameters:
      sdf - The SimpleDateFormat
    • setMetadata

      public void setMetadata(HashMap types)
      Sets the metadata of the XMLTable using the HashMap passed as parameter
      Parameters:
      types - The map that contains the metadata of the table
    • setMetadata

      public void setMetadata(XMLTree metadata)
      Sets the metadata of the XMLTable using the XMLTree passed as parameter
      Parameters:
      metadata - The XMLTree that contains the metadata of the table
    • convertOldVersion

      protected void convertOldVersion()
    • getXml

      public XMLTree getXml(String name)
      Returns the XMLTree that corresponds to the XMLTable
      Parameters:
      name - The name of the XMLTree
      Returns:
      The tree that corresponds to the XMLTable
    • getXml

      public XMLTree getXml(String name, boolean typed)
      Returns the XMLTree that corresponds to the XMLTable
      Parameters:
      name - The name of the XMLTree
      typed - true to encode the values, false otherwise
      Returns:
      The tree that corresponds to the XMLTable
    • dataXml

      protected XMLTree dataXml(DBView dbv, String dataformat)
    • dataXml

      protected XMLTree dataXml(DBView dbv, String dataformat, boolean typeEncode)
    • metadataFromValues

      protected XMLTree metadataFromValues(HashMap types)
    • metadataFromFields

      protected XMLTree metadataFromFields(HashSet fields)
    • getMetadata

      public XMLTree getMetadata()
      Returns the metadata of the XMLTable
      Returns:
      The XMLTree of the metadata
    • getDBView

      public DBView getDBView()
      Returns the DBView of the XMLTable
      Returns:
      The DBView
    • encode

      public static String encode(Object o)
      Transforms the Object passed as parameter in a String
      Parameters:
      o - The Object to encode
      Returns:
      The String version of the Object
    • encode

      protected static String encode(Object o, String type, SimpleDateFormat sdf, boolean typeEncode, Getter attributes, String timeZone)
    • decode

      protected static String decode(String s)