public abstract class AccountUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ACCOUNT
sort by account (this is always 'other' acct - the first split's account).
|
static java.util.Comparator<Account> |
ACCOUNT_NAME_COMPARATOR
Compare two accounts by name, for sorting a list by account name.
|
static java.util.Comparator<Account> |
ACCOUNT_TYPE_NAME_COMPARATOR
Compare two accounts by name, for sorting a list by account name.
|
static int |
ACTION |
static int |
AMOUNT |
static java.util.Comparator<Txn> |
AMOUNT_COMPARATOR |
static int |
CATEGORY
Sort by category account.
|
static int |
CHECKNUM |
static int |
CHECKNUM_INT |
static int |
CHECKNUM_PARENT
Sort by check#, but only check the parent's check# and ignore the split's.
|
static int |
DATE |
static int |
DATE_ENTERED |
static java.util.Comparator<Txn> |
DATE_ENTERED_COMPARATOR
Comparator for sorting transactions by date-entered.
|
static int |
DATE_THEN_AMOUNT |
static java.util.Comparator<Txn> |
DATE_THEN_AMOUNT_COMPARATOR |
static int |
DATE_THEN_CHECKNUM |
static int |
DATE_THEN_STATUS |
static int |
DESCRIPTION |
static int |
NOT_CATEGORY
Sort by non-category account.
|
static int |
STATUS_THEN_CKNUM |
static int |
STATUS_THEN_DATE |
static int |
TAXDATE_THEN_CHECKNUM
Sort by tax date then by check#.
|
static java.util.Comparator<Txn> |
TXN_CATEGORY_THEN_DATE_ENTERED |
static java.util.Comparator<Txn> |
TXN_DATE_THEN_CHECKNUM |
static java.util.Comparator<Txn> |
TXN_DESCRIPTION |
static java.util.Comparator<Txn> |
TXN_TAXDATE_THEN_CHECKNUM |
Constructor and Description |
---|
AccountUtil() |
Modifier and Type | Method and Description |
---|---|
static java.util.List<Account> |
allMatchesForSearch(Account rootAccount,
AcctFilter search)
Return a list of accounts matching the given filter
|
static int |
compAccountDateEntered(Txn t1,
Txn t2) |
static long |
compAmount(Txn t1,
Txn t2) |
static int |
compCategoryOrAccount(Txn t1,
Txn t2)
Compare the category account for two transactions.
|
static int |
compCheckIntId(AbstractTxn t1,
AbstractTxn t2) |
static int |
compCheckNumAmt(Txn t1,
Txn t2)
Compare the two transactions based on their check number and then their
amount if the check numbers are the same.
|
static int |
compCheckNumBoth(AbstractTxn t1,
AbstractTxn t2)
Compare the check number field for both numeric only and also text values.
|
static int |
compCheckNumBoth(Txn t1,
Txn t2,
boolean forceUseParent)
Compare the check number field for both numeric only and also text values.
|
static int |
compCheckNumId(AbstractTxn t1,
AbstractTxn t2) |
static int |
compCheckNumParent(AbstractTxn t1,
AbstractTxn t2)
Compare the check number field, but only use the parent transaction's check number, do not use
the check number for a split.
|
static int |
compDate(Txn t1,
Txn t2)
Compare the transaction date of two transactions.
|
static int |
compDateCheckNum(Txn t1,
Txn t2,
boolean useTaxDate)
Compare two transactions by date.
|
static int |
compDateDateEntered(Txn t1,
Txn t2) |
static int |
compDateEntered(Txn t1,
Txn t2) |
static long |
compDateThenAmount(AbstractTxn t1,
AbstractTxn t2) |
static int |
compDateThenStatus(AbstractTxn t1,
AbstractTxn t2) |
static int |
compDescription(Txn t1,
Txn t2)
Compare the description, or 'payee', of two transactions.
|
static int |
compDescriptionDate(AbstractTxn t1,
AbstractTxn t2) |
static int |
compDescriptionDateEntered(Txn t1,
Txn t2) |
static int |
compStatus(AbstractTxn t1,
AbstractTxn t2) |
static int |
compStatusChecknum(AbstractTxn t1,
AbstractTxn t2) |
static int |
compTaxDate(Txn t1,
Txn t2)
Compare the tax date of two transactions.
|
static Account |
findAccountWithID(Account root,
java.lang.String accountUUID)
Find and return the account having the given UUID
|
static void |
findAllReferencesToAccount(java.util.List<MoneydanceSyncableItem> itemsWithReferences,
Account acct)
Adds to the list of all items that reference the given account.
|
static Account |
firstMatchForSearch(Account rootAccount,
AcctFilter search)
Return the first account that matches the given filter under the specified account
|
static java.util.Iterator<Account> |
getAccountFlatIterator(Account account) |
static java.util.Iterator<Account> |
getAccountIterator(Account account)
Return an iterator for all of the accounts that are under the given
account.
|
static java.util.Iterator<Account> |
getAccountIterator(AccountBook book)
Return an iterator for all of the accounts that are within the given
data set.
|
static long |
getBalanceAsOfDate(AccountBook book,
Account account,
int asofDate)
Get a single account's balance as of a given date.
|
static long |
getBalanceAsOfDate(AccountBook book,
Account account,
int asofDate,
boolean outOfDateAsZero)
Get a single account's balance as of a given date.
|
static long[] |
getBalancesAsOfDates(AccountBook book,
Account account,
int[] asofDates)
Get a single account's balance as of a list of given dates.
|
static long[] |
getBalancesAsOfDates(AccountBook book,
Account account,
int[] asofDates,
boolean outOfDateAsZero)
Get a single account's balance as of a list of given dates.
|
static Account |
getCategoryFromTxn(AbstractTxn previousTxn) |
static Account |
getDefaultCategoryForAcct(Account acct)
Get the default category for use transactions in the given account.
|
static Account |
getDefaultTransferAcct(Account acct)
Get the default transfer account for transaction in the given account.
|
static AcctFilter |
getFilterForType(Account.AccountType type) |
static Account |
getNonCategoryFromTxn(AbstractTxn txn)
Return the non-category account from a transaction.
|
static int |
insertSortedTransaction(TxnSet transactions,
AbstractTxn t,
int sortedBy)
Inserts the given transaction into the specified array in
sorted order.
|
static boolean |
isCompatibleWith(OnlineAccountInfo olAcct,
Account acct)
Returns true iff the given online account can be associated with the
given local account.
|
static boolean |
isTransactionSorted(int index,
AbstractTxn t,
TxnSet transactions,
int sortedBy) |
static void |
readAccountsFromTable(AccountBook book,
java.util.ResourceBundle resources,
CurrencyTable currencyTable,
Account parent,
StreamVector children,
CurrencyType baseCurr) |
static void |
sortTransactions(TxnSet transactions,
int sortField) |
public static final int DATE
public static final int DATE_ENTERED
public static final int DESCRIPTION
public static final int AMOUNT
public static final int STATUS_THEN_DATE
public static final int ACCOUNT
public static final int DATE_THEN_STATUS
public static final int DATE_THEN_AMOUNT
public static final int DATE_THEN_CHECKNUM
public static final int CHECKNUM
public static final int ACTION
public static final int CHECKNUM_INT
public static final int STATUS_THEN_CKNUM
public static final int CATEGORY
public static final int NOT_CATEGORY
public static final int TAXDATE_THEN_CHECKNUM
public static final int CHECKNUM_PARENT
public static final java.util.Comparator<Account> ACCOUNT_NAME_COMPARATOR
public static final java.util.Comparator<Account> ACCOUNT_TYPE_NAME_COMPARATOR
public static final java.util.Comparator<Txn> DATE_ENTERED_COMPARATOR
public static final java.util.Comparator<Txn> AMOUNT_COMPARATOR
public static final java.util.Comparator<Txn> DATE_THEN_AMOUNT_COMPARATOR
public static final java.util.Comparator<Txn> TXN_CATEGORY_THEN_DATE_ENTERED
public static final java.util.Comparator<Txn> TXN_DATE_THEN_CHECKNUM
public static final java.util.Comparator<Txn> TXN_TAXDATE_THEN_CHECKNUM
public static final java.util.Comparator<Txn> TXN_DESCRIPTION
public static Account firstMatchForSearch(Account rootAccount, AcctFilter search)
public static java.util.List<Account> allMatchesForSearch(Account rootAccount, AcctFilter search)
public static Account findAccountWithID(Account root, java.lang.String accountUUID)
public static AcctFilter getFilterForType(Account.AccountType type)
public static final Account getDefaultCategoryForAcct(Account acct)
public static final Account getDefaultTransferAcct(Account acct)
public static java.util.Iterator<Account> getAccountIterator(Account account)
public static java.util.Iterator<Account> getAccountIterator(AccountBook book)
public static java.util.Iterator<Account> getAccountFlatIterator(Account account)
public static boolean isCompatibleWith(OnlineAccountInfo olAcct, Account acct)
public static int insertSortedTransaction(TxnSet transactions, AbstractTxn t, int sortedBy)
public static long compDateThenAmount(AbstractTxn t1, AbstractTxn t2)
public static int compDateThenStatus(AbstractTxn t1, AbstractTxn t2)
public static int compStatus(AbstractTxn t1, AbstractTxn t2)
public static int compStatusChecknum(AbstractTxn t1, AbstractTxn t2)
public static int compDescriptionDate(AbstractTxn t1, AbstractTxn t2)
public static int compDescription(Txn t1, Txn t2)
t1
- First transaction to compare (left hand side).t2
- Second transaction to compare (right hand side).public static int compDateCheckNum(Txn t1, Txn t2, boolean useTaxDate)
t1
- First transaction to compare (left hand side).t2
- Second transaction to compare (right hand side).useTaxDate
- True if comparing tax dates, false if transaction date.public static int compDate(Txn t1, Txn t2)
t1
- First transaction to compare (left hand side).t2
- Second transaction to compare (right hand side).public static int compTaxDate(Txn t1, Txn t2)
t1
- First transaction to compare (left hand side).t2
- Second transaction to compare (right hand side).public static int compCategoryOrAccount(Txn t1, Txn t2)
t1
- First transaction to compare (left hand side).t2
- Second transaction to compare (right hand side).
accounts.public static Account getNonCategoryFromTxn(AbstractTxn txn)
null
.txn
- The transaction to check.null
.public static int compCheckNumBoth(AbstractTxn t1, AbstractTxn t2)
t1
- First transaction to compare (left hand side).t2
- Second transaction to compare (right hand side).public static int compCheckNumBoth(Txn t1, Txn t2, boolean forceUseParent)
t1
- First transaction to compare (left hand side).t2
- Second transaction to compare (right hand side).forceUseParent
- True if always getting the check# from the parent, false otherwise.public static int compCheckNumId(AbstractTxn t1, AbstractTxn t2)
public static int compCheckNumParent(AbstractTxn t1, AbstractTxn t2)
t1
- First transaction to compare (left hand side).t2
- Second transaction to compare (right hand side).public static int compCheckNumAmt(Txn t1, Txn t2)
public static final int compCheckIntId(AbstractTxn t1, AbstractTxn t2)
public static boolean isTransactionSorted(int index, AbstractTxn t, TxnSet transactions, int sortedBy)
public static void sortTransactions(TxnSet transactions, int sortField)
public static long getBalanceAsOfDate(AccountBook book, Account account, int asofDate)
book
- The root account for all transactions.account
- Account to obtain the balance for.asofDate
- The date to obtain the balance for.public static long getBalanceAsOfDate(AccountBook book, Account account, int asofDate, boolean outOfDateAsZero)
book
- The root account for all transactions.account
- Account to obtain the balance for.asofDate
- The date to obtain the balance for.outOfDateAsZero
- True if out-of-date returns a zero balance, false if it returns a
Long.MIN_VALUE
if the account did not exist.public static long[] getBalancesAsOfDates(AccountBook book, Account account, int[] asofDates)
book
- The root account for all transactions.account
- Account to obtain the balance for.asofDates
- The dates to obtain the balance for.asofDates
.public static long[] getBalancesAsOfDates(AccountBook book, Account account, int[] asofDates, boolean outOfDateAsZero)
Long.MIN_VALUE
for the balance. Transactions for
the given date will be included, so it is the balance as of the end of the given date. If
outOfDateAsZero
is true
, this is overridden and 0 is returned
even if the date is too early.book
- The root account for all transactions.account
- Account to obtain the balance for.asofDates
- The dates to obtain the balance for.outOfDateAsZero
- True if out-of-date returns a zero balance, false if it returns a
Long.MIN_VALUE
if the account did not exist.asofDates
.public static void findAllReferencesToAccount(java.util.List<MoneydanceSyncableItem> itemsWithReferences, Account acct)
public static void readAccountsFromTable(AccountBook book, java.util.ResourceBundle resources, CurrencyTable currencyTable, Account parent, StreamVector children, CurrencyType baseCurr) throws java.lang.Exception
java.lang.Exception
public static Account getCategoryFromTxn(AbstractTxn previousTxn)