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