Derek Hulley 76abcf04d9 Merged V2.9 to HEAD
10586: Merged V2.2 to V2.9
      9883: Fix for https://issues.alfresco.com/jira/browse/ETWOTWO-561
      9893: Gave some more time to wait for the threads to finish (QNameDAOTest)
      9955: Added trace logging of calls that possibly cause failures during session flushing
      9956: Part fix ETWOTWO570: RetryingTransactionAdvice needs to use RetryingTransactionHelper
      9958: Fixed ETWOTWO-570: AVM transaction interceptors fail if methods are incorrectly declared
      9973: More missing transaction declarations for AttributeService
      9977: Fixed unit test to rollback properly after expected txn failure
      9978: Fix for ETWOTWO-440: Error : 500: Failed to execute method NodeInfoBean.sendNodeInfo
      9986: LinkValidationService missing txn declaration for onBootstrap
   10588: Merged V2.2 to V2.9
      9898: Fixed handling of cm:name on root nodes
      9900: Empty property sets are allowed
   10589: Merged V2.2 to V2.9
      9965: Fixed unit test to inject 'nodeService' and not 'NodeService'.
      10311: getWebProjectUserRole - change log level from info to debug
      10329: Fix missing and mis-spelt transaction declarations
      10343: Fix for ETWOTWO-32
      10346: Build Fix
      10358: Fix for ETWOTWO-621
      10362: Fix for ETWOTWO-518
      10371: QNameDAO cache doesn't blow up if cache entry is invalid
      10538: Fix for minor XSS issue identified in ETWOTWO-657 item 3
   10678: Merged V2.2 to V2.9
      10205: Fix for ETWOTWO-48: Cancelled import of war into a Web project and Web Project became unusable
      10206: Fix for ETWOTWO-181: Deletion of checked out document


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10710 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2008-09-04 01:19:51 +00:00

55 lines
2.2 KiB
Java

/*
* Copyright (C) 2005-2008 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.repo.transaction;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport.TxnReadState;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
/**
* A wrapper that checks that a transaction is present.
*
* @author Derek Hulley
* @since 2.2.1
*/
public class CheckTransactionAdvice implements MethodInterceptor
{
public CheckTransactionAdvice()
{
}
public Object invoke(final MethodInvocation methodInvocation) throws Throwable
{
// Just check for any transaction
if (AlfrescoTransactionSupport.getTransactionReadState() == TxnReadState.TXN_NONE)
{
String methodName = methodInvocation.getMethod().getName();
String className = methodInvocation.getMethod().getDeclaringClass().getName();
throw new AlfrescoRuntimeException("A transaction has not be started for method " + methodName + " on " + className);
}
return methodInvocation.proceed();
}
}