001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.spring.transaction;
016    
017    import com.liferay.portal.kernel.transaction.Isolation;
018    import com.liferay.portal.kernel.transaction.Propagation;
019    
020    import org.springframework.transaction.interceptor.TransactionAttribute;
021    
022    /**
023     * @author Shuyang Zhou
024     */
025    public class TransactionAttributeAdapter
026            implements com.liferay.portal.kernel.transaction.TransactionAttribute,
027                               TransactionAttribute {
028    
029            public TransactionAttributeAdapter(
030                    TransactionAttribute transactionAttribute) {
031    
032                    _transactionAttribute = transactionAttribute;
033            }
034    
035            @Override
036            public Isolation getIsolation() {
037                    return Isolation.getIsolation(
038                            _transactionAttribute.getIsolationLevel());
039            }
040    
041            @Override
042            public int getIsolationLevel() {
043                    return _transactionAttribute.getIsolationLevel();
044            }
045    
046            @Override
047            public String getName() {
048                    return _transactionAttribute.getName();
049            }
050    
051            @Override
052            public Propagation getPropagation() {
053                    return Propagation.getPropagation(
054                            _transactionAttribute.getPropagationBehavior());
055            }
056    
057            @Override
058            public int getPropagationBehavior() {
059                    return _transactionAttribute.getPropagationBehavior();
060            }
061    
062            @Override
063            public String getQualifier() {
064                    return _transactionAttribute.getQualifier();
065            }
066    
067            @Override
068            public int getTimeout() {
069                    return _transactionAttribute.getTimeout();
070            }
071    
072            @Override
073            public boolean isReadOnly() {
074                    return _transactionAttribute.isReadOnly();
075            }
076    
077            @Override
078            public boolean rollbackOn(Throwable throwable) {
079                    return _transactionAttribute.rollbackOn(throwable);
080            }
081    
082            private final TransactionAttribute _transactionAttribute;
083    
084    }