public SpringTransactionPolicy(PlatformTransactionManager transactionManager, TransactionType type) {
this.transactionManager = transactionManager;
this.type = type;
DefaultTransactionDefinition transactionDefinition = new DefaultTransactionDefinition();
switch (type) {
case BeanManaged:
transactionDefinition.setPropagationBehavior(org.springframework.transaction.TransactionDefinition.PROPAGATION_NOT_SUPPORTED);
break;
case Mandatory:
transactionDefinition.setPropagationBehavior(org.springframework.transaction.TransactionDefinition.PROPAGATION_MANDATORY);
break;
case Never:
transactionDefinition.setPropagationBehavior(org.springframework.transaction.TransactionDefinition.PROPAGATION_NEVER);
break;
case NotSupported:
transactionDefinition.setPropagationBehavior(org.springframework.transaction.TransactionDefinition.PROPAGATION_NOT_SUPPORTED);
break;
case Required:
transactionDefinition.setPropagationBehavior(org.springframework.transaction.TransactionDefinition.PROPAGATION_REQUIRED);
break;
case RequiresNew:
transactionDefinition.setPropagationBehavior(org.springframework.transaction.TransactionDefinition.PROPAGATION_REQUIRES_NEW);
break;
case Supports:
transactionDefinition.setPropagationBehavior(org.springframework.transaction.TransactionDefinition.PROPAGATION_SUPPORTS);
break;
}
TransactionStatus transactionStatus = transactionManager.getTransaction(transactionDefinition);
if (!(transactionManager instanceof DefaultTransactionStatus)) {