public class AccountBook
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DROPBOX_SYNC_UUID |
Modifier and Type | Method and Description |
---|---|
static AccountBook |
accountBookForFolder(java.io.File folder) |
void |
addAccountListener(AccountListener listener)
add a listener to be notified when an account is modified.
|
void |
addFileListener(MDFileListener listener) |
void |
addListener(AccountBookListener listener) |
void |
cleanUp()
Avoid lapsed listener leaks when successively opening multiple
files.
|
void |
cleanupDeletedAttachments() |
protected boolean |
createAccountBookStructure() |
void |
doInitialLoad(boolean isSyncMaster)
Load the set of accounts from storage
|
boolean |
equals(java.lang.Object obj) |
static AccountBook |
fakeAccountBook() |
Account |
getAccountByNum(int acctNum) |
Account |
getAccountByUUID(java.lang.String acctID) |
AddressBook |
getAddresses() |
java.lang.String |
getAttachmentsFolder() |
static java.io.File |
getBookFileForName(java.io.File containerFolder,
java.lang.String bookName) |
BudgetList |
getBudgets() |
java.util.List<java.io.File> |
getCheckpointFiles() |
java.io.File |
getCheckpointsFolder() |
CurrencyTable |
getCurrencies()
Get the set of currencies associated with this file
|
java.lang.String |
getFileUUID()
Get the unique ID for this data file.
|
MoneydanceSyncableItem |
getItemForID(java.lang.String itemID)
Returns the local item that has the given ID
|
java.util.List<com.infinitekind.tiksync.SyncableItem> |
getItemsWithType(java.lang.String type) |
long |
getLastModified() |
LocalStorage |
getLocalStorage()
Returns an object that can be used to save information locally, such as
preferences, network/syncing settings, and passwords (if the data file is encrypted).
|
ReportSpecManager |
getMemorizedItems() |
java.lang.String |
getName() |
OnlineInfo |
getOnlineInfo() |
StreamTable |
getPublicMetaData()
Return public metadata about this set of accounts.
|
boolean |
getRecalcBalances() |
ReminderSet |
getReminders() |
Account |
getRootAccount() |
java.lang.String |
getRootAccountFile() |
java.io.File |
getRootFolder() |
com.infinitekind.tiksync.Syncer |
getSyncer()
Get the syncer associated with this data set, if any.
|
java.io.File |
getTemporaryFolder() |
TransactionSet |
getTransactionSet()
Get the set of all transactions.
|
static java.io.File |
getUnusedFileNameWithBase(java.io.File containerFolder,
java.lang.String baseName)
Return a unique internal account book file folder with a name based on the given base file name
|
static java.io.File |
getUnusedFriendlyFileInBase(java.io.File baseFolder) |
boolean |
hasCompletedInitialSync() |
boolean |
hasLoggedChanges() |
void |
initializeAccounts(Account rootAccount) |
void |
initializeNewEmptyAccounts(java.lang.String defaultCurrencyID) |
boolean |
isValid() |
static boolean |
isValid(AccountBook book) |
static boolean |
isValidBookFile(java.lang.String filename) |
static boolean |
isValidBookName(java.io.File baseFolder,
java.lang.String bookName) |
boolean |
logModifiedItem(MoneydanceSyncableItem modifiedItem)
Record that the given item was changed, so that the change can be saved and synced.
|
boolean |
logModifiedItems(java.util.List<MoneydanceSyncableItem> modifiedItems)
Record that the given items were changed, so that the changes can be saved and synced.
|
boolean |
logRemovedItem(MoneydanceSyncableItem removedItem)
Record that the given item was removed, so that the removal of the item can be synced.
|
boolean |
logRemovedItems(java.util.List<MoneydanceSyncableItem> itemsToRemove) |
protected void |
notifyAccountAdded(Account parent,
Account newAccount)
notify all listeners that the specified account has been added.
|
protected void |
notifyAccountDeleted(Account parent,
Account deletedAcct)
notify all listeners that the specified account has been deleted.
|
void |
notifyAccountModified(Account acct)
notify all listeners that the specified account has been modified.
|
protected void |
notifyBalanceChanged(Account acct)
notify all listeners that a balance in the specified account has changed.
|
void |
pauseSyncing() |
boolean |
refreshAccountBalances()
This will update the accounts balance from the "working" value and notify
listeners if the balance has changed.
|
void |
refreshAccountBalancesAsync() |
void |
registerAttachmentForDeletion(java.lang.String attachmentPath) |
void |
registerNewItemWithoutSyncing(com.infinitekind.tiksync.SyncableItem newItem)
Call this to add an item to the data set that is not yet synced.
|
void |
removeAccountListener(AccountListener listener)
remove the specified object so that it doesn't get any more
notifications when an account is modified.
|
void |
removeFileListener(MDFileListener listener) |
void |
removeListener(AccountBookListener listener) |
void |
resetLoggedChanges() |
void |
resumeSyncing() |
boolean |
save()
Save any pending queued changes, returning false if we couldn't save something
|
void |
saveTrunkFile()
Save the current state of the data to a trunk file.
|
void |
scheduleQueuePurgeInMillisecondsFromNow(long inXMilliseconds) |
void |
setFinishedInitialLoad(boolean b) |
void |
setLocalStorage(LocalStorage newStorage)
Sets an object that can be used to save information locally, such as preferences,
network/syncing settings, and passwords (if the data file is encrypted).
|
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 |
startSyncing(com.infinitekind.tiksync.SyncFolder syncFolder)
If the syncing process hasn't already been established then this synchronously downloads
the initial data set.
|
void |
startSyncing(com.infinitekind.tiksync.SyncFolder syncFolder,
boolean isMasterSyncer)
If the syncing process hasn't already been established then this synchronously downloads
the initial data set.
|
void |
stopSyncing() |
static java.lang.String |
stripNonFilenameSafeCharacters(java.lang.String filename)
Strip all characters that should not appear in a filename (including path characters)
|
java.lang.String |
toString() |
void |
unregisterAttachmentForDeletion(java.lang.String attachmentPath) |
public static final java.lang.String DROPBOX_SYNC_UUID
public LocalStorage getLocalStorage()
public void setLocalStorage(LocalStorage newStorage)
public final java.lang.String getFileUUID()
public void doInitialLoad(boolean isSyncMaster) throws java.lang.Exception
java.lang.Exception
public void saveTrunkFile() throws java.lang.Exception
java.lang.Exception
public boolean hasCompletedInitialSync()
public void startSyncing(com.infinitekind.tiksync.SyncFolder syncFolder) throws java.lang.Exception
syncFolder
- The online "folder" in which sync files are storedjava.lang.Exception
- whenever it feels the urgepublic void startSyncing(com.infinitekind.tiksync.SyncFolder syncFolder, boolean isMasterSyncer) throws java.lang.Exception
syncFolder
- The online "folder" in which sync files are storedisMasterSyncer
- true if this data set is a master copy; that is, it's not a mobile device or secondary desktop copyjava.lang.Exception
- whenever it feels the urgepublic void stopSyncing()
public void pauseSyncing()
public void resumeSyncing()
public final Account getAccountByUUID(java.lang.String acctID)
public final Account getAccountByNum(int acctNum)
public com.infinitekind.tiksync.Syncer getSyncer()
public void initializeNewEmptyAccounts(java.lang.String defaultCurrencyID)
public void initializeAccounts(Account rootAccount)
public java.lang.String getName()
public java.lang.String getRootAccountFile()
public java.lang.String getAttachmentsFolder()
public java.io.File getCheckpointsFolder()
public long getLastModified()
public java.util.List<java.io.File> getCheckpointFiles()
public java.io.File getRootFolder()
public java.io.File getTemporaryFolder()
public Account getRootAccount()
public TransactionSet getTransactionSet()
public CurrencyTable getCurrencies()
public ReminderSet getReminders()
public BudgetList getBudgets()
public AddressBook getAddresses()
public OnlineInfo getOnlineInfo()
public ReportSpecManager getMemorizedItems()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
protected boolean createAccountBookStructure()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isValid()
public static boolean isValid(AccountBook book)
public static AccountBook accountBookForFolder(java.io.File folder)
public static boolean isValidBookName(java.io.File baseFolder, java.lang.String bookName)
public static boolean isValidBookFile(java.lang.String filename)
public void setPublicMetaData(StreamTable newMetaInfo)
public StreamTable getPublicMetaData()
public void cleanUp()
public void registerAttachmentForDeletion(java.lang.String attachmentPath)
public void unregisterAttachmentForDeletion(java.lang.String attachmentPath)
public void cleanupDeletedAttachments()
public void addListener(AccountBookListener listener)
public void removeListener(AccountBookListener listener)
public void addFileListener(MDFileListener listener)
public void removeFileListener(MDFileListener listener)
public final void addAccountListener(AccountListener listener)
public final void removeAccountListener(AccountListener listener)
protected void notifyAccountDeleted(Account parent, Account deletedAcct)
protected void notifyAccountAdded(Account parent, Account newAccount)
public void notifyAccountModified(Account acct)
protected void notifyBalanceChanged(Account acct)
public boolean refreshAccountBalances()
public void refreshAccountBalancesAsync()
public void setRecalcBalances(boolean doRecalcs)
public boolean getRecalcBalances()
public boolean logRemovedItems(java.util.List<MoneydanceSyncableItem> itemsToRemove)
public boolean logRemovedItem(MoneydanceSyncableItem removedItem)
public void registerNewItemWithoutSyncing(com.infinitekind.tiksync.SyncableItem newItem)
public boolean logModifiedItem(MoneydanceSyncableItem modifiedItem)
public boolean logModifiedItems(java.util.List<MoneydanceSyncableItem> modifiedItems)
public boolean save()
public void setFinishedInitialLoad(boolean b)
public void scheduleQueuePurgeInMillisecondsFromNow(long inXMilliseconds)
public boolean hasLoggedChanges()
public final void resetLoggedChanges()
public final MoneydanceSyncableItem getItemForID(java.lang.String itemID)
public java.util.List<com.infinitekind.tiksync.SyncableItem> getItemsWithType(java.lang.String type)
public static AccountBook fakeAccountBook()
public static java.io.File getUnusedFriendlyFileInBase(java.io.File baseFolder)
public static java.io.File getUnusedFileNameWithBase(java.io.File containerFolder, java.lang.String baseName)
public static java.io.File getBookFileForName(java.io.File containerFolder, java.lang.String bookName)
public static java.lang.String stripNonFilenameSafeCharacters(java.lang.String filename)