1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kim.impl.responsibility;
17
18 import javax.persistence.EntityManager;
19 import java.util.ArrayList;
20 import java.util.List;
21
22 public class ResponsibilityDaoJpa implements ResponsibilityDao {
23
24 private EntityManager entityManager;
25
26 @Override
27 public List<ResponsibilityBo> findWorkflowResponsibilities(String documentTypeName) {
28
29
30
31 List<String> responsibilityIds = getEntityManager().createNamedQuery("Responsibility.workflowResponsibilities", String.class).
32 setParameter("documentTypeName", documentTypeName).getResultList();
33 List<ResponsibilityBo> responsibilities = new ArrayList<>();
34 for (String responsibilityId : responsibilityIds) {
35 responsibilities.add(entityManager.find(ResponsibilityBo.class, responsibilityId));
36 }
37 return responsibilities;
38 }
39
40 @Override
41 public List<ResponsibilityBo> findWorkflowExceptionResponsibilities(String documentTypeName) {
42
43
44
45 List<String> responsibilityIds = getEntityManager().createNamedQuery("Responsibility.workflowExceptionResponsibilities", String.class).
46 setParameter("documentTypeName", documentTypeName).getResultList();
47 List<ResponsibilityBo> responsibilities = new ArrayList<>();
48 for (String responsibilityId : responsibilityIds) {
49 responsibilities.add(entityManager.find(ResponsibilityBo.class, responsibilityId));
50 }
51 return responsibilities;
52 }
53
54 public void setEntityManager(EntityManager entityManager) {
55 this.entityManager = entityManager;
56 }
57
58 public EntityManager getEntityManager() {
59 return entityManager;
60 }
61 }