Clover Coverage Report - Kuali Student 1.1.1-SNAPSHOT (Aggregated)
Coverage timestamp: Wed Apr 20 2011 04:04:00 EST
../../../../../img/srcFileCovDistChart9.png 28% of files have more coverage
16   63   6   3.2
2   38   0.38   5
5     1.2  
1    
 
  MyDaoImpl       Line # 24 16 0% 6 3 87% 0.8695652
 
  (7)
 
1    /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10    * software distributed under the License is distributed on an "AS IS"
11    * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12    * or implied. See the License for the specific language governing
13    * permissions and limitations under the License.
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   
 
24    public class MyDaoImpl implements MyDao {
25   
26    private EntityManager entityManager;
27   
 
28  4 toggle @PersistenceContext
29    public void setEntityManager(EntityManager entityManager) {
30  4 this.entityManager = entityManager;
31    }
32   
 
33  8 toggle public String createValue(Value value) {
34  8 entityManager.persist(value);
35  8 return value.getId();
36    }
37   
 
38  7 toggle 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   
 
46  3 toggle @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   
 
56  1 toggle 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    }