Coverage Report - org.kuali.rice.core.config.spring.PlatformTransactionManagerFactoryBean
 
Classes in this File Line Coverage Branch Coverage Complexity
PlatformTransactionManagerFactoryBean
0%
0/16
0%
0/2
1.286
 
 1  
 /*
 2  
  * Copyright 2008-2009 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.core.config.spring;
 17  
 
 18  
 import javax.transaction.TransactionManager;
 19  
 import javax.transaction.UserTransaction;
 20  
 
 21  
 import org.kuali.rice.core.config.ConfigContext;
 22  
 import org.kuali.rice.core.util.RiceConstants;
 23  
 import org.springframework.beans.factory.FactoryBean;
 24  
 import org.springframework.transaction.PlatformTransactionManager;
 25  
 import org.springframework.transaction.jta.JtaTransactionManager;
 26  
 
 27  0
 public class PlatformTransactionManagerFactoryBean implements FactoryBean {
 28  
         
 29  
         private UserTransaction userTransaction;
 30  
         private TransactionManager transactionManager;
 31  
 
 32  
         public Object getObject() throws Exception {
 33  0
                 if (ConfigContext.getCurrentContextConfig().getObject(RiceConstants.SPRING_TRANSACTION_MANAGER) != null) {
 34  0
                         return ConfigContext.getCurrentContextConfig().getObject(RiceConstants.SPRING_TRANSACTION_MANAGER);
 35  
                 }
 36  0
                 JtaTransactionManager jtaTransactionManager = new JtaTransactionManager();
 37  0
                 jtaTransactionManager.setTransactionManager(this.getTransactionManager());
 38  0
                 jtaTransactionManager.setUserTransaction(this.getUserTransaction());
 39  0
                 jtaTransactionManager.afterPropertiesSet();
 40  0
                 return jtaTransactionManager;
 41  
         }
 42  
 
 43  
         public Class getObjectType() {
 44  0
                 return PlatformTransactionManager.class;
 45  
         }
 46  
 
 47  
         public boolean isSingleton() {
 48  0
                 return true;
 49  
         }
 50  
 
 51  
         public UserTransaction getUserTransaction() {
 52  0
                 return userTransaction;
 53  
         }
 54  
 
 55  
         public void setUserTransaction(UserTransaction userTransaction) {
 56  0
                 this.userTransaction = userTransaction;
 57  0
         }
 58  
 
 59  
         public TransactionManager getTransactionManager() {
 60  0
                 return transactionManager;
 61  
         }
 62  
 
 63  
         public void setTransactionManager(TransactionManager transactionManager) {
 64  0
                 this.transactionManager = transactionManager;
 65  0
         }
 66  
 
 67  
 }