From b138841faa468dce97562ab625738e5a5a18dbf3 Mon Sep 17 00:00:00 2001 From: Joern Muehlencord Date: Mon, 19 Aug 2019 13:04:06 +0200 Subject: [PATCH] fixed header --- ...ApplicationTransactionJoinInterceptor.java | 107 ++++++++++-------- .../de/muehlencord/shared/db/Validity.java | 18 ++- 2 files changed, 75 insertions(+), 50 deletions(-) diff --git a/db/src/main/java/de/muehlencord/shared/db/ApplicationTransactionJoinInterceptor.java b/db/src/main/java/de/muehlencord/shared/db/ApplicationTransactionJoinInterceptor.java index c61fe62..b2ee97f 100644 --- a/db/src/main/java/de/muehlencord/shared/db/ApplicationTransactionJoinInterceptor.java +++ b/db/src/main/java/de/muehlencord/shared/db/ApplicationTransactionJoinInterceptor.java @@ -1,46 +1,61 @@ -package de.muehlencord.shared.db; - -import javax.annotation.Priority; -import javax.inject.Inject; -import javax.interceptor.AroundInvoke; -import javax.interceptor.Interceptor; -import javax.interceptor.InvocationContext; -import javax.persistence.EntityManager; -import javax.transaction.Transactional; -import static javax.transaction.Transactional.TxType.REQUIRED; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Joern Muehlencord - */ -@Transactional(value = REQUIRED) -@Interceptor -@Priority(value = ApplicationTransactionJoinInterceptor.PRIORITY) -public class ApplicationTransactionJoinInterceptor { - - private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationTransactionJoinInterceptor.class); - - // attach behind the interceptor of the container - public static final int PRIORITY = Interceptor.Priority.PLATFORM_BEFORE + 250; - - @Inject - @ApplicationPU - private EntityManager em; - - @AroundInvoke - public Object joinTransaction(InvocationContext context) throws Exception { - if (em == null) { - return context.proceed(); - } else { - if (em.isJoinedToTransaction()) { - LOGGER.trace("transaction already joined"); - } else { - LOGGER.trace("joining transaction"); - em.joinTransaction(); - } - } - return context.proceed(); - } -} +/* + * Copyright 2019 joern.muehlencord. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package de.muehlencord.shared.db; + +import javax.annotation.Priority; +import javax.inject.Inject; +import javax.interceptor.AroundInvoke; +import javax.interceptor.Interceptor; +import javax.interceptor.InvocationContext; +import javax.persistence.EntityManager; +import javax.transaction.Transactional; +import static javax.transaction.Transactional.TxType.REQUIRED; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Joern Muehlencord + */ +@Transactional(value = REQUIRED) +@Interceptor +@Priority(value = ApplicationTransactionJoinInterceptor.PRIORITY) +public class ApplicationTransactionJoinInterceptor { + + private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationTransactionJoinInterceptor.class); + + // attach behind the interceptor of the container + public static final int PRIORITY = Interceptor.Priority.PLATFORM_BEFORE + 250; + + @Inject + @ApplicationPU + private EntityManager em; + + @AroundInvoke + public Object joinTransaction(InvocationContext context) throws Exception { + if (em == null) { + return context.proceed(); + } else { + if (em.isJoinedToTransaction()) { + LOGGER.trace("transaction already joined"); + } else { + LOGGER.trace("joining transaction"); + em.joinTransaction(); + } + } + return context.proceed(); + } +} diff --git a/db/src/main/java/de/muehlencord/shared/db/Validity.java b/db/src/main/java/de/muehlencord/shared/db/Validity.java index fe5a841..b8f5042 100644 --- a/db/src/main/java/de/muehlencord/shared/db/Validity.java +++ b/db/src/main/java/de/muehlencord/shared/db/Validity.java @@ -1,7 +1,17 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. +/* + * Copyright 2019 joern.muehlencord. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package de.muehlencord.shared.db;