public interface RateHandler
RateTypeHandler and its child classes.| Modifier and Type | Method and Description |
|---|---|
<T extends Transfer> |
applyTransfer(T transfer)
Applies a transfer, that is:
gets the rate from the fromAccount
sets those to the transfer
There is nothing saved to any accounts, as this happens only at account closing.
|
<T extends ObservableBean> |
bigDecimalResolverForRates(Property<java.math.BigDecimal,? super T> property)
provides a standard BigDecimalScaleResolver for rates.
|
void |
copy(HasRates source,
HasRates destination)
Copies rate fields from one HasRates to another.
|
void |
copy(RatedEntity source,
RatedEntity destination)
copies all rate fields from one RatedEntity to another.
|
org.cyclos.impl.banking.FromRatesData |
getFromRates(Account fromAccount,
TransferType transferType,
java.math.BigDecimal amount,
java.util.Date date,
RateVisibility visibility)
gets the rates of a from account for a transaction.
|
org.cyclos.impl.banking.RatesData |
getRates(Account account,
java.util.Date time,
RateVisibility visibility)
gets the rates of the account on the given date, according to the RateVisibility param.
|
boolean |
isAnyRateEnabled(Currency currency,
java.util.Date time)
Checks if any rate is enabled on the given date/time and for the given currency.
|
boolean |
isVisible(Currency currency,
java.util.Date date)
Determines if any rate is to be shown to users.
|
void |
resetCurrency(Currency entity)
Resets the currency entity to its RateParameters.
|
void |
resolveValidator(org.cyclos.impl.utils.validation.Validator validator,
CurrencyDTO dto)
gets the nested validator for the currency's rateparameters.
|
void |
setRateParametersToCurrencyDTO(CurrencyDTO result)
sets the RateParameters correctly to the currencyDTO, by:
gets the specific RateParametersDTO from the CurrencyDTO
if it exists, sets the
enabledOnForm property of the RateParametersDTO to true. |
void |
toEntity(Currency target,
CurrencyDTO dto)
sets the RateParameters entities to the Currency entity
|
<T extends Transfer> void applyTransfer(T transfer) throws FrameworkException
transfer - the transfer to be applied.FrameworkException<T extends ObservableBean> org.cyclos.impl.utils.BigDecimalScaleResolver<T> bigDecimalResolverForRates(Property<java.math.BigDecimal,? super T> property)
void copy(HasRates source, HasRates destination) throws FrameworkException
FrameworkExceptionvoid copy(RatedEntity source, RatedEntity destination)
org.cyclos.impl.banking.FromRatesData getFromRates(Account fromAccount, TransferType transferType, java.math.BigDecimal amount, java.util.Date date, RateVisibility visibility)
FromRatesData.changedDueToCreation is set to true.
This does NOT happen in case of an unlimited account.fromAccount - the account which is the from account of the transfertransferType - the transfertype of the transferamount - the transfer amountdate - the processing date of the transfer; if null, now is used.visibility - the visibility to be applied. This is usually RateVisibility.PARAMS in case the
result is to be shown directly to users, or RateVisibility.ALL in case it is further processed in a transfer.org.cyclos.impl.banking.RatesData getRates(Account account, java.util.Date time, RateVisibility visibility) throws FrameworkException
account - the account. May not be nullvisibility - FrameworkExceptionboolean isAnyRateEnabled(Currency currency, java.util.Date time) throws FrameworkException
currency - - If null then it checks it for all the currencies available on the network, and will return true
if any of those currencies is found with any of the rates enabled.time - - if null checks it for now.FrameworkExceptionboolean isVisible(Currency currency, java.util.Date date)
currency - - If null then it checks it for all the currencies available on the network, and will return true
if any of those currencies applies.date - - if null checks it for now.void resetCurrency(Currency entity) throws FrameworkException
FrameworkExceptionvoid resolveValidator(org.cyclos.impl.utils.validation.Validator validator,
CurrencyDTO dto)
throws FrameworkException
FrameworkExceptionvoid setRateParametersToCurrencyDTO(CurrencyDTO result) throws FrameworkException
enabledOnForm property of the RateParametersDTO to true. This is needed for a correct handling on the
currency details form.
FrameworkExceptionvoid toEntity(Currency target, CurrencyDTO dto) throws FrameworkException
target - the Currency entity to which the RateParameters must be setdto - the CurrencyDTO from which the currency was retrieved, and which is used to read the RateParametersDTOFrameworkException