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