JIDE 3.5.15

com.jidesoft.pivot
Class AggregateTablePersistenceUtils

java.lang.Object
  extended by com.jidesoft.pivot.AggregateTablePersistenceUtils

public class AggregateTablePersistenceUtils
extends Object

A helper class that can support persist AggregateTable's layout to/from xml file.


Constructor Summary
AggregateTablePersistenceUtils()
           
 
Method Summary
static String getVersion(Document document)
          Gets the version of the layout file.
static String getVersion(InputStream in)
          Gets the version of the layout file.
static String getVersion(String fileName)
          Gets the version of the layout file.
static void isLayoutValid(AggregateTable table, Document document)
          Checks if the layout is valid.
static void isLayoutValid(AggregateTable table, InputStream in)
          Checks if the layout is valid.
static void isLayoutValid(AggregateTable table, String fileName)
          Checks if the layout is valid.
static void load(AggregateTable table, Document document)
          Loads the layout from xml document.
static void load(AggregateTable table, Document document, PersistenceUtilsCallback.Load callback)
          Loads the layout from xml document.
static void load(AggregateTable table, InputStream in)
          Loads the AggregateTable's layout from an input stream.
static void load(AggregateTable table, InputStream in, PersistenceUtilsCallback.Load callback)
          Loads the layout from input stream.
static void load(AggregateTable table, String fileName)
          Loads the layout from xml file.
static void load(AggregateTable table, String fileName, PersistenceUtilsCallback.Load callback)
          Loads the layout from xml file.
static Document save(AggregateTable table)
          Saves the AggregateTable's layout to an XML Document
static void save(AggregateTable table, OutputStream out)
          Saves the AggregateTable's layout to an output stream.
static void save(AggregateTable table, OutputStream out, PersistenceUtilsCallback.Save callback)
          Saves the AggregateTable's layout to an output stream.
static void save(AggregateTable table, OutputStream out, PersistenceUtilsCallback.Save callback, String encoding)
          Saves the AggregateTable's layout to an output stream.
static Document save(AggregateTable table, PersistenceUtilsCallback.Save callback)
          Saves the AggregateTable's layout to an XML Document
static void save(AggregateTable table, String fileName)
          Saves the AggregateTable's layout to a file.
static void save(AggregateTable table, String fileName, PersistenceUtilsCallback.Save callback)
          Saves the AggregateTable's layout to a file.
static void save(AggregateTable table, String fileName, PersistenceUtilsCallback.Save callback, String encoding)
          Saves the AggregateTable's layout to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregateTablePersistenceUtils

public AggregateTablePersistenceUtils()
Method Detail

save

public static void save(AggregateTable table,
                        String fileName)
                 throws ParserConfigurationException,
                        IOException
Saves the AggregateTable's layout to a file.

Parameters:
table - the AggregateTable
fileName - the file name
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration
IOException - If the pathname argument is null or any IO errors happen

save

public static void save(AggregateTable table,
                        OutputStream out)
                 throws ParserConfigurationException,
                        IOException
Saves the AggregateTable's layout to an output stream.

Parameters:
table - the AggregateTable
out - the output stream
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration
IOException - If the pathname argument is null or any IO errors happen

save

public static Document save(AggregateTable table)
                     throws ParserConfigurationException
Saves the AggregateTable's layout to an XML Document

Parameters:
table - the AggregateTable
Returns:
XML Document which has the AggregateTable's layout.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration

save

public static void save(AggregateTable table,
                        String fileName,
                        PersistenceUtilsCallback.Save callback)
                 throws ParserConfigurationException,
                        IOException
Saves the AggregateTable's layout to a file.

Parameters:
table - the AggregateTable
fileName - the file name
callback - The callback which will be called when saving each element to the XML document.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration
IOException - If the pathname argument is null or any IO errors happen

save

public static void save(AggregateTable table,
                        String fileName,
                        PersistenceUtilsCallback.Save callback,
                        String encoding)
                 throws ParserConfigurationException,
                        IOException
Saves the AggregateTable's layout to a file.

Parameters:
table - the AggregateTable
fileName - the file name
callback - the callback which will be called when saving each element to the XML document
encoding - the encoding choice. It would be UTF-8 in default if you call the method without this parameter.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration
IOException - If the pathname argument is null or any IO errors happen

save

public static void save(AggregateTable table,
                        OutputStream out,
                        PersistenceUtilsCallback.Save callback)
                 throws ParserConfigurationException,
                        IOException
Saves the AggregateTable's layout to an output stream.

Parameters:
table - the AggregateTable
out - the output stream
callback - The callback which will be called when saving each element to the XML document.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration
IOException - If the pathname argument is null or any IO errors happen

save

public static void save(AggregateTable table,
                        OutputStream out,
                        PersistenceUtilsCallback.Save callback,
                        String encoding)
                 throws ParserConfigurationException,
                        IOException
Saves the AggregateTable's layout to an output stream.

Parameters:
table - the AggregateTable
out - the output stream
callback - The callback which will be called when saving each element to the XML document.
encoding - the encoding choice. It would be UTF-8 in default if you call the method without this parameter.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration
IOException - If the pathname argument is null or any IO errors happen

save

public static Document save(AggregateTable table,
                            PersistenceUtilsCallback.Save callback)
                     throws ParserConfigurationException
Saves the AggregateTable's layout to an XML Document

Parameters:
table - the AggregateTable
callback - The callback which will be called when saving each element to the XML document.
Returns:
XML Document which has the AggregateTable's layout.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration

load

public static void load(AggregateTable table,
                        InputStream in)
                 throws ParserConfigurationException,
                        SAXException,
                        IOException
Loads the AggregateTable's layout from an input stream.

Parameters:
table - the AggregateTable
in - the input stream
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration
SAXException - if either the XML parser or the application has errors
IOException - if the pathname argument is null or any IO errors happen

load

public static void load(AggregateTable table,
                        String fileName)
                 throws ParserConfigurationException,
                        SAXException,
                        IOException
Loads the layout from xml file.

Parameters:
table - the AggregateTable
fileName - the layout file name.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration requested.
SAXException - If any parse errors occur.
IOException - If the pathname argument is null or any IO errors happen

load

public static void load(AggregateTable table,
                        Document document)
Loads the layout from xml document.

Parameters:
table - the AggregateTable
document - the XML document

load

public static void load(AggregateTable table,
                        InputStream in,
                        PersistenceUtilsCallback.Load callback)
                 throws ParserConfigurationException,
                        SAXException,
                        IOException
Loads the layout from input stream.

Parameters:
table - the AggregateTable
in - the input stream
callback - The callback which will be called when loading each element in the XML document.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration requested.
SAXException - If any parse errors occur.
IOException - If the pathname argument is null or any IO errors happen

load

public static void load(AggregateTable table,
                        String fileName,
                        PersistenceUtilsCallback.Load callback)
                 throws ParserConfigurationException,
                        SAXException,
                        IOException
Loads the layout from xml file.

Parameters:
table - the AggregateTable
fileName - the layout file name.
callback - The callback which will be called when loading each element in the XML document.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration requested.
SAXException - If any parse errors occur.
IOException - If the pathname argument is null or any IO errors happen

load

public static void load(AggregateTable table,
                        Document document,
                        PersistenceUtilsCallback.Load callback)
Loads the layout from xml document.

Parameters:
table - the AggregateTable
document - the XML document
callback - The callback which will be called when loading each element in the XML document.

getVersion

public static String getVersion(InputStream in)
                         throws ParserConfigurationException,
                                SAXException,
                                IOException
Gets the version of the layout file. Null is the layout file is invalid.

Parameters:
in - the InputStream
Returns:
the version.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration requested.
SAXException - If any parse errors occur.
IOException - If the pathname argument is null or any IO errors happen

getVersion

public static String getVersion(String fileName)
                         throws ParserConfigurationException,
                                SAXException,
                                IOException
Gets the version of the layout file. Null is the layout file is invalid.

Parameters:
fileName - the Document for the layout
Returns:
the version.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration requested.
SAXException - If any parse errors occur.
IOException - If the pathname argument is null or any IO errors happen

getVersion

public static String getVersion(Document document)
Gets the version of the layout file. Null is the layout file is invalid.

Parameters:
document - the Document for the layout
Returns:
the version.

isLayoutValid

public static void isLayoutValid(AggregateTable table,
                                 InputStream in)
                          throws ParserConfigurationException,
                                 SAXException,
                                 IOException,
                                 IllegalArgumentException
Checks if the layout is valid.

Parameters:
table - the aggregate table.
in - the input steam which is an XML layout file.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration requested.
SAXException - if any parse error occurs.
IOException - if any IO error occurs.
IllegalArgumentException - if the layout content is invalid such as version number is missing or the field in the layout is no longer in the pivot table pane.

isLayoutValid

public static void isLayoutValid(AggregateTable table,
                                 String fileName)
                          throws ParserConfigurationException,
                                 SAXException,
                                 IOException,
                                 IllegalArgumentException
Checks if the layout is valid.

Parameters:
table - the aggregate table.
fileName - the file name of an XML layout file.
Throws:
ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration requested.
SAXException - if any parse error occurs.
IOException - if any IO error occurs.
IllegalArgumentException - if the layout content is invalid such as version number is missing or the field in the layout is no longer in the pivot table pane.

isLayoutValid

public static void isLayoutValid(AggregateTable table,
                                 Document document)
                          throws IllegalArgumentException
Checks if the layout is valid.

Parameters:
table - the aggregate table.
document - the XML Document
Throws:
IllegalArgumentException - if the layout content is invalid such as version number is missing or the field in the layout is no longer in the pivot table pane.

JIDE 3.5.15