Class ExportUtil

java.lang.Object
com.jalios.jcms.mashup.ExportUtil
All Implemented Interfaces:
MashupConstants

public class ExportUtil extends Object implements MashupConstants
This class provides utility methods for the ExportManager.
Since:
jcms-5.7.2
Author:
Olivier Dedieu
  • Constructor Details

    • ExportUtil

      public ExportUtil()
  • Method Details

    • exportRelated

      public static String exportRelated(int indentLevel, String name, Object value)
      Returns a XML representation of a related (result of a method, after computation or search from an index).
      Parameters:
      indentLevel - the indentation level
      name - the realted's name
      value - the related's value
      Returns:
      a XML representation of a related.
      Since:
      jcms-6.1
    • exportField

      public static String exportField(int indentLevel, String name, String value)
      Returns a XML representation of a text field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      Returns:
      a XML representation of a date field.
      Since:
      jcms-5.7.2
    • exportField

      public static String exportField(int indentLevel, String name, String value, boolean isAbstract)
      Returns a XML representation of a text field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      isAbstract - is it the abstact field?
      Returns:
      a XML representation of a date field.
      Since:
      jcms-6.0.1
    • exportField

      public static String exportField(int indentLevel, String name, String value, boolean isAbstract, boolean unescapeHTML)
      Returns a XML representation of a text field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      isAbstract - is it the abstact field?
      unescapeHTML - set to true to unescape HTML PRIOR to HTML attribute encoding, set to false to only perform HTML attribute encoding.
      Unescaping the HTML is needed when working with text value stored inside JCMS Data. Indeed, text entered by the user is escaped using JcmsUtil.escapeHtml(String) prior being saved in the Data fields, thus in order to outpu the text exactly as entered by the user, unescaping the input using JcmsUtil.unescapeHtml(String) is necessary.
      Returns:
      a XML representation of a date field.
      Since:
      jcms-9.0.0
    • exportField

      public static String exportField(int indentLevel, String name, String value, String mlField)
      Returns a XML representation of a text field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      mlField - the name of the ML Field bound to this field
      Returns:
      a XML representation of a date field.
      Since:
      jcms-6.0.1
    • exportField

      public static String exportField(int indentLevel, String name, String value, String mlField, boolean isAbstract)
      Returns a XML representation of a text field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      mlField - the name of the ML Field bound to this field
      isAbstract - is it the abstact field?
      Returns:
      a XML representation of a date field.
      Since:
      jcms-6.0.1
    • exportField

      public static String exportField(int indentLevel, String name, String value, String mlField, boolean isAbstract, boolean unescapeHTML)
      Returns a XML representation of a text field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      mlField - the name of the ML Field bound to this field
      isAbstract - is it the abstact field?
      unescapeHTML - set to true to unescape HTML PRIOR to HTML attribute encoding, set to false to only perform HTML attribute encoding.
      Unescaping the HTML is needed when working with text value stored inside JCMS Data. Indeed, text entered by the user is escaped using JcmsUtil.escapeHtml(String) prior being saved in the Data fields, thus in order to outpu the text exactly as entered by the user, unescaping the input using JcmsUtil.unescapeHtml(String) is necessary.
      Returns:
      a XML representation of a date field.
      Since:
      jcms-9.0.0
    • exportField

      public static String exportField(int indentLevel, String name, Data value, String mlField)
      Returns a XML representation of a text field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      mlField - the name of the ML Field bound to this field
      Returns:
      a XML representation of a date field.
      Since:
      jcms-7.0.1
    • exportField

      public static String exportField(int indentLevel, String name, String value, String[] attNames, String[] attValues)
      Returns a XML representation of a text field with attributes
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      attNames - an array of attribute names
      attValues - an array of attribute values
      Returns:
      a XML representation of a date field.
      Since:
      jcms-5.7.2
    • exportField

      public static String exportField(int indentLevel, String name, Data[] value, String mlField)
      Returns a XML representation of a Data array field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      mlField - the name of the ML Field bound to this field
      Returns:
      a XML representation of a date field.
      Since:
      jcms-7.0.1
    • exportField

      public static String exportField(int indentLevel, String name, Data value)
      Returns a XML representation of a data field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      Returns:
      a XML representation of a date field.
      Since:
      jcms-5.7.2
    • exportField

      public static String exportField(int indentLevel, String name, Data[] value)
      Returns a XML representation of a data array field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      Returns:
      a XML representation of a date field.
      Since:
      jcms-5.7.2
    • exportField

      public static String exportField(int indentLevel, String name, Collection<?> values)
      Returns a XML representation of a data collection field (Data or String).
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      values - the collection of Data or String
      Returns:
      a XML representation of a collection field.
      Since:
      jcms-6.0.0
    • exportField

      public static String exportField(int indentLevel, String name, Collection<?> values, String nameML)
      Returns a XML representation of a homogeneous collection (Data, String, Boolean, Number and Date).
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      values - the collection of Data or String
      nameML - the name of the ML Field bound to this field
      Returns:
      a XML representation of a collection field.
      Since:
      jcms-7.0.1
    • exportField

      public static String exportField(int indentLevel, String name, String[] value)
      Returns a XML representation of a String array field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      Returns:
      a XML representation of a data String field.
      Since:
      jcms-5.7.2
    • exportField

      public static String exportField(int indentLevel, String name, String[] value, boolean isAbstract)
      Returns a XML representation of a String array field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      isAbstract - is it the abstact field?
      Returns:
      a XML representation of a data String field.
      Since:
      jcms-6.0.1
    • exportField

      public static String exportField(int indentLevel, String name, String[] value, boolean isAbstract, boolean unescapeHTML)
      Returns a XML representation of a String array field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      isAbstract - is it the abstact field?
      unescapeHTML - set to true to unescape HTML PRIOR to HTML attribute encoding, set to false to only perform HTML attribute encoding.
      Unescaping the HTML is needed when working with text value stored inside JCMS Data. Indeed, text entered by the user is escaped using JcmsUtil.escapeHtml(String) prior being saved in the Data fields, thus in order to outpu the text exactly as entered by the user, unescaping the input using JcmsUtil.unescapeHtml(String) is necessary.
      Returns:
      a XML representation of a data String field.
      Since:
      jcms-9.0.0
    • exportField

      public static String exportField(int indentLevel, String name, String[] value, String mlField)
      Returns a XML representation of a String array field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      mlField - the name of the ML Field bound to this field
      Returns:
      a XML representation of a data String field.
      Since:
      jcms-6.0.1
    • exportField

      public static String exportField(int indentLevel, String name, String[] value, String mlField, boolean isAbstract)
      Returns a XML representation of a String array field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      mlField - the name of the ML Field bound to this field
      isAbstract - is it the abstact field?
      Returns:
      a XML representation of a data String field.
      Since:
      jcms-6.0.1
    • exportField

      public static String exportField(int indentLevel, String name, String[] value, String mlField, boolean isAbstract, boolean unescapeHTML)
      Returns a XML representation of a String array field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      mlField - the name of the ML Field bound to this field
      isAbstract - is it the abstact field?
      unescapeHTML - set to true to unescape HTML PRIOR to HTML attribute encoding, set to false to only perform HTML attribute encoding.
      Unescaping the HTML is needed when working with text value stored inside JCMS Data. Indeed, text entered by the user is escaped using JcmsUtil.escapeHtml(String) prior being saved in the Data fields, thus in order to outpu the text exactly as entered by the user, unescaping the input using JcmsUtil.unescapeHtml(String) is necessary.
      Returns:
      a XML representation of a data String field.
      Since:
      jcms-9.0.0
    • exportField

      public static String exportField(int indentLevel, String name, Date value)
      Returns a XML representation of a date field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      Returns:
      a XML representation of a date field.
      Since:
      jcms-5.7.2
    • exportField

      public static String exportField(int indentLevel, String name, Date[] value)
      Returns a XML representation of a date array field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      Returns:
      a XML representation of a date array field.
      Since:
      jcms-5.7.2
    • exportField

      public static String exportField(int indentLevel, String name, int value)
      Returns a XML representation of a primitive integer field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      Returns:
      a XML representation of a primitive integer field.
      Since:
      jcms-5.7.2
    • exportField

      public static String exportField(int indentLevel, String name, int[] value)
      Returns a XML representation of a primitive integer array field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      Returns:
      a XML representation of a primitive integer array field.
      Since:
      jcms-5.7.2
    • exportField

      public static String exportField(int indentLevel, String name, long value)
      Returns a XML representation of a primitive long integer field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      Returns:
      a XML representation of a primitive long integer field.
      Since:
      jcms-5.7.2
    • exportField

      public static String exportField(int indentLevel, String name, long[] value)
      Returns a XML representation of a primitive long integer array field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      Returns:
      a XML representation of a primitive long integer array field.
      Since:
      jcms-5.7.2
    • exportField

      public static String exportField(int indentLevel, String name, double value)
      Returns a XML representation of a primitive double field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      Returns:
      a XML representation of a primitive double field.
      Since:
      jcms-5.7.2
    • exportField

      public static String exportField(int indentLevel, String name, double[] value)
      Returns a XML representation of a primitive double array field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      Returns:
      a XML representation of a primitive double array field.
      Since:
      jcms-5.7.2
    • exportField

      public static String exportField(int indentLevel, String name, boolean value)
      Returns a XML representation of a primitive boolean field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      Returns:
      a XML representation of a primitive boolean field.
      Since:
      jcms-5.7.2
    • exportField

      public static String exportField(int indentLevel, String name, Locale value)
      Returns a XML representation of a Locale field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      Returns:
      a XML representation of a Locale field.
      Since:
      jcms-6.1.0
    • exportField

      public static String exportField(int indentLevel, String name, boolean[] value)
      Returns a XML representation of a boolean array field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      value - the field's value
      Returns:
      a XML representation of a boolean array field.
      Since:
      jcms-5.7.2
    • exportField

      public static String exportField(int indentLevel, String name, Map map)
      Returns a XML representation of a map field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      map - the map to be exported
      Returns:
      a XML representation of a map field.
      Since:
      jcms-5.7.2
    • exportField

      public static String exportField(int indentLevel, String name, Map map, boolean unescapeHTML)
      Returns a XML representation of a map field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      map - the map to be exported
      unescapeHTML - set to true to unescape HTML PRIOR to HTML attribute encoding, set to false to only perform HTML attribute encoding.
      Unescaping the HTML is needed when working with text value stored inside JCMS Data. Indeed, text entered by the user is escaped using JcmsUtil.escapeHtml(String) prior being saved in the Data fields, thus in order to outpu the text exactly as entered by the user, unescaping the input using JcmsUtil.unescapeHtml(String) is necessary.
      Returns:
      a XML representation of a map field.
      Since:
      jcms-9.0.0
    • exportField

      public static String exportField(int indentLevel, String name, ZoneId zoneId)
      Returns a XML representation of a ZoneId field.
      Parameters:
      indentLevel - the indentation level
      name - the field's name
      zoneId - the ZoneId to be exported
      Returns:
      a XML representation of a map field.
      Since:
      jcms-10.0.8 / JCMS-10381
    • exportFile

      public static String exportFile(int indentLevel, String fieldName, String filename)
      Returns a XML representation of a file.
      Parameters:
      indentLevel - the indentation level
      fieldName - the field's name
      filename - the filename
      Returns:
      a XML representation of a file.
      Since:
      jcms-5.7.2
    • exportFile

      public static String exportFile(int indentLevel, String fieldName, String[] filenames)
      Returns a XML representation of an array of files.
      Parameters:
      indentLevel - the indentation level
      fieldName - the field's name
      filenames - an array of filenames
      Returns:
      a XML representation of an array of files.
      Since:
      jcms-5.7.2
    • exportFile

      public static String exportFile(int indentLevel, String fieldName, String filename, String id)
      Returns a XML representation of a file.
      Parameters:
      indentLevel - the indentation level
      fieldName - the field's name
      filename - the filename
      id - the id of the FileDocument bound to this file
      Returns:
      a XML representation of a file.
      Since:
      jcms-5.7.2
    • exportFile

      public static String exportFile(int indentLevel, String fieldName, FileDocument doc)
      Returns a XML representation of a FileDocument.
      Parameters:
      indentLevel - the indentation level
      fieldName - the field's name
      doc - the FileDocument
      Returns:
      a XML representation of a FileDocument.
      Since:
      jcms-5.7.2
    • exportFile

      public static String exportFile(int indentLevel, String fieldName, FileDocument[] docs)
      Returns a XML representation of an array of FileDocument.
      Parameters:
      indentLevel - the indentation level
      fieldName - the field's name
      docs - the array of FileDocument
      Returns:
      a XML representation of an array of FileDocument.
      Since:
      jcms-5.7.2
    • getIndent

      public static String getIndent(int indentLevel)
      Returns a String of indentLevel * INDENT_UNIT.
      Parameters:
      indentLevel - the indentation level
      Returns:
      a String of indentLevel * INDENT_UNIT.
      Since:
      jcms-5.7.2