Example usage for org.joda.time LocalDate toDate

List of usage examples for org.joda.time LocalDate toDate

Introduction

In this page you can find the example usage for org.joda.time LocalDate toDate.

Prototype

@SuppressWarnings("deprecation")
public Date toDate() 

Source Link

Document

Get the date time as a java.util.Date.

Usage

From source file:org.kuali.kpme.core.calendar.entry.CalendarEntry.java

License:Educational Community License

public void setBeginPeriodDate(Date beginPeriodDate) {
    LocalDate localDate = beginPeriodDate != null ? LocalDate.fromDateFields(beginPeriodDate) : null;
    LocalTime localTime = beginPeriodDateTime != null ? LocalTime.fromDateFields(beginPeriodDateTime)
            : LocalTime.MIDNIGHT;
    beginPeriodDateTime = localDate != null ? localDate.toDateTime(localTime).toDate() : null;
}

From source file:org.kuali.kpme.core.calendar.entry.CalendarEntry.java

License:Educational Community License

public void setEndPeriodDate(Date endPeriodDate) {
    LocalDate localDate = endPeriodDate != null ? LocalDate.fromDateFields(endPeriodDate) : null;
    LocalTime localTime = endPeriodDateTime != null ? LocalTime.fromDateFields(endPeriodDateTime)
            : LocalTime.MIDNIGHT;
    endPeriodDateTime = localDate != null ? localDate.toDateTime(localTime).toDate() : null;
}

From source file:org.kuali.kpme.core.calendar.entry.CalendarEntry.java

License:Educational Community License

public void setBatchInitiateDate(Date batchInitiateDate) {
    LocalDate localDate = batchInitiateDate != null ? LocalDate.fromDateFields(batchInitiateDate) : null;
    LocalTime localTime = batchInitiateDateTime != null ? LocalTime.fromDateFields(batchInitiateDateTime)
            : LocalTime.MIDNIGHT;
    batchInitiateDateTime = localDate != null ? localDate.toDateTime(localTime).toDate() : null;
}

From source file:org.kuali.kpme.core.calendar.entry.CalendarEntry.java

License:Educational Community License

public void setBatchEndPayPeriodDate(Date batchEndPayPeriodDate) {
    LocalDate localDate = batchEndPayPeriodDate != null ? LocalDate.fromDateFields(batchEndPayPeriodDate)
            : null;//from   w ww .j ava 2  s  .  c  om
    LocalTime localTime = batchEndPayPeriodDateTime != null
            ? LocalTime.fromDateFields(batchEndPayPeriodDateTime)
            : LocalTime.MIDNIGHT;
    batchEndPayPeriodDateTime = localDate != null ? localDate.toDateTime(localTime).toDate() : null;
}

From source file:org.kuali.kpme.core.calendar.entry.CalendarEntry.java

License:Educational Community License

public void setBatchEmployeeApprovalDate(Date batchEmployeeApprovalDate) {
    LocalDate localDate = batchEmployeeApprovalDate != null
            ? LocalDate.fromDateFields(batchEmployeeApprovalDate)
            : null;//  w  ww . j a  v a  2s .  c  om
    LocalTime localTime = batchEmployeeApprovalDateTime != null
            ? LocalTime.fromDateFields(batchEmployeeApprovalDateTime)
            : LocalTime.MIDNIGHT;
    batchEmployeeApprovalDateTime = localDate != null ? localDate.toDateTime(localTime).toDate() : null;
}

From source file:org.kuali.kpme.core.calendar.entry.CalendarEntry.java

License:Educational Community License

public void setBatchSupervisorApprovalDate(Date batchSupervisorApprovalDate) {
    LocalDate localDate = batchSupervisorApprovalDate != null
            ? LocalDate.fromDateFields(batchSupervisorApprovalDate)
            : null;//  ww  w .  ja  v a  2  s  .com
    LocalTime localTime = batchSupervisorApprovalDateTime != null
            ? LocalTime.fromDateFields(batchSupervisorApprovalDateTime)
            : LocalTime.MIDNIGHT;
    batchSupervisorApprovalDateTime = localDate != null ? localDate.toDateTime(localTime).toDate() : null;
}

From source file:org.kuali.kpme.core.calendar.entry.CalendarEntryBo.java

License:Educational Community License

public void setBatchPayrollApprovalDate(Date batchPayrollApprovalDate) {
    LocalDate localDate = batchPayrollApprovalDate != null ? LocalDate.fromDateFields(batchPayrollApprovalDate)
            : null;/*from  ww w  .  j a  v  a2 s  .c  o m*/
    LocalTime localTime = batchPayrollApprovalDateTime != null
            ? LocalTime.fromDateFields(batchPayrollApprovalDateTime)
            : LocalTime.MIDNIGHT;
    batchPayrollApprovalDateTime = localDate != null ? localDate.toDateTime(localTime).toDate() : null;
}

From source file:org.kuali.kpme.core.calendar.entry.dao.CalendarEntryDaoOjbImpl.java

License:Educational Community License

public List<CalendarEntry> getAllCalendarEntriesForCalendarIdAndYear(String hrCalendarId, String year) {
    Criteria crit = new Criteria();
    List<CalendarEntry> ceList = new ArrayList<CalendarEntry>();
    crit.addEqualTo("hrCalendarId", hrCalendarId);
    DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy");
    LocalDate currentYear = formatter.parseLocalDate(year);
    LocalDate nextYear = currentYear.plusYears(1);
    crit.addGreaterOrEqualThan("beginPeriodDateTime", currentYear.toDate());
    crit.addLessThan("beginPeriodDateTime", nextYear.toDate());

    QueryByCriteria query = new QueryByCriteria(CalendarEntry.class, crit);
    Collection c = this.getPersistenceBrokerTemplate().getCollectionByQuery(query);
    if (c != null) {
        ceList.addAll(c);//from   w ww .  j  av a  2 s  .  c  om
    }
    return ceList;
}

From source file:org.kuali.kpme.core.earncode.dao.EarnCodeDaoOjbImpl.java

License:Educational Community License

@Override
public int getNewerEarnCodeCount(String earnCode, LocalDate effdt) {
    Criteria crit = new Criteria();
    crit.addEqualTo("earnCode", earnCode);
    crit.addEqualTo("active", "Y");
    crit.addGreaterThan("effectiveDate", effdt.toDate());
    Query query = QueryFactory.newQuery(EarnCode.class, crit);
    return this.getPersistenceBrokerTemplate().getCount(query);
}

From source file:org.kuali.kpme.core.earncode.dao.EarnCodeDaoOjbImpl.java

License:Educational Community License

@Override
@SuppressWarnings("unchecked")
public List<EarnCode> getEarnCodes(String earnCode, String ovtEarnCode, String descr, String leavePlan,
        String accrualCategory, LocalDate fromEffdt, LocalDate toEffdt, String active, String showHistory) {
    List<EarnCode> results = new ArrayList<EarnCode>();

    Criteria root = new Criteria();

    if (StringUtils.isNotBlank(earnCode)) {
        root.addLike("earnCode", earnCode);
    }//from w  ww  . j a va2s. c o m

    if (StringUtils.isNotBlank(ovtEarnCode)) {
        root.addEqualTo("ovtEarnCode", ovtEarnCode);
    }

    if (StringUtils.isNotBlank(descr)) {
        root.addLike("description", descr);
    }

    if (StringUtils.isNotBlank(leavePlan)) {
        root.addLike("leavePlan", leavePlan);
    }

    if (StringUtils.isNotBlank(accrualCategory)) {
        root.addLike("accrualCategory", accrualCategory);
    }

    Criteria effectiveDateFilter = new Criteria();
    if (fromEffdt != null) {
        effectiveDateFilter.addGreaterOrEqualThan("effectiveDate", fromEffdt.toDate());
    }
    if (toEffdt != null) {
        effectiveDateFilter.addLessOrEqualThan("effectiveDate", toEffdt.toDate());
    }
    if (fromEffdt == null && toEffdt == null) {
        effectiveDateFilter.addLessOrEqualThan("effectiveDate", LocalDate.now().toDate());
    }
    root.addAndCriteria(effectiveDateFilter);

    if (StringUtils.isNotBlank(active)) {
        Criteria activeFilter = new Criteria();
        if (StringUtils.equals(active, "Y")) {
            activeFilter.addEqualTo("active", true);
        } else if (StringUtils.equals(active, "N")) {
            activeFilter.addEqualTo("active", false);
        }
        root.addAndCriteria(activeFilter);
    }

    if (StringUtils.equals(showHistory, "N")) {
        root.addEqualTo("effectiveDate", OjbSubQueryUtil.getEffectiveDateSubQueryWithFilter(EarnCode.class,
                effectiveDateFilter, EarnCode.EQUAL_TO_FIELDS, false));
        root.addEqualTo("timestamp",
                OjbSubQueryUtil.getTimestampSubQuery(EarnCode.class, EarnCode.EQUAL_TO_FIELDS, false));
    }

    Query query = QueryFactory.newQuery(EarnCode.class, root);
    results.addAll(getPersistenceBrokerTemplate().getCollectionByQuery(query));

    return results;
}