Class FlowXML

  • All Implemented Interfaces:
    java.io.Serializable

    public class FlowXML
    extends java.lang.Object
    implements java.io.Serializable

    Simplicite XML flow manager

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      FlowXML()
      Empty flow
      FlowXML​(boolean atomic)
      Empty flow
      FlowXML​(boolean atomic, java.lang.String clear)
      Empty flow
      FlowXML​(byte[] zipData)
      Load zip data which contains:
      - XML files to load in alphabetic order
      - Attached documents
      FlowXML​(java.io.InputStream zipData)
      Load zip data which contains:
      - XML files to load in alphabetic order
      - Attached documents
      FlowXML​(java.io.InputStream is, java.lang.String origin)
      Load a stream
    • Method Summary

      Modifier and Type Method Description
      void addObject​(ObjectXML obj)  
      void addObject​(ObjectDB obj, java.lang.String action)  
      void addObject​(ObjectDB obj, java.lang.String action, boolean timestampFields, boolean inlineDocs)  
      void clear()  
      java.lang.String compare​(Grant g, FlowXML origin, FlowXML flow, java.lang.String title1, java.lang.String title2)
      XML difference (sources must contain full existing objects with all fields to compare)
      static java.lang.String error​(java.lang.String message)
      Standard XML error message
      java.lang.String getClearCache()  
      java.util.Date getEffectiveDate()  
      java.lang.String getExternalDir()  
      java.io.InputStream getInputStream()
      Stream xml as ByteArrayInputStream
      ObjectXML getLastObject()  
      ObjectXML getObject​(int i)  
      java.util.List<ObjectXML> getObjects()  
      int getSize()  
      java.lang.String getTempDir()  
      void insertObject​(ObjectXML obj, int index)  
      boolean isAtomic()  
      void removeTempDir()  
      static java.lang.String result​(java.lang.String message)
      Standard XML error message
      void setEffectiveDate​(java.util.Date d)  
      boolean toFile​(java.lang.String path)  
      java.lang.StringBuilder toJSON()
      Build the JSON flow
      java.lang.String toString()  
      java.lang.StringBuilder toXML()
      Build the XML flow uing tabs
      java.lang.StringBuilder toXML​(java.lang.String tab)
      Build the XML flow
      java.io.File toZIP​(java.lang.String name)
      Build a Zip file with documents
      static java.lang.String xmlFooter()  
      static java.lang.String xmlHeader()  
      static java.lang.String xmlHeader​(boolean atomic, java.util.Date effectiveDate, java.lang.String clearCache)  
      • Methods inherited from class java.lang.Object

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

      • FlowXML

        public FlowXML()

        Empty flow

      • FlowXML

        public FlowXML​(boolean atomic)

        Empty flow

        Parameters:
        atomic - True = transactional (not supported yet)
      • FlowXML

        public FlowXML​(boolean atomic,
                       java.lang.String clear)

        Empty flow

        Parameters:
        atomic - True = transactional (TODO not supported yet)
        clear - Optional clear cache: none,before,after,both
      • FlowXML

        public FlowXML​(java.io.InputStream is,
                       java.lang.String origin)
                throws java.lang.Exception

        Load a stream

        Parameters:
        is - input stream
        origin - flow source
        Throws:
        java.lang.Exception
      • FlowXML

        public FlowXML​(byte[] zipData)
                throws java.lang.Exception
        Load zip data which contains:
        - XML files to load in alphabetic order
        - Attached documents
        Parameters:
        zipData - ZIP data
        Throws:
        java.lang.Exception
      • FlowXML

        public FlowXML​(java.io.InputStream zipData)
                throws java.lang.Exception
        Load zip data which contains:
        - XML files to load in alphabetic order
        - Attached documents
        Parameters:
        zipData - ZIP data
        Throws:
        java.lang.Exception
    • Method Detail

      • getObject

        public ObjectXML getObject​(int i)
      • getLastObject

        public ObjectXML getLastObject()
      • getObjects

        public java.util.List<ObjectXML> getObjects()
      • getSize

        public int getSize()
      • clear

        public void clear()
      • isAtomic

        public boolean isAtomic()
      • getExternalDir

        public java.lang.String getExternalDir()
      • getTempDir

        public java.lang.String getTempDir()
      • getClearCache

        public java.lang.String getClearCache()
      • getEffectiveDate

        public java.util.Date getEffectiveDate()
      • setEffectiveDate

        public void setEffectiveDate​(java.util.Date d)
      • addObject

        public void addObject​(ObjectXML obj)
      • insertObject

        public void insertObject​(ObjectXML obj,
                                 int index)
      • addObject

        public void addObject​(ObjectDB obj,
                              java.lang.String action)
      • addObject

        public void addObject​(ObjectDB obj,
                              java.lang.String action,
                              boolean timestampFields,
                              boolean inlineDocs)
      • xmlHeader

        public static java.lang.String xmlHeader()
      • xmlHeader

        public static java.lang.String xmlHeader​(boolean atomic,
                                                 java.util.Date effectiveDate,
                                                 java.lang.String clearCache)
      • xmlFooter

        public static java.lang.String xmlFooter()
      • result

        public static java.lang.String result​(java.lang.String message)

        Standard XML error message

        Parameters:
        message - Error message
        Returns:
        Standard XML fragment for result message
      • error

        public static java.lang.String error​(java.lang.String message)

        Standard XML error message

        Parameters:
        message - Error message
        Returns:
        Standard XML fragment for error message
      • getInputStream

        public java.io.InputStream getInputStream()
        Stream xml as ByteArrayInputStream
        Returns:
        Stream
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toXML

        public java.lang.StringBuilder toXML()
        Build the XML flow uing tabs
        Returns:
        XML buffer
      • toXML

        public java.lang.StringBuilder toXML​(java.lang.String tab)
        Build the XML flow
        Parameters:
        tab - Tabulation to use
        Returns:
        XML buffer
      • toJSON

        public java.lang.StringBuilder toJSON()
        Build the JSON flow
        Returns:
        JSON buffer
      • toFile

        public boolean toFile​(java.lang.String path)
      • toZIP

        public java.io.File toZIP​(java.lang.String name)

        Build a Zip file with documents

        Parameters:
        name - archive name
        Returns:
        Zip file in temp directory, caller have to delete it after usage
      • removeTempDir

        public void removeTempDir()
      • compare

        public java.lang.String compare​(Grant g,
                                        FlowXML origin,
                                        FlowXML flow,
                                        java.lang.String title1,
                                        java.lang.String title2)
        XML difference (sources must contain full existing objects with all fields to compare)
        Parameters:
        origin - Flow to compare
        flow - XML result of the difference with this
        Returns:
        Comparison in a HTML table