Example #1
0
 /**
  * Vrátí zda je měna podporovaná
  *
  * @param currency
  * @return
  */
 @WebResult(name = "isSupported")
 @WebMethod(operationName = "isSupportedCurrency")
 public boolean isSupportedCurrency(@WebParam(name = "currency") String currency) {
   register();
   try {
     cz.cvut.felk.support.aos.sw.exchangerates.ExchangeRates port =
         service.getExchangeRatesImplPort();
     java.util.List<java.lang.String> currencies = port.getSupportedCurrencies();
     return currencies.contains(currency);
   } catch (Exception ex) {
     Logger.getLogger(ClearingService.class.getName()).log(Level.SEVERE, null, ex);
   }
   return false;
 }
Example #2
0
 /**
  * Převod peněz do jiné banky
  *
  * @param fromCurrency
  * @param toCurrency
  * @param amount
  * @return
  * @throws ClearingServiceException
  */
 @WebResult(name = "exchangedAmount")
 @WebMethod(operationName = "exchangeMoney")
 public BigDecimal exchangeMoney(
     @WebParam(name = "fromCurrency") String fromCurrency,
     @WebParam(name = "toCurrency") String toCurrency,
     @WebParam(name = "amount") BigDecimal amount)
     throws ClearingServiceException {
   register();
   try {
     cz.cvut.felk.support.aos.sw.exchangerates.ExchangeRates port =
         service.getExchangeRatesImplPort();
     java.math.BigDecimal exchangeRate = port.getExchangeRate(fromCurrency, toCurrency);
     return amount.multiply(exchangeRate);
   } catch (Exception ex) {
     Logger.getLogger(ClearingService.class.getName()).log(Level.SEVERE, null, ex);
     throw new ClearingServiceException("Jedna z měn není podporována");
   }
 }