1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.common_test_tester.support; |
17 |
|
|
18 |
|
import java.util.List; |
19 |
|
|
20 |
|
import javax.persistence.EntityManager; |
21 |
|
import javax.persistence.PersistenceContext; |
22 |
|
import javax.persistence.Query; |
23 |
|
|
|
|
| 87% |
Uncovered Elements: 3 (23) |
Complexity: 6 |
Complexity Density: 0.38 |
|
24 |
|
public class MyDaoImpl implements MyDao { |
25 |
|
|
26 |
|
private EntityManager entityManager; |
27 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
28 |
4
|
@PersistenceContext... |
29 |
|
public void setEntityManager(EntityManager entityManager) { |
30 |
4
|
this.entityManager = entityManager; |
31 |
|
} |
32 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
33 |
8
|
public String createValue(Value value) {... |
34 |
8
|
entityManager.persist(value); |
35 |
8
|
return value.getId(); |
36 |
|
} |
37 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
38 |
7
|
public String findValue(String id) {... |
39 |
7
|
Value tv = entityManager.find(Value.class, id); |
40 |
7
|
if(tv==null){ |
41 |
0
|
return null; |
42 |
|
} |
43 |
7
|
return tv.getValue(); |
44 |
|
} |
45 |
|
|
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
46 |
3
|
@SuppressWarnings("unchecked")... |
47 |
|
public Value findValueFromValue(String value) { |
48 |
3
|
Query q = entityManager.createQuery("SELECT v FROM Value v WHERE v.value=:valueIn"); |
49 |
3
|
q.setParameter("valueIn", value); |
50 |
3
|
for(Value tv : (List<Value>)q.getResultList()){ |
51 |
3
|
return tv; |
52 |
|
} |
53 |
0
|
return null; |
54 |
|
} |
55 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
56 |
1
|
public boolean updateValue(String id, String value) {... |
57 |
1
|
Value v = entityManager.find(Value.class, id); |
58 |
1
|
v.setValue(value); |
59 |
1
|
entityManager.merge(v); |
60 |
1
|
return true; |
61 |
|
} |
62 |
|
|
63 |
|
} |