Clover Coverage Report - Kuali Student 1.2.1-SNAPSHOT (Aggregated)
Coverage timestamp: Wed Nov 2 2011 04:03:58 EST
../../../../../img/srcFileCovDistChart8.png 28% of files have more coverage
17   68   6   4.25
4   39   0.35   4
4     1.5  
1    
 
  MetaEntity       Line # 26 17 0% 6 6 76% 0.76
 
  (98)
 
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.entity;
17   
18    import java.util.Date;
19   
20    import javax.persistence.Embedded;
21    import javax.persistence.MappedSuperclass;
22   
23    import org.kuali.student.common.util.security.SecurityUtils;
24   
25    @MappedSuperclass
 
26    public abstract class MetaEntity extends BaseEntity{
27   
28    @Embedded
29    private Meta meta;
30   
 
31  42 toggle @Override
32    protected void onPrePersist(){
33  42 super.onPrePersist();
34  42 if(meta==null){
35  42 meta = new Meta();
36    }
37  42 meta.setCreateTime(new Date());
38  42 meta.setUpdateTime(new Date());
39   
40  42 String user = SecurityUtils.getCurrentUserId();
41  42 meta.setCreateId(user);
42  42 meta.setUpdateId(user);
43   
44    }
45   
 
46  34 toggle @Override
47    protected void onPreUpdate(){
48  34 super.onPreUpdate();
49    //This code should not be here, but hibernate is calling update callback instead of prepersit if the id is not null.
50  34 if(meta==null){
51  0 meta = new Meta();
52  0 meta.setCreateTime(new Date());
53    }
54   
55  34 meta.setUpdateTime(new Date());
56   
57  34 String user = SecurityUtils.getCurrentUserId();
58  34 meta.setUpdateId(user);
59    }
60   
 
61  245 toggle public Meta getMeta() {
62  245 return meta;
63    }
64   
 
65  0 toggle public void setMeta(Meta meta) {
66  0 this.meta = meta;
67    }
68    }