Example usage for java.time LocalDate now

List of usage examples for java.time LocalDate now

Introduction

In this page you can find the example usage for java.time LocalDate now.

Prototype

public static LocalDate now() 

Source Link

Document

Obtains the current date from the system clock in the default time-zone.

Usage

From source file:com.hotelbeds.distribution.hotel_api_sdk.HotelApiClient.java

public RateCommentDetailsRS getRateCommentDetail(String rateCommentId) throws HotelApiSDKException {
    return getRateCommentDetail(LocalDate.now(), rateCommentId);
}

From source file:ch.algotrader.service.LookupServiceImpl.java

@Override
public List<Transaction> getDailyTransactions(int limit) {

    LocalDate today = LocalDate.now();
    return this.cacheManager.find(Transaction.class, "Transaction.findDailyTransactions", limit,
            QueryType.BY_NAME, new NamedParam("curdate", DateTimeLegacy.toLocalDate(today)));
}

From source file:com.omertron.slackbot.listeners.GoogleSheetsListener.java

public static void createGameNightMessage(SlackSession session, SlackChannel msgChannel) {
    LocalDate now = LocalDate.now();
    Period diff = Period.between(now, sheetInfo.getGameDate());

    switch (diff.getDays()) {
    case 0://from  www .ja va  2s  . co  m
        session.sendMessage(msgChannel, "Game night is tonight!! :grin:",
                GoogleSheetsListener.createGameInfo());
        break;
    case 1:
        session.sendMessage(msgChannel, "Game night is tomorrow! :smile:",
                GoogleSheetsListener.createGameInfo());
        break;
    default:
        session.sendMessage(msgChannel, GoogleSheetsListener.createSimpleNightMessage(sheetInfo, diff));
        break;
    }
}

From source file:ch.algotrader.service.LookupServiceImpl.java

@Override
public List<Transaction> getDailyTransactionsByStrategy(String strategyName, int limit) {

    Validate.notEmpty(strategyName, "Strategy name is empty");

    LocalDate today = LocalDate.now();
    return this.cacheManager.find(Transaction.class, "Transaction.findDailyTransactionsByStrategy", limit,
            QueryType.BY_NAME, new NamedParam("strategyName", strategyName),
            new NamedParam("curdate", DateTimeLegacy.toLocalDate(today)));
}

From source file:com.github.drbookings.ui.controller.MainController.java

private LocalDate getSelectedDate() {
    ObservableList<DateBean> selectedDate = tableView.getSelectionModel().getSelectedItems();
    if (logger.isDebugEnabled()) {
        logger.debug("Selected date: " + selectedDate);
    }//from  w  w  w  .  j a  v  a  2s .c  o  m
    LocalDate selectedDate2;
    if (selectedDate == null || selectedDate.isEmpty()) {
        selectedDate2 = LocalDate.now();
    } else {
        selectedDate2 = selectedDate.get(0).getDate();
    }
    return selectedDate2;
}

From source file:alfio.manager.EventManagerIntegrationTest.java

@Test
public void testUpdateBoundedFlagToTrue() {
    List<TicketCategoryModification> categories = Collections.singletonList(new TicketCategoryModification(null,
            "default", AVAILABLE_SEATS, new DateTimeModification(LocalDate.now(), LocalTime.now()),
            new DateTimeModification(LocalDate.now(), LocalTime.now()), DESCRIPTION, BigDecimal.TEN, false, "",
            false, null, null, null, null, null));
    Pair<Event, String> pair = initEvent(categories, organizationRepository, userManager, eventManager,
            eventRepository);//from   w ww  .j  a va 2 s.  c  o  m
    Event event = pair.getLeft();
    String username = pair.getRight();
    assertEquals(new Integer(AVAILABLE_SEATS), ticketRepository.countFreeTicketsForUnbounded(event.getId()));
    TicketCategory category = ticketCategoryRepository.findByEventId(event.getId()).get(0);
    Map<String, String> categoryDescription = ticketCategoryDescriptionRepository
            .descriptionForTicketCategory(category.getId());
    TicketCategoryModification tcm = new TicketCategoryModification(category.getId(), category.getName(),
            AVAILABLE_SEATS, DateTimeModification.fromZonedDateTime(category.getUtcInception()),
            DateTimeModification.fromZonedDateTime(category.getUtcExpiration()), categoryDescription,
            category.getPrice(), false, "", true, null, null, null, null, null);
    Result<TicketCategory> result = eventManager.updateCategory(category.getId(), event, tcm, username);
    assertTrue(result.isSuccess());
    assertEquals(new Integer(0), ticketRepository.countFreeTicketsForUnbounded(event.getId()));
}

From source file:ch.algotrader.service.LookupServiceImpl.java

@Override
public List<Order> getDailyOrders() {

    LocalDate today = LocalDate.now();
    return this.cacheManager.find(Order.class, "Order.findDailyOrders", QueryType.BY_NAME,
            new NamedParam("curdate", DateTimeLegacy.toLocalDate(today)));
}

From source file:ch.algotrader.service.LookupServiceImpl.java

@Override
public List<Order> getDailyOrdersByStrategy(String strategyName) {

    Validate.notEmpty(strategyName, "Strategy name is empty");

    LocalDate today = LocalDate.now();
    return this.cacheManager.find(Order.class, "Order.findDailyOrdersByStrategy", QueryType.BY_NAME,
            new NamedParam("strategyName", strategyName),
            new NamedParam("curdate", DateTimeLegacy.toLocalDate(today)));
}

From source file:alfio.manager.EventManagerIntegrationTest.java

@Test
public void testUpdateBoundedFlagToFalse() {
    List<TicketCategoryModification> categories = Collections.singletonList(new TicketCategoryModification(null,
            "default", AVAILABLE_SEATS, new DateTimeModification(LocalDate.now(), LocalTime.now()),
            new DateTimeModification(LocalDate.now(), LocalTime.now()), DESCRIPTION, BigDecimal.TEN, false, "",
            true, null, null, null, null, null));
    Pair<Event, String> pair = initEvent(categories, organizationRepository, userManager, eventManager,
            eventRepository);/*ww w .  j a v a  2 s  .c om*/
    Event event = pair.getLeft();
    String username = pair.getRight();
    assertEquals(new Integer(0), ticketRepository.countFreeTicketsForUnbounded(event.getId()));

    TicketCategory category = ticketCategoryRepository.findByEventId(event.getId()).get(0);
    Map<String, String> categoryDescription = ticketCategoryDescriptionRepository
            .descriptionForTicketCategory(category.getId());

    TicketCategoryModification tcm = new TicketCategoryModification(category.getId(), category.getName(),
            AVAILABLE_SEATS, DateTimeModification.fromZonedDateTime(category.getUtcInception()),
            DateTimeModification.fromZonedDateTime(category.getUtcExpiration()), categoryDescription,
            category.getPrice(), false, "", false, null, null, null, null, null);
    Result<TicketCategory> result = eventManager.updateCategory(category.getId(), event, tcm, username);
    assertTrue(result.isSuccess());
    assertEquals(AVAILABLE_SEATS, ticketRepository.countReleasedUnboundedTickets(event.getId()).intValue());
    waitingQueueSubscriptionProcessor.distributeAvailableSeats(event);
    assertEquals(AVAILABLE_SEATS, ticketRepository.countFreeTicketsForUnbounded(event.getId()).intValue());
}

From source file:alfio.manager.WaitingQueueManagerIntegrationTest.java

private List<TicketCategoryModification> getPreSalesTicketCategoryModifications(boolean firstBounded,
        int firstSeats, boolean lastBounded, int lastSeats) {
    LocalDateTime start = LocalDateTime.now().plusMinutes(4);
    return Arrays.asList(
            new TicketCategoryModification(null, "defaultFirst", firstSeats,
                    new DateTimeModification(start.toLocalDate(), start.toLocalTime()),
                    new DateTimeModification(LocalDate.now().plusDays(1), LocalTime.now()), DESCRIPTION,
                    BigDecimal.TEN, false, "", firstBounded, null, null, null, null, null),
            new TicketCategoryModification(null, "defaultLast", lastSeats,
                    new DateTimeModification(LocalDate.now().plusDays(1), LocalTime.now()),
                    new DateTimeModification(LocalDate.now().plusDays(2), LocalTime.now()), DESCRIPTION,
                    BigDecimal.TEN, false, "", lastBounded, null, null, null, null, null));
}