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.kns.lookup.LookupResults;
27 import org.kuali.rice.kns.lookup.SelectedObjectIds;
28 import org.kuali.rice.krad.dao.PersistedLookupMetadataDao;
29 import org.kuali.rice.krad.util.KRADPropertyConstants;
30
31 @Deprecated
32 public class PersistedLookupMetadataDaoJpa implements PersistedLookupMetadataDao {
33 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PersistedLookupMetadataDaoJpa.class);
34
35 @PersistenceContext
36 private EntityManager entityManager;
37
38
39
40
41 public void deleteOldLookupResults(Timestamp expirationDate) {
42 Criteria criteria = new Criteria(LookupResults.class.getName());
43 criteria.lt(KRADPropertyConstants.LOOKUP_DATE, expirationDate);
44 new QueryByCriteria(entityManager, criteria, QueryByCriteriaType.DELETE).toQuery().executeUpdate();
45 }
46
47
48
49
50 public void deleteOldSelectedObjectIds(Timestamp expirationDate) {
51 Criteria criteria = new Criteria(SelectedObjectIds.class.getName());
52 criteria.lt(KRADPropertyConstants.LOOKUP_DATE, expirationDate);
53 new QueryByCriteria(entityManager, criteria, QueryByCriteriaType.DELETE).toQuery().executeUpdate();
54 }
55
56
57
58
59 public EntityManager getEntityManager() {
60 return this.entityManager;
61 }
62
63
64
65
66 public void setEntityManager(EntityManager entityManager) {
67 this.entityManager = entityManager;
68 }
69 }