Class ImportExportTool

  • All Implemented Interfaces:
    java.io.Serializable

    public class ImportExportTool
    extends java.lang.Object
    implements java.io.Serializable
    Objects import/export services.
    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.lang.String export​(ServletParameters params, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ObjectDB object, java.lang.String rowId)
      Asynchronous export form or list data
      static ObjectDB getExportObject​(ObjectDB obj, boolean list, boolean pref)
      Object instance dedicated to asynchronous export
      static java.lang.String importCSV​(ServletParameters params, Grant g)
      CVS upload and import (static)
      static java.lang.String importFile​(ServletParameters params, Grant g)
      XML/ZIP/ADP file upload and import (static)
      static java.lang.String toARC​(ObjectDB obj, boolean list, java.lang.String mode, java.io.OutputStream out)
      Build archive into output stream
      static java.lang.String toARC​(ObjectDB obj, boolean list, java.lang.String mode, javax.servlet.http.HttpServletResponse response)
      Export into a ZIP with excel + documents
      static java.lang.String toARC​(ObjectDB obj, java.lang.String mode, java.io.OutputStream out)
      Deprecated.
      Use toARC with list argument
      static java.lang.String toARC​(ObjectDB obj, java.lang.String mode, javax.servlet.http.HttpServletResponse response)
      Deprecated.
      Use toARC with list argument
      static void toDataStream​(ObjectDB obj, java.util.List<java.lang.String[]> rows, java.lang.String mode, boolean timestamp, boolean inline, java.lang.String format, java.io.OutputStream out)
      Multiple records XML/JSON/YAML export
      static java.lang.String toJSON​(ObjectDB obj, java.lang.String mode, boolean inline)
      Single record JSON export (with children if full)
      static java.lang.String toJSON​(ObjectDB obj, java.util.List<java.lang.String[]> rows, java.lang.String mode, boolean inline)
      Multiple records JSON export
      static java.lang.String toXML​(ObjectDB obj, java.lang.String mode, boolean timestamp, boolean inline)
      Single record XML export (with children if full)
      static java.lang.String toXML​(ObjectDB obj, java.util.List<java.lang.String[]> rows, java.lang.String mode, boolean timestamp, boolean inline)
      Multiple records XML export (with children if full)
      static java.lang.String toYAML​(ObjectDB obj, java.lang.String mode, boolean inline)
      Single record YAML export (with children if full)
      static java.lang.String toYAML​(ObjectDB obj, java.util.List<java.lang.String[]> rows, java.lang.String mode, boolean inline)
      Multiple records YAML export
      static java.lang.String toZIP​(ObjectDB obj, java.lang.String row_id, java.lang.String mode, java.io.OutputStream out, boolean timestamp)
      Export object to ZIP format
      static java.lang.String toZIP​(ObjectDB obj, java.lang.String row_id, java.lang.String mode, javax.servlet.http.HttpServletResponse response, boolean timestamp)
      Export into a ZIP (XML and documents)
      • Methods inherited from class java.lang.Object

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

      • ImportExportTool

        public ImportExportTool()
    • Method Detail

      • importFile

        public static java.lang.String importFile​(ServletParameters params,
                                                  Grant g)
        XML/ZIP/ADP file upload and import (static)
        Parameters:
        params - Parameters
        g - User rights
        Returns:
        URL of the XML Supervisor
      • importCSV

        public static java.lang.String importCSV​(ServletParameters params,
                                                 Grant g)
        CVS upload and import (static)
        Parameters:
        params - Parameters
        g - User rights
        Returns:
        URL of the XML Supervisor
      • getExportObject

        public static ObjectDB getExportObject​(ObjectDB obj,
                                               boolean list,
                                               boolean pref)
        Object instance dedicated to asynchronous export
        Parameters:
        obj - Object to export
        list - Is it a list?
        pref - apply user preferences?
        Returns:
        New instance with same filters
      • export

        public static java.lang.String export​(ServletParameters params,
                                              javax.servlet.http.HttpServletRequest request,
                                              javax.servlet.http.HttpServletResponse response,
                                              ObjectDB object,
                                              java.lang.String rowId)
                                       throws java.io.IOException
        Asynchronous export form or list data
        Parameters:
        request - HTTP request with action, mode, media, data, imported
        response - HTTP response
        object - Business Object
        rowId - Optional object row ID, export the list if null
        Returns:
        HTML flow or binary
        Throws:
        java.io.IOException
      • toDataStream

        public static void toDataStream​(ObjectDB obj,
                                        java.util.List<java.lang.String[]> rows,
                                        java.lang.String mode,
                                        boolean timestamp,
                                        boolean inline,
                                        java.lang.String format,
                                        java.io.OutputStream out)
        Multiple records XML/JSON/YAML export
        Parameters:
        obj - Business object
        rows - Records set (search with pagination if null)
        mode - 'full' to export children or simple 'list'
        timestamp - Export timestamp?
        inline - Export inlined documents?
        format - output format: 'xml' | 'json' | 'yml'
        out - Output stream
      • toXML

        public static java.lang.String toXML​(ObjectDB obj,
                                             java.util.List<java.lang.String[]> rows,
                                             java.lang.String mode,
                                             boolean timestamp,
                                             boolean inline)
                                      throws java.io.IOException
        Multiple records XML export (with children if full)
        Parameters:
        obj - Business object
        rows - Records set
        mode - full or list
        timestamp - Export timestamp?
        inline - Export inlined documents?
        Returns:
        XML
        Throws:
        java.io.IOException
      • toXML

        public static java.lang.String toXML​(ObjectDB obj,
                                             java.lang.String mode,
                                             boolean timestamp,
                                             boolean inline)
                                      throws java.io.IOException
        Single record XML export (with children if full)
        Parameters:
        obj - Business object
        mode - form or full
        timestamp - Export timestamp ?
        inline - Export inlined documents ?
        Returns:
        XML
        Throws:
        java.io.IOException
      • toJSON

        public static java.lang.String toJSON​(ObjectDB obj,
                                              java.util.List<java.lang.String[]> rows,
                                              java.lang.String mode,
                                              boolean inline)
                                       throws java.io.IOException
        Multiple records JSON export
        Parameters:
        obj - Business object
        rows - Optional rows
        inline - Export inlined documents ?
        Returns:
        JSON
        Throws:
        java.io.IOException
      • toJSON

        public static java.lang.String toJSON​(ObjectDB obj,
                                              java.lang.String mode,
                                              boolean inline)
                                       throws java.io.IOException
        Single record JSON export (with children if full)
        Parameters:
        obj - Business object
        mode - form or full
        inline - Export inlined documents?
        Returns:
        JSON
        Throws:
        java.io.IOException
      • toYAML

        public static java.lang.String toYAML​(ObjectDB obj,
                                              java.util.List<java.lang.String[]> rows,
                                              java.lang.String mode,
                                              boolean inline)
                                       throws java.io.IOException
        Multiple records YAML export
        Parameters:
        obj - Business object
        rows - Optional rows
        inline - Export inlined documents?
        Returns:
        YAML
        Throws:
        java.io.IOException
      • toYAML

        public static java.lang.String toYAML​(ObjectDB obj,
                                              java.lang.String mode,
                                              boolean inline)
                                       throws java.io.IOException
        Single record YAML export (with children if full)
        Parameters:
        obj - Business object
        mode - form or full
        inline - Export inlined documents ?
        Returns:
        YAML
        Throws:
        java.io.IOException
      • toZIP

        public static java.lang.String toZIP​(ObjectDB obj,
                                             java.lang.String row_id,
                                             java.lang.String mode,
                                             javax.servlet.http.HttpServletResponse response,
                                             boolean timestamp)
                                      throws java.io.IOException
        Export into a ZIP (XML and documents)
        Parameters:
        obj - Business Object
        row_id - Optional row_id (export current list if null)
        mode - full or form (no recursion)
        response - HTTP response to put the ZIP flow
        Returns:
        null or error
        Throws:
        java.io.IOException
      • toZIP

        public static java.lang.String toZIP​(ObjectDB obj,
                                             java.lang.String row_id,
                                             java.lang.String mode,
                                             java.io.OutputStream out,
                                             boolean timestamp)
                                      throws java.io.IOException
        Export object to ZIP format
        Parameters:
        obj - Object
        row_id - Optional row_id (export list if null)
        mode - 'full' to get children
        out - Output stream to write the ZIP flow
        timestamp - export timestamps?
        Returns:
        error or null
        Throws:
        java.io.IOException
      • toARC

        @Deprecated(forRemoval=false,
                    since="5")
        public static java.lang.String toARC​(ObjectDB obj,
                                             java.lang.String mode,
                                             javax.servlet.http.HttpServletResponse response)
        Deprecated.
        Use toARC with list argument
      • toARC

        public static java.lang.String toARC​(ObjectDB obj,
                                             boolean list,
                                             java.lang.String mode,
                                             javax.servlet.http.HttpServletResponse response)
        Export into a ZIP with excel + documents
        Parameters:
        obj - Object
        list - export a list?
        mode - form or full
        response - Optional HTTP response to return the ZIP stream
        Returns:
        null or tmp file name to wait for
      • toARC

        @Deprecated(forRemoval=false,
                    since="5")
        public static java.lang.String toARC​(ObjectDB obj,
                                             java.lang.String mode,
                                             java.io.OutputStream out)
        Deprecated.
        Use toARC with list argument
      • toARC

        public static java.lang.String toARC​(ObjectDB obj,
                                             boolean list,
                                             java.lang.String mode,
                                             java.io.OutputStream out)
        Build archive into output stream
        Returns:
        error or null