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 void
addToOpeningBalance
(TransactionManager tm, Money amount) final void
addToOpeningBalance
(TransactionManager tm, Money amount, Money localCurrencyAmount) final void
allow
(Transaction transaction, boolean debit, boolean credit) static String[]
final void
close
(Transaction transaction) static void
final Money
createAmount
(BigDecimal amount) final Money
createLocalCurrencyAmount
(BigDecimal amount) static String[]
static Account
get
(SystemEntity systemEntity, String name) final String
final int
final Money
final Money
getBalance
(Date date) static <A extends Account>
AgetByNameOrNumber
(SystemEntity systemEntity, Class<A> accountClass, String nameOrNumber, boolean any) final AccountChart
getChart()
final Id
final Currency
Gets the currency.static Account
getLedger
(DatePeriod period) final Currency
Gets the local currency.final Money
final Money
getLocalCurrencyBalance
(Date date) final Money
final Money
final String
getName()
Get the name.final String
final Money
final Money
getOpeningBalance
(Date date) final String
static String
getStatusDescription
(int accountStatus) final SystemEntity
Gets the System Entity.final Id
Gets the Id of the System Entity.getTitle()
Get the title of the account.static void
final boolean
isClosed()
final boolean
final boolean
static 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 void
readOnlyColumns
(ColumnNames columnNames) final void
refresh()
Refreshes the balance and account status from the database.final void
reopen
(Transaction transaction) static String[]
final void
setAccountStatus
(int accountStatus) Set the account status.void
setAlternateNumber
(String alternateNumber) final void
setBalance
(Object balance) final void
setChart
(AccountChart chart) final void
final void
setChart
(BigDecimal chartId) final void
setCurrency
(String currency) Sets the currency.final void
setCurrency
(Currency currency) Sets the currency.final void
setLocalCurrencyBalance
(Object localCurrencyBalance) final void
setLocalCurrencyOpeningBalance
(Object localCurrencyOpeningBalance) void
final void
final void
setOpeningBalance
(TransactionManager tm, Money amount) final void
setOpeningBalance
(TransactionManager tm, Money amount, Money localCurrencyAmount) final void
setOpeningBalance
(Object openingBalance) final void
setSystemEntity
(Id systemEntityId) final void
setSystemEntity
(SystemEntity systemEntity) final void
setSystemEntity
(BigDecimal idValue) Display representation of the instance used for human-friendly display.final String
toString()
String representation of the instance.protected void
Validate account status to make sure that every status bit value adheres to the type of account.void
This will be invoked by the system whenever the object is saved to the DB.void
This 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, fill, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, getAttachment, getAttachmentId, getChildren, 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, 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, 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, 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, valueEquals
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:
getSystemEntityId
in interfaceOfEntity
- Returns:
- The Id of the System Entity
-
setSystemEntity
-
setSystemEntity
-
setSystemEntity
- Specified by:
setSystemEntity
in interfaceOfEntity
-
getSystemEntity
Gets the System Entity.- Specified by:
getSystemEntity
in 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:StoredObject
This will be invoked by the system whenever the object is saved to the DB. It will be invoked in all cases, while creating new objects and updating/deleting/un-deleting 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:
validateData
in classStoredObject
- Parameters:
tm
- Current transaction manager.- Throws:
Exception
- If data is invalid.
-
validateAccountStatus
-
validateDelete
Description copied from class:StoredObject
This 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:
validateDelete
in 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:StoredObject
String representation of the instance. Mostly used for logging purposes.- Overrides:
toString
in classStoredObject
- Returns:
- String representation of the instance.
-
toDisplay
Description copied from class:StoredObject
Display representation of the instance used for human-friendly display.- Specified by:
toDisplay
in interfaceDisplayable
- Overrides:
toDisplay
in 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
-