List of usage examples for org.joda.time LocalDate toDate
@SuppressWarnings("deprecation") public Date toDate()
java.util.Date
. From source file:org.kuali.kpme.core.earncode.group.dao.EarnCodeGroupDaoOjbImpl.java
License:Educational Community License
@Override public int getNewerEarnCodeGroupCount(String earnCodeGroup, LocalDate effdt) { Criteria crit = new Criteria(); crit.addEqualTo("earnCodeGroup", earnCodeGroup); crit.addEqualTo("active", "Y"); crit.addGreaterThan("effectiveDate", effdt.toDate()); Query query = QueryFactory.newQuery(EarnCodeGroup.class, crit); return this.getPersistenceBrokerTemplate().getCount(query); }
From source file:org.kuali.kpme.core.earncode.group.dao.EarnCodeGroupDaoOjbImpl.java
License:Educational Community License
public List<EarnCode> getEarnCodeGroups(String earnCodeGroup, String descr, LocalDate fromEffdt, LocalDate toEffdt, String active, String showHist) { List<EarnCode> results = new ArrayList<EarnCode>(); Criteria root = new Criteria(); if (StringUtils.isNotBlank(earnCodeGroup)) { root.addLike("earnCodeGroup", earnCodeGroup); }// w ww . j a v a2 s.c o m if (StringUtils.isNotBlank(descr)) { root.addLike("description", descr); } 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(showHist, "N")) { root.addEqualTo("effectiveDate", OjbSubQueryUtil.getEffectiveDateSubQueryWithFilter(EarnCodeGroup.class, effectiveDateFilter, EarnCodeGroup.EQUAL_TO_FIELDS, false)); root.addEqualTo("timestamp", OjbSubQueryUtil.getTimestampSubQuery(EarnCodeGroup.class, EarnCodeGroup.EQUAL_TO_FIELDS, false)); } Query query = QueryFactory.newQuery(EarnCodeGroup.class, root); results.addAll(getPersistenceBrokerTemplate().getCollectionByQuery(query)); return results; }
From source file:org.kuali.kpme.core.earncode.security.dao.EarnCodeSecurityDaoOjbImpl.java
License:Educational Community License
@Override @SuppressWarnings("unchecked") public List<EarnCodeSecurity> searchEarnCodeSecurities(String dept, String salGroup, String earnCode, String location, LocalDate fromEffdt, LocalDate toEffdt, String active, String showHistory) { List<EarnCodeSecurity> results = new ArrayList<EarnCodeSecurity>(); Criteria root = new Criteria(); if (StringUtils.isNotBlank(dept)) { root.addLike("dept", dept); }//from w ww.ja v a 2 s . c o m if (StringUtils.isNotBlank(salGroup)) { root.addLike("hrSalGroup", salGroup); } if (StringUtils.isNotBlank(earnCode)) { root.addLike("earnCode", earnCode); } if (StringUtils.isNotBlank(location)) { root.addLike("location", location); } 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( EarnCodeSecurity.class, effectiveDateFilter, EarnCodeSecurity.EQUAL_TO_FIELDS, false)); root.addEqualTo("timestamp", OjbSubQueryUtil.getTimestampSubQuery(EarnCodeSecurity.class, EarnCodeSecurity.EQUAL_TO_FIELDS, false)); } Query query = QueryFactory.newQuery(EarnCodeSecurity.class, root); results.addAll(getPersistenceBrokerTemplate().getCollectionByQuery(query)); return results; }
From source file:org.kuali.kpme.core.earncode.security.dao.EarnCodeSecurityDaoOjbImpl.java
License:Educational Community License
@Override public int getEarnCodeSecurityCount(String dept, String salGroup, String earnCode, String employee, String approver, String payrollProcessor, String location, String active, LocalDate effdt, String hrDeptEarnCodeId) { Criteria crit = new Criteria(); crit.addEqualTo("dept", dept); crit.addEqualTo("hrSalGroup", salGroup); crit.addEqualTo("earnCode", earnCode); crit.addEqualTo("employee", employee); crit.addEqualTo("approver", approver); crit.addEqualTo("payrollProcessor", payrollProcessor); crit.addEqualTo("location", location); crit.addEqualTo("active", active); crit.addEqualTo("effectiveDate", effdt.toDate()); if (hrDeptEarnCodeId != null) { crit.addEqualTo("hrEarnCodeSecurityId", hrDeptEarnCodeId); }//from w w w . j a v a 2s. co m Query query = QueryFactory.newQuery(EarnCodeSecurity.class, crit); return this.getPersistenceBrokerTemplate().getCount(query); }
From source file:org.kuali.kpme.core.earncode.security.dao.EarnCodeSecurityDaoOjbImpl.java
License:Educational Community License
@Override public int getNewerEarnCodeSecurityCount(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(EarnCodeSecurity.class, crit); return this.getPersistenceBrokerTemplate().getCount(query); }
From source file:org.kuali.kpme.core.job.dao.JobDaoOjbImpl.java
License:Educational Community License
@Override @SuppressWarnings("unchecked") public List<Job> getJobs(String principalId, String jobNumber, String dept, String positionNumber, String hrPayType, LocalDate fromEffdt, LocalDate toEffdt, String active, String showHistory) { List<Job> results = new ArrayList<Job>(); Criteria root = new Criteria(); if (StringUtils.isNotBlank(principalId)) { root.addLike("principalId", principalId); }/* ww w . ja v a2 s .co m*/ if (StringUtils.isNotBlank(jobNumber)) { root.addLike("jobNumber", jobNumber); } if (StringUtils.isNotBlank(dept)) { root.addLike("dept", dept); } if (StringUtils.isNotBlank(positionNumber)) { root.addLike("positionNumber", positionNumber); } if (StringUtils.isNotBlank(hrPayType)) { root.addLike("hrPayType", hrPayType); } 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")) { ImmutableList<String> fields = new ImmutableList.Builder<String>().add("principalId").add("jobNumber") .add("dept").add("positionNumber").add("hrPayType").build(); root.addEqualTo("effectiveDate", OjbSubQueryUtil.getEffectiveDateSubQueryWithFilter(Job.class, effectiveDateFilter, Job.EQUAL_TO_FIELDS, false)); root.addEqualTo("timestamp", OjbSubQueryUtil.getTimestampSubQuery(Job.class, Job.EQUAL_TO_FIELDS, false)); } Query query = QueryFactory.newQuery(Job.class, root); results.addAll(getPersistenceBrokerTemplate().getCollectionByQuery(query)); return results; }
From source file:org.kuali.kpme.core.job.dao.JobDaoOjbImpl.java
License:Educational Community License
@Override public List<Job> getAllActiveLeaveJobs(String principalId, LocalDate asOfDate) { Criteria root = new Criteria(); root.addEqualTo("principalId", principalId); root.addLessOrEqualThan("effectiveDate", asOfDate.toDate()); root.addEqualTo("active", true); root.addEqualTo("eligibleForLeave", true); Query query = QueryFactory.newQuery(Job.class, root); Collection c = this.getPersistenceBrokerTemplate().getCollectionByQuery(query); List<Job> jobs = new LinkedList<Job>(); if (c != null) { jobs.addAll(c);// ww w . j a v a2s . c o m } return jobs; }
From source file:org.kuali.kpme.core.job.dao.JobDaoOjbImpl.java
License:Educational Community License
public List<Job> getAllInActiveLeaveJobsInRange(String principalId, LocalDate endDate) { Criteria root = new Criteria(); root.addEqualTo("principalId", principalId); root.addLessOrEqualThan("effectiveDate", endDate.toDate()); root.addEqualTo("active", false); Query query = QueryFactory.newQuery(Job.class, root); return (List<Job>) this.getPersistenceBrokerTemplate().getCollectionByQuery(query); }
From source file:org.kuali.kpme.core.leaveplan.dao.LeavePlanDaoOjbImpl.java
License:Educational Community License
@Override public List<LeavePlan> getAllActiveLeavePlan(String leavePlan, LocalDate asOfDate) { Criteria root = new Criteria(); root.addEqualTo("leavePlan", leavePlan); root.addEqualTo("active", true); root.addLessOrEqualThan("effectiveDate", asOfDate.toDate()); Query query = QueryFactory.newQuery(LeavePlan.class, root); Collection c = this.getPersistenceBrokerTemplate().getCollectionByQuery(query); List<LeavePlan> lps = new LinkedList<LeavePlan>(); if (c != null) { lps.addAll(c);//w w w. j av a2 s . co m } return lps; }