Class XmlGenerationUtil

java.lang.Object
com.aquima.interactions.foundation.ds.XmlGenerationUtil

public final class XmlGenerationUtil extends Object
Utility class for creating XML elements of datasource objects.
Since:
7.1
Author:
Jon van Leuven
  • Method Details

    • setAttribute

      public static void setAttribute(IXmlElement node, String attributeName, String stringValue)
      Set the node's attribute value when stringValue not is null.
      Parameters:
      node - The target node.
      attributeName - The name of the attribute.
      stringValue - The value of the attribute, may be null.
    • setAttribute

      public static void setAttribute(IXmlElement node, String attributeName, boolean booleanValue)
      Set the node's attribute value with a boolean. When the boolean is false no attribute is added!
      Parameters:
      node - The target node.
      attributeName - The name of the attribute.
      booleanValue - The value of the attribute.
    • setAttribute

      public static void setAttribute(IXmlElement node, String attributeName, BooleanValue booleanValue)
      Set the node's attribute value with a boolean value. When the boolean is null or unknown no attribute is added!
      Parameters:
      node - The target node.
      attributeName - The name of the attribute.
      booleanValue - The value of the attribute.
    • setAttribute

      public static void setAttribute(IXmlElement node, String attributeName, int intValue)
      Set the node's attribute value with an int.
      Parameters:
      node - The target node.
      attributeName - The name of the attribute.
      intValue - The value of the attribute.
    • writeValueElement

      public static void writeValueElement(IXmlWriter writer, String nodeName, IValue value) throws IOException
      Utility method to create an IValue xml fragment for a value.
      Parameters:
      writer - The destination xml writer.
      nodeName - the name of the node in which the IValue is saved
      value - the value, not null.
      Throws:
      IOException - Is thrown when the xml could not be written
    • writeMultilingualXmlElement

      public static void writeMultilingualXmlElement(IXmlWriter writer, IPrimitiveValue domainValue, String[] languageCodes) throws IOException
      Utility method to create a multilingual xml fragment for a value (with display value).
      Parameters:
      writer - The destination xml writer.
      domainValue - The value (with optional display value)
      languageCodes - All the languageCodes that should be rendered to xml.
      Throws:
      IOException - Is thrown when the xml could not be written
    • writeMultilingualXmlElement

      public static void writeMultilingualXmlElement(IXmlWriter writer, IMultilingualText displayValue, String[] languageCodes) throws IOException
      Utility method to create a multilingual xml fragment for a with display value.
      Parameters:
      writer - The destination xml writer.
      displayValue - The value (with optional display value)
      languageCodes - All the languages that should be rendered to xml.
      Throws:
      IOException - Is thrown when the xml could not be written
    • writeDocumentation

      public static void writeDocumentation(IXmlWriter writer, String documentation) throws IOException
      Writes a documentation CData element
      Parameters:
      writer - The destination xml writer
      documentation - The documentation contents to write
      Throws:
      IOException - Is thrown when the xml could not be written
    • writeExpression

      public static void writeExpression(IXmlWriter writer, String nodeName, String expression) throws IOException
      Writes an element with a CData element containing the expression
      Parameters:
      writer - The destination xml writer.
      nodeName - the name of the node in which the expression is saved
      expression - the expression, not null.
      Throws:
      IOException - Is thrown when the xml could not be written
    • writeDescription

      public static void writeDescription(IXmlWriter writer, String description) throws IOException
      Writes a description CData element
      Parameters:
      writer - The destination xml writer
      description - The description contents to write
      Throws:
      IOException - Is thrown when the xml could not be written