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 javax.persistence.EntityManager; |
19 | |
import javax.persistence.PersistenceContext; |
20 | |
|
21 | |
import org.kuali.rice.core.framework.persistence.jpa.OrmUtils; |
22 | |
import org.kuali.rice.kew.rule.RuleTemplateOptionBo; |
23 | |
import org.kuali.rice.kew.rule.dao.RuleTemplateOptionDAO; |
24 | |
|
25 | |
|
26 | 0 | public class RuleTemplateOptionDAOJpaImpl implements RuleTemplateOptionDAO { |
27 | |
|
28 | |
@PersistenceContext(unitName="kew-unit") |
29 | |
private EntityManager entityManager; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
public void delete(String ruleTemplateOptionId) { |
36 | 0 | entityManager.remove(findByRuleTemplateOptionId(ruleTemplateOptionId)); |
37 | 0 | } |
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
public RuleTemplateOptionBo findByRuleTemplateOptionId(String ruleTemplateOptionId) { |
44 | 0 | return entityManager.find(RuleTemplateOptionBo.class, ruleTemplateOptionId); |
45 | |
} |
46 | |
|
47 | |
public void save (RuleTemplateOptionBo ruleTemplateOption){ |
48 | 0 | if(ruleTemplateOption.getId()==null){ |
49 | 0 | entityManager.persist(ruleTemplateOption); |
50 | |
}else{ |
51 | 0 | OrmUtils.merge(entityManager, ruleTemplateOption); |
52 | |
} |
53 | 0 | } |
54 | |
|
55 | |
public EntityManager getEntityManager() { |
56 | 0 | return this.entityManager; |
57 | |
} |
58 | |
|
59 | |
public void setEntityManager(EntityManager entityManager) { |
60 | 0 | this.entityManager = entityManager; |
61 | 0 | } |
62 | |
} |