Class ExportUtil

  • All Implemented Interfaces:
    MashupConstants

    public class ExportUtil
    extends java.lang.Object
    implements MashupConstants
    This class provides utility methods for the ExportManager.
    Since:
    jcms-5.7.2
    Version:
    $Revision: 118938 $
    Author:
    Olivier Dedieu
    • Constructor Summary

      Constructors 
      Constructor Description
      ExportUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String exportField​(int indentLevel, java.lang.String name, boolean value)
      Returns a XML representation of a primitive boolean field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, boolean[] value)
      Returns a XML representation of a boolean array field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, double value)
      Returns a XML representation of a primitive double field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, double[] value)
      Returns a XML representation of a primitive double array field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, int value)
      Returns a XML representation of a primitive integer field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, int[] value)
      Returns a XML representation of a primitive integer array field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, long value)
      Returns a XML representation of a primitive long integer field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, long[] value)
      Returns a XML representation of a primitive long integer array field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, Data value)
      Returns a XML representation of a data field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, Data[] value)
      Returns a XML representation of a data array field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, Data[] value, java.lang.String mlField)
      Returns a XML representation of a Data array field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, Data value, java.lang.String mlField)
      Returns a XML representation of a text field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.lang.String value)
      Returns a XML representation of a text field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.lang.String[] value)
      Returns a XML representation of a String array field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.lang.String[] value, boolean isAbstract)
      Returns a XML representation of a String array field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.lang.String[] value, boolean isAbstract, boolean unescapeHTML)
      Returns a XML representation of a String array field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.lang.String[] value, java.lang.String mlField)
      Returns a XML representation of a String array field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.lang.String[] value, java.lang.String mlField, boolean isAbstract)
      Returns a XML representation of a String array field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.lang.String[] value, java.lang.String mlField, boolean isAbstract, boolean unescapeHTML)
      Returns a XML representation of a String array field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.lang.String value, boolean isAbstract)
      Returns a XML representation of a text field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.lang.String value, boolean isAbstract, boolean unescapeHTML)
      Returns a XML representation of a text field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.lang.String value, java.lang.String mlField)
      Returns a XML representation of a text field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.lang.String value, java.lang.String[] attNames, java.lang.String[] attValues)
      Returns a XML representation of a text field with attributes
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.lang.String value, java.lang.String mlField, boolean isAbstract)
      Returns a XML representation of a text field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.lang.String value, java.lang.String mlField, boolean isAbstract, boolean unescapeHTML)
      Returns a XML representation of a text field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.util.Collection<?> values)
      Returns a XML representation of a data collection field (Data or String).
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.util.Collection<?> values, java.lang.String nameML)
      Returns a XML representation of a homogeneous collection (Data, String, Boolean, Number and Date).
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.util.Date value)
      Returns a XML representation of a date field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.util.Date[] value)
      Returns a XML representation of a date array field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.util.Locale value)
      Returns a XML representation of a Locale field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.util.Map map)
      Returns a XML representation of a map field.
      static java.lang.String exportField​(int indentLevel, java.lang.String name, java.util.Map map, boolean unescapeHTML)
      Returns a XML representation of a map field.
      static java.lang.String exportFile​(int indentLevel, java.lang.String fieldName, FileDocument doc)
      Returns a XML representation of a FileDocument.
      static java.lang.String exportFile​(int indentLevel, java.lang.String fieldName, FileDocument[] docs)
      Returns a XML representation of an array of FileDocument.
      static java.lang.String exportFile​(int indentLevel, java.lang.String fieldName, java.lang.String filename)
      Returns a XML representation of a file.
      static java.lang.String exportFile​(int indentLevel, java.lang.String fieldName, java.lang.String[] filenames)
      Returns a XML representation of an array of files.
      static java.lang.String exportFile​(int indentLevel, java.lang.String fieldName, java.lang.String filename, java.lang.String id)
      Returns a XML representation of a file.
      static java.lang.String exportRelated​(int indentLevel, java.lang.String name, java.lang.Object value)
      Returns a XML representation of a related (result of a method, after computation or search from an index).
      static java.lang.String getIndent​(int indentLevel)
      Returns a String of indentLevel * INDENT_UNIT.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ExportUtil

        public ExportUtil()
    • Method Detail

      • exportRelated

        public static java.lang.String exportRelated​(int indentLevel,
                                                     java.lang.String name,
                                                     java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.lang.String value,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.lang.String value,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.lang.String value,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   Data value,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.lang.String value,
                                                   java.lang.String[] attNames,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   Data[] value,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.util.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.util.Collection<?> values,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.lang.String[] value,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.lang.String[] value,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.lang.String[] value,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.util.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.util.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.util.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.util.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 java.lang.String exportField​(int indentLevel,
                                                   java.lang.String name,
                                                   java.util.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
      • exportFile

        public static java.lang.String exportFile​(int indentLevel,
                                                  java.lang.String fieldName,
                                                  java.lang.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 java.lang.String exportFile​(int indentLevel,
                                                  java.lang.String fieldName,
                                                  java.lang.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 java.lang.String exportFile​(int indentLevel,
                                                  java.lang.String fieldName,
                                                  java.lang.String filename,
                                                  java.lang.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 java.lang.String exportFile​(int indentLevel,
                                                  java.lang.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 java.lang.String exportFile​(int indentLevel,
                                                  java.lang.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 java.lang.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