com.moneydance.apps.md.model
Class RootAccount

java.lang.Object
  extended by com.moneydance.apps.md.model.Account
      extended by com.moneydance.apps.md.model.RootAccount
All Implemented Interfaces:
AccountListener, CurrencyListener, OnlineInfoListener, ReminderListener, TransactionListener

public class RootAccount
extends Account
implements AccountListener, TransactionListener, CurrencyListener, ReminderListener, OnlineInfoListener

The root of all accounts. All "top-level" accounts are actually children of this account. Adding a listener to this account, effectively adds a listener to the root, and all sub-accounts. The RootAccount represents a full data set including reminders, tags, a set of transactions, and online banking information.


Field Summary
static java.lang.String STORE_PINS_PARAM
           
 
Fields inherited from class com.moneydance.apps.md.model.Account
ACCOUNT_TYPE_ASSET, ACCOUNT_TYPE_BANK, ACCOUNT_TYPE_CREDIT_CARD, ACCOUNT_TYPE_EXPENSE, ACCOUNT_TYPE_INCOME, ACCOUNT_TYPE_INVESTMENT, ACCOUNT_TYPE_LIABILITY, ACCOUNT_TYPE_LOAN, ACCOUNT_TYPE_ROOT, ACCOUNT_TYPE_SECURITY, BUDGET_CLASS_DISCRETIONARY, BUDGET_CLASS_INCOME, BUDGET_CLASS_MISC, BUDGET_CLASS_REQUIRED, BUDGET_INTERVAL_MONTHLY, BUDGET_INTERVAL_QUARTERLY, BUDGET_INTERVAL_WEEKLY, BUDGET_INTERVAL_YEARLY, MAX_BUDGETS, negate, PARAM_HAVE_NEW_TXNS, PARAM_NEW_TXN_COUNT, PARAM_QIF_TXNID, PARAM_TAX_RELATED, PARAM_VAT_ACCT, PARAM_VAT_APPLIES, PARAM_VAT_PCT, PASSWD_CACHE_KEY, SPLIT_ACCOUNT_ID
 
Constructor Summary
RootAccount(CurrencyType currency, CurrencyTable currencyTable)
           
RootAccount(CurrencyType currency, CurrencyTable currencyTable, java.util.Hashtable settings)
           
RootAccount(java.lang.String acctName, CurrencyType currency, CurrencyTable currencyTable, java.util.Hashtable settings)
           
 
Method Summary
 void accountAdded(Account parentAccount, Account newAccount)
          Is called when an account is added.
 void accountBalanceChanged(Account account)
          Is called when the account balance is changed
 void accountDeleted(Account parentAccount, Account deletedAccount)
          Is called when an account is deleted.
 void accountModified(Account account)
          Is called when some aspect of the account is modified, such as account name, currency, etc.
 void addFileListener(MDFileListener listener)
           
 void autoCommitReminders()
           
 void cleanUp()
          Avoid lapsed listener leaks when opening successively opening multiple files.
 void currencyTableModified(CurrencyTable table)
           
 void deleteAccountAndAllReferences(Account acct)
          Deletes an account as well as everything that references it.
 void doneLoading()
          This is called after a data set has been fully loaded from a stream.
 boolean fileNeedsToBeSaved()
           
 Account getAccountById(int id)
           
 AddressBook getAddressBook()
          In versions 452 and later, this is for the use of the address book.
 BudgetList getBudgetList()
          Get the set of budgets for this data file.
 java.lang.String getBudgetName(int budgetNum, java.lang.String defaultName)
          Get the name of the budget that is identified by the given number.
 CurrencyTable getCurrencyTable()
           
 java.io.File getDataFile()
           
 int getDataFileFormat()
          Get the format of the data file from which this data was read.
 java.lang.String getEncryptionHint()
          Gets the hint that will be stored (unencrypted) with this file to help the user remember their passphrase.
 byte[] getEncryptionKey()
          Get the key that will be used to encrypt this file.
 java.lang.String getEncryptionLevel()
          Get the level of encryption.
 java.lang.String getFullAccountName()
           
 Account getInvstCommissionAcct()
           
 MemorizedItemManager getMemorizedItemManager()
           
 java.lang.String getNewsToken()
           
 OnlineInfo getOnlineInfo()
           
 StreamTable getPublicMetaData()
          Return public metadata about this set of accounts.
 boolean getRecalcBalances()
           
 ReminderSet getReminderSet()
          Get the set of reminders that are associated with this data set.
 TransactionSet getTransactionSet()
          Get the set of all transactions.
 TxnTagSet getTxnTagSet()
          Get the set of tags that can be associated with transactions.
 boolean isUnsavedData()
          Returns true if there is data in this account or any child accounts that hasn't been saved.
 void onlineInfoModified(OnlineInfo info)
           
 void refreshAccountBalances()
          This will update the accounts balance from the "working" value and notify listeners if the balance has changed.
 void reminderAdded(Reminder r)
          Called after a reminder has been added to the reminder set.
 void reminderModified(Reminder r)
          Called after a reminder has been modified.
 void reminderRemoved(Reminder r)
          Called after a reminder has been removed from the reminder set.
 void removeFileListener(MDFileListener listener)
           
 void resetDirtyFlags()
          set the dirty flag for this account and all sub-accounts to a non-dirty state.
 void saveSecondaryInfo()
           
 void setBudgetName(int budgetNum, java.lang.String budgetName)
          Get the name of the budget that is identified by the given number.
 void setDataFile(java.io.File f)
           
 void setDataFileFormat(int newFormat)
           
 void setEncryptionHint(java.lang.String hint)
          Sets the hint that will be stored with this file to help the user remember their passphrase.
 void setEncryptionKey(byte[] encryptionKey)
          Set the key that will be used to encrypt this file.
 void setEncryptionLevel(java.lang.String newLevel)
          Set the level of encryption.
 void setNewsToken(java.lang.String newsToken)
           
 void setPublicMetaData(StreamTable newMetaInfo)
          Set the public meta data that applies to this set of accounts.
 void setRecalcBalances(boolean doRecalcs)
          Tells the model whether or not all account balances should be recalculated whenever a transaction is modified.
 void transactionAdded(AbstractTxn t)
          Called after a transaction has been added to the transaction set.
 void transactionModified(AbstractTxn t)
          Called after a transaction has been modified.
 void transactionRemoved(AbstractTxn t)
          Called after a transaction has been removed from the transaction set.
 
Methods inherited from class com.moneydance.apps.md.model.Account
_getAccountByName, _getAccountByName, _removeSubAccount, addAccountListener, addSubAccount, adjustStartBalance, balanceIsNegated, billpayTxnsUpdated, canDownloadTxns, cloneParameters, compareFullPathToAccount, compareToAccount, doesParameterExist, downloadedTxnsUpdated, dumpAccounts, ensureHasSubAccount, getAccountByName, getAccountByName, getAccountIsInactive, getAccountName, getAccountNum, getAccountOrParentIsInactive, getAccountType, getAllAccountNames, getBalance, getBankingFI, getBillPayFI, getBillpayTxns, getBooleanParameter, getBudgetAmount, getBudgetClass, getBudgetInterval, getCheckNumTags, getClearedBalance, getComment, getConfirmedBalance, getCreationDate, getCreationDateInt, getCurrencyType, getCurrentBalance, getDefaultCategory, getDepth, getDoubleParameter, getDownloadedTxns, getHideOnHomePage, getHighestAccountNum, getIndentedName, getIntParameter, getLongParameter, getNextCheckNumber, getOFXAccountKey, getOFXAccountMsgType, getOFXAccountNumber, getOFXAccountType, getOFXBankID, getOFXBillPayAccountNumber, getOFXBillPayAccountType, getOFXBillPayBankID, getOFXBranchID, getOFXBrokerID, getOFXLastTxnUpdate, getOnlineAvailBalance, getOnlineAvailBalanceDate, getOnlineLedgerBalance, getOnlineLedgerBalanceDate, getParameter, getParameter, getParameterCount, getParameterKeys, getParentAccount, getPath, getPreferredSortAscending, getPreferredSortOrder, getPreferredTwoLines, getReconcilingBalance, getRecursiveBalance, getRecursiveClearedBalance, getRecursiveCurrentBalance, getRecursiveReconcilingBalance, getRecursiveStartBalance, getRecursiveUserBalance, getRecursiveUserClearedBalance, getRecursiveUserCurrentBalance, getRecursiveUserReconcilingBalance, getRecursiveUserStartBalance, getRootAccount, getStartBalance, getSubAccount, getSubAccountCount, getSubAccounts, getTaxCategory, getUserBalance, getUserClearedBalance, getUserConfirmedBalance, getUserCurrentBalance, getUserReconcilingBalance, getUserStartBalance, hasOnlineAvailBalance, hasOnlineLedgerBalance, indexOf, isAncestorOf, isDeductible, isDescendantOf, isDirty, isLeafNode, isOnlineBankingCandidate, isOnlineBillpayCandidate, isOnlineEnabled, isRegisterAccount, isTaxable, isTaxRelated, makeAccount, notifyAccountAdded, notifyAccountDeleted, notifyAccountModified, notifyBalanceChanged, removeAccountListener, removeParameter, removeSubAccount, setAccountIsInactive, setAccountName, setBankingFI, setBillPayFI, setBudgetAmount, setBudgetClass, setBudgetInterval, setCheckNumTags, setComment, setCreationDate, setCurrencyType, setDeductible, setDefaultCategory, setDirtyFlag, setHideOnHomePage, setIncludeInNetWorth, setOFXAccountKey, setOFXAccountMsgType, setOFXAccountNumber, setOFXAccountType, setOFXBankID, setOFXBillPayAccountNumber, setOFXBillPayAccountType, setOFXBillPayBankID, setOFXBranchID, setOFXBrokerID, setOFXLastTxnUpdate, setOnlineAvailBalance, setOnlineLedgerBalance, setParameter, setParameter, setParameter, setParameter, setParameter, setParameterNoNotify, setParentAccount, setPreference, setPreference, setPreference, setPreferredSortAscending, setPreferredSortOrder, setPreferredTwoLines, setStartBalance, setTaxable, setTaxCategory, setTaxRelated, setUserStartBalance, shouldBeIncludedInNetWorth, sortAccounts, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STORE_PINS_PARAM

public static final java.lang.String STORE_PINS_PARAM
See Also:
Constant Field Values
Constructor Detail

RootAccount

public RootAccount(CurrencyType currency,
                   CurrencyTable currencyTable)

RootAccount

public RootAccount(CurrencyType currency,
                   CurrencyTable currencyTable,
                   java.util.Hashtable settings)

RootAccount

public RootAccount(java.lang.String acctName,
                   CurrencyType currency,
                   CurrencyTable currencyTable,
                   java.util.Hashtable settings)
Method Detail

cleanUp

public void cleanUp()
Avoid lapsed listener leaks when opening successively opening multiple files. Clean up all fields that have back references to this object, and remove any listeners that were not already removed.


getMemorizedItemManager

public MemorizedItemManager getMemorizedItemManager()
Returns:
The memorized item manager for memorized reports and graphs

getAddressBook

public AddressBook getAddressBook()
In versions 452 and later, this is for the use of the address book.


setPublicMetaData

public void setPublicMetaData(StreamTable newMetaInfo)
Set the public meta data that applies to this set of accounts. This should only be called by the objects that read the data from an input stream.


getPublicMetaData

public StreamTable getPublicMetaData()
Return public metadata about this set of accounts. This should include any information that is not in the encrypted part of the file. This will most likely only contain the encryption hint.


onlineInfoModified

public void onlineInfoModified(OnlineInfo info)
Specified by:
onlineInfoModified in interface OnlineInfoListener

setEncryptionHint

public void setEncryptionHint(java.lang.String hint)
Sets the hint that will be stored with this file to help the user remember their passphrase.


getEncryptionHint

public java.lang.String getEncryptionHint()
Gets the hint that will be stored (unencrypted) with this file to help the user remember their passphrase.


getEncryptionKey

public byte[] getEncryptionKey()
Get the key that will be used to encrypt this file. Is null if no encryption is required.


getEncryptionLevel

public java.lang.String getEncryptionLevel()
Get the level of encryption. Can currently be "des" or "3des".

Since:
build 380 (MD 2004 r4)

setEncryptionLevel

public void setEncryptionLevel(java.lang.String newLevel)
Set the level of encryption. Can be "des" or "3des".

Since:
build 380 (MD 2004 r4)

setEncryptionKey

public void setEncryptionKey(byte[] encryptionKey)
Set the key that will be used to encrypt this file. Should be null if no encryption is required.


getBudgetName

public java.lang.String getBudgetName(int budgetNum,
                                      java.lang.String defaultName)
Get the name of the budget that is identified by the given number.


setBudgetName

public void setBudgetName(int budgetNum,
                          java.lang.String budgetName)
Get the name of the budget that is identified by the given number.


setDataFile

public void setDataFile(java.io.File f)

getDataFile

public java.io.File getDataFile()

setDataFileFormat

public void setDataFileFormat(int newFormat)

getDataFileFormat

public int getDataFileFormat()
Get the format of the data file from which this data was read.


fileNeedsToBeSaved

public boolean fileNeedsToBeSaved()

autoCommitReminders

public void autoCommitReminders()

getNewsToken

public java.lang.String getNewsToken()

setNewsToken

public void setNewsToken(java.lang.String newsToken)

getCurrencyTable

public CurrencyTable getCurrencyTable()

isUnsavedData

public boolean isUnsavedData()
Returns true if there is data in this account or any child accounts that hasn't been saved.


saveSecondaryInfo

public void saveSecondaryInfo()

getTransactionSet

public TransactionSet getTransactionSet()
Get the set of all transactions.


getReminderSet

public ReminderSet getReminderSet()
Get the set of reminders that are associated with this data set.


getTxnTagSet

public TxnTagSet getTxnTagSet()
Get the set of tags that can be associated with transactions. This method is only available for build 414 and higher.


getBudgetList

public BudgetList getBudgetList()
Get the set of budgets for this data file. This method is only available for build 550 (MD 2007) and higher.


getFullAccountName

public java.lang.String getFullAccountName()
Overrides:
getFullAccountName in class Account

getOnlineInfo

public OnlineInfo getOnlineInfo()

getAccountById

public Account getAccountById(int id)

doneLoading

public void doneLoading()
This is called after a data set has been fully loaded from a stream.


resetDirtyFlags

public void resetDirtyFlags()
Description copied from class: Account
set the dirty flag for this account and all sub-accounts to a non-dirty state. If an account is dirty, it means that it has been changed since the last time it was saved.

Overrides:
resetDirtyFlags in class Account

currencyTableModified

public void currencyTableModified(CurrencyTable table)
Specified by:
currencyTableModified in interface CurrencyListener

accountModified

public void accountModified(Account account)
Description copied from interface: AccountListener
Is called when some aspect of the account is modified, such as account name, currency, etc.

Specified by:
accountModified in interface AccountListener

accountBalanceChanged

public void accountBalanceChanged(Account account)
Description copied from interface: AccountListener
Is called when the account balance is changed

Specified by:
accountBalanceChanged in interface AccountListener

accountDeleted

public void accountDeleted(Account parentAccount,
                           Account deletedAccount)
Is called when an account is deleted.

Specified by:
accountDeleted in interface AccountListener

accountAdded

public void accountAdded(Account parentAccount,
                         Account newAccount)
Is called when an account is added.

Specified by:
accountAdded in interface AccountListener

setRecalcBalances

public void setRecalcBalances(boolean doRecalcs)
Tells the model whether or not all account balances should be recalculated whenever a transaction is modified. For performance reasons this should be set to false before adding/modifying/deleting a bunch of transactions and then set to true afterwards. DON'T FORGET TO SET TO TRUE WHEN DONE WITH THE OPERATION!!!!


getRecalcBalances

public boolean getRecalcBalances()

addFileListener

public void addFileListener(MDFileListener listener)

removeFileListener

public void removeFileListener(MDFileListener listener)

refreshAccountBalances

public void refreshAccountBalances()
This will update the accounts balance from the "working" value and notify listeners if the balance has changed.


reminderRemoved

public void reminderRemoved(Reminder r)
Called after a reminder has been removed from the reminder set.

Specified by:
reminderRemoved in interface ReminderListener

reminderAdded

public void reminderAdded(Reminder r)
Called after a reminder has been added to the reminder set.

Specified by:
reminderAdded in interface ReminderListener

reminderModified

public void reminderModified(Reminder r)
Called after a reminder has been modified.

Specified by:
reminderModified in interface ReminderListener

transactionRemoved

public void transactionRemoved(AbstractTxn t)
Called after a transaction has been removed from the transaction set.

Specified by:
transactionRemoved in interface TransactionListener

transactionAdded

public void transactionAdded(AbstractTxn t)
Called after a transaction has been added to the transaction set.

Specified by:
transactionAdded in interface TransactionListener

transactionModified

public void transactionModified(AbstractTxn t)
Called after a transaction has been modified.

Specified by:
transactionModified in interface TransactionListener

getInvstCommissionAcct

public Account getInvstCommissionAcct()

deleteAccountAndAllReferences

public void deleteAccountAndAllReferences(Account acct)
Deletes an account as well as everything that references it.