1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.actionrequest.dao.impl;
17
18 import org.kuali.rice.kew.actionrequest.ActionRequestValue;
19 import org.kuali.rice.kew.actionrequest.dao.ActionRequestDAO;
20 import org.kuali.rice.kew.api.action.ActionRequestStatus;
21 import org.kuali.rice.kew.api.action.RecipientType;
22
23 import javax.persistence.EntityManager;
24 import javax.persistence.TypedQuery;
25 import java.util.List;
26
27
28
29
30
31
32 public class ActionRequestDAOJpaImpl implements ActionRequestDAO {
33
34 private EntityManager entityManager;
35
36
37
38
39 public EntityManager getEntityManager() {
40 return this.entityManager;
41 }
42
43
44
45
46 public void setEntityManager(EntityManager entityManager) {
47 this.entityManager = entityManager;
48 }
49
50 public List<ActionRequestValue> findPendingRootRequestsByDocumentType(String documentTypeId) {
51 TypedQuery<ActionRequestValue> query =
52 entityManager.createNamedQuery("ActionRequestValue.FindPendingRootRequestsByDocumentType", ActionRequestValue.class);
53 query.setParameter("documentTypeId", documentTypeId);
54 query.setParameter("currentIndicator", Boolean.TRUE);
55 query.setParameter("actionRequestStatus1", ActionRequestStatus.INITIALIZED.getCode());
56 query.setParameter("actionRequestStatus2", ActionRequestStatus.ACTIVATED.getCode());
57 return query.getResultList();
58 }
59
60 public List<String> getRequestGroupIds(String documentId) {
61 TypedQuery<String> query = entityManager.createNamedQuery("ActionRequestValue.GetRequestGroupIds", String.class);
62 query.setParameter("documentId", documentId);
63 query.setParameter("currentIndicator", Boolean.TRUE);
64 query.setParameter("recipientTypeCd", RecipientType.GROUP.getCode());
65 return query.getResultList();
66 }
67
68 }