use of org.broadleafcommerce.common.currency.util.CurrencyCodeIdentifiable in project BroadleafCommerce by BroadleafCommerce.
the class MoneyFieldPersistenceProvider method getCurrency.
@Override
protected Currency getCurrency(ExtractValueRequest extractValueRequest, Property property) {
String currencyCodeField = extractValueRequest.getMetadata().getCurrencyCodeField();
if (!StringUtils.isEmpty(currencyCodeField)) {
try {
return Currency.getInstance((String) extractValueRequest.getFieldManager().getFieldValue(extractValueRequest.getEntity(), currencyCodeField));
} catch (Exception e) {
// do nothing
}
}
if (extractValueRequest.getEntity() instanceof CurrencyCodeIdentifiable) {
try {
return Currency.getInstance(((CurrencyCodeIdentifiable) extractValueRequest.getEntity()).getCurrencyCode());
} catch (Exception e) {
// do nothing
}
}
BroadleafRequestContext brc = BroadleafRequestContext.getBroadleafRequestContext();
return brc.getJavaCurrency();
}
Aggregations