transactionAttribute = this.defaultTransactionAttribute;
}
switch (transactionAttribute) {
case MANDATORY:
if (!this.cdoTransaction.isActive()) {
throw new CdoException("An active transaction is MANDATORY when calling method '" +
method.getDeclaringClass().getName() + "#" + method.getName() + "'");
}
return context.proceed();
case REQUIRES: {
if (!this.cdoTransaction.isActive()) {
try {
this.cdoTransaction.begin();
Object result = context.proceed();
this.cdoTransaction.commit();
return result;
} catch (RuntimeException e) {
if (this.cdoTransaction.isActive()) {
this.cdoTransaction.rollback();
}
throw e;
} catch (Exception e) {
if (this.cdoTransaction.isActive()) {
this.cdoTransaction.commit();
}
throw e;
}
} else {
return context.proceed();
}
}
case NOT_SUPPORTED:
return context.proceed();
default: {
throw new CdoException("Unsupported transaction attribute '" + transactionAttribute + "'");
}
}
}