Package com.xebia.lottery.shared

Examples of com.xebia.lottery.shared.LotteryInfo


    public LotteryCreatedEventHandler() {
        super(LotteryCreatedEvent.class);
    }

    public void handleMessage(LotteryCreatedEvent message) {
        LotteryInfo info = message.getInfo();
        simpleJdbcTemplate.update("insert into lottery(id, version, name, drawing_timestamp, prize_amount, ticket_price) values (?, ?, ?, ?, ?, ?)",
                message.getAggregateRootId().getId(),
                message.getAggregateRootId().getVersion(),
                info.getName(),
                info.getDrawingTimestamp(),
                info.getPrizeAmount(),
                info.getTicketPrice());
    }
View Full Code Here


           
            private static final long serialVersionUID = 1L;
           
            @Override
            protected void populateItem(final ListItem<LotteryInfoQueryResult> item) {
                LotteryInfo info = item.getModelObject().getLotteryInfo();
                item.add(new Label("name", info.getName()));
                item.add(new Label("drawingTimestamp", formatDate(info.getDrawingTimestamp())));
                item.add(new Label("prizeAmount", String.valueOf(info.getPrizeAmount())));
                item.add(new Label("ticketPrice", String.valueOf(info.getTicketPrice())));
                item.add(new Link<Void>("drawLottery") {
                    private static final long serialVersionUID = 1L;
                   
                    @SpringBean private Bus bus;
                   
View Full Code Here

            add(new TextField<Double>("ticketPrice").setRequired(true));
        }
       
        @Override
        protected void onSubmit() {
            Response response = bus.sendAndWaitForResponse(new CreateLotteryCommand(VersionedId.random(), new LotteryInfo(name, drawingTimestamp, prizeAmount, ticketPrice)));
            System.err.println("response: " + response);
            setResponsePage(LotteriesPage.class);
        }
View Full Code Here

    public List<LotteryInfoQueryResult> findUpcomingLotteries() {
        return simpleJdbcTemplate.query("select id, version, name, drawing_timestamp, prize_amount, ticket_price from lottery order by name", new ParameterizedRowMapper<LotteryInfoQueryResult>() {
            public LotteryInfoQueryResult mapRow(ResultSet rs, int rowNum) throws SQLException {
                return new LotteryInfoQueryResult(
                        VersionedId.forSpecificVersion(UUID.fromString(rs.getString("id")), rs.getLong("version")),
                        new LotteryInfo(
                                rs.getString("name"),
                                new Date(rs.getTimestamp("drawing_timestamp").getTime()),
                                rs.getDouble("prize_amount"),
                                rs.getDouble("ticket_price")));
            }
View Full Code Here

TOP

Related Classes of com.xebia.lottery.shared.LotteryInfo

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.