Class TransactionTable
- java.lang.Object
-
- com.aoindustries.aoserv.client.AOServTable<K,V>
-
- com.aoindustries.aoserv.client.CachedTable<Integer,V>
-
- com.aoindustries.aoserv.client.CachedTableIntegerKey<Transaction>
-
- com.aoindustries.aoserv.client.billing.TransactionTable
-
- All Implemented Interfaces:
Table<Transaction>,Iterable<Transaction>
public final class TransactionTable extends CachedTableIntegerKey<Transaction>
- Author:
- AO Industries, Inc.
- See Also:
Transaction
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.aoindustries.aoserv.client.AOServTable
AOServTable.OrderBy
-
-
Field Summary
-
Fields inherited from class com.aoindustries.aoserv.client.AOServTable
ASCENDING, connector, DESCENDING
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intadd(int timeType, Timestamp time, Account account, Account sourceAccount, Administrator administrator, TransactionType type, String description, int quantity, Money rate, PaymentType paymentType, String paymentInfo, Processor processor, byte paymentConfirmed)voidclearCache()Clears the cache, freeing up memory.Transactionget(int transid)List<Transaction>get(TransactionSearchCriteria criteria)MoniesgetAccountBalance(Account account)MoniesgetAccountBalance(Account account, Timestamp before)MoniesgetActiveAccountBalance(Account account)MoniesgetActiveAccountBalance(Account account, long currentTime)Gets the active account balances for an account, including zero balances for any currency that has no transactions and is currently active in billing.MoniesgetConfirmedAccountBalance(Account account)MoniesgetConfirmedAccountBalance(Account account, Timestamp before)protected AOServTable.OrderBy[]getDefaultOrderBy()Gets the default sorting for this table.Table.TableIDgetTableID()Gets the unique identifier for this table.MoniesgetTransactionBalance(Transaction transaction)List<Transaction>getTransactions(Account account)Gets transactions that have this account as their applied-to.List<Transaction>getTransactions(Administrator ba)List<Transaction>getTransactionsFrom(Account account)Gets transactions that have this account as their source.booleanhandleCommand(String[] args, Reader in, TerminalWriter out, TerminalWriter err, boolean isInteractive)-
Methods inherited from class com.aoindustries.aoserv.client.CachedTableIntegerKey
get
-
Methods inherited from class com.aoindustries.aoserv.client.CachedTable
getIndexedRows, getRows, getRowsCopy, getUniqueRowImpl, isLoaded
-
Methods inherited from class com.aoindustries.aoserv.client.AOServTable
addProgressListener, addTableListener, addTableListener, addTableLoadListener, getCachedRowCount, getConnector, getDefaultOrderBySQLExpressions, getIndexedRows, getMap, getNewObject, getObject, getObjects, getObjects, getObjects, getObjectsNoProgress, getObjectsNoProgress, getSize, getSortAlgorithm, getTableName, getTableSchema, getUniqueRow, getUniqueRow, getUniqueRow, getUniqueRow, hasAnyTableListener, hasTableListener, isEmpty, iterator, printTable, removeProgressListener, removeTableListener, removeTableLoadListener, size, sortIfNeeded, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
getDefaultOrderBy
protected AOServTable.OrderBy[] getDefaultOrderBy()
Description copied from class:AOServTableGets the default sorting for this table.- Specified by:
getDefaultOrderByin classAOServTable<Integer,Transaction>- Returns:
nullif the sorting is performed by the server or the array of column names
-
add
public int add(int timeType, Timestamp time, Account account, Account sourceAccount, Administrator administrator, TransactionType type, String description, int quantity, Money rate, PaymentType paymentType, String paymentInfo, Processor processor, byte paymentConfirmed) throws IOException, SQLException- Parameters:
timeType- EitherType.DATE(rounded to the date inType.DATE_TIME_ZONEtime zone) orType.TIME, which maintains up to microsecond accuracy and is time zone agnostic.time- The time of the transaction ornullto use the current date / time per the master database clock. The master database server is both NTP-synchronized and actively monitored, so it is best to let the master database choose the time when "now" or "today" is desired for the transaction.- Throws:
IOExceptionSQLException
-
get
public Transaction get(int transid) throws IOException, SQLException
- Specified by:
getin classCachedTableIntegerKey<Transaction>- Throws:
IOExceptionSQLException- See Also:
CachedTableIntegerKey.get(java.lang.Object)
-
clearCache
public void clearCache()
Description copied from class:CachedTableClears the cache, freeing up memory. The data will be reloaded upon next use.- Overrides:
clearCachein classCachedTable<Integer,Transaction>
-
getAccountBalance
public Monies getAccountBalance(Account account) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getActiveAccountBalance
public Monies getActiveAccountBalance(Account account, long currentTime) throws IOException, SQLException
Gets the active account balances for an account, including zero balances for any currency that has no transactions and is currently active in billing. A currency is active when any of the following is true:- Is part of the current
monthly chargesapplied to the account (seeAccount.getCanceled()andAccount.getBillingMonthlyRate()). - Has any existing
transactionin the currency and any of the following:- Account is active (see
Account.getCanceled()) - Account canceled less than a year ago
- Account has a non-zero balance in the currency
- Account has a
transactionin the currency within the last year
- Account is active (see
- Throws:
IOExceptionSQLException
- Is part of the current
-
getActiveAccountBalance
public Monies getActiveAccountBalance(Account account) throws IOException, SQLException
-
getAccountBalance
public Monies getAccountBalance(Account account, Timestamp before) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getConfirmedAccountBalance
public Monies getConfirmedAccountBalance(Account account) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getConfirmedAccountBalance
public Monies getConfirmedAccountBalance(Account account, Timestamp before) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getTransactionBalance
public Monies getTransactionBalance(Transaction transaction) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getTableID
public Table.TableID getTableID()
Description copied from class:AOServTableGets the unique identifier for this table. Each table has a unique identifier, as defined inSchemaTable.TableID.- Specified by:
getTableIDin classAOServTable<Integer,Transaction>- Returns:
- the identifier for this table
- See Also:
Table.TableID
-
get
public List<Transaction> get(TransactionSearchCriteria criteria) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getTransactions
public List<Transaction> getTransactions(Account account) throws IOException, SQLException
Gets transactions that have this account as their applied-to.- Throws:
IOExceptionSQLException
-
getTransactionsFrom
public List<Transaction> getTransactionsFrom(Account account) throws IOException, SQLException
Gets transactions that have this account as their source.- Throws:
IOExceptionSQLException
-
getTransactions
public List<Transaction> getTransactions(Administrator ba) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
handleCommand
public boolean handleCommand(String[] args, Reader in, TerminalWriter out, TerminalWriter err, boolean isInteractive) throws IllegalArgumentException, IOException, SQLException
- Overrides:
handleCommandin classAOServTable<Integer,Transaction>- Throws:
IllegalArgumentExceptionIOExceptionSQLException
-
-