1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krad.dao.impl; |
17 | |
|
18 | |
import java.sql.Timestamp; |
19 | |
|
20 | |
import javax.persistence.EntityManager; |
21 | |
import javax.persistence.PersistenceContext; |
22 | |
|
23 | |
import org.kuali.rice.core.framework.persistence.jpa.criteria.Criteria; |
24 | |
import org.kuali.rice.core.framework.persistence.jpa.criteria.QueryByCriteria; |
25 | |
import org.kuali.rice.core.framework.persistence.jpa.criteria.QueryByCriteria.QueryByCriteriaType; |
26 | |
import org.kuali.rice.krad.bo.LookupResults; |
27 | |
import org.kuali.rice.krad.bo.SelectedObjectIds; |
28 | |
import org.kuali.rice.krad.dao.PersistedLookupMetadataDao; |
29 | |
import org.kuali.rice.krad.util.KRADPropertyConstants; |
30 | |
|
31 | 0 | public class PersistedLookupMetadataDaoJpa implements PersistedLookupMetadataDao { |
32 | 0 | private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PersistedLookupMetadataDaoJpa.class); |
33 | |
|
34 | |
@PersistenceContext |
35 | |
private EntityManager entityManager; |
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
public void deleteOldLookupResults(Timestamp expirationDate) { |
41 | 0 | Criteria criteria = new Criteria(LookupResults.class.getName()); |
42 | 0 | criteria.lt(KRADPropertyConstants.LOOKUP_DATE, expirationDate); |
43 | 0 | new QueryByCriteria(entityManager, criteria, QueryByCriteriaType.DELETE).toQuery().executeUpdate(); |
44 | 0 | } |
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
public void deleteOldSelectedObjectIds(Timestamp expirationDate) { |
50 | 0 | Criteria criteria = new Criteria(SelectedObjectIds.class.getName()); |
51 | 0 | criteria.lt(KRADPropertyConstants.LOOKUP_DATE, expirationDate); |
52 | 0 | new QueryByCriteria(entityManager, criteria, QueryByCriteriaType.DELETE).toQuery().executeUpdate(); |
53 | 0 | } |
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
public EntityManager getEntityManager() { |
59 | 0 | return this.entityManager; |
60 | |
} |
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
public void setEntityManager(EntityManager entityManager) { |
66 | 0 | this.entityManager = entityManager; |
67 | 0 | } |
68 | |
} |