Package com.storedobject.core
Class Tax
java.lang.Object
com.storedobject.core.StoredObject
com.storedobject.core.Tax
- All Implemented Interfaces:
Displayable,StringFiller,HasId
Represents a monetary tax amount computed for a given tax type and rate. When taxes are computed, for each calculation,
the resulting tax amount is stored in this class.
- Author:
- Syam
-
Field Summary
Fields inherited from class com.storedobject.core.StoredObject
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidConfigures the columns for the providedColumnsinstance by adding specific column definitions.getLabel()Generates and returns a label that combines the name of the tax type with the tax rate.getRate()Retrieves the rate as a percentage value.Retrieves the region information of the associated tax type.Retrieves the Id of the tax region of the associated tax type.getTax()Retrieves the tax amount associated with this entity.getType()Retrieves the tax type associated with the current tax instance.Retrieves the identifier representing the type.voidsetRate(Percentage rate) Sets the rate for this instance.voidSets the rate value by converting the provided object into aPercentageinstance.voidSets the tax value for the current Tax object.voidSets the tax value using the provided amount.voidSets the type for this Tax object using the specified type ID.voidSets the tax type by extracting and setting the ID from the provided TaxType object.voidsetType(BigDecimal idValue) Sets the type of the tax entity using the given id value.toString()Returns a string representation of the Tax object, combining its label and tax value.voidvalidate()Validates the object to ensure it is in an acceptable state before operations such as saving to the database are performed.voidValidates the tax data by ensuring all required fields, including the tax type, are properly set.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, getActor, 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, migrateLink, migrateLink, 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, toDisplay, transacting, undelete, undelete, undeleted, updated, user, userId, validateChildAttach, validateChildDetach, validateChildUpdate, validateDelete, validateInsert, validateParentAttach, validateParentDetach, validateParentUpdate, validateUndelete, validateUpdate, valueEquals
-
Constructor Details
-
Tax
public Tax()Default constructor for the Tax class. Initializes a new instance of the Tax object with no specific parameters.
-
-
Method Details
-
columns
Configures the columns for the providedColumnsinstance by adding specific column definitions.- Parameters:
columns- theColumnsinstance to which the columns should be added
-
setType
Sets the type for this Tax object using the specified type ID. Throws aSet_Not_Allowedexception if the type cannot be changed. Updates the tax rate based on the specified type ID.- Parameters:
typeId- TheIdrepresenting the type to set for this Tax object. If the type ID isnull, the rate is not updated.- Throws:
Set_Not_Allowed- if the type is not allowed to be set in the current state.
-
setType
Sets the type of the tax entity using the given id value.- Parameters:
idValue- The BigDecimal value representing the identifier of the type to be set.
-
setType
Sets the tax type by extracting and setting the ID from the provided TaxType object.- Parameters:
type- The TaxType object whose ID is to be set. If the provided TaxType is null, a null value will be set.
-
getTypeId
Retrieves the identifier representing the type.- Returns:
- The identifier of the type as an
Idobject.
-
getType
Retrieves the tax type associated with the current tax instance.- Returns:
- The tax type determined by the internal type identifier.
-
setRate
Sets the rate for this instance.- Parameters:
rate- The percentage rate to be set. It represents a value of typePercentage.
-
setRate
Sets the rate value by converting the provided object into aPercentageinstance.- Parameters:
value- The value to be converted to aPercentageand set as the rate.
-
getRate
Retrieves the rate as a percentage value.- Returns:
- The rate associated with this object, represented as a Percentage instance.
-
setTax
Sets the tax value for the current Tax object.- Parameters:
tax- the monetary amount representing the tax to be set
-
setTax
Sets the tax value using the provided amount. The value is converted to aMoneyinstance using theMoney.createmethod before storing it.- Parameters:
moneyValue- The monetary value to set as tax. It can be any object convertible toMoney.
-
getTax
-
validateData
Validates the tax data by ensuring all required fields, including the tax type, are properly set. If the tax type is null, an exception is thrown with the description of the missing value. Additionally, invokes the superclass's validation logic.- Overrides:
validateDatain classStoredObject- Parameters:
tm- TheTransactionManagerinstance to manage this validation process.- Throws:
Invalid_Value- If the tax type is not set.Exception- If the superclass validation or other validation logic encounters an issue.
-
validate
Validates the object to ensure it is in an acceptable state before operations such as saving to the database are performed. This method is overridden to enforce specific internal validation logic. It performs the following checks: 1. Verifies whether the object is marked as internal. If it is not internal, anInvalid_Stateexception is thrown with an error message indicating illegal access. 2. Invokes the superclass's `validate` method to ensure further state or business logic validation is executed. Note: Failing to call the superclass's `validate` method may result in a design error.- Overrides:
validatein classStoredObject- Throws:
Invalid_State- if the object is accessed illegally when not marked as internal.Exception- if any other conditions in the superclass validation fail.
-
toString
Returns a string representation of the Tax object, combining its label and tax value.- Overrides:
toStringin classStoredObject- Returns:
- A string composed of the label and the tax value, separated by a space.
-
getLabel
Generates and returns a label that combines the name of the tax type with the tax rate.- Returns:
- A string representing the label in the format "
@ ".
-
getRegion
-
getRegionId
-