Пример #1
0
  public ConstrainByDate writeTimeConstrain(ConstrainDateType from, ConstrainDateType to) {
    ConstrainByDate timeConstrain = new ConstrainByDate();
    DTOFactory dtoFactory = new DTOFactory();

    // ConstrainDateType constraindateType = new ConstrainDateType();
    // constraindateType.setValue(dtoFactory.getXMLGregorianCalendarDate(
    // endYear(),
    // endMonth(), endDay()));
    Calendar cal = Calendar.getInstance();
    if (from != null) {
      timeConstrain.setDateFrom(from);
      startYear = from.getValue().getYear();
      startMonth = from.getValue().getMonth();
      startDay = from.getValue().getDay();
      cal.set(startYear, startMonth, startDay);
      startTime = cal.getTimeInMillis(); // new Date(startYear,
      // startMonth,
      // startDay).getTime();
      // startTime(from.getTime().
    }
    if (to != null) {
      timeConstrain.setDateTo(to);
      endYear = to.getValue().getYear();
      endMonth = to.getValue().getMonth();
      endDay = to.getValue().getDay();
      cal.set(endYear, endMonth, endDay);
      endTime = cal.getTimeInMillis(); // new Date(startYear, startMonth,
      // startDay).getTime();

    }
    return timeConstrain;
  }
Пример #2
0
  public void setTimeConstrain(ConstrainDateType from, ConstrainDateType to) {

    Calendar cal = Calendar.getInstance();
    if (from != null) {

      startYear = from.getValue().getYear();
      startMonth = from.getValue().getMonth() - 1;
      startDay = from.getValue().getDay();
      cal.set(startYear, startMonth, startDay);
      startTime = cal.getTimeInMillis();
    }
    if (to != null) {

      endYear = to.getValue().getYear();
      endMonth = to.getValue().getMonth() - 1;
      endDay = to.getValue().getDay();
      cal.set(endYear, endMonth, endDay);
      endTime = cal.getTimeInMillis();
    }
  }