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