Package org.projectforge.common

Examples of org.projectforge.common.DateHolder


      myFilter = (TimesheetFilter) filter;
    } else {
      myFilter = new TimesheetFilter(filter);
    }
    if (myFilter.getStopTime() != null) {
      final DateHolder date = new DateHolder(myFilter.getStopTime());
      date.setEndOfDay();
      myFilter.setStopTime(date.getDate());
    }
    final QueryFilter queryFilter = buildQueryFilter(myFilter);
    List<TimesheetDO> result = getList(queryFilter);
    if (result == null) {
      return null;
View Full Code Here


    for (final TaskNode node : list) {
      final Date date = node.getTask().getProtectTimesheetsUntil();
      if (date == null) {
        continue;
      }
      final DateHolder dh = new DateHolder(date);
      dh.setEndOfDay();
      if (timesheet.getStartTime().before(dh.getDate()) == true) {
        if (throwException == true) {
          throw new AccessException("timesheet.error.timesheetProtectionVioloation", node.getTask().getTitle()
              + " (#"
              + node.getTaskId()
              + ")", DateHelper.formatIsoDate(dh.getDate()));
        }
        return false;
      }
    }
    return true;
View Full Code Here

    final String s = "select distinct location from "
        + clazz.getSimpleName()
        + " t where deleted=false and t.user.id = ? and lastUpdate > ? and lower(t.location) like ?) order by t.location";
    final Query query = getSession().createQuery(s);
    query.setInteger(0, PFUserContext.getUser().getId());
    final DateHolder dh = new DateHolder();
    dh.add(Calendar.YEAR, -1);
    query.setDate(1, dh.getDate());
    query.setString(2, "%" + StringUtils.lowerCase(searchString) + "%");
    final List<String> list = query.list();
    return list;
  }
View Full Code Here

    log.info("Get recent locations from the database.");
    final String s = "select location from "
        + (clazz.getSimpleName() + " t where deleted=false and t.user.id = ? and lastUpdate > ? and t.location != null and t.location != '' order by t.lastUpdate desc");
    final Query query = getSession().createQuery(s);
    query.setInteger(0, PFUserContext.getUser().getId());
    final DateHolder dh = new DateHolder();
    dh.add(Calendar.YEAR, -1);
    query.setDate(1, dh.getDate());
    final List<Object> list = query.list();
    int counter = 0;
    final List<String> res = new ArrayList<String>();
    for (final Object loc : list) {
      if (res.contains(loc) == true) {
View Full Code Here

    }
    if (week != null) {
      getData().setWeek(week);
    }
    if (getData().getWeek() != null) {
      final DateHolder date = new DateHolder(getData().getWeek(), ConfigXml.getInstance().getDefaultLocale());
      if (date.isBeginOfWeek() == false) {
        date.setBeginOfWeek();
        getData().setWeek(date.getSQLDate());
      }
    } else {
      // Get week of last edited entry as default.
      final Object obj = getUserPrefEntry(SESSION_KEY_RECENT_WEEK);
      if (obj instanceof Long) {
View Full Code Here

      @SuppressWarnings("serial")
      final Link<Object> link = new Link<Object>("resourceLink") {
        @Override
        public void onClick()
        {
          final DateHolder date = new DateHolder(startTime);
          final Long millis = date.getSQLDate().getTime();
          final PageParameters pageParams = new PageParameters();
          pageParams.add(WebConstants.PARAMETER_USER_ID, String.valueOf(user.getId()));
          pageParams.add(WebConstants.PARAMETER_DATE, millis.toString());
          final HRPlanningEditPage page = new HRPlanningEditPage(pageParams);
          page.setReturnToPage(hrListPage);
View Full Code Here

   * @param userId
   * @return
   */
  public static TimesheetStats getStats(final Collection<TimesheetDO> timesheets, final Date day, final Integer userId)
  {
    final DateHolder dh = new DateHolder(day).setBeginOfDay();
    final Date startDate = dh.getDate();
    final Date stopDate = dh.add(Calendar.DAY_OF_MONTH, 1).getDate();
    return getStats(timesheets, startDate, stopDate, userId);
  }
View Full Code Here

      form.getSearchFilter().setUserId((Integer) selectedValue);
      refresh();
    } else if (property.startsWith("quickSelect.") == true) { // month".equals(property) == true) {
      final Date date = (Date) selectedValue;
      form.getSearchFilter().setStartTime(date);
      final DateHolder dateHolder = new DateHolder(date);
      if (property.endsWith(".month") == true) {
        dateHolder.setEndOfMonth();
      } else if (property.endsWith(".week") == true) {
        dateHolder.setEndOfWeek();
      } else {
        log.error("Property '" + property + "' not supported for selection.");
      }
      form.getSearchFilter().setStopTime(dateHolder.getDate());
      form.startDate.markModelAsChanged();
      form.stopDate.markModelAsChanged();
      refresh();
    } else {
      super.select(property, selectedValue);
View Full Code Here

    }
    log.info("load report: " + filter);
    final ReportStorage storage = getReportStorage();
    final Report report = storage.getRoot();
    final String currentReportId = storage.getCurrentReport().getId(); // Store current report id.
    final DateHolder day = new DateHolder(filter.getFromDate());
    report.setFrom(day.getYear(), day.getMonth());
    if (filter.getToDate() != null) {
      day.setDate(filter.getToDate());
    } else {
      day.setEndOfMonth();
    }
    report.setTo(day.getYear(), day.getMonth());
    reportDao.loadReport(report);
    storage.setCurrentReport(currentReportId); // Select previous current report.
  }
View Full Code Here

        + " t where deleted=false and lastUpdate > ? and lower(t."
        + property
        + ") like ?) order by t."
        + property;
    final Query query = getSession().createQuery(hql);
    final DateHolder dh = new DateHolder();
    dh.add(Calendar.YEAR, -2); // Search only for entries of the last 2 years.
    query.setDate(0, dh.getDate());
    query.setString(1, "%" + StringUtils.lowerCase(searchString) + "%");
    final List<String> list = query.list();
    return list;
  }
View Full Code Here

TOP

Related Classes of org.projectforge.common.DateHolder

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.