private Boolean requiresNew()

in jpa-cdi/src/main/java/org/apache/aries/jpa/cdi/TransactionalInterceptor.java [164:199]


    private Boolean requiresNew(boolean active, Transactional.TxType attribute) {
        switch (attribute) {
            case MANDATORY:
                if (active) {
                    return false;
                } else {
                    throw new IllegalStateException("Transaction is required to perform this method");
                }

            case NEVER:
                if (!active) {
                    return null;
                } else {
                    throw new IllegalStateException("This method cannot be invoked within a transaction");
                }

            case NOT_SUPPORTED:
                return null;

            case REQUIRED:
                return !active;

            case REQUIRES_NEW:
                return true;

            case SUPPORTS:
                if (active) {
                    return false;
                } else {
                    return null;
                }

            default:
                throw new UnsupportedOperationException("Unsupported TransactionAttribute value " + attribute);
        }
    }