Coverage Report - org.kuali.student.core.bo.KsMetaBusinessObjectBase
 
Classes in this File Line Coverage Branch Coverage Complexity
KsMetaBusinessObjectBase
0%
0/34
0%
0/4
1.167
 
 1  
 package org.kuali.student.core.bo;
 2  
 
 3  
 import java.util.Date;
 4  
 
 5  
 import org.apache.commons.lang.StringUtils;
 6  
 import org.apache.ojb.broker.PersistenceBrokerException;
 7  
 import org.kuali.rice.core.api.CoreApiServiceLocator;
 8  
 import org.kuali.rice.krad.util.GlobalVariables;
 9  
 
 10  0
 public class KsMetaBusinessObjectBase extends KsBusinessObjectBase implements KsMetaBusinessObject {
 11  
 
 12  
     private static final long serialVersionUID = -6804800481530556124L;
 13  
 
 14  
     
 15  
     private String createId;
 16  
 
 17  
     private Date createDate;
 18  
 
 19  
     private String updateId;
 20  
 
 21  
     private Date updateDate;
 22  
 
 23  
 
 24  
     /**
 25  
      * This will take properties and create a Meta object to return, the value is not persisted.
 26  
      * This is to support the KS embedded style Meta object for future compatibility.  OJB/KNS
 27  
      * do not seem to support embedded entities (called Nested in OJB terms).
 28  
      */
 29  
     @Override
 30  
     public Meta getMeta() {
 31  0
         Meta meta = new Meta();
 32  
         
 33  0
         meta.setCreateId(createId);
 34  0
         meta.setCreateTime(createDate);
 35  0
         meta.setUpdateId(updateId);
 36  0
         meta.setUpdateTime(updateDate);
 37  
         
 38  0
         return meta;
 39  
     }
 40  
 
 41  
     /**
 42  
      * This will set the internal properties from the incoming Meta object.
 43  
      * This is to support the KS embedded style Meta object for future compatibility.  OJB/KNS
 44  
      * do not seem to support embedded entities (called Nested in OJB terms).
 45  
      * 
 46  
      * Uses setter methods to allow behavior from subclass.
 47  
      */
 48  
     @Override
 49  
     public void setMeta(Meta meta) {
 50  0
         this.setCreateId(meta.getCreateId());
 51  0
         this.setCreateDate(meta.getCreateTime());
 52  0
         this.setUpdateId(meta.getUpdateId());
 53  0
         this.setUpdateDate(meta.getCreateTime());
 54  0
     }
 55  
     
 56  
     @Override
 57  
     public void prePersist() throws PersistenceBrokerException {
 58  0
         super.prePersist();
 59  
 
 60  0
         if (StringUtils.isBlank(this.getCreateId())) {
 61  0
             this.setCreateId(GlobalVariables.getUserSession().getPrincipalName());
 62  
         }
 63  
 
 64  0
         if (this.getCreateDate() == null) {
 65  0
             this.setCreateDate(CoreApiServiceLocator.getDateTimeService().getCurrentSqlDate());
 66  
         }
 67  0
     }
 68  
 
 69  
     @Override
 70  
     public void preUpdate() {
 71  0
         super.preUpdate();
 72  
 
 73  0
         this.setUpdateId(GlobalVariables.getUserSession().getPrincipalName());
 74  0
         this.setUpdateDate(CoreApiServiceLocator.getDateTimeService().getCurrentSqlDate());
 75  0
     }
 76  
 
 77  
     public String getCreateId() {
 78  0
         return createId;
 79  
     }
 80  
 
 81  
     public void setCreateId(String createId) {
 82  0
         this.createId = createId;
 83  0
     }
 84  
 
 85  
     public Date getCreateDate() {
 86  0
         return createDate;
 87  
     }
 88  
 
 89  
     public void setCreateDate(Date createDate) {
 90  0
         this.createDate = createDate;
 91  0
     }
 92  
 
 93  
     public String getUpdateId() {
 94  0
         return updateId;
 95  
     }
 96  
 
 97  
     public void setUpdateId(String updateId) {
 98  0
         this.updateId = updateId;
 99  0
     }
 100  
 
 101  
     public Date getUpdateDate() {
 102  0
         return updateDate;
 103  
     }
 104  
 
 105  
     public void setUpdateDate(Date updateDate) {
 106  0
         this.updateDate = updateDate;
 107  0
     }
 108  
 
 109  
 }