Clover Coverage Report - Kuali Student 1.1.0-SNAPSHOT (Aggregated)
Coverage timestamp: Tue Feb 15 2011 04:04:07 EST
../../../../../img/srcFileCovDistChart9.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 3 88% 0.88
 
  (244)
 
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.core.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  2448 toggle @Override
32    protected void onPrePersist(){
33  2448 super.onPrePersist();
34  2448 if(meta==null){
35  2448 meta = new Meta();
36    }
37  2448 meta.setCreateTime(new Date());
38  2448 meta.setUpdateTime(new Date());
39   
40  2448 String user = SecurityUtils.getCurrentUserId();
41  2448 meta.setCreateId(user);
42  2448 meta.setUpdateId(user);
43   
44    }
45   
 
46  536 toggle @Override
47    protected void onPreUpdate(){
48  536 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  536 if(meta==null){
51  6 meta = new Meta();
52  6 meta.setCreateTime(new Date());
53    }
54   
55  536 meta.setUpdateTime(new Date());
56   
57  536 String user = SecurityUtils.getCurrentUserId();
58  536 meta.setUpdateId(user);
59    }
60   
 
61  6773 toggle public Meta getMeta() {
62  6773 return meta;
63    }
64   
 
65  0 toggle public void setMeta(Meta meta) {
66  0 this.meta = meta;
67    }
68    }