jgnash.engine
Class AccountTreeXMLFactory

java.lang.Object
  extended by jgnash.engine.AccountTreeXMLFactory

public class AccountTreeXMLFactory
extends java.lang.Object

Import and export a tree of accounts

Version:
$Id$
Author:
Craig Cavanaugh

Nested Class Summary
private static class AccountTreeXMLFactory.AccountImport
           
 
Constructor Summary
private AccountTreeXMLFactory()
           
 
Method Summary
static void exportAccountTree(Engine engine, java.io.File file)
           
private static com.thoughtworks.xstream.XStream getStream()
           
static void importAccountTree(Engine engine, RootAccount root)
          Imports an account tree into the existing account tree.
static RootAccount loadAccountTree(java.io.File file)
          Load an account tree given a reader
static RootAccount loadAccountTree(java.io.InputStream stream)
          Load an account tree given an InputStream
private static RootAccount loadAccountTree(java.io.Reader reader)
          Load an account tree given a reader
static void mergeAccountTree(Engine engine, RootAccount root)
          Merges an account tree into the existing account tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccountTreeXMLFactory

private AccountTreeXMLFactory()
Method Detail

getStream

private static com.thoughtworks.xstream.XStream getStream()

exportAccountTree

public static void exportAccountTree(Engine engine,
                                     java.io.File file)

loadAccountTree

private static RootAccount loadAccountTree(java.io.Reader reader)
Load an account tree given a reader

Parameters:
reader - Reader to use
Returns:
RootAccount if reader is valid

loadAccountTree

public static RootAccount loadAccountTree(java.io.File file)
Load an account tree given a reader

Parameters:
file - file name to use
Returns:
RootAccount if file name is valid

loadAccountTree

public static RootAccount loadAccountTree(java.io.InputStream stream)
Load an account tree given an InputStream

Parameters:
stream - InputStream to use
Returns:
RootAccount if stream is valid

importAccountTree

public static void importAccountTree(Engine engine,
                                     RootAccount root)
Imports an account tree into the existing account tree. Account currencies are forced to the engine's default

Parameters:
engine - current engine to merge into
root - root of account structure to merge

mergeAccountTree

public static void mergeAccountTree(Engine engine,
                                    RootAccount root)
Merges an account tree into the existing account tree. Duplicate currencies are prevented

Parameters:
engine - current engine to merge into
root - root of account structure to merge