1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.rule.dao.impl; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.Collection; |
20 | |
import java.util.List; |
21 | |
import java.util.Map; |
22 | |
|
23 | |
import javax.persistence.EntityManager; |
24 | |
import javax.persistence.PersistenceContext; |
25 | |
|
26 | |
import org.kuali.rice.core.framework.persistence.jpa.OrmUtils; |
27 | |
import org.kuali.rice.core.framework.persistence.jpa.criteria.Criteria; |
28 | |
import org.kuali.rice.core.framework.persistence.jpa.criteria.QueryByCriteria; |
29 | |
import org.kuali.rice.kew.rule.RuleDelegationBo; |
30 | |
import org.kuali.rice.kew.rule.dao.RuleDelegationDAO; |
31 | |
|
32 | |
|
33 | 0 | public class RuleDelegationDAOJpaImpl implements RuleDelegationDAO { |
34 | |
|
35 | |
@PersistenceContext(unitName="kew-unit") |
36 | |
private EntityManager entityManager; |
37 | |
|
38 | |
public List<RuleDelegationBo> findByDelegateRuleId(String ruleId) { |
39 | 0 | Criteria crit = new Criteria(RuleDelegationBo.class.getName()); |
40 | 0 | crit.eq("delegateRuleId", ruleId); |
41 | 0 | return (List) new QueryByCriteria(entityManager, crit).toQuery().getResultList(); |
42 | |
} |
43 | |
|
44 | |
public void save(RuleDelegationBo ruleDelegation) { |
45 | 0 | if(ruleDelegation.getRuleDelegationId()==null){ |
46 | 0 | entityManager.persist(ruleDelegation); |
47 | |
}else{ |
48 | 0 | OrmUtils.merge(entityManager, ruleDelegation); |
49 | |
} |
50 | 0 | } |
51 | |
public List<RuleDelegationBo> findAllCurrentRuleDelegations(){ |
52 | 0 | Criteria crit = new Criteria(RuleDelegationBo.class.getName()); |
53 | 0 | crit.eq("delegationRuleBaseValues.currentInd", true); |
54 | 0 | return (List) new QueryByCriteria(entityManager, crit).toQuery().getResultList(); |
55 | |
} |
56 | |
|
57 | |
public RuleDelegationBo findByRuleDelegationId(String ruleDelegationId){ |
58 | 0 | return entityManager.find(RuleDelegationBo.class, ruleDelegationId); |
59 | |
|
60 | |
} |
61 | |
public void delete(String ruleDelegationId){ |
62 | 0 | entityManager.remove(findByRuleDelegationId(ruleDelegationId)); |
63 | 0 | } |
64 | |
|
65 | |
public EntityManager getEntityManager() { |
66 | 0 | return this.entityManager; |
67 | |
} |
68 | |
|
69 | |
public void setEntityManager(EntityManager entityManager) { |
70 | 0 | this.entityManager = entityManager; |
71 | 0 | } |
72 | |
|
73 | |
public List<RuleDelegationBo> findByResponsibilityIdWithCurrentRule(String responsibilityId) { |
74 | 0 | Criteria crit = new Criteria(RuleDelegationBo.class.getName()); |
75 | 0 | crit.eq("responsibilityId", responsibilityId); |
76 | 0 | crit.eq("delegationRuleBaseValues.currentInd", true); |
77 | 0 | Collection delegations = new QueryByCriteria(entityManager, crit).toQuery().getResultList(); |
78 | 0 | return new ArrayList<RuleDelegationBo>(delegations); |
79 | |
} |
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
public List<RuleDelegationBo> search(String parentRuleBaseVaueId, String parentResponsibilityId, String docTypeName, String ruleId, |
87 | |
String ruleTemplateId, String ruleDescription, String workgroupId, |
88 | |
String workflowId, String delegationType, Boolean activeInd, |
89 | |
Map extensionValues, String workflowIdDirective) { |
90 | |
|
91 | 0 | return null; |
92 | |
} |
93 | |
|
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | |
public List<RuleDelegationBo> search(String parentRuleBaseVaueId, String parentResponsibilityId, String docTypeName, String ruleTemplateId, |
100 | |
String ruleDescription, Collection<String> workgroupIds, |
101 | |
String workflowId, String delegationType, Boolean activeInd, |
102 | |
Map extensionValues, Collection actionRequestCodes) { |
103 | |
|
104 | 0 | return null; |
105 | |
} |
106 | |
|
107 | |
} |