Package com.storedobject.core
Class Account
java.lang.Object
com.storedobject.core.StoredObject
com.storedobject.core.Account
- All Implemented Interfaces:
Displayable,StringFiller,HasId,HasName,OfEntity
- Direct Known Subclasses:
AccountTitle,BranchAccount,EntityAccount,OffsetAccount
This class represents an Account. Account has a status (
getAccountStatus()) which is a bit pattern with
following values:
0: [Account level] 0 = Active, 1 = Closed
2,1: [Account level, Overrides 10,9] 00 = Bits 10,9 applicable, 01 = Debits allowed (credit blocked),
10 = Credits allowed (debits blocked), 11 = Frozen
3: [Chart level] 0 = Balance control is not strict, 1 = Strict balance control
4: [Chart level] (Strictly applied if bit 3 = 1) 0 = Debit balance, 1 = Credit balance
6,5: [Chart level] 00 = BS item, 01 = PL item, 10 = Stock item, 11 = Contingent.
7: [Chart level] 0 = Normal, 1 = Deep frozen (No transactions, no way to override).
8: [Chart level] 0 = No limit check, 1 = Limit check
10,9: [Chart level] 00 = Debit and credit trans allowed, 01 = Generally debited, 10 = Generally credited, 11 = Frozen
-
Field Summary
FieldsFields inherited from class com.storedobject.core.StoredObject
logger -
Constructor Summary
ConstructorsConstructorDescriptionAccount()Constructs a local currency Account.Constructs an Account in local currency.Constructs an Account in local currency.Constructs an Account.Constructs an Account. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddToOpeningBalance(TransactionManager tm, Money amount) final voidaddToOpeningBalance(TransactionManager tm, Money amount, Money localCurrencyAmount) final voidallow(Transaction transaction, boolean debit, boolean credit) static String[]final voidclose(Transaction transaction) static voidfinal MoneycreateAmount(BigDecimal amount) final MoneycreateLocalCurrencyAmount(BigDecimal amount) static String[]static Accountget(SystemEntity systemEntity, String name) final Stringfinal intfinal Moneyfinal MoneygetBalance(Date date) static <A extends Account>
AgetByNameOrNumber(SystemEntity systemEntity, Class<A> accountClass, String nameOrNumber, boolean any) final AccountChartgetChart()final Idfinal CurrencyGets the currency.static AccountgetLedger(DatePeriod period) final CurrencyGets the local currency.final Moneyfinal MoneygetLocalCurrencyBalance(Date date) final Moneyfinal Moneyfinal StringgetName()Get the name.final Stringfinal Moneyfinal MoneygetOpeningBalance(Date date) final Stringstatic StringgetStatusDescription(int accountStatus) final SystemEntityGets the System Entity.final IdGets the Id of the System Entity.getTitle()Get the title of the account.static voidfinal booleanisClosed()final booleanfinal booleanstatic ObjectIterator<? extends Account> list(SystemEntity systemEntity, String name) static <A extends Account>
ObjectIterator<A> listByNameOrNumber(SystemEntity systemEntity, Class<A> accountClass, String nameOrNumber, boolean any) static String[]static voidreadOnlyColumns(ColumnNames columnNames) final voidrefresh()Refreshes the balance and account status from the database.final voidreopen(Transaction transaction) static String[]final voidsetAccountStatus(int accountStatus) Set the account status.voidsetAlternateNumber(String alternateNumber) final voidsetBalance(Object balance) final voidsetChart(AccountChart chart) final voidfinal voidsetChart(BigDecimal chartId) final voidsetCurrency(String currency) Sets the currency.final voidsetCurrency(Currency currency) Sets the currency.final voidsetLocalCurrencyBalance(Object localCurrencyBalance) final voidsetLocalCurrencyOpeningBalance(Object localCurrencyOpeningBalance) voidfinal voidfinal voidsetOpeningBalance(TransactionManager tm, Money amount) final voidsetOpeningBalance(TransactionManager tm, Money amount, Money localCurrencyAmount) final voidsetOpeningBalance(Object openingBalance) final voidsetSystemEntity(Id systemEntityId) final voidsetSystemEntity(SystemEntity systemEntity) final voidsetSystemEntity(BigDecimal idValue) Display representation of the instance used for human-friendly display.final StringtoString()String representation of the instance.protected voidValidate account status to make sure that every status bit value adheres to the type of account.voidThe system will invoke this whenever the object is saved to the DB.voidThis method will be invoked whenever an existing instance is deleted from the database.Methods inherited from class com.storedobject.core.StoredObject
addLink, addLink, addLink, addLink, addLink, addLink, addLink, addLink, checkCurrency, checkCurrency, checkForDuplicate, checkForDuplicate, checkTimeZone, checkTransaction, clearObjectLinks, contemporary, copy, copy, count, count, count, count, count, count, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, create, created, delete, delete, delete, deleted, directUpdate, equals, exists, exists, exists, exists, exists, existsFileData, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsMaster, existsMaster, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, family, family, family, family, fill, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, getAttachment, getAttachmentId, getChildren, getContemporaryOf, getDeleted, getDeleted, getExistsCondition, getExistsCondition, getFileData, getFileData, getHistorical, getId, getKeyIndex, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getNotExistsCondition, getNotExistsCondition, getParent, getParent, getParent, getParentId, getParentId, getParentId, getRelated, getRelated, getTransaction, getTransactionId, getTransactionIP, getUnique, getUniqueCondition, hashCode, inserted, isModified, isVirtual, list, list, list, list, list, list, list, list, list, list, list, list, list, listDeletedIds, listFileData, listFileData, listHistory, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listTree, listTree, listTree, listTree, listViaQuery, listViaQuery, load, load, load, load, loadAttributesFrom, loaded, loading, makeNew, makeVirtual, migrate, moduleName, nextVersion, objectLink, objectLink, objectLink, objectLinks, objectLinks, old, person, previousVersion, previousVersion, query, query, query, query, query, query, query, query, query, query, query, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, reload, reload, reloaded, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeReverseLinks, removeReverseLinks, save, save, save, save, save, save, save, save, save, save, save, save, save, save, save, saved, saving, setMaster, setRawValue, setTransaction, stringify, tableName, timestamp, toCode, transacting, undelete, undelete, undeleted, updated, user, userId, validate, validateChildAttach, validateChildDetach, validateChildUpdate, validateInsert, validateParentAttach, validateParentDetach, validateParentUpdate, validateUndelete, validateUpdate, valueEqualsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.storedobject.core.OfEntity
check, findSystemEntityId
-
Field Details
-
number
-
-
Constructor Details
-
Account
-
Account
-
Account
-
Account
-
Account
public Account()Constructs a local currency Account.
-
-
Method Details
-
columns
-
readOnlyColumns
-
indices
-
displayColumns
-
browseColumns
-
searchColumns
-
protectedColumns
-
getAccountNumber
-
refresh
public final void refresh()Refreshes the balance and account status from the database. -
getLocalCurrency
-
getCurrency
-
setCurrency
Sets the currency.- Parameters:
currency- The currency.
-
setCurrency
Sets the currency.- Parameters:
currency- The currency.
-
getSystemEntityId
Gets the Id of the System Entity.- Specified by:
getSystemEntityIdin interfaceOfEntity- Returns:
- The Id of the System Entity
-
setSystemEntity
-
setSystemEntity
-
setSystemEntity
- Specified by:
setSystemEntityin interfaceOfEntity
-
getSystemEntity
Gets the System Entity.- Specified by:
getSystemEntityin interfaceOfEntity- Returns:
- The System Entity
-
setBalance
-
getBalance
-
getBalance
-
setLocalCurrencyBalance
-
getLocalCurrencyBalance
-
getLocalCurrencyBalance
-
setOpeningBalance
-
getOpeningBalance
-
getOpeningBalance
-
setLocalCurrencyOpeningBalance
-
getLocalCurrencyOpeningBalance
-
getLocalCurrencyOpeningBalance
-
isLocalCurrency
public final boolean isLocalCurrency() -
isForeignCurrency
public final boolean isForeignCurrency() -
getAccountStatus
-
setAccountStatus
public final void setAccountStatus(int accountStatus) Set the account status. If invoked on an active account, this will throw a run-time exception unless it is a virtual instance.- Parameters:
accountStatus- Status to set.
-
close
- Throws:
Exception
-
reopen
- Throws:
Exception
-
allow
- Throws:
Exception
-
isClosed
public final boolean isClosed() -
getStatusDescription
-
getStatusDescription
-
validateData
Description copied from class:StoredObjectThe system will invoke this whenever the object is saved to the DB. It will be invoked in all cases while creating new objects and updating/deleting/undeleting existing objects. If any exception is raised by this method, the process of saving to the DB will be abandoned.
Note: This method is mainly used to validate the data of all attributes of the object, and it may be used by others for validating the object. For example, front-end data-entry systems can use this method for validating the object.
- Overrides:
validateDatain classStoredObject- Parameters:
tm- Current transaction manager.- Throws:
Exception- If data is invalid.
-
validateAccountStatus
-
validateDelete
Description copied from class:StoredObjectThis method will be invoked whenever an existing instance is deleted from the database. So, it will be called within an active transaction. Child classes can override this method to do validation when an existing instance is deleted from the database.Note: When overridden "super" should be called, otherwise, a "design error" will occur.
Also, see
StoredObject.validate().- Overrides:
validateDeletein classStoredObject- Throws:
Exception- By raising an exception from this method, the current transaction can be abandoned.
-
getName
-
setName
-
getNumber
-
setNumber
-
getAlternateNumber
-
setAlternateNumber
-
setChart
-
setChart
-
setChart
-
getChartId
-
getChart
-
getTitle
-
toString
Description copied from class:StoredObjectString representation of the instance. Mostly used for logging purposes.- Overrides:
toStringin classStoredObject- Returns:
- String representation of the instance.
-
toDisplay
Description copied from class:StoredObjectDisplay representation of the instance used for human-friendly display.- Specified by:
toDisplayin interfaceDisplayable- Overrides:
toDisplayin classStoredObject- Returns:
- Display representation of the instance.
-
toSubstring
-
createAmount
-
createLocalCurrencyAmount
-
setOpeningBalance
- Throws:
Exception
-
setOpeningBalance
public final void setOpeningBalance(TransactionManager tm, Money amount, Money localCurrencyAmount) throws Exception - Throws:
Exception
-
addToOpeningBalance
- Throws:
Exception
-
addToOpeningBalance
public final void addToOpeningBalance(TransactionManager tm, Money amount, Money localCurrencyAmount) throws Exception - Throws:
Exception
-
getByNameOrNumber
public static <A extends Account> A getByNameOrNumber(SystemEntity systemEntity, Class<A> accountClass, String nameOrNumber, boolean any) -
listByNameOrNumber
public static <A extends Account> ObjectIterator<A> listByNameOrNumber(SystemEntity systemEntity, Class<A> accountClass, String nameOrNumber, boolean any) -
get
-
list
-
getFor
-
getLedger
-
getLedger
-
actionPrefixForUI
-