Package auction.model

Examples of auction.model.MonetaryAmount


    if (resultSet.wasNull()) return null;
    BigDecimal value = resultSet.getBigDecimal( names[0] );
        // When loading, take the currency from the database
    Currency currency = Currency.getInstance(resultSet.getString( names[1] ) );
        return new MonetaryAmount(value, currency);
  }
View Full Code Here


      throws HibernateException, SQLException {

    if (value==null) {
        statement.setNull(index, Types.NUMERIC);
    } else {
        MonetaryAmount amount = (MonetaryAmount) value;
            // When saving, convert to target currency
        MonetaryAmount dbAmount = MonetaryAmount.convert(amount, convertTo);
        statement.setBigDecimal( index, dbAmount.getValue() );
            statement.setString( index+1, convertTo.getCurrencyCode());
    }
  }
View Full Code Here

        BigDecimal value = resultSet.getBigDecimal( names[0] );
        if (resultSet.wasNull()) return null;
        Currency currency =
            Currency.getInstance(resultSet.getString( names[1] ) );
        return new MonetaryAmount(value, currency);
    }
View Full Code Here

        if (value==null) {
            statement.setNull(index, Hibernate.BIG_DECIMAL.sqlType());
            statement.setNull(index+1, Hibernate.CURRENCY.sqlType());
        } else {
            MonetaryAmount amount = (MonetaryAmount) value;
            String currencyCode =
                        amount.getCurrency().getCurrencyCode();
            statement.setBigDecimal( index, amount.getValue() );
            statement.setString( index+1, currencyCode );
        }
    }
View Full Code Here

                            Hibernate.CURRENCY };
  }

  public Object getPropertyValue(Object component,
                   int property) {
        MonetaryAmount monetaryAmount = (MonetaryAmount) component;
        if (property == 0)
            return monetaryAmount.getValue();
        else
            return monetaryAmount.getCurrency();
  }
View Full Code Here

        // Make a new auction item persistent
        Calendar startDate = GregorianCalendar.getInstance();
        Calendar endDate = GregorianCalendar.getInstance();
        endDate.add(Calendar.DAY_OF_YEAR, 3);

        MonetaryAmount initialPrice =
            new MonetaryAmount(new BigDecimal(123), Currency.getInstance("USD"));
        MonetaryAmount reservePrice =
            new MonetaryAmount(new BigDecimal(333), Currency.getInstance("USD"));

        Item newItem =
            new Item( "Testitem", "Test Description", user,
                      initialPrice, reservePrice,
                      startDate.getTime(), endDate.getTime() );
View Full Code Here

        // Make a new auction item persistent
        Calendar startDate = GregorianCalendar.getInstance();
        Calendar endDate = GregorianCalendar.getInstance();
        endDate.add(Calendar.DAY_OF_YEAR, 3);

        MonetaryAmount initialPrice =
            new MonetaryAmount(new BigDecimal(123), Currency.getInstance("USD"));
        MonetaryAmount reservePrice =
            new MonetaryAmount(new BigDecimal(333), Currency.getInstance("USD"));

        Item newItem =
            new Item( "Testitem", "Test Description", user,
                      initialPrice, reservePrice,
                      startDate.getTime(), endDate.getTime() );
View Full Code Here

TOP

Related Classes of auction.model.MonetaryAmount

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.