Coverage Report - org.kuali.rice.kns.document.MaintenanceLock
 
Classes in this File Line Coverage Branch Coverage Complexity
MaintenanceLock
0%
0/14
N/A
1
 
 1  
 /*
 2  
  * Copyright 2007-2008 The Kuali Foundation
 3  
  * 
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  * 
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  * 
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.kns.document;
 17  
 
 18  
 import javax.persistence.Column;
 19  
 import javax.persistence.Entity;
 20  
 import javax.persistence.EntityManagerFactory;
 21  
 import javax.persistence.Id;
 22  
 import javax.persistence.PrePersist;
 23  
 import javax.persistence.Table;
 24  
 
 25  
 import org.kuali.rice.core.framework.persistence.jpa.OrmUtils;
 26  
 import org.kuali.rice.core.framework.persistence.jpa.annotations.Sequence;
 27  
 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
 28  
 import org.kuali.rice.kns.service.KNSServiceLocator;
 29  
 
 30  
 /**
 31  
  * List of business objects that this maintenance document is locking (prevents two documents from being routed trying to update the same object)
 32  
  * Most maintenance documents have only one lock, but globals have many 
 33  
  */
 34  
 @Entity
 35  
 @Sequence(name="KRNS_MAINT_LOCK_S",property="lockId")
 36  
 @Table(name="KRNS_MAINT_LOCK_T")
 37  0
 public class MaintenanceLock extends PersistableBusinessObjectBase {
 38  
     private static final long serialVersionUID = 7766326835852387301L;
 39  
         @Id
 40  
     @Column(name="MAINT_LOCK_ID")
 41  
     private String lockId;
 42  
         @Column(name="MAINT_LOCK_REP_TXT")
 43  
         private String lockingRepresentation;
 44  
     @Column(name="DOC_HDR_ID")
 45  
         private String documentNumber;
 46  
 
 47  
     public String getLockId() {
 48  0
                 return this.lockId;
 49  
         }
 50  
 
 51  
         public void setLockId(String lockId) {
 52  0
                 this.lockId = lockId;
 53  0
         }
 54  
 
 55  
         public String getLockingRepresentation() {
 56  0
         return lockingRepresentation;
 57  
     }
 58  
 
 59  
     public void setLockingRepresentation(String lockingRepresentation) {
 60  0
         this.lockingRepresentation = lockingRepresentation;
 61  0
     }
 62  
     
 63  
     public String getDocumentNumber() {
 64  0
         return documentNumber;
 65  
     }
 66  
 
 67  
     public void setDocumentNumber(String documentNumber) {
 68  0
         this.documentNumber = documentNumber;
 69  0
     }
 70  
 
 71  
         /**
 72  
          * Uses OrmUtils to set the sequence
 73  
      * 
 74  
      * @see org.kuali.rice.kns.bo.PersistableBusinessObjectBase#prePersist()
 75  
      */
 76  
     @PrePersist
 77  
         protected void customPrePersist() {
 78  0
                 final EntityManagerFactory factory = KNSServiceLocator.getApplicationEntityManagerFactory();
 79  0
                 OrmUtils.populateAutoIncValue(this, factory.createEntityManager());
 80  
                 
 81  0
                 super.prePersist();
 82  0
         }
 83  
     
 84  
 }
 85