private void initialization() {

    Date value = getValue();

    dayToSelectList.clear();
    hourToSelectList.clear();

    SingleSelectionSpinner<DayToSelect> daySelector =
        (SingleSelectionSpinner<DayToSelect>) findViewById(R.id.datePicker1);
    SingleSelectionSpinner<HourToSelect> hourSelector =
        (SingleSelectionSpinner<HourToSelect>) findViewById(R.id.timePicker1);

    // build date
    LocalDateTime now = startDate;
    now = now.withMillisOfDay(0);
    now = now.withHourOfDay(0);

    for (int i = 0; i < maxDay; i++) {
      dayToSelectList.add(new DayToSelect(now, now.getDayOfMonth() + "/" + now.getMonthOfYear()));
      now = now.plusDays(1);
    }

    daySelector.setItems(dayToSelectList);

    // build date
    for (int i = 0; i <= 24; i++) {
      hourToSelectList.add(new HourToSelect(i, i + ":00"));
    }

    hourSelector.setItems(hourToSelectList);

    if (value != null) {
      setValue(value);
    }
  }
 public List<GameEntity> findByNearDays(LocalDateTime gameTime) {
   return getSession()
       .createCriteria(GameEntity.class)
       .setFetchMode("odds", FetchMode.SELECT)
       .add(Restrictions.between("gameTime", gameTime, gameTime.plusDays(1)))
       .list();
 }
 public List<GameEntity> findGameOnComing() {
   LocalDateTime today = LocalDate.now().toLocalDateTime(new LocalTime(0, 0));
   return getSession()
       .createCriteria(GameEntity.class)
       .setFetchMode("odds", FetchMode.SELECT)
       .add(Restrictions.between("gameTime", today, today.plusDays(3)))
       .list();
 }
 public List<GameEntity> findFinishedGameToday() {
   LocalDateTime today = LocalDate.now().toLocalDateTime(new LocalTime(0, 0));
   Criterion isEnd = Restrictions.eq("isEnd", true);
   Criterion gameStatus = Restrictions.eq("gameStatus", 2L);
   return getSession()
       .createCriteria(GameEntity.class)
       .setFetchMode("odds", FetchMode.SELECT)
       .add(Restrictions.between("gameTime", today, today.plusDays(1)))
       .add(Restrictions.or(isEnd, gameStatus))
       .list();
 }
  // 找出當天比賽所有的投注一個list 是一場比賽的投注集合,list<list...>是多場比賽的投注集合
  public List<GameEntity> findGameByLocalDate(LocalDate gameTime) {
    LocalDateTime gameTimeLocalDateTime = gameTime.toLocalDateTime(new LocalTime(0, 0));

    Criterion lessEqualGameTime =
        Restrictions.between("gameTime", gameTimeLocalDateTime, gameTimeLocalDateTime.plusDays(1));
    return getSession()
        .createCriteria(GameEntity.class)
        .setFetchMode("odds", FetchMode.SELECT)
        .add(lessEqualGameTime)
        /*.setProjection(Projections.property("odds"))*/
        .list();
  }
  /*
   * (non-Javadoc)
   *
   * @see WorkflowStep#invoke(WorkflowContext)
   */
  @Override
  public WorkflowContext invoke(WorkflowContext context) {
    LOGGER.info("AgrFlexOfferStub: started");
    List<FlexOfferDto> outputFlexOffers = new ArrayList<>();

    @SuppressWarnings("unchecked")
    List<FlexRequestDto> inputFlexRequests =
        (List<FlexRequestDto>)
            context.getValue(
                FlexOfferDetermineFlexibilityStepParameter.IN.FLEX_REQUEST_DTO_LIST.name());

    /*
     * For each give flex request, choose to: - create an offer, - do not create offer at all, - do not create offer now.
     */
    int decision;
    for (FlexRequestDto flexRequestDto : inputFlexRequests) {
      decision = 1; // original: RANDOM.nextInt(3); // 0,1 or 2
      FlexOfferDto flexOfferDto = new FlexOfferDto();
      flexOfferDto.setFlexRequestSequenceNumber(flexRequestDto.getSequenceNumber());
      flexOfferDto.setExpirationDateTime(
          now.plusDays(FLEX_OFFER_EXPIRATION_DAYS).withTime(0, 0, 0, 0));
      if (decision == 0) {
        // create a flex offer for the flex request: put a populated flex offer.
        LOGGER.debug(
            "A new FlexOffer will be created for FlexRequest with sequence [{}]",
            flexRequestDto.getSequenceNumber());
        populateFlexOfferDto(flexOfferDto, flexRequestDto, true);
        outputFlexOffers.add(flexOfferDto);
      } else if (decision == 1) {
        // refuse to create an offer for the flex request: put an empty flex offer.
        LOGGER.debug(
            "An empty FlexOffer will be created for FlexRequest with sequence [{}]",
            flexRequestDto.getSequenceNumber());
        populateFlexOfferDto(flexOfferDto, flexRequestDto, false);
        outputFlexOffers.add(flexOfferDto);
      } else {
        // do not create a flex offer now: don't put anything new in the output list.
        LOGGER.debug(
            "No FlexOffer will be created now for FlexRequest with sequence [{}]",
            flexRequestDto.getSequenceNumber());
      }
    }
    context.setValue(
        FlexOfferDetermineFlexibilityStepParameter.OUT.FLEX_OFFER_DTO_LIST.name(),
        outputFlexOffers);
    LOGGER.info("AgrFlexOfferStub: complete");
    return context;
  }