From bfcabea61048ccb21a591e0c4f1f8efecc7636b4 Mon Sep 17 00:00:00 2001 From: SebastianRoseneck <55637012+SebastianRoseneck@users.noreply.github.com> Date: Thu, 20 May 2021 09:41:58 +0200 Subject: [PATCH] TSK-1596: Automatic TraceLogging (#1577) --- .github/workflows/continuous-integration.yml | 4 +- ci/taskana-sonar-test-coverage/pom.xml | 5 + common/pom.xml | 1 + common/taskana-common-data/pom.xml | 7 +- .../sampledata/SampleDataGenerator.java | 16 -- common/taskana-common-logging/pom.xml | 60 +++++ .../internal/logging/LoggingAspect.java | 85 +++++++ .../common/internal/logging/NoLogging.java | 10 + .../internal/logging/LoggingAspectTest.java | 177 +++++++++++++++ .../src/test/resources/log4j2-test.xml | 18 ++ common/taskana-common-security/pom.xml | 5 + .../security/CurrentUserContextImpl.java | 16 +- common/taskana-common-test/pom.xml | 7 +- common/taskana-common/pom.xml | 10 + .../configuration/DbSchemaCreator.java | 34 ++- .../configuration/SecurityVerifier.java | 19 +- .../internal/persistence/MapTypeHandler.java | 4 +- .../util/ObjectAttributeChangeDetector.java | 27 --- history/taskana-loghistory-provider/pom.xml | 7 +- .../impl/LogfileHistoryServiceImpl.java | 8 +- .../taskana-simplehistory-provider/pom.xml | 5 + .../impl/ClassificationHistoryQueryImpl.java | 25 -- .../impl/SimpleHistoryServiceImpl.java | 12 - .../impl/TaskHistoryQueryImpl.java | 25 -- .../impl/WorkbasketHistoryQueryImpl.java | 25 -- .../impl/jobs/HistoryCleanupJob.java | 44 ++-- ...eteHistoryEventsOnTaskDeletionAccTest.java | 9 +- .../taskana-simplehistory-rest-spring/pom.xml | 5 + .../rest/TaskHistoryEventController.java | 20 -- lib/taskana-cdi-example/pom.xml | 5 + lib/taskana-cdi/pom.xml | 7 +- .../common/internal/TaskanaProducers.java | 4 +- lib/taskana-core/pom.xml | 5 + .../taskana/TaskanaEngineConfiguration.java | 60 +++-- .../api/ClassificationService.java | 2 +- .../internal/ClassificationQueryImpl.java | 25 +- .../internal/ClassificationServiceImpl.java | 42 ++-- .../jobs/ClassificationChangedJob.java | 14 +- .../common/internal/JobServiceImpl.java | 35 +-- .../common/internal/jobs/JobRunner.java | 9 +- ...assificationCategoryReportBuilderImpl.java | 7 - .../ClassificationReportBuilderImpl.java | 8 - ...TaskCustomFieldValueReportBuilderImpl.java | 7 - .../reports/TaskStatusReportBuilderImpl.java | 29 +-- .../TimeIntervalReportBuilderImpl.java | 16 -- .../reports/TimestampReportBuilderImpl.java | 5 - .../reports/WorkbasketReportBuilderImpl.java | 31 ++- .../history/internal/HistoryEventManager.java | 16 +- .../routing/internal/TaskRoutingManager.java | 5 - .../CreateTaskPreprocessorManager.java | 4 +- .../task/api/models/ObjectReference.java | 5 - .../task/internal/AttachmentHandler.java | 58 ++--- .../internal/ObjectReferenceQueryImpl.java | 24 -- .../task/internal/TaskCommentServiceImpl.java | 41 +--- .../taskana/task/internal/TaskQueryImpl.java | 29 +-- .../task/internal/TaskServiceImpl.java | 214 ++++-------------- .../task/internal/TaskTransferrer.java | 99 ++------ .../task/internal/jobs/TaskCleanupJob.java | 22 +- ...AbstractWorkbasketAccessItemQueryImpl.java | 28 --- .../WorkbasketAccessItemQueryImpl.java | 26 --- .../internal/WorkbasketQueryImpl.java | 28 --- .../internal/WorkbasketServiceImpl.java | 208 +++++++---------- .../internal/jobs/WorkbasketCleanupJob.java | 8 +- .../java/acceptance/ArchitectureTest.java | 8 +- .../src/test/java/acceptance/PojoTest.java | 22 +- .../task/SelectAndClaimTaskAccTest.java | 2 +- lib/taskana-spring-example/pom.xml | 5 + lib/taskana-spring/pom.xml | 7 +- pom.xml | 50 ++++ rest/taskana-rest-spring-example-boot/pom.xml | 11 +- .../pom.xml | 7 +- .../taskana/example/jobs/JobScheduler.java | 2 - .../rest/controllers/LoginController.java | 5 - .../pom.xml | 7 +- rest/taskana-rest-spring/pom.xml | 7 +- .../rest/ClassificationController.java | 34 --- .../ClassificationDefinitionController.java | 27 --- .../common/rest/AccessIdController.java | 44 +--- .../rest/SpringSecurityToJaasFilter.java | 27 ++- .../common/rest/TaskanaEngineController.java | 56 +---- .../taskana/common/rest/ldap/LdapClient.java | 99 +++----- .../monitor/rest/MonitorController.java | 56 ++--- .../task/rest/TaskCommentController.java | 78 +------ .../pro/taskana/task/rest/TaskController.java | 133 ++--------- .../rest/WorkbasketAccessItemController.java | 18 +- .../workbasket/rest/WorkbasketController.java | 118 ++-------- .../rest/WorkbasketDefinitionController.java | 22 +- ...sificationDefinitionControllerIntTest.java | 8 +- .../taskana-spi-routing-dmn-router/pom.xml | 5 + web/pom.xml | 8 + 90 files changed, 1055 insertions(+), 1627 deletions(-) create mode 100644 common/taskana-common-logging/pom.xml create mode 100644 common/taskana-common-logging/src/main/java/pro/taskana/common/internal/logging/LoggingAspect.java create mode 100644 common/taskana-common-logging/src/main/java/pro/taskana/common/internal/logging/NoLogging.java create mode 100644 common/taskana-common-logging/src/test/java/pro/taskana/common/internal/logging/LoggingAspectTest.java create mode 100644 common/taskana-common-logging/src/test/resources/log4j2-test.xml diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 9fe811460..20f3d094e 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -230,6 +230,7 @@ jobs: - taskana-common - taskana-common-security - taskana-common-data + - taskana-common-logging - taskana-common-test - taskana-core - taskana-cdi @@ -367,7 +368,8 @@ jobs: ./mvnw -B deploy -P $([[ "$GITHUB_REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "release" || echo "snapshot") \ --settings ci/mvnsettings.xml -DskipTests -Dcheckstyle.skip -Dasciidoctor.skip -Djacoco.skip \ -pl :taskana-parent,\ - :taskana-common-parent,:taskana-common,:taskana-common-security,:taskana-common-data,:taskana-common-test,\ + :taskana-common-parent,:taskana-common-logging,:taskana-common,:taskana-common-security,\ + :taskana-common-data,:taskana-common-test,\ :taskana-lib-parent,:taskana-core,:taskana-cdi,:taskana-spring,\ :taskana-rest-parent,:taskana-web,:taskana-rest-spring,\ :taskana-history-parent,:taskana-simplehistory-provider,:taskana-simplehistory-rest-spring,:taskana-loghistory-provider,\ diff --git a/ci/taskana-sonar-test-coverage/pom.xml b/ci/taskana-sonar-test-coverage/pom.xml index 18c431f14..a984a8609 100644 --- a/ci/taskana-sonar-test-coverage/pom.xml +++ b/ci/taskana-sonar-test-coverage/pom.xml @@ -17,6 +17,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + pro.taskana taskana-common diff --git a/common/pom.xml b/common/pom.xml index 0e53d69fa..8a36b662a 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -21,5 +21,6 @@ taskana-common-security taskana-common-data taskana-common-test + taskana-common-logging diff --git a/common/taskana-common-data/pom.xml b/common/taskana-common-data/pom.xml index a6f114675..57b1341a1 100644 --- a/common/taskana-common-data/pom.xml +++ b/common/taskana-common-data/pom.xml @@ -15,6 +15,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + org.mybatis mybatis @@ -52,4 +57,4 @@ test - \ No newline at end of file + diff --git a/common/taskana-common-data/src/main/java/pro/taskana/sampledata/SampleDataGenerator.java b/common/taskana-common-data/src/main/java/pro/taskana/sampledata/SampleDataGenerator.java index 5a5a5d938..a0a51c038 100644 --- a/common/taskana-common-data/src/main/java/pro/taskana/sampledata/SampleDataGenerator.java +++ b/common/taskana-common-data/src/main/java/pro/taskana/sampledata/SampleDataGenerator.java @@ -51,43 +51,29 @@ public class SampleDataGenerator { } public void generateSampleData() { - LOGGER.debug("entry to generateSampleData()"); clearDb(); Stream scripts = SampleDataProvider.getSampleDataCreationScripts(); executeAndCacheScripts(scripts, CACHED_SAMPLE); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("exit from generateSampleData()"); - } } public void generateTestData() { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("entry to generateTestData()"); - } Stream scripts = SampleDataProvider.getTestDataScripts(); executeAndCacheScripts(scripts, CACHED_TEST); - LOGGER.debug("exit from generateTestData()"); } public void generateMonitorData() { - LOGGER.debug("entry to generateMonitorData()"); Stream scripts = SampleDataProvider.getMonitorDataScripts(); executeAndCacheScripts(scripts, CACHED_MONITOR); - LOGGER.debug("exit from generateMonitorData()"); } public void clearDb() { - LOGGER.debug("entry to clearDb()"); Stream scripts = SampleDataProvider.getScriptsToClearDatabase(); executeAndCacheScripts(scripts, CACHED_CLEAR_DB); - LOGGER.debug("exit from clearDb()"); } public void dropDb() { - LOGGER.debug("entry to dropDb()"); Stream scripts = SampleDataProvider.getScriptsToDropDatabase(); executeAndCacheScripts(scripts, CACHED_DROP_DB); - LOGGER.debug("exit from dropDb()"); } private List parseScripts(Stream scripts) { @@ -127,7 +113,6 @@ public class SampleDataGenerator { } private void executeAndCacheScripts(Stream scripts, String cacheKey) { - LOGGER.debug("entry to executeAndCacheScripts(scripts = {}, cacheKey = {})", scripts, cacheKey); runScripts( runner -> CACHED_SCRIPTS.computeIfAbsent(cacheKey, key -> parseScripts(scripts)).stream() @@ -135,7 +120,6 @@ public class SampleDataGenerator { .map(ByteArrayInputStream::new) .map(s -> new InputStreamReader(s, StandardCharsets.UTF_8)) .forEach(runner::runScript)); - LOGGER.debug("exit from executeAndCacheScripts()"); } private ScriptRunner getScriptRunner( diff --git a/common/taskana-common-logging/pom.xml b/common/taskana-common-logging/pom.xml new file mode 100644 index 000000000..1fdbc01f8 --- /dev/null +++ b/common/taskana-common-logging/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + taskana-common-logging + + ${project.groupId}:${project.artifactId} + The global trace logging implementation + + + taskana-common-parent + pro.taskana + 4.6.1-SNAPSHOT + + + + + org.aspectj + aspectjrt + ${version.aspectj} + + + org.slf4j + slf4j-api + + + + + org.junit.jupiter + junit-jupiter + test + + + uk.org.lidalia + slf4j-test + ${version.slf4j-test} + test + + + org.assertj + assertj-core + test + + + + + + + com.nickwongdev + aspectj-maven-plugin + ${version.aspectj-maven-plugin} + + + + + + + + diff --git a/common/taskana-common-logging/src/main/java/pro/taskana/common/internal/logging/LoggingAspect.java b/common/taskana-common-logging/src/main/java/pro/taskana/common/internal/logging/LoggingAspect.java new file mode 100644 index 000000000..c3aa1f270 --- /dev/null +++ b/common/taskana-common-logging/src/main/java/pro/taskana/common/internal/logging/LoggingAspect.java @@ -0,0 +1,85 @@ +package pro.taskana.common.internal.logging; + +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.AfterReturning; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Aspect +public class LoggingAspect { + + private static final Map CLASS_TO_LOGGER = new ConcurrentHashMap<>(); + + @Pointcut( + "!@annotation(pro.taskana.common.internal.logging.NoLogging)" + + " && execution(* *(..))" + + " && !execution(* lambda*(..))" + + " && !execution(String *.toString())" + + " && !execution(int *.hashCode())" + + " && !execution(boolean *.canEqual(Object))" + + " && !execution(boolean *.equals(Object))") + public void traceLogging() {} + + @Before("traceLogging()") + public void beforeMethodExecuted(JoinPoint joinPoint) { + MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); + String declaringTypeName = methodSignature.getDeclaringTypeName(); + Logger currentLogger = + CLASS_TO_LOGGER.computeIfAbsent(declaringTypeName, LoggerFactory::getLogger); + + if (currentLogger.isTraceEnabled()) { + String methodName = methodSignature.getName(); + Object[] values = joinPoint.getArgs(); + String[] parameterNames = methodSignature.getParameterNames(); + String parametersValues = mapParametersNameValue(parameterNames, values); + + currentLogger.trace("entry to {}({})", methodName, parametersValues); + } + } + + @AfterReturning(pointcut = "traceLogging()", returning = "returnedObject") + public void afterMethodExecuted(JoinPoint joinPoint, Object returnedObject) { + MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); + String declaringTypeName = methodSignature.getDeclaringTypeName(); + Logger currentLogger = + CLASS_TO_LOGGER.computeIfAbsent(declaringTypeName, LoggerFactory::getLogger); + + if (currentLogger.isTraceEnabled()) { + String methodName = methodSignature.getName(); + // unfortunately necessary, because this method returns a raw type + Class returnType = methodSignature.getReturnType(); + if (returnType.isAssignableFrom(void.class)) { + currentLogger.trace("exit from {}.", methodName); + } else { + currentLogger.trace( + "exit from {}. Returning: '{}'", methodName, Objects.toString(returnedObject, "null")); + } + } + } + + @NoLogging + private static String mapParametersNameValue(String[] parameterNames, Object[] values) { + Map parametersNameToValue = new HashMap<>(); + + if (parameterNames.length > 0) { + for (int i = 0; i < parameterNames.length; i++) { + parametersNameToValue.put(parameterNames[i], values[i]); + } + } + + StringBuilder stringBuilder = new StringBuilder(); + for (Entry parameter : parametersNameToValue.entrySet()) { + stringBuilder.append(parameter.getKey()).append(" = ").append(parameter.getValue()); + } + return stringBuilder.toString(); + } +} diff --git a/common/taskana-common-logging/src/main/java/pro/taskana/common/internal/logging/NoLogging.java b/common/taskana-common-logging/src/main/java/pro/taskana/common/internal/logging/NoLogging.java new file mode 100644 index 000000000..2e96250aa --- /dev/null +++ b/common/taskana-common-logging/src/main/java/pro/taskana/common/internal/logging/NoLogging.java @@ -0,0 +1,10 @@ +package pro.taskana.common.internal.logging; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD, ElementType.TYPE}) +public @interface NoLogging {} diff --git a/common/taskana-common-logging/src/test/java/pro/taskana/common/internal/logging/LoggingAspectTest.java b/common/taskana-common-logging/src/test/java/pro/taskana/common/internal/logging/LoggingAspectTest.java new file mode 100644 index 000000000..5f5340dbe --- /dev/null +++ b/common/taskana-common-logging/src/test/java/pro/taskana/common/internal/logging/LoggingAspectTest.java @@ -0,0 +1,177 @@ +package pro.taskana.common.internal.logging; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.assertj.core.api.Condition; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import uk.org.lidalia.slf4jext.Level; +import uk.org.lidalia.slf4jtest.LoggingEvent; +import uk.org.lidalia.slf4jtest.TestLogger; +import uk.org.lidalia.slf4jtest.TestLoggerFactory; + +class LoggingAspectTest { + + TestLogger logger = TestLoggerFactory.getTestLogger(LoggingTestClass.class); + + @BeforeEach + public void clearLoggers() { + TestLoggerFactory.clear(); + } + + @Test + void should_Log_For_InternalMethod() { + LoggingTestClass loggingTestClass = new LoggingTestClass(); + + loggingTestClass.logInternalMethod(); + + verifyLoggingStatement("logInternalMethod", "", null); + } + + @Test + void should_Log_For_InternalMethodWithReturnValue() { + LoggingTestClass loggingTestClass = new LoggingTestClass(); + + loggingTestClass.logInternalMethodWithReturnValue(); + + verifyLoggingStatement("logInternalMethodWithReturnValue", "", "test string"); + } + + @Test + void should_Log_For_InternalMethodWithReturnValueNull() { + LoggingTestClass loggingTestClass = new LoggingTestClass(); + + loggingTestClass.logInternalMethodWithReturnValueNull(); + + verifyLoggingStatement("logInternalMethodWithReturnValueNull", "", "null"); + } + + @Test + void should_Log_For_InternalMethodWithArguments() { + LoggingTestClass loggingTestClass = new LoggingTestClass(); + + loggingTestClass.logInternalMethodWithArguments("message"); + + verifyLoggingStatement("logInternalMethodWithArguments", "param = message", null); + } + + @Test + void should_Log_For_InternalMethodWithReturnValueAndArguments() { + LoggingTestClass loggingTestClass = new LoggingTestClass(); + + loggingTestClass.logInternalMethodWithReturnValueAndArguments("message"); + + verifyLoggingStatement( + "logInternalMethodWithReturnValueAndArguments", "param = message", "return value"); + } + + @Test + void should_NotLog_For_ExternalMethod() { + LoggingTestClass loggingTestClass = new LoggingTestClass(); + + loggingTestClass.callsExternalMethod(); + + verifyLoggingStatement("callsExternalMethod", "", null); + } + + @Test + void should_LogMultipleMethods_When_SubMethodIsCalled() { + LoggingTestClass loggingTestClass = new LoggingTestClass(); + + loggingTestClass.logInternalMethodWrapper(); + assertThat(logger.getLoggingEvents()) + .extracting(LoggingEvent::getMessage) + .areExactly(2, new Condition<>(message -> message.startsWith("entry to"), "entry log")) + .areExactly(2, new Condition<>(message -> message.startsWith("exit from"), "exit log")); + } + + @Test + void should_NotLogInternalMethod_When_MethodIsAnnotatedWithNoLogging() { + LoggingTestClass loggingTestClass = new LoggingTestClass(); + + loggingTestClass.doNotLogInternalMethod(); + + assertThat(logger.getLoggingEvents()).isEmpty(); + } + + @Test + void should_NotLogInternalMethod_When_ClassIsAnnotatedWithNoLogging() { + NoLoggingTestClass noLoggingTestClass = new NoLoggingTestClass(); + + noLoggingTestClass.doNotLogInternalMethod(); + + assertThat(logger.getLoggingEvents()).isEmpty(); + } + + @Test + void should_NotLogInternalMethod_When_SuperClassIsAnnotatedWithNoLogging() { + NoLoggingTestSubClass noLoggingTestSubClass = new NoLoggingTestSubClass(); + + noLoggingTestSubClass.doNotLogInternalMethod(); + + assertThat(logger.getLoggingEvents()).isEmpty(); + } + + private void verifyLoggingStatement(String methodName, String arguments, Object returnValue) { + assertThat(logger.getLoggingEvents()).hasSize(2); + LoggingEvent entryLoggingEvent = logger.getLoggingEvents().get(0); + assertThat(entryLoggingEvent.getLevel()).isEqualTo(Level.TRACE); + assertThat(entryLoggingEvent.getMessage()).startsWith("entry to"); + assertThat(entryLoggingEvent.getArguments()).containsExactly(methodName, arguments); + + LoggingEvent exitLoggingEvent = logger.getLoggingEvents().get(1); + + assertThat(exitLoggingEvent.getLevel()).isEqualTo(Level.TRACE); + assertThat(exitLoggingEvent.getMessage()).startsWith("exit from"); + + if (returnValue == null) { + assertThat(exitLoggingEvent.getArguments()).containsExactly(methodName); + } else { + assertThat(exitLoggingEvent.getMessage()).contains("Returning: "); + assertThat(exitLoggingEvent.getArguments()).containsExactly(methodName, returnValue); + } + } + + static class LoggingTestClass { + public void logInternalMethod() {} + + @SuppressWarnings("UnusedReturnValue") + String logInternalMethodWithReturnValue() { + return "test string"; + } + + @SuppressWarnings("UnusedReturnValue") + public String logInternalMethodWithReturnValueNull() { + return null; + } + + @SuppressWarnings("unused") + public void logInternalMethodWithArguments(String param) {} + + @SuppressWarnings({"UnusedReturnValue", "unused"}) + public String logInternalMethodWithReturnValueAndArguments(String param) { + return "return value"; + } + + public void logInternalMethodWrapper() { + logInternalMethodPrivate(); + } + + @SuppressWarnings("unused") + public void callsExternalMethod() { + String sum = String.valueOf(5); + } + + @NoLogging + public void doNotLogInternalMethod() {} + + private void logInternalMethodPrivate() {} + } + + @NoLogging + static class NoLoggingTestClass { + public void doNotLogInternalMethod() {} + } + + static class NoLoggingTestSubClass extends NoLoggingTestClass {} +} diff --git a/common/taskana-common-logging/src/test/resources/log4j2-test.xml b/common/taskana-common-logging/src/test/resources/log4j2-test.xml new file mode 100644 index 000000000..f63741e5f --- /dev/null +++ b/common/taskana-common-logging/src/test/resources/log4j2-test.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + diff --git a/common/taskana-common-security/pom.xml b/common/taskana-common-security/pom.xml index 32ad9973c..ed80b6774 100644 --- a/common/taskana-common-security/pom.xml +++ b/common/taskana-common-security/pom.xml @@ -15,6 +15,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + org.slf4j slf4j-api diff --git a/common/taskana-common-security/src/main/java/pro/taskana/common/internal/security/CurrentUserContextImpl.java b/common/taskana-common-security/src/main/java/pro/taskana/common/internal/security/CurrentUserContextImpl.java index 48dc05855..c356e08aa 100644 --- a/common/taskana-common-security/src/main/java/pro/taskana/common/internal/security/CurrentUserContextImpl.java +++ b/common/taskana-common-security/src/main/java/pro/taskana/common/internal/security/CurrentUserContextImpl.java @@ -30,10 +30,14 @@ public class CurrentUserContextImpl implements CurrentUserContext { this.shouldUseLowerCaseForAccessIds = shouldUseLowerCaseForAccessIds; try { Class.forName(WSSUBJECT_CLASSNAME); - LOGGER.debug("WSSubject detected. Assuming that Taskana runs on IBM WebSphere."); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("WSSubject detected. Assuming that Taskana runs on IBM WebSphere."); + } runningOnWebSphere = true; } catch (ClassNotFoundException e) { - LOGGER.debug("No WSSubject detected. Using JAAS subject further on."); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("No WSSubject detected. Using JAAS subject further on."); + } runningOnWebSphere = false; } } @@ -79,10 +83,14 @@ public class CurrentUserContextImpl implements CurrentUserContext { Method getCallerSubjectMethod = wsSubjectClass.getMethod(GET_CALLER_SUBJECT_METHOD, (Class[]) null); Subject callerSubject = (Subject) getCallerSubjectMethod.invoke(null, (Object[]) null); - LOGGER.debug("Subject of caller: {}", callerSubject); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Subject of caller: {}", callerSubject); + } if (callerSubject != null) { Set publicCredentials = callerSubject.getPublicCredentials(); - LOGGER.debug("Public credentials of caller: {}", publicCredentials); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Public credentials of caller: {}", publicCredentials); + } return publicCredentials.stream() .map( // we could use CheckedFunction#wrap here, but this either requires a dependency diff --git a/common/taskana-common-test/pom.xml b/common/taskana-common-test/pom.xml index 0e5c763b5..98948e9be 100644 --- a/common/taskana-common-test/pom.xml +++ b/common/taskana-common-test/pom.xml @@ -16,6 +16,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + pro.taskana taskana-common @@ -110,4 +115,4 @@ - \ No newline at end of file + diff --git a/common/taskana-common/pom.xml b/common/taskana-common/pom.xml index 849023d1b..61e2fdc74 100644 --- a/common/taskana-common/pom.xml +++ b/common/taskana-common/pom.xml @@ -15,6 +15,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + pro.taskana taskana-common-security @@ -36,6 +41,11 @@ + + org.slf4j + slf4j-simple + test + org.junit.jupiter junit-jupiter diff --git a/common/taskana-common/src/main/java/pro/taskana/common/internal/configuration/DbSchemaCreator.java b/common/taskana-common/src/main/java/pro/taskana/common/internal/configuration/DbSchemaCreator.java index 5072b8710..ec0a77498 100644 --- a/common/taskana-common/src/main/java/pro/taskana/common/internal/configuration/DbSchemaCreator.java +++ b/common/taskana-common/src/main/java/pro/taskana/common/internal/configuration/DbSchemaCreator.java @@ -56,10 +56,12 @@ public class DbSchemaCreator { */ public void run() throws SQLException { try (Connection connection = dataSource.getConnection()) { - LOGGER.debug( - "Using database of type {} with url '{}'", - connection.getMetaData().getDatabaseProductName(), - connection.getMetaData().getURL()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Using database of type {} with url '{}'", + connection.getMetaData().getDatabaseProductName(), + connection.getMetaData().getURL()); + } ScriptRunner runner = getScriptRunnerInstance(connection); String dbProductId = DB.getDatabaseProductId(connection.getMetaData().getDatabaseProductName()); @@ -72,7 +74,9 @@ public class DbSchemaCreator { runner.runScript(getSqlSchemaNameParsed(reader)); } } - LOGGER.debug(outWriter.toString()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug(outWriter.toString()); + } if (!errorWriter.toString().trim().isEmpty()) { LOGGER.error(errorWriter.toString()); } @@ -82,7 +86,9 @@ public class DbSchemaCreator { try (Connection connection = dataSource.getConnection()) { connection.setSchema(this.schemaName); SqlRunner runner = new SqlRunner(connection); - LOGGER.debug(connection.getMetaData().toString()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug(connection.getMetaData().toString()); + } String query = "select VERSION from TASKANA_SCHEMA_VERSION where " @@ -100,7 +106,9 @@ public class DbSchemaCreator { expectedMinVersion); return false; } else { - LOGGER.debug("Schema version is valid."); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Schema version is valid."); + } return true; } @@ -164,13 +172,17 @@ public class DbSchemaCreator { BufferedReader reader = new BufferedReader(inputReader)) { runner.runScript(getSqlSchemaNameParsed(reader)); } catch (RuntimeSqlException | IOException e) { - LOGGER.debug("Schema does not exist."); - if (!errorWriter.toString().trim().isEmpty()) { - LOGGER.debug(errorWriter.toString()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Schema does not exist."); + if (!errorWriter.toString().trim().isEmpty()) { + LOGGER.debug(errorWriter.toString()); + } } return false; } - LOGGER.debug("Schema does exist."); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Schema does exist."); + } return true; } diff --git a/common/taskana-common/src/main/java/pro/taskana/common/internal/configuration/SecurityVerifier.java b/common/taskana-common/src/main/java/pro/taskana/common/internal/configuration/SecurityVerifier.java index c68e73918..d498d7e0e 100644 --- a/common/taskana-common/src/main/java/pro/taskana/common/internal/configuration/SecurityVerifier.java +++ b/common/taskana-common/src/main/java/pro/taskana/common/internal/configuration/SecurityVerifier.java @@ -26,13 +26,6 @@ public class SecurityVerifier { } public void checkSecureAccess(boolean securityEnabled) { - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - String.format( - "Entering checkSecureAccess with securityEnabled set to %b", securityEnabled)); - } - try (Connection connection = dataSource.getConnection()) { if (LOGGER.isDebugEnabled()) { @@ -54,14 +47,18 @@ public class SecurityVerifier { } } catch (SQLException ex) { - LOGGER.debug( - String.format( - "Security-mode is not yet set. Setting security flag to %b", securityEnabled)); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + String.format( + "Security-mode is not yet set. Setting security flag to %b", securityEnabled)); + } setInitialSecurityMode(securityEnabled); } - LOGGER.debug("Security-mode is enabled"); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Security-mode is enabled"); + } } private void setInitialSecurityMode(boolean securityEnabled) { diff --git a/common/taskana-common/src/main/java/pro/taskana/common/internal/persistence/MapTypeHandler.java b/common/taskana-common/src/main/java/pro/taskana/common/internal/persistence/MapTypeHandler.java index f97a2f56e..7f22d7f46 100644 --- a/common/taskana-common/src/main/java/pro/taskana/common/internal/persistence/MapTypeHandler.java +++ b/common/taskana-common/src/main/java/pro/taskana/common/internal/persistence/MapTypeHandler.java @@ -22,7 +22,9 @@ public class MapTypeHandler extends BaseTypeHandler> { PreparedStatement ps, int i, Map parameter, JdbcType jdbcType) throws SQLException { if (parameter != null && parameter.size() > 0) { - LOGGER.debug("Input-Map before serializing: {}", parameter); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Input-Map before serializing: {}", parameter); + } // Convert Map to JSON string JSONObject jsonObj = new JSONObject(parameter); ps.setString(i, jsonObj.toString()); diff --git a/common/taskana-common/src/main/java/pro/taskana/common/internal/util/ObjectAttributeChangeDetector.java b/common/taskana-common/src/main/java/pro/taskana/common/internal/util/ObjectAttributeChangeDetector.java index c9ac70f51..2ee632b82 100644 --- a/common/taskana-common/src/main/java/pro/taskana/common/internal/util/ObjectAttributeChangeDetector.java +++ b/common/taskana-common/src/main/java/pro/taskana/common/internal/util/ObjectAttributeChangeDetector.java @@ -9,15 +9,11 @@ import java.util.Optional; import java.util.function.Predicate; import java.util.stream.Collectors; import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import pro.taskana.common.api.exceptions.SystemException; public class ObjectAttributeChangeDetector { - private static final Logger LOGGER = LoggerFactory.getLogger(ObjectAttributeChangeDetector.class); - private ObjectAttributeChangeDetector() {} /** @@ -30,11 +26,6 @@ public class ObjectAttributeChangeDetector { * @throws SystemException when any parameter is null */ public static String determineChangesInAttributes(T oldObject, T newObject) { - LOGGER.debug( - "Entry to determineChangesInAttributes (oldObject = {}, newObject = {}", - oldObject, - newObject); - List fields = new ArrayList<>(); if (Objects.isNull(oldObject) || Objects.isNull(newObject)) { @@ -85,10 +76,6 @@ public class ObjectAttributeChangeDetector { JSONObject changes = new JSONObject(); changes.put("changes", changedAttributes); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from determineChangesInAttributes(), returning {}", changes); - } - return changes.toString(); } @@ -100,12 +87,6 @@ public class ObjectAttributeChangeDetector { } private static String compareLists(T oldObject, T newObject) { - - LOGGER.debug( - "Entry to determineChangesInAttributes (oldObject = {}, newObject = {}", - oldObject, - newObject); - if (!oldObject.equals(newObject)) { JSONObject changedAttribute = new JSONObject(); @@ -116,16 +97,8 @@ public class ObjectAttributeChangeDetector { changes.put("changes", changedAttribute); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from determineChangesInAttributes(), returning {}", changes); - } return changes.toString(); } - - LOGGER.debug( - "Exit from determineChangesInAttributes(), " - + "returning empty String because there are no changed attributes"); - return ""; } } diff --git a/history/taskana-loghistory-provider/pom.xml b/history/taskana-loghistory-provider/pom.xml index ef28c2a99..313284ee9 100644 --- a/history/taskana-loghistory-provider/pom.xml +++ b/history/taskana-loghistory-provider/pom.xml @@ -16,6 +16,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + pro.taskana taskana-core @@ -59,4 +64,4 @@ - \ No newline at end of file + diff --git a/history/taskana-loghistory-provider/src/main/java/pro/taskana/loghistory/impl/LogfileHistoryServiceImpl.java b/history/taskana-loghistory-provider/src/main/java/pro/taskana/loghistory/impl/LogfileHistoryServiceImpl.java index 7d762abb3..f743ce30a 100644 --- a/history/taskana-loghistory-provider/src/main/java/pro/taskana/loghistory/impl/LogfileHistoryServiceImpl.java +++ b/history/taskana-loghistory-provider/src/main/java/pro/taskana/loghistory/impl/LogfileHistoryServiceImpl.java @@ -105,13 +105,17 @@ public class LogfileHistoryServiceImpl implements TaskanaHistory { LOGGER.error("taskana properties file {} was not found on classpath.", propertiesFile); } else { props.load(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); - LOGGER.debug("properties were loaded from file {} from classpath.", propertiesFile); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("properties were loaded from file {} from classpath.", propertiesFile); + } } } else { try (FileInputStream stream = new FileInputStream(propertiesFile)) { props.load(stream); } - LOGGER.debug("properties were loaded from file {}.", propertiesFile); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("properties were loaded from file {}.", propertiesFile); + } } } catch (IOException e) { LOGGER.error("caught IOException when processing properties file {}.", propertiesFile); diff --git a/history/taskana-simplehistory-provider/pom.xml b/history/taskana-simplehistory-provider/pom.xml index 38c32ced9..83a1620e9 100644 --- a/history/taskana-simplehistory-provider/pom.xml +++ b/history/taskana-simplehistory-provider/pom.xml @@ -16,6 +16,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + pro.taskana taskana-core diff --git a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/ClassificationHistoryQueryImpl.java b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/ClassificationHistoryQueryImpl.java index 17ff107c0..472c22cdb 100644 --- a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/ClassificationHistoryQueryImpl.java +++ b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/ClassificationHistoryQueryImpl.java @@ -414,7 +414,6 @@ public class ClassificationHistoryQueryImpl implements ClassificationHistoryQuer @Override public List list() { - LOGGER.debug("entry to list(), this = {}", this); List result = new ArrayList<>(); try { taskanaHistoryEngine.openConnection(); @@ -425,16 +424,11 @@ public class ClassificationHistoryQueryImpl implements ClassificationHistoryQuer return result; } finally { taskanaHistoryEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from list(). Returning {} resulting Objects: {} ", result.size(), result); - } } } @Override public List list(int offset, int limit) { - LOGGER.debug("entry to list({},{}), this = {}", offset, limit, this); List result = new ArrayList<>(); try { taskanaHistoryEngine.openConnection(); @@ -446,23 +440,12 @@ public class ClassificationHistoryQueryImpl implements ClassificationHistoryQuer return result; } finally { taskanaHistoryEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from list(offset,limit). Returning {} resulting Objects: {} ", - result.size(), - result); - } } } @Override public List listValues( ClassificationHistoryQueryColumnName dbColumnName, SortDirection sortDirection) { - LOGGER.debug( - "entry to listValues() of column {} with sortDirection {}, this {}", - dbColumnName, - sortDirection, - this); List result = new ArrayList<>(); this.columnName = dbColumnName; List cacheOrderBy = new ArrayList<>(this.orderBy); @@ -481,16 +464,11 @@ public class ClassificationHistoryQueryImpl implements ClassificationHistoryQuer this.columnName = null; this.orderColumns.remove(orderColumns.size() - 1); taskanaHistoryEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "Exit from listValues. Returning {} resulting Objects: {} ", result.size(), result); - } } } @Override public ClassificationHistoryEvent single() { - LOGGER.debug("entry to single(), this = {}", this); ClassificationHistoryEvent result = null; try { @@ -503,13 +481,11 @@ public class ClassificationHistoryQueryImpl implements ClassificationHistoryQuer return result; } finally { taskanaHistoryEngine.returnConnection(); - LOGGER.debug("exit from single(). Returning result {} ", result); } } @Override public long count() { - LOGGER.debug("entry to count(), this = {}", this); Long rowCount = null; try { taskanaHistoryEngine.openConnection(); @@ -520,7 +496,6 @@ public class ClassificationHistoryQueryImpl implements ClassificationHistoryQuer return -1; } finally { taskanaHistoryEngine.returnConnection(); - LOGGER.debug("exit from count(). Returning result {} ", rowCount); } } diff --git a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/SimpleHistoryServiceImpl.java b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/SimpleHistoryServiceImpl.java index 4c2c3cca5..1183cebb8 100644 --- a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/SimpleHistoryServiceImpl.java +++ b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/SimpleHistoryServiceImpl.java @@ -62,7 +62,6 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory { LOGGER.error("Error while inserting task history event into database", e); } finally { taskanaHistoryEngine.returnConnection(); - LOGGER.debug("Exit from create(TaskHistoryEvent event). Returning object = {}.", event); } } @@ -79,7 +78,6 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory { LOGGER.error("Error while inserting workbasket history event into database", e); } finally { taskanaHistoryEngine.returnConnection(); - LOGGER.debug("Exit from create(WorkbasketHistoryEvent event). Returning object = {}.", event); } } @@ -96,19 +94,12 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory { LOGGER.error("Error while inserting classification history event into database", e); } finally { taskanaHistoryEngine.returnConnection(); - LOGGER.debug( - "Exit from create(ClassificationHistoryEvent event). Returning object = {}.", event); } } @Override public void deleteHistoryEventsByTaskIds(List taskIds) throws InvalidArgumentException, NotAuthorizedException { - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("entry to deleteHistoryEventsByTaskIds(taskIds = {})", taskIds); - } - taskanaHistoryEngine.checkRoleMembership(TaskanaRole.ADMIN); if (taskIds == null) { @@ -123,14 +114,12 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory { } catch (SQLException e) { LOGGER.error("Caught exception while trying to delete history events", e); } finally { - LOGGER.debug("exit from deleteHistoryEventsByTaskIds()"); taskanaHistoryEngine.returnConnection(); } } public TaskHistoryEvent getTaskHistoryEvent(String historyEventId) throws TaskanaHistoryEventNotFoundException { - LOGGER.debug("entry to getTaskHistoryEvent (id = {})", historyEventId); TaskHistoryEvent resultEvent = null; try { taskanaHistoryEngine.openConnection(); @@ -149,7 +138,6 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory { return resultEvent; } finally { taskanaHistoryEngine.returnConnection(); - LOGGER.debug("exit from getHistoryEvent(). Returning result {} ", resultEvent); } } diff --git a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/TaskHistoryQueryImpl.java b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/TaskHistoryQueryImpl.java index 78414a4ff..34a869ddb 100644 --- a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/TaskHistoryQueryImpl.java +++ b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/TaskHistoryQueryImpl.java @@ -625,7 +625,6 @@ public class TaskHistoryQueryImpl implements TaskHistoryQuery { @Override public List list() { - LOGGER.debug("entry to list(), this = {}", this); List result = new ArrayList<>(); try { taskanaHistoryEngine.openConnection(); @@ -636,16 +635,11 @@ public class TaskHistoryQueryImpl implements TaskHistoryQuery { return result; } finally { taskanaHistoryEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from list(). Returning {} resulting Objects: {} ", result.size(), result); - } } } @Override public List list(int offset, int limit) { - LOGGER.debug("entry to list({},{}), this = {}", offset, limit, this); List result = new ArrayList<>(); try { taskanaHistoryEngine.openConnection(); @@ -657,23 +651,12 @@ public class TaskHistoryQueryImpl implements TaskHistoryQuery { return result; } finally { taskanaHistoryEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from list(offset,limit). Returning {} resulting Objects: {} ", - result.size(), - result); - } } } @Override public List listValues( TaskHistoryQueryColumnName dbColumnName, SortDirection sortDirection) { - LOGGER.debug( - "entry to listValues() of column {} with sortDirection {}, this {}", - dbColumnName, - sortDirection, - this); List result = new ArrayList<>(); this.columnName = dbColumnName; this.orderBy.clear(); @@ -689,16 +672,11 @@ public class TaskHistoryQueryImpl implements TaskHistoryQuery { } finally { this.orderColumns.remove(orderColumns.size() - 1); taskanaHistoryEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "Exit from listValues. Returning {} resulting Objects: {} ", result.size(), result); - } } } @Override public TaskHistoryEvent single() { - LOGGER.debug("entry to single(), this = {}", this); TaskHistoryEvent result = null; try { taskanaHistoryEngine.openConnection(); @@ -711,13 +689,11 @@ public class TaskHistoryQueryImpl implements TaskHistoryQuery { return result; } finally { taskanaHistoryEngine.returnConnection(); - LOGGER.debug("exit from single(). Returning result {} ", result); } } @Override public long count() { - LOGGER.debug("entry to count(), this = {}", this); Long rowCount = null; try { taskanaHistoryEngine.openConnection(); @@ -728,7 +704,6 @@ public class TaskHistoryQueryImpl implements TaskHistoryQuery { return -1; } finally { taskanaHistoryEngine.returnConnection(); - LOGGER.debug("exit from count(). Returning result {} ", rowCount); } } diff --git a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/WorkbasketHistoryQueryImpl.java b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/WorkbasketHistoryQueryImpl.java index 65bd0609f..67b449274 100644 --- a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/WorkbasketHistoryQueryImpl.java +++ b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/WorkbasketHistoryQueryImpl.java @@ -466,7 +466,6 @@ public class WorkbasketHistoryQueryImpl implements WorkbasketHistoryQuery { @Override public List list() { - LOGGER.debug("entry to list(), this = {}", this); List result = new ArrayList<>(); try { taskanaHistoryEngine.openConnection(); @@ -477,16 +476,11 @@ public class WorkbasketHistoryQueryImpl implements WorkbasketHistoryQuery { return result; } finally { taskanaHistoryEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from list(). Returning {} resulting Objects: {} ", result.size(), result); - } } } @Override public List list(int offset, int limit) { - LOGGER.debug("entry to list({},{}), this = {}", offset, limit, this); List result = new ArrayList<>(); try { taskanaHistoryEngine.openConnection(); @@ -498,23 +492,12 @@ public class WorkbasketHistoryQueryImpl implements WorkbasketHistoryQuery { return result; } finally { taskanaHistoryEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from list(offset,limit). Returning {} resulting Objects: {} ", - result.size(), - result); - } } } @Override public List listValues( WorkbasketHistoryQueryColumnName dbColumnName, SortDirection sortDirection) { - LOGGER.debug( - "entry to listValues() of column {} with sortDirection {}, this {}", - dbColumnName, - sortDirection, - this); List result = new ArrayList<>(); this.columnName = dbColumnName; List cacheOrderBy = this.orderBy; @@ -533,16 +516,11 @@ public class WorkbasketHistoryQueryImpl implements WorkbasketHistoryQuery { this.columnName = null; this.orderColumns.remove(orderColumns.size() - 1); taskanaHistoryEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "Exit from listValues. Returning {} resulting Objects: {} ", result.size(), result); - } } } @Override public WorkbasketHistoryEvent single() { - LOGGER.debug("entry to single(), this = {}", this); WorkbasketHistoryEvent result = null; try { taskanaHistoryEngine.openConnection(); @@ -554,13 +532,11 @@ public class WorkbasketHistoryQueryImpl implements WorkbasketHistoryQuery { return result; } finally { taskanaHistoryEngine.returnConnection(); - LOGGER.debug("exit from single(). Returning result {} ", result); } } @Override public long count() { - LOGGER.debug("entry to count(), this = {}", this); Long rowCount = null; try { taskanaHistoryEngine.openConnection(); @@ -571,7 +547,6 @@ public class WorkbasketHistoryQueryImpl implements WorkbasketHistoryQuery { return -1; } finally { taskanaHistoryEngine.returnConnection(); - LOGGER.debug("exit from count(). Returning result {} ", rowCount); } } diff --git a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/jobs/HistoryCleanupJob.java b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/jobs/HistoryCleanupJob.java index ad1306ede..31283f1c9 100644 --- a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/jobs/HistoryCleanupJob.java +++ b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/jobs/HistoryCleanupJob.java @@ -196,12 +196,6 @@ public class HistoryCleanupJob extends AbstractTaskanaJob { } private int deleteHistoryEventsTransactionally(List taskIdsToDeleteHistoryEventsFor) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to deleteHistoryEventsTransactionally(taskIdsToDeleteHistoryEventsFor = {})", - taskIdsToDeleteHistoryEventsFor); - } - int deletedEventsCount = 0; if (txProvider != null) { int count = @@ -215,7 +209,6 @@ public class HistoryCleanupJob extends AbstractTaskanaJob { return 0; } }); - LOGGER.debug("exit from deleteHistoryEventsTransactionally(), returning {}", count); return count; } else { try { @@ -224,19 +217,11 @@ public class HistoryCleanupJob extends AbstractTaskanaJob { LOGGER.warn("Could not delete history events.", e); } } - LOGGER.debug( - "exit from deleteHistoryEventsTransactionally()(), returning {}", deletedEventsCount); return deletedEventsCount; } private int deleteEvents(List taskIdsToDeleteHistoryEventsFor) throws InvalidArgumentException, NotAuthorizedException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to deleteEvents(taskIdsToDeleteHistoryEventsFor = {})", - taskIdsToDeleteHistoryEventsFor); - } - SimpleHistoryServiceImpl simpleHistoryService = (SimpleHistoryServiceImpl) taskanaHistoryEngine.getTaskanaHistoryService(); @@ -250,19 +235,18 @@ public class HistoryCleanupJob extends AbstractTaskanaJob { simpleHistoryService.deleteHistoryEventsByTaskIds(taskIdsToDeleteHistoryEventsFor); - LOGGER.debug("{} events deleted.", deletedTasksCount); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("{} events deleted.", deletedTasksCount); + } - LOGGER.debug("exit from deleteEvents(), returning {}", taskIdsToDeleteHistoryEventsFor.size()); return deletedTasksCount; } private void scheduleNextCleanupJob() { - LOGGER.debug("Entry to scheduleNextCleanupJob."); ScheduledJob job = new ScheduledJob(); job.setType(Type.HISTORYCLEANUPJOB); job.setDue(getNextDueForCleanupJob()); taskanaEngineImpl.getJobService().createJob(job); - LOGGER.debug("Exit from scheduleNextCleanupJob."); } private void initJobParameters(Properties props) { @@ -294,11 +278,13 @@ public class HistoryCleanupJob extends AbstractTaskanaJob { } } - LOGGER.debug("Configured number of history events per transaction: {}", batchSize); - LOGGER.debug("HistoryCleanupJob configuration: runs every {}", runEvery); - LOGGER.debug( - "HistoryCleanupJob configuration: minimum age of history events to be cleanup up is {}", - minimumAge); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Configured number of history events per transaction: {}", batchSize); + LOGGER.debug("HistoryCleanupJob configuration: runs every {}", runEvery); + LOGGER.debug( + "HistoryCleanupJob configuration: minimum age of history events to be cleanup up is {}", + minimumAge); + } } private Properties readPropertiesFromFile(String propertiesFile) { @@ -312,13 +298,17 @@ public class HistoryCleanupJob extends AbstractTaskanaJob { LOGGER.error("taskana properties file {} was not found on classpath.", propertiesFile); } else { props.load(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); - LOGGER.debug( - "taskana properties were loaded from file {} from classpath.", propertiesFile); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "taskana properties were loaded from file {} from classpath.", propertiesFile); + } } } else { try (FileInputStream fileInputStream = new FileInputStream(propertiesFile)) { props.load(fileInputStream); - LOGGER.debug("taskana properties were loaded from file {}.", propertiesFile); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("taskana properties were loaded from file {}.", propertiesFile); + } } } } catch (IOException e) { diff --git a/history/taskana-simplehistory-provider/src/test/java/acceptance/events/task/DeleteHistoryEventsOnTaskDeletionAccTest.java b/history/taskana-simplehistory-provider/src/test/java/acceptance/events/task/DeleteHistoryEventsOnTaskDeletionAccTest.java index a01d51fb4..f103290cb 100644 --- a/history/taskana-simplehistory-provider/src/test/java/acceptance/events/task/DeleteHistoryEventsOnTaskDeletionAccTest.java +++ b/history/taskana-simplehistory-provider/src/test/java/acceptance/events/task/DeleteHistoryEventsOnTaskDeletionAccTest.java @@ -26,8 +26,7 @@ class DeleteHistoryEventsOnTaskDeletionAccTest extends AbstractAccTest { @Test @WithAccessId(user = "admin") - void should_DeleteHistoryEvents_When_TaskIsDeleted_With_HistoryDeletionEnabled() - throws Exception { + void should_DeleteHistoryEvents_When_TaskIsDeletedWithHistoryDeletionEnabled() throws Exception { final String taskid = "TKI:000000000000000000000000000000000036"; taskanaEngineConfiguration.setDeleteHistoryOnTaskDeletionEnabled(true); @@ -57,7 +56,7 @@ class DeleteHistoryEventsOnTaskDeletionAccTest extends AbstractAccTest { @Test @WithAccessId(user = "admin") - void should_DeleteHistoryEvents_When_TasksAreDeleted_With_HistoryDeletionEnabled() + void should_DeleteHistoryEvents_When_TasksAreDeletedWithHistoryDeletionEnabled() throws Exception { final String taskId_1 = "TKI:000000000000000000000000000000000037"; @@ -97,7 +96,7 @@ class DeleteHistoryEventsOnTaskDeletionAccTest extends AbstractAccTest { @Test @WithAccessId(user = "admin") - void should_NotDeleteHistoryEvents_When_TaskIsDeleted_With_HistoryDeletionDisabled() + void should_NotDeleteHistoryEvents_When_TaskIsDeletedWithHistoryDeletionDisabled() throws Exception { final String taskId = "TKI:000000000000000000000000000000000039"; @@ -129,7 +128,7 @@ class DeleteHistoryEventsOnTaskDeletionAccTest extends AbstractAccTest { @Test @WithAccessId(user = "admin") - void should_NotDeleteHistoryEvents_When_TasksAreDeleted_With_HistoryDeletionDisabled() + void should_NotDeleteHistoryEvents_When_TasksAreDeletedWithHistoryDeletionDisabled() throws Exception { final String taskId_1 = "TKI:000000000000000000000000000000000040"; final String taskId_2 = "TKI:000000000000000000000000000000000068"; diff --git a/history/taskana-simplehistory-rest-spring/pom.xml b/history/taskana-simplehistory-rest-spring/pom.xml index 8cbe792ad..a593f397c 100644 --- a/history/taskana-simplehistory-rest-spring/pom.xml +++ b/history/taskana-simplehistory-rest-spring/pom.xml @@ -16,6 +16,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + pro.taskana.history taskana-simplehistory-provider diff --git a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/TaskHistoryEventController.java b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/TaskHistoryEventController.java index 1efc5a690..e22e3205e 100644 --- a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/TaskHistoryEventController.java +++ b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/TaskHistoryEventController.java @@ -5,8 +5,6 @@ import java.sql.SQLException; import java.util.List; import java.util.function.BiConsumer; import javax.servlet.http.HttpServletRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.hateoas.MediaTypes; import org.springframework.hateoas.config.EnableHypermediaSupport; @@ -38,8 +36,6 @@ import pro.taskana.spi.history.api.exceptions.TaskanaHistoryEventNotFoundExcepti @EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL) public class TaskHistoryEventController { - private static final Logger LOGGER = LoggerFactory.getLogger(TaskHistoryEventController.class); - private final SimpleHistoryServiceImpl simpleHistoryService; private final TaskHistoryEventRepresentationModelAssembler assembler; @@ -91,10 +87,6 @@ public class TaskHistoryEventController { ResponseEntity response = ResponseEntity.ok(pagedResources); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getTaskHistoryEvents(), returning {}", response); - } - return response; } @@ -111,21 +103,9 @@ public class TaskHistoryEventController { @Transactional(readOnly = true, rollbackFor = Exception.class) public ResponseEntity getTaskHistoryEvent( @PathVariable String historyEventId) throws TaskanaHistoryEventNotFoundException { - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Entry to getTaskHistoryEvent(historyEventId= {})", historyEventId); - } - TaskHistoryEvent resultEvent = simpleHistoryService.getTaskHistoryEvent(historyEventId); TaskHistoryEventRepresentationModel taskEventResource = assembler.toModel(resultEvent); - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "Exit from getTaskHistoryEvent, returning {}", - new ResponseEntity<>(taskEventResource, HttpStatus.OK)); - } - return new ResponseEntity<>(taskEventResource, HttpStatus.OK); } diff --git a/lib/taskana-cdi-example/pom.xml b/lib/taskana-cdi-example/pom.xml index 553317903..391309135 100644 --- a/lib/taskana-cdi-example/pom.xml +++ b/lib/taskana-cdi-example/pom.xml @@ -16,6 +16,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + javax javaee-api diff --git a/lib/taskana-cdi/pom.xml b/lib/taskana-cdi/pom.xml index 25f88dd07..6f037b08d 100644 --- a/lib/taskana-cdi/pom.xml +++ b/lib/taskana-cdi/pom.xml @@ -15,6 +15,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + javax javaee-api @@ -112,4 +117,4 @@ http://repository.jboss.org/nexus/content/groups/public-jboss/ - \ No newline at end of file + diff --git a/lib/taskana-cdi/src/main/java/pro/taskana/common/internal/TaskanaProducers.java b/lib/taskana-cdi/src/main/java/pro/taskana/common/internal/TaskanaProducers.java index 7cd8f8e18..825d0b7dc 100644 --- a/lib/taskana-cdi/src/main/java/pro/taskana/common/internal/TaskanaProducers.java +++ b/lib/taskana-cdi/src/main/java/pro/taskana/common/internal/TaskanaProducers.java @@ -49,7 +49,9 @@ public class TaskanaProducers { dataSource = (DataSource) ctx.lookup(properties.getProperty("datasource.jndi")); try (Connection connection = dataSource.getConnection()) { DatabaseMetaData metaData = connection.getMetaData(); - LOGGER.debug("---------------> {}", metaData); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("---------------> {}", metaData); + } } this.taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, true, false, "TASKANA"); diff --git a/lib/taskana-core/pom.xml b/lib/taskana-core/pom.xml index b05609f01..43647cde8 100644 --- a/lib/taskana-core/pom.xml +++ b/lib/taskana-core/pom.xml @@ -15,6 +15,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + pro.taskana taskana-common diff --git a/lib/taskana-core/src/main/java/pro/taskana/TaskanaEngineConfiguration.java b/lib/taskana-core/src/main/java/pro/taskana/TaskanaEngineConfiguration.java index 8b013dc60..38bf7fd4a 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/TaskanaEngineConfiguration.java +++ b/lib/taskana-core/src/main/java/pro/taskana/TaskanaEngineConfiguration.java @@ -147,8 +147,10 @@ public class TaskanaEngineConfiguration { } public void initTaskanaProperties(String propertiesFile, String separator) { - LOGGER.debug( - "Reading taskana configuration from {} with separator {}", propertiesFile, separator); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Reading taskana configuration from {} with separator {}", propertiesFile, separator); + } Properties props = readPropertiesFromFile(propertiesFile); initTaskanaRoles(props, separator); initJobParameters(props); @@ -409,18 +411,20 @@ public class TaskanaEngineConfiguration { Boolean::parseBoolean) .ifPresent(this::setTaskCleanupJobAllCompletedSameParentBusiness); - LOGGER.debug( - "Configured number of task and workbasket updates per transaction: {}", jobBatchSize); - LOGGER.debug("Number of retries of failed task updates: {}", maxNumberOfJobRetries); - LOGGER.debug("CleanupJob configuration: first run at {}", cleanupJobFirstRun); - LOGGER.debug("CleanupJob configuration: runs every {}", cleanupJobRunEvery); - LOGGER.debug( - "CleanupJob configuration: minimum age of tasks to be cleanup up is {}", - cleanupJobMinimumAge); - LOGGER.debug( - "TaskCleanupJob configuration: all completed task with the " - + "same parent business property id {}", - taskCleanupJobAllCompletedSameParentBusiness); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Configured number of task and workbasket updates per transaction: {}", jobBatchSize); + LOGGER.debug("Number of retries of failed task updates: {}", maxNumberOfJobRetries); + LOGGER.debug("CleanupJob configuration: first run at {}", cleanupJobFirstRun); + LOGGER.debug("CleanupJob configuration: runs every {}", cleanupJobRunEvery); + LOGGER.debug( + "CleanupJob configuration: minimum age of tasks to be cleanup up is {}", + cleanupJobMinimumAge); + LOGGER.debug( + "TaskCleanupJob configuration: all completed task with the " + + "same parent business property id {}", + taskCleanupJobAllCompletedSameParentBusiness); + } } private void initDomains(Properties props) { @@ -428,7 +432,9 @@ public class TaskanaEngineConfiguration { p -> splitStringAndTrimElements(p, ",", String::toUpperCase); parseProperty(props, TASKANA_DOMAINS_PROPERTY, parseFunction).ifPresent(this::setDomains); - LOGGER.debug("Configured domains: {}", domains); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Configured domains: {}", domains); + } } private void initClassificationTypes(Properties props) { @@ -437,7 +443,9 @@ public class TaskanaEngineConfiguration { parseProperty(props, TASKANA_CLASSIFICATION_TYPES_PROPERTY, parseFunction) .ifPresent(this::setClassificationTypes); - LOGGER.debug("Configured classificationTypes: {}", classificationTypes); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Configured classificationTypes: {}", classificationTypes); + } } private void initClassificationCategories(Properties props) { @@ -457,7 +465,9 @@ public class TaskanaEngineConfiguration { .map(type -> Pair.of(type, getClassificationCategoriesForType.apply(type))) .collect(Collectors.toMap(Pair::getLeft, Pair::getRight)); - LOGGER.debug("Configured classification categories : {}", classificationCategoriesByTypeMap); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Configured classification categories : {}", classificationCategoriesByTypeMap); + } } private void initBooleanProperty( @@ -484,7 +494,9 @@ public class TaskanaEngineConfiguration { LOGGER.error("Caught exception when attempting to initialize the schema name", ex); } - LOGGER.debug("Using schema name {}", this.getSchemaName()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Using schema name {}", this.getSchemaName()); + } } private void initTaskanaRoles(Properties props, String rolesSeparator) { @@ -527,7 +539,9 @@ public class TaskanaEngineConfiguration { .collect(Collectors.toList()); parseProperty(props, TASKANA_CUSTOM_HOLIDAY, parseFunction).ifPresent(this::addCustomHolidays); - LOGGER.debug("Configured custom Holidays : {}", customHolidays); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Configured custom Holidays : {}", customHolidays); + } } private CustomHoliday createCustomHolidayFromPropsEntry(String customHolidayEntry) @@ -559,11 +573,9 @@ public class TaskanaEngineConfiguration { private Properties readPropertiesFromFile(String propertiesFile) { Properties props = new Properties(); - try { - try (InputStream stream = - FileLoaderUtil.openFileFromClasspathOrSystem(propertiesFile, getClass())) { - props.load(stream); - } + try (InputStream stream = + FileLoaderUtil.openFileFromClasspathOrSystem(propertiesFile, getClass())) { + props.load(stream); } catch (IOException e) { LOGGER.error("caught IOException when processing properties file {}.", propertiesFile); throw new SystemException( diff --git a/lib/taskana-core/src/main/java/pro/taskana/classification/api/ClassificationService.java b/lib/taskana-core/src/main/java/pro/taskana/classification/api/ClassificationService.java index 34e7dba06..33529ba58 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/classification/api/ClassificationService.java +++ b/lib/taskana-core/src/main/java/pro/taskana/classification/api/ClassificationService.java @@ -66,7 +66,7 @@ public interface ClassificationService { throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException; /** - * Inserts a new Classification after adding default values.
+ * Inserts a new Classification after adding default values.
* The Classification will be added to master-domain, too - if not already existing.
* The default values are: * diff --git a/lib/taskana-core/src/main/java/pro/taskana/classification/internal/ClassificationQueryImpl.java b/lib/taskana-core/src/main/java/pro/taskana/classification/internal/ClassificationQueryImpl.java index 4c105086a..cfaf43734 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/classification/internal/ClassificationQueryImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/classification/internal/ClassificationQueryImpl.java @@ -5,8 +5,6 @@ import java.util.Arrays; import java.util.List; import org.apache.ibatis.exceptions.PersistenceException; import org.apache.ibatis.session.RowBounds; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import pro.taskana.classification.api.ClassificationCustomField; import pro.taskana.classification.api.ClassificationQuery; @@ -28,7 +26,7 @@ public class ClassificationQueryImpl implements ClassificationQuery { private static final String LINK_TO_VALUEMAPPER = "pro.taskana.classification.internal.ClassificationQueryMapper." + "queryClassificationColumnValues"; - private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationQueryImpl.class); + private final InternalTaskanaEngine taskanaEngine; private final List orderBy; private final List orderColumns; @@ -325,7 +323,6 @@ public class ClassificationQueryImpl implements ClassificationQuery { @Override public List list() { - LOGGER.debug("entry to list(), this = {}", this); List result = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -333,16 +330,11 @@ public class ClassificationQueryImpl implements ClassificationQuery { return result; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from list(). Returning {} resulting Objects: {} ", result.size(), result); - } } } @Override public List list(int offset, int limit) { - LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this); List result = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -360,19 +352,12 @@ public class ClassificationQueryImpl implements ClassificationQuery { throw e; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from list(offset,limit). Returning {} resulting Objects: {} ", - result.size(), - result); - } } } @Override public List listValues( ClassificationQueryColumnName columnName, SortDirection sortDirection) { - LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this); List result = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -383,16 +368,11 @@ public class ClassificationQueryImpl implements ClassificationQuery { return result; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "Exit from listValues. Returning {} resulting Objects: {} ", result.size(), result); - } } } @Override public ClassificationSummary single() { - LOGGER.debug("entry to single(), this = {}", this); ClassificationSummary result = null; try { taskanaEngine.openConnection(); @@ -400,13 +380,11 @@ public class ClassificationQueryImpl implements ClassificationQuery { return result; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from single(). Returning result {} ", result); } } @Override public long count() { - LOGGER.debug("entry to count(), this = {}", this); Long rowCount = null; try { taskanaEngine.openConnection(); @@ -414,7 +392,6 @@ public class ClassificationQueryImpl implements ClassificationQuery { return (rowCount == null) ? 0L : rowCount; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from count(). Returning result {} ", rowCount); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/classification/internal/ClassificationServiceImpl.java b/lib/taskana-core/src/main/java/pro/taskana/classification/internal/ClassificationServiceImpl.java index f139030d9..bafeb5ba2 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/classification/internal/ClassificationServiceImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/classification/internal/ClassificationServiceImpl.java @@ -61,7 +61,6 @@ public class ClassificationServiceImpl implements ClassificationService { @Override public Classification getClassification(String key, String domain) throws ClassificationNotFoundException { - LOGGER.debug("entry to getClassification(key = {}, domain = {})", key, domain); if (key == null) { throw new ClassificationNotFoundException( null, domain, "Classification for null key and domain " + domain + " was not found."); @@ -81,7 +80,6 @@ public class ClassificationServiceImpl implements ClassificationService { return result; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from getClassification(). Returning result {} ", result); } } @@ -90,7 +88,6 @@ public class ClassificationServiceImpl implements ClassificationService { if (id == null) { throw new ClassificationNotFoundException(null, "Classification for null id is invalid."); } - LOGGER.debug("entry to getClassification(id = {})", id); Classification result = null; try { taskanaEngine.openConnection(); @@ -102,14 +99,12 @@ public class ClassificationServiceImpl implements ClassificationService { return result; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from getClassification(). Returning result {} ", result); } } @Override public void deleteClassification(String classificationId) throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException { - LOGGER.debug("entry to deleteClassification(id = {})", classificationId); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); try { taskanaEngine.openConnection(); @@ -166,14 +161,12 @@ public class ClassificationServiceImpl implements ClassificationService { } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from deleteClassification()"); } } @Override public void deleteClassification(String classificationKey, String domain) throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException { - LOGGER.debug("entry to deleteClassification(key = {}, domain = {})", classificationKey, domain); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); try { taskanaEngine.openConnection(); @@ -191,7 +184,6 @@ public class ClassificationServiceImpl implements ClassificationService { deleteClassification(classification.getId()); } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from deleteClassification(key,domain)"); } } @@ -199,7 +191,6 @@ public class ClassificationServiceImpl implements ClassificationService { public Classification createClassification(Classification classification) throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException, InvalidArgumentException { - LOGGER.debug("entry to createClassification(classification = {})", classification); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); if (!taskanaEngine.domainExists(classification.getDomain()) && !"".equals(classification.getDomain())) { @@ -239,14 +230,15 @@ public class ClassificationServiceImpl implements ClassificationService { details)); } - LOGGER.debug("Method createClassification created classification {}.", classificationImpl); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Method createClassification created classification {}.", classificationImpl); + } if (!classification.getDomain().isEmpty()) { addClassificationToMasterDomain(classificationImpl); } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from createClassification()"); } return classificationImpl; } @@ -255,7 +247,6 @@ public class ClassificationServiceImpl implements ClassificationService { public Classification updateClassification(Classification classification) throws NotAuthorizedException, ConcurrencyException, ClassificationNotFoundException, InvalidArgumentException { - LOGGER.debug("entry to updateClassification(Classification = {})", classification); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); ClassificationImpl classificationImpl; try { @@ -291,12 +282,13 @@ public class ClassificationServiceImpl implements ClassificationService { taskanaEngine.getEngine().getCurrentUserContext().getUserid(), details)); } - LOGGER.debug( - "Method updateClassification() updated the classification {}.", classificationImpl); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Method updateClassification() updated the classification {}.", classificationImpl); + } return classification; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from updateClassification()."); } } @@ -402,10 +394,12 @@ public class ClassificationServiceImpl implements ClassificationService { throw new ClassificationAlreadyExistException(masterClassification); } catch (ClassificationNotFoundException e) { doesExist = false; - LOGGER.debug( - "Method createClassification: Classification does not " - + "exist in master domain. Classification {}.", - masterClassification); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Method createClassification: Classification does not " + + "exist in master domain. Classification {}.", + masterClassification); + } } catch (ClassificationAlreadyExistException ex) { LOGGER.warn( "Method createClassification: Classification does already exist " @@ -414,10 +408,12 @@ public class ClassificationServiceImpl implements ClassificationService { } finally { if (!doesExist) { classificationMapper.insert(masterClassification); - LOGGER.debug( - "Method createClassification: Classification created in " - + "master-domain, too. Classification {}.", - masterClassification); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Method createClassification: Classification created in " + + "master-domain, too. Classification {}.", + masterClassification); + } } } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/classification/internal/jobs/ClassificationChangedJob.java b/lib/taskana-core/src/main/java/pro/taskana/classification/internal/jobs/ClassificationChangedJob.java index 87b60b65d..0be127325 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/classification/internal/jobs/ClassificationChangedJob.java +++ b/lib/taskana-core/src/main/java/pro/taskana/classification/internal/jobs/ClassificationChangedJob.java @@ -53,12 +53,14 @@ public class ClassificationChangedJob extends AbstractTaskanaJob { private void scheduleTaskRefreshJobs(List affectedTaskIds) { int batchSize = taskanaEngineImpl.getConfiguration().getMaxNumberOfUpdatesPerTransaction(); List> affectedTaskBatches = partition(affectedTaskIds, batchSize); - LOGGER.debug( - "Creating {} TaskRefreshJobs out of {} affected tasks " - + "with a maximum number of {} tasks each. ", - affectedTaskBatches.size(), - affectedTaskIds.size(), - batchSize); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Creating {} TaskRefreshJobs out of {} affected tasks " + + "with a maximum number of {} tasks each. ", + affectedTaskBatches.size(), + affectedTaskIds.size(), + batchSize); + } for (List taskIdBatch : affectedTaskBatches) { Map args = new HashMap<>(); if (!taskIdBatch.isEmpty()) { diff --git a/lib/taskana-core/src/main/java/pro/taskana/common/internal/JobServiceImpl.java b/lib/taskana-core/src/main/java/pro/taskana/common/internal/JobServiceImpl.java index 66fa032f9..7fb40e671 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/common/internal/JobServiceImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/common/internal/JobServiceImpl.java @@ -26,76 +26,75 @@ public class JobServiceImpl implements JobService { @Override public ScheduledJob createJob(ScheduledJob job) { - LOGGER.debug("Entry to createJob({})", job); try { taskanaEngineImpl.openConnection(); job = initializeJobDefault(job); Integer jobId = jobMapper.insertJob(job); job.setJobId(jobId); - LOGGER.debug("Created job {}", job); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Created job {}", job); + } } finally { taskanaEngineImpl.returnConnection(); } - LOGGER.debug("Exit from createJob"); return job; } public void deleteJobs(Type jobType) { - LOGGER.debug("entry to deleteJobs(jobType = {})", jobType); try { taskanaEngineImpl.openConnection(); jobMapper.deleteMultiple(jobType); - LOGGER.debug("Deleted jobs of type: {}", jobType); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Deleted jobs of type: {}", jobType); + } } finally { taskanaEngineImpl.returnConnection(); - LOGGER.debug("exit from deleteJobs()"); } } public ScheduledJob lockJob(ScheduledJob job, String owner) { - LOGGER.debug("entry to lockJob(jobId = {}, owner = {})", job.getJobId(), owner); try { taskanaEngineImpl.openConnection(); job.setLockedBy(owner); job.setLockExpires(Instant.now().plusMillis(DEFAULT_LOCK_EXPIRATION_PERIOD)); job.setRetryCount(job.getRetryCount() - 1); jobMapper.update(job); - LOGGER.debug("Job {} locked. Remaining retries: {}", job.getJobId(), job.getRetryCount()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Job {} locked. Remaining retries: {}", job.getJobId(), job.getRetryCount()); + } } finally { taskanaEngineImpl.returnConnection(); - LOGGER.debug("exit from lockJob()"); } return job; } public List findJobsToRun() { - LOGGER.debug("entry to findJobsToRun"); List availableJobs; try { taskanaEngineImpl.openConnection(); availableJobs = jobMapper.findJobsToRun(Instant.now()); - LOGGER.debug("Found available jobs: {}", availableJobs); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Found available jobs: {}", availableJobs); + } } finally { taskanaEngineImpl.returnConnection(); - LOGGER.debug("exit from findJobsToRun()"); } return availableJobs; } public void deleteJob(ScheduledJob job) { - LOGGER.debug("entry to deleteJob(jobId = {})", job.getJobId()); try { taskanaEngineImpl.openConnection(); jobMapper.delete(job); - LOGGER.debug("Deleted job: {}", job); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Deleted job: {}", job); + } } finally { taskanaEngineImpl.returnConnection(); - LOGGER.debug("exit from deleteJob()"); } } private ScheduledJob initializeJobDefault(ScheduledJob job) { - LOGGER.debug("entry to initializeJobDefault(job = {})", job); job.setCreated(Instant.now()); job.setState(ScheduledJob.State.READY); job.setPriority(JOB_DEFAULT_PRIORITY); @@ -103,7 +102,9 @@ public class JobServiceImpl implements JobService { job.setDue(Instant.now()); } job.setRetryCount(taskanaEngineImpl.getEngine().getConfiguration().getMaxNumberOfJobRetries()); - LOGGER.debug("Job after initialization: {}", job); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Job after initialization: {}", job); + } return job; } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/common/internal/jobs/JobRunner.java b/lib/taskana-core/src/main/java/pro/taskana/common/internal/jobs/JobRunner.java index 04e674366..c2057140b 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/common/internal/jobs/JobRunner.java +++ b/lib/taskana-core/src/main/java/pro/taskana/common/internal/jobs/JobRunner.java @@ -37,7 +37,6 @@ public class JobRunner { } public void runJobs() { - LOGGER.info("entry to runJobs()"); try { List jobsToRun = findAndLockJobsToRun(); for (ScheduledJob scheduledJob : jobsToRun) { @@ -45,8 +44,6 @@ public class JobRunner { } } catch (Exception e) { LOGGER.error("Error occurred while running jobs: ", e); - } finally { - LOGGER.info("exit from runJobs()."); } } @@ -66,7 +63,9 @@ public class JobRunner { } else { lockedJob = lockJob(job); } - LOGGER.debug("Locked job: {}", lockedJob); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Locked job: {}", lockedJob); + } return lockedJob; } @@ -103,7 +102,6 @@ public class JobRunner { } private void runScheduledJob(ScheduledJob scheduledJob) { - LOGGER.debug("entry to runScheduledJob(job = {})", scheduledJob); if (taskanaEngine.isUserInRole(TaskanaRole.ADMIN)) { // we run already as admin @@ -125,7 +123,6 @@ public class JobRunner { LOGGER.warn("Attempt to run job {} failed.", scheduledJob, e); } } - LOGGER.debug("exit from runScheduledJob"); } private void runScheduledJobImpl(ScheduledJob scheduledJob) { diff --git a/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/ClassificationCategoryReportBuilderImpl.java b/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/ClassificationCategoryReportBuilderImpl.java index 39c76ef9c..3f3237851 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/ClassificationCategoryReportBuilderImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/ClassificationCategoryReportBuilderImpl.java @@ -2,8 +2,6 @@ package pro.taskana.monitor.internal.reports; import java.time.Instant; import java.util.List; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.exceptions.InvalidArgumentException; @@ -22,9 +20,6 @@ public class ClassificationCategoryReportBuilderImpl extends TimeIntervalReportBuilderImpl implements ClassificationCategoryReport.Builder { - private static final Logger LOGGER = - LoggerFactory.getLogger(ClassificationCategoryReportBuilderImpl.class); - public ClassificationCategoryReportBuilderImpl( InternalTaskanaEngine taskanaEngine, MonitorMapper monitorMapper) { super(taskanaEngine, monitorMapper); @@ -39,7 +34,6 @@ public class ClassificationCategoryReportBuilderImpl @Override public ClassificationCategoryReport buildReport(TaskTimestamp timestamp) throws InvalidArgumentException, NotAuthorizedException { - LOGGER.debug("entry to buildReport(), this = {}", this); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR); try { this.taskanaEngine.openConnection(); @@ -62,7 +56,6 @@ public class ClassificationCategoryReportBuilderImpl return report; } finally { this.taskanaEngine.returnConnection(); - LOGGER.debug("exit from buildReport()."); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/ClassificationReportBuilderImpl.java b/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/ClassificationReportBuilderImpl.java index 84f10ef60..62e010bc1 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/ClassificationReportBuilderImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/ClassificationReportBuilderImpl.java @@ -5,8 +5,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import pro.taskana.classification.api.ClassificationService; import pro.taskana.classification.api.models.ClassificationSummary; @@ -30,8 +28,6 @@ public class ClassificationReportBuilderImpl extends TimeIntervalReportBuilderImpl implements ClassificationReport.Builder { - private static final Logger LOGGER = - LoggerFactory.getLogger(ClassificationReportBuilderImpl.class); private final ClassificationService classificationService; public ClassificationReportBuilderImpl( @@ -49,7 +45,6 @@ public class ClassificationReportBuilderImpl @Override public ClassificationReport buildReport(TaskTimestamp timestamp) throws InvalidArgumentException, NotAuthorizedException { - LOGGER.debug("entry to buildReport(), this = {}", this); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN); try { this.taskanaEngine.openConnection(); @@ -86,7 +81,6 @@ public class ClassificationReportBuilderImpl return report; } finally { this.taskanaEngine.returnConnection(); - LOGGER.debug("exit from buildReport()."); } } @@ -99,7 +93,6 @@ public class ClassificationReportBuilderImpl @Override public DetailedClassificationReport buildDetailedReport(TaskTimestamp timestamp) throws InvalidArgumentException, NotAuthorizedException { - LOGGER.debug("entry to buildDetailedReport(), this = {}", this); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN); try { this.taskanaEngine.openConnection(); @@ -141,7 +134,6 @@ public class ClassificationReportBuilderImpl return report; } finally { this.taskanaEngine.returnConnection(); - LOGGER.debug("exit from buildDetailedReport()."); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/TaskCustomFieldValueReportBuilderImpl.java b/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/TaskCustomFieldValueReportBuilderImpl.java index ca9eaf8a7..8b6954eb2 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/TaskCustomFieldValueReportBuilderImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/TaskCustomFieldValueReportBuilderImpl.java @@ -2,8 +2,6 @@ package pro.taskana.monitor.internal.reports; import java.time.Instant; import java.util.List; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.exceptions.InvalidArgumentException; @@ -23,9 +21,6 @@ public class TaskCustomFieldValueReportBuilderImpl extends TimeIntervalReportBuilderImpl implements TaskCustomFieldValueReport.Builder { - private static final Logger LOGGER = - LoggerFactory.getLogger(TaskCustomFieldValueReportBuilderImpl.class); - private final TaskCustomField taskCustomField; public TaskCustomFieldValueReportBuilderImpl( @@ -45,7 +40,6 @@ public class TaskCustomFieldValueReportBuilderImpl @Override public TaskCustomFieldValueReport buildReport(TaskTimestamp timestamp) throws InvalidArgumentException, NotAuthorizedException { - LOGGER.debug("entry to buildReport(taskCustomField = {}), this = {}", taskCustomField, this); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR); try { this.taskanaEngine.openConnection(); @@ -70,7 +64,6 @@ public class TaskCustomFieldValueReportBuilderImpl return report; } finally { this.taskanaEngine.returnConnection(); - LOGGER.debug("exit from buildReport()."); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/TaskStatusReportBuilderImpl.java b/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/TaskStatusReportBuilderImpl.java index 2742ff05b..ce810d2e1 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/TaskStatusReportBuilderImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/TaskStatusReportBuilderImpl.java @@ -3,8 +3,6 @@ package pro.taskana.monitor.internal.reports; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.exceptions.NotAuthorizedException; @@ -20,7 +18,6 @@ import pro.taskana.workbasket.api.models.WorkbasketSummary; /** The implementation of TaskStatusReportBuilder. */ public class TaskStatusReportBuilderImpl implements TaskStatusReport.Builder { - private static final Logger LOGGER = LoggerFactory.getLogger(TaskStatusReportBuilderImpl.class); private final InternalTaskanaEngine taskanaEngine; private final MonitorMapper monitorMapper; private final WorkbasketService workbasketService; @@ -38,7 +35,6 @@ public class TaskStatusReportBuilderImpl implements TaskStatusReport.Builder { @Override public TaskStatusReport buildReport() throws NotAuthorizedException { - LOGGER.debug("entry to buildReport(), this = {}", this); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN); try { this.taskanaEngine.openConnection(); @@ -48,20 +44,25 @@ public class TaskStatusReportBuilderImpl implements TaskStatusReport.Builder { TaskStatusReport report = new TaskStatusReport(this.states); report.addItems(tasks); Map displayMap = - taskanaEngine.getEngine().runAsAdmin( - () -> - workbasketService.createWorkbasketQuery() - .keyIn(report.getRows().keySet().toArray(new String[0])) - .domainIn(domains != null ? domains.toArray(new String[0]) : null).list() - .stream() - .collect( - Collectors.toMap( - WorkbasketSummary::getKey, WorkbasketSummary::getName, (a, b) -> a))); + taskanaEngine + .getEngine() + .runAsAdmin( + () -> + workbasketService + .createWorkbasketQuery() + .keyIn(report.getRows().keySet().toArray(new String[0])) + .domainIn(domains != null ? domains.toArray(new String[0]) : null) + .list() + .stream() + .collect( + Collectors.toMap( + WorkbasketSummary::getKey, + WorkbasketSummary::getName, + (a, b) -> a))); report.augmentDisplayNames(displayMap); return report; } finally { this.taskanaEngine.returnConnection(); - LOGGER.debug("exit from buildReport()."); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/TimeIntervalReportBuilderImpl.java b/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/TimeIntervalReportBuilderImpl.java index b3dc0ebb8..f3e982cbf 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/TimeIntervalReportBuilderImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/TimeIntervalReportBuilderImpl.java @@ -7,8 +7,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.WorkingDaysToDaysConverter; @@ -40,8 +38,6 @@ abstract class TimeIntervalReportBuilderImpl< H extends TimeIntervalColumnHeader> implements TimeIntervalReportBuilder { - private static final Logger LOGGER = LoggerFactory.getLogger(TimeIntervalReportBuilder.class); - protected InternalTaskanaEngine taskanaEngine; protected MonitorMapper monitorMapper; protected List columnHeaders; @@ -120,12 +116,6 @@ abstract class TimeIntervalReportBuilderImpl< public List listTaskIdsForSelectedItems( List selectedItems, TaskTimestamp timestamp) throws NotAuthorizedException, InvalidArgumentException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to listTaskIdsForSelectedItems(selectedItems = {}), this = {}", - selectedItems, - this); - } this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR); try { @@ -162,17 +152,12 @@ abstract class TimeIntervalReportBuilderImpl< joinWithAttachments); } finally { this.taskanaEngine.returnConnection(); - LOGGER.debug("exit from listTaskIdsForSelectedItems()."); } } @Override public List listCustomAttributeValuesForCustomAttributeName( TaskCustomField taskCustomField) throws NotAuthorizedException { - LOGGER.debug( - "entry to listCustomAttributeValuesForCustomAttributeName(customField = {}), this = {}", - taskCustomField, - this); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR); try { this.taskanaEngine.openConnection(); @@ -188,7 +173,6 @@ abstract class TimeIntervalReportBuilderImpl< taskCustomField); } finally { this.taskanaEngine.returnConnection(); - LOGGER.debug("exit from listCustomAttributeValuesForCustomAttributeName()."); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/TimestampReportBuilderImpl.java b/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/TimestampReportBuilderImpl.java index 443dc71fa..2029ed41b 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/TimestampReportBuilderImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/TimestampReportBuilderImpl.java @@ -6,8 +6,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.stream.Collectors; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.exceptions.InvalidArgumentException; @@ -29,7 +27,6 @@ public class TimestampReportBuilderImpl extends TimeIntervalReportBuilderImpl implements TimestampReport.Builder { - private static final Logger LOGGER = LoggerFactory.getLogger(TimestampReportBuilderImpl.class); private List status = Arrays.asList(TaskTimestamp.CREATED, TaskTimestamp.COMPLETED); @@ -64,7 +61,6 @@ public class TimestampReportBuilderImpl @Override public TimestampReport buildReport() throws NotAuthorizedException, InvalidArgumentException { - LOGGER.debug("entry to buildDetailedReport(), this = {}", this); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN); try { this.taskanaEngine.openConnection(); @@ -84,7 +80,6 @@ public class TimestampReportBuilderImpl return report; } finally { this.taskanaEngine.returnConnection(); - LOGGER.debug("exit from buildDetailedReport()."); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/WorkbasketReportBuilderImpl.java b/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/WorkbasketReportBuilderImpl.java index 6173a00b7..eb6eb3d2b 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/WorkbasketReportBuilderImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/monitor/internal/reports/WorkbasketReportBuilderImpl.java @@ -4,8 +4,6 @@ import java.time.Instant; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import pro.taskana.common.api.TaskanaRole; import pro.taskana.common.api.exceptions.InvalidArgumentException; @@ -27,7 +25,6 @@ public class WorkbasketReportBuilderImpl extends TimeIntervalReportBuilderImpl implements WorkbasketReport.Builder { - private static final Logger LOGGER = LoggerFactory.getLogger(WorkbasketReportBuilderImpl.class); private final WorkbasketService workbasketService; private List combinedClassificationFilter; @@ -45,7 +42,6 @@ public class WorkbasketReportBuilderImpl @Override public WorkbasketReport buildReport(TaskTimestamp timestamp) throws InvalidArgumentException, NotAuthorizedException { - LOGGER.debug("entry to buildReport(), this = {}", this); this.taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN); try { this.taskanaEngine.openConnection(); @@ -68,22 +64,25 @@ public class WorkbasketReportBuilderImpl this.columnHeaders, converter, this.inWorkingDays)); Map displayMap = - taskanaEngine.getEngine().runAsAdmin( - () -> - workbasketService - .createWorkbasketQuery() - .keyIn(report.getRows().keySet().toArray(new String[0])) - .domainIn(domains != null ? domains.toArray(new String[0]) : null) - .list() - .stream() - .collect( - Collectors.toMap( - WorkbasketSummary::getKey, WorkbasketSummary::getName, (a, b) -> a))); + taskanaEngine + .getEngine() + .runAsAdmin( + () -> + workbasketService + .createWorkbasketQuery() + .keyIn(report.getRows().keySet().toArray(new String[0])) + .domainIn(domains != null ? domains.toArray(new String[0]) : null) + .list() + .stream() + .collect( + Collectors.toMap( + WorkbasketSummary::getKey, + WorkbasketSummary::getName, + (a, b) -> a))); report.augmentDisplayNames(displayMap); return report; } finally { this.taskanaEngine.returnConnection(); - LOGGER.debug("exit from buildReport()."); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/spi/history/internal/HistoryEventManager.java b/lib/taskana-core/src/main/java/pro/taskana/spi/history/internal/HistoryEventManager.java index 4f568fc5b..d65801fe6 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/spi/history/internal/HistoryEventManager.java +++ b/lib/taskana-core/src/main/java/pro/taskana/spi/history/internal/HistoryEventManager.java @@ -45,7 +45,9 @@ public final class HistoryEventManager { } public void createEvent(TaskHistoryEvent event) { - LOGGER.debug("Sending event to history service providers: {}", event); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Sending event to history service providers: {}", event); + } serviceLoader.forEach( historyProvider -> { try { @@ -62,7 +64,9 @@ public final class HistoryEventManager { } public void createEvent(WorkbasketHistoryEvent event) { - LOGGER.debug("Sending event to history service providers: {}", event); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Sending event to history service providers: {}", event); + } serviceLoader.forEach( historyProvider -> { try { @@ -79,7 +83,9 @@ public final class HistoryEventManager { } public void createEvent(ClassificationHistoryEvent event) { - LOGGER.debug("Sending event to history service providers: {}", event); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Sending event to history service providers: {}", event); + } serviceLoader.forEach( historyProvider -> { try { @@ -97,7 +103,9 @@ public final class HistoryEventManager { } public void deleteEvents(List taskIds) { - LOGGER.debug("Sending taskIds to history service providers: {}", taskIds); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Sending taskIds to history service providers: {}", taskIds); + } serviceLoader.forEach( historyProvider -> { try { diff --git a/lib/taskana-core/src/main/java/pro/taskana/spi/routing/internal/TaskRoutingManager.java b/lib/taskana-core/src/main/java/pro/taskana/spi/routing/internal/TaskRoutingManager.java index f8bdd8fd1..044f12915 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/spi/routing/internal/TaskRoutingManager.java +++ b/lib/taskana-core/src/main/java/pro/taskana/spi/routing/internal/TaskRoutingManager.java @@ -63,10 +63,6 @@ public final class TaskRoutingManager { * @return the id of the workbasket in which the task is to be created. */ public String determineWorkbasketId(Task task) { - LOGGER.debug( - "entry to routeToWorkbasket. TaskRouterr is enabled {}, task = {}", - isTaskRoutingEnabled(), - task); String workbasketId = null; if (isTaskRoutingEnabled()) { // route to all TaskRoutingProviders @@ -104,7 +100,6 @@ public final class TaskRoutingManager { workbasketId = workbasketIds.stream().findFirst().orElse(null); } } - LOGGER.debug("exit from routeToWorkbasketId. Destination WorkbasketId = {}", workbasketId); return workbasketId; } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/spi/task/internal/CreateTaskPreprocessorManager.java b/lib/taskana-core/src/main/java/pro/taskana/spi/task/internal/CreateTaskPreprocessorManager.java index 050b71635..af1bf4399 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/spi/task/internal/CreateTaskPreprocessorManager.java +++ b/lib/taskana-core/src/main/java/pro/taskana/spi/task/internal/CreateTaskPreprocessorManager.java @@ -40,7 +40,9 @@ public class CreateTaskPreprocessorManager { } public Task processTaskBeforeCreation(Task taskToProcess) { - LOGGER.debug("Sending task to CreateTaskPreprocessor providers: {}", taskToProcess); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Sending task to CreateTaskPreprocessor providers: {}", taskToProcess); + } serviceLoader.forEach( createTaskPreprocessorProvider -> { try { diff --git a/lib/taskana-core/src/main/java/pro/taskana/task/api/models/ObjectReference.java b/lib/taskana-core/src/main/java/pro/taskana/task/api/models/ObjectReference.java index 2fa94b44a..e25a28062 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/task/api/models/ObjectReference.java +++ b/lib/taskana-core/src/main/java/pro/taskana/task/api/models/ObjectReference.java @@ -1,14 +1,11 @@ package pro.taskana.task.api.models; import java.util.Objects; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import pro.taskana.common.api.exceptions.InvalidArgumentException; /** ObjectReference entity. */ public class ObjectReference { - private static final Logger LOGGER = LoggerFactory.getLogger(ObjectReference.class); private String id; private String company; private String system; @@ -28,7 +25,6 @@ public class ObjectReference { public static void validate(ObjectReference objectReference, String objRefType, String objName) throws InvalidArgumentException { - LOGGER.debug("entry to validateObjectReference()"); // check that all values in the ObjectReference are set correctly if (objectReference == null) { throw new InvalidArgumentException( @@ -43,7 +39,6 @@ public class ObjectReference { throw new InvalidArgumentException( String.format("Value of %s of %s must not be empty", objRefType, objName)); } - LOGGER.debug("exit from validateObjectReference()"); } public String getId() { diff --git a/lib/taskana-core/src/main/java/pro/taskana/task/internal/AttachmentHandler.java b/lib/taskana-core/src/main/java/pro/taskana/task/internal/AttachmentHandler.java index ca7e8c8f7..00087c19b 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/task/internal/AttachmentHandler.java +++ b/lib/taskana-core/src/main/java/pro/taskana/task/internal/AttachmentHandler.java @@ -37,7 +37,6 @@ public class AttachmentHandler { List augmentAttachmentsByClassification( List attachmentImpls, BulkOperationResults bulkLog) { - LOGGER.debug("entry to augmentAttachmentsByClassification()"); List result = new ArrayList<>(); if (attachmentImpls == null || attachmentImpls.isEmpty()) { return result; @@ -73,18 +72,12 @@ public class AttachmentHandler { } } - LOGGER.debug("exit from augmentAttachmentsByClassification()"); return result; } void insertAndDeleteAttachmentsOnTaskUpdate(TaskImpl newTaskImpl, TaskImpl oldTaskImpl) throws AttachmentPersistenceException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to insertAndDeleteAttachmentsOnTaskUpdate(oldTaskImpl = {}, newTaskImpl = {})", - oldTaskImpl, - newTaskImpl); - } + List newAttachments = newTaskImpl.getAttachments().stream().filter(Objects::nonNull).collect(Collectors.toList()); newTaskImpl.setAttachments(newAttachments); @@ -92,12 +85,6 @@ public class AttachmentHandler { deleteRemovedAttachmentsOnTaskUpdate(newTaskImpl, oldTaskImpl); insertNewAttachmentsOnTaskUpdate(newTaskImpl, oldTaskImpl); updateModifiedAttachmentsOnTaskUpdate(newTaskImpl, oldTaskImpl); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from insertAndDeleteAttachmentsOnTaskUpdate(oldTaskImpl = {}, newTaskImpl = {})", - oldTaskImpl, - newTaskImpl); - } } void updateModifiedAttachmentsOnTaskUpdate(TaskImpl newTaskImpl, TaskImpl oldTaskImpl) { @@ -157,12 +144,6 @@ public class AttachmentHandler { } void deleteRemovedAttachmentsOnTaskUpdate(TaskImpl newTaskImpl, TaskImpl oldTaskImpl) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to deleteRemovedAttachmentsOnTaskUpdate(oldTaskImpl = {}, newTaskImpl = {})", - oldTaskImpl, - newTaskImpl); - } final List newAttachments = newTaskImpl.getAttachments(); List newAttachmentIds = new ArrayList<>(); @@ -177,28 +158,30 @@ public class AttachmentHandler { a -> { if (!newAttIds.contains(a.getId())) { attachmentMapper.delete(a.getId()); - LOGGER.debug( - "TaskService.updateTask() for TaskId={} DELETED an Attachment={}.", - newTaskImpl.getId(), - a); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "TaskService.updateTask() for TaskId={} DELETED an Attachment={}.", + newTaskImpl.getId(), + a); + } } }); } - LOGGER.debug("exit from deleteRemovedAttachmentsOnTaskUpdate()"); } void insertNewAttachmentOnTaskUpdate(TaskImpl newTaskImpl, Attachment attachment) throws AttachmentPersistenceException { - LOGGER.debug("entry to insertNewAttachmentOnTaskUpdate()"); AttachmentImpl attachmentImpl = (AttachmentImpl) attachment; initAttachment(attachmentImpl, newTaskImpl); try { attachmentMapper.insert(attachmentImpl); - LOGGER.debug( - "TaskService.updateTask() for TaskId={} INSERTED an Attachment={}.", - newTaskImpl.getId(), - attachmentImpl); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "TaskService.updateTask() for TaskId={} INSERTED an Attachment={}.", + newTaskImpl.getId(), + attachmentImpl); + } } catch (PersistenceException e) { throw new AttachmentPersistenceException( String.format( @@ -206,11 +189,9 @@ public class AttachmentHandler { attachmentImpl.getId(), newTaskImpl.getId()), e.getCause()); } - LOGGER.debug("exit from insertNewAttachmentOnTaskUpdate(), returning"); } void initAttachment(AttachmentImpl attachment, Task newTask) { - LOGGER.debug("entry to initAttachment()"); if (attachment.getId() == null) { attachment.setId(IdGenerator.generateWithPrefix(IdGenerator.ID_PREFIX_ATTACHMENT)); } @@ -223,21 +204,21 @@ public class AttachmentHandler { if (attachment.getTaskId() == null) { attachment.setTaskId(newTask.getId()); } - LOGGER.debug("exit from initAttachment()"); } private void initializeAndInsertAttachment(TaskImpl task, AttachmentImpl attachmentImpl) throws AttachmentPersistenceException, InvalidArgumentException { - LOGGER.debug("entry to initializeAndInsertAttachment()"); initAttachment(attachmentImpl, task); ObjectReference objRef = attachmentImpl.getObjectReference(); ObjectReference.validate(objRef, "ObjectReference", "Attachment"); try { attachmentMapper.insert(attachmentImpl); - LOGGER.debug( - "TaskService.updateTask() for TaskId={} INSERTED an Attachment={}.", - task.getId(), - attachmentImpl); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "TaskService.updateTask() for TaskId={} INSERTED an Attachment={}.", + task.getId(), + attachmentImpl); + } } catch (PersistenceException e) { throw new AttachmentPersistenceException( String.format( @@ -245,6 +226,5 @@ public class AttachmentHandler { attachmentImpl.getId(), task.getId()), e.getCause()); } - LOGGER.debug("exit from initializeAndInsertAttachment()"); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/task/internal/ObjectReferenceQueryImpl.java b/lib/taskana-core/src/main/java/pro/taskana/task/internal/ObjectReferenceQueryImpl.java index ae5db7e04..c9fa3538f 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/task/internal/ObjectReferenceQueryImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/task/internal/ObjectReferenceQueryImpl.java @@ -5,8 +5,6 @@ import java.util.Arrays; import java.util.List; import org.apache.ibatis.exceptions.PersistenceException; import org.apache.ibatis.session.RowBounds; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import pro.taskana.common.api.exceptions.TaskanaRuntimeException; import pro.taskana.common.internal.InternalTaskanaEngine; @@ -23,7 +21,6 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery { "pro.taskana.task.internal.TaskQueryMapper.countQueryObjectReferences"; private static final String LINK_TO_VALUEMAPPER = "pro.taskana.task.internal.TaskQueryMapper.queryObjectReferenceColumnValues"; - private static final Logger LOGGER = LoggerFactory.getLogger(ObjectReferenceQueryImpl.class); private final InternalTaskanaEngine taskanaEngine; private final List orderBy; private ObjectReferenceQueryColumnName columnName; @@ -70,7 +67,6 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery { @Override public List list() { - LOGGER.debug("entry to list(), this = {}", this); List result = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -78,16 +74,11 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery { return result; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from list(). Returning {} resulting Objects: {} ", result.size(), result); - } } } @Override public List list(int offset, int limit) { - LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this); List result = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -105,19 +96,12 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery { throw e; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from list(offset,limit). Returning {} resulting Objects: {} ", - result.size(), - result); - } } } @Override public List listValues( ObjectReferenceQueryColumnName columnName, SortDirection sortDirection) { - LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this); List result = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -128,16 +112,11 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery { return result; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "Exit from listValues. Returning {} resulting Objects: {} ", result.size(), result); - } } } @Override public ObjectReference single() { - LOGGER.debug("entry to single(), this = {}", this); ObjectReference result = null; try { taskanaEngine.openConnection(); @@ -145,13 +124,11 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery { return result; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from single(). Returning result {} ", result); } } @Override public long count() { - LOGGER.debug("entry to count(), this = {}", this); Long rowCount = null; try { taskanaEngine.openConnection(); @@ -159,7 +136,6 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery { return (rowCount == null) ? 0L : rowCount; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from count(). Returning result {} ", rowCount); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskCommentServiceImpl.java b/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskCommentServiceImpl.java index cac11df3e..0a703fcb2 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskCommentServiceImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskCommentServiceImpl.java @@ -37,13 +37,9 @@ class TaskCommentServiceImpl { TaskComment newTaskComment(String taskId) { - LOGGER.debug("entry to newTaskComment (taskId = {})", taskId); - TaskCommentImpl taskComment = new TaskCommentImpl(); taskComment.setTaskId(taskId); - LOGGER.debug("exit from newTaskComment(), returning {}", taskComment); - return taskComment; } @@ -51,8 +47,6 @@ class TaskCommentServiceImpl { throws NotAuthorizedException, ConcurrencyException, TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException { - LOGGER.debug("entry to updateTaskComment (taskComment = {})", taskCommentToUpdate); - String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid(); TaskCommentImpl taskCommentImplToUpdate = (TaskCommentImpl) taskCommentToUpdate; @@ -73,10 +67,12 @@ class TaskCommentServiceImpl { taskCommentMapper.update(taskCommentImplToUpdate); - LOGGER.debug( - "Method updateTaskComment() updated taskComment '{}' for user '{}'.", - taskCommentImplToUpdate.getId(), - userId); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Method updateTaskComment() updated taskComment '{}' for user '{}'.", + taskCommentImplToUpdate.getId(), + userId); + } } else { throw new NotAuthorizedException( @@ -88,7 +84,6 @@ class TaskCommentServiceImpl { } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from updateTaskComment()"); } return taskCommentImplToUpdate; @@ -97,8 +92,6 @@ class TaskCommentServiceImpl { TaskComment createTaskComment(TaskComment taskCommentToCreate) throws NotAuthorizedException, TaskNotFoundException, InvalidArgumentException { - LOGGER.debug("entry to setTaskComment (taskCommentToCreate = {})", taskCommentToCreate); - TaskCommentImpl taskCommentImplToCreate = (TaskCommentImpl) taskCommentToCreate; try { @@ -114,10 +107,7 @@ class TaskCommentServiceImpl { taskCommentMapper.insert(taskCommentImplToCreate); } finally { - taskanaEngine.returnConnection(); - - LOGGER.debug("exit from setTaskComment()"); } return taskCommentImplToCreate; @@ -127,8 +117,6 @@ class TaskCommentServiceImpl { throws NotAuthorizedException, TaskCommentNotFoundException, TaskNotFoundException, InvalidArgumentException { - LOGGER.debug("entry to deleteTaskComment (taskComment = {}", taskCommentId); - String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid(); try { @@ -143,7 +131,9 @@ class TaskCommentServiceImpl { taskCommentMapper.delete(taskCommentId); - LOGGER.debug("taskComment {} deleted", taskCommentToDelete.getId()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("taskComment {} deleted", taskCommentToDelete.getId()); + } } else { throw new NotAuthorizedException( @@ -156,15 +146,12 @@ class TaskCommentServiceImpl { } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from deleteTaskComment()"); } } List getTaskComments(String taskId) throws NotAuthorizedException, TaskNotFoundException { - LOGGER.debug("entry to getTaskComments (taskId = {})", taskId); - try { taskanaEngine.openConnection(); @@ -173,17 +160,14 @@ class TaskCommentServiceImpl { List taskComments = new ArrayList<>(taskCommentMapper.findByTaskId(taskId)); - if (taskComments.isEmpty()) { + if (taskComments.isEmpty() && LOGGER.isDebugEnabled()) { LOGGER.debug("getTaskComments() found no comments for the provided taskId"); } return taskComments; } finally { - taskanaEngine.returnConnection(); - - LOGGER.debug("exit from getTaskComments()"); } } @@ -191,8 +175,6 @@ class TaskCommentServiceImpl { throws TaskCommentNotFoundException, NotAuthorizedException, TaskNotFoundException, InvalidArgumentException { - LOGGER.debug("entry to getTaskComment (taskCommentId = {})", taskCommentId); - TaskCommentImpl result; verifyTaskCommentIdIsNotNullOrEmpty(taskCommentId); @@ -214,10 +196,7 @@ class TaskCommentServiceImpl { return result; } finally { - taskanaEngine.returnConnection(); - - LOGGER.debug("exit from getTaskComment()"); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskQueryImpl.java b/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskQueryImpl.java index ff5a74f09..b205b2fe5 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskQueryImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskQueryImpl.java @@ -919,7 +919,6 @@ public class TaskQueryImpl implements TaskQuery { public List list() { List result = new ArrayList<>(); try { - LOGGER.debug("entry to list(), this = {}", this); taskanaEngine.openConnection(); checkForIllegalParamCombinations(); checkOpenAndReadPermissionForSpecifiedWorkbaskets(); @@ -927,23 +926,16 @@ public class TaskQueryImpl implements TaskQuery { setupAccessIds(); List tasks = taskanaEngine.getSqlSession().selectList(getLinkToMapperScript(), this); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("mapper returned {} resulting Objects: {} ", tasks.size(), tasks); - } + result = taskService.augmentTaskSummariesByContainedSummariesWithPartitioning(tasks); return result; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from list(). Returning {} resulting Objects: {} ", result.size(), result); - } } } @Override public List list(int offset, int limit) { - LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this); List result = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -967,18 +959,11 @@ public class TaskQueryImpl implements TaskQuery { throw e; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from list(offset,limit). Returning {} resulting Objects: {} ", - result.size(), - result); - } } } @Override public List listValues(TaskQueryColumnName columnName, SortDirection sortDirection) { - LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this); List result = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -1006,16 +991,11 @@ public class TaskQueryImpl implements TaskQuery { return result; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "Exit from listValues. Returning {} resulting Objects: {} ", result.size(), result); - } } } @Override public TaskSummary single() { - LOGGER.debug("entry to single(), this = {}", this); TaskSummary result = null; try { taskanaEngine.openConnection(); @@ -1036,13 +1016,11 @@ public class TaskQueryImpl implements TaskQuery { return result; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from single(). Returning result {} ", result); } } @Override public long count() { - LOGGER.debug("entry to count(), this = {}", this); Long rowCount = null; try { taskanaEngine.openConnection(); @@ -1053,7 +1031,6 @@ public class TaskQueryImpl implements TaskQuery { return (rowCount == null) ? 0L : rowCount; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from count(). Returning result {} ", rowCount); } } @@ -1627,7 +1604,9 @@ public class TaskQueryImpl implements TaskQuery { private void checkOpenAndReadPermissionForSpecifiedWorkbaskets() { if (taskanaEngine.getEngine().isUserInRole(TaskanaRole.ADMIN, TaskanaRole.TASK_ADMIN)) { - LOGGER.debug("Skipping permissions check since user is in role ADMIN or TASK_ADMIN."); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Skipping permissions check since user is in role ADMIN or TASK_ADMIN."); + } return; } try { diff --git a/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskServiceImpl.java b/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskServiceImpl.java index 999c03363..ad45e047c 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskServiceImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskServiceImpl.java @@ -159,7 +159,6 @@ public class TaskServiceImpl implements TaskService { public Task createTask(Task taskToCreate) throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, TaskAlreadyExistException, InvalidArgumentException { - LOGGER.debug("entry to createTask(task = {})", taskToCreate); if (CreateTaskPreprocessorManager.isCreateTaskPreprocessorEnabled()) { taskToCreate = createTaskPreprocessorManager.processTaskBeforeCreation(taskToCreate); @@ -174,7 +173,9 @@ public class TaskServiceImpl implements TaskService { throw new InvalidArgumentException("taskId must be empty when creating a task"); } - LOGGER.debug("Task {} cannot be found, so it can be created.", task.getId()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Task {} cannot be found, so it can be created.", task.getId()); + } Workbasket workbasket; if (task.getWorkbasketSummary().getId() != null) { @@ -219,7 +220,9 @@ public class TaskServiceImpl implements TaskService { setCallbackStateOnTaskCreation(task); try { this.taskMapper.insert(task); - LOGGER.debug("Method createTask() created Task '{}'.", task.getId()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Method createTask() created Task '{}'.", task.getId()); + } if (HistoryEventManager.isHistoryEnabled()) { String details = @@ -266,13 +269,11 @@ public class TaskServiceImpl implements TaskService { return task; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from createTask(task = {})", task); } } @Override public Task getTask(String id) throws NotAuthorizedException, TaskNotFoundException { - LOGGER.debug("entry to getTaskById(id = {})", id); TaskImpl resultTask = null; try { taskanaEngine.openConnection(); @@ -325,7 +326,6 @@ public class TaskServiceImpl implements TaskService { } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from getTaskById(). Returning result {} ", resultTask); } } @@ -346,7 +346,6 @@ public class TaskServiceImpl implements TaskService { @Override public Task setTaskRead(String taskId, boolean isRead) throws TaskNotFoundException, NotAuthorizedException { - LOGGER.debug("entry to setTaskRead(taskId = {}, isRead = {})", taskId, isRead); TaskImpl task = null; try { taskanaEngine.openConnection(); @@ -354,11 +353,12 @@ public class TaskServiceImpl implements TaskService { task.setRead(isRead); task.setModified(Instant.now()); taskMapper.update(task); - LOGGER.debug("Method setTaskRead() set read property of Task '{}' to {} ", task, isRead); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Method setTaskRead() set read property of Task '{}' to {} ", task, isRead); + } return task; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from setTaskRead(taskId, isRead). Returning result {} ", task); } } @@ -384,13 +384,11 @@ public class TaskServiceImpl implements TaskService { @Override public Task newTask(String workbasketKey, String domain) { - LOGGER.debug("entry to newTask(workbasketKey = {}, domain = {})", workbasketKey, domain); TaskImpl task = new TaskImpl(); WorkbasketSummaryImpl wb = new WorkbasketSummaryImpl(); wb.setKey(workbasketKey); wb.setDomain(domain); task.setWorkbasketSummary(wb); - LOGGER.debug("exit from newTask(), returning {}", task); return task; } @@ -410,7 +408,6 @@ public class TaskServiceImpl implements TaskService { NotAuthorizedException, AttachmentPersistenceException, InvalidStateException, ClassificationNotFoundException { String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid(); - LOGGER.debug("entry to updateTask(task = {}, userId = {})", task, userId); TaskImpl newTaskImpl = (TaskImpl) task; TaskImpl oldTaskImpl; try { @@ -426,7 +423,9 @@ public class TaskServiceImpl implements TaskService { taskMapper.update(newTaskImpl); - LOGGER.debug("Method updateTask() updated task '{}' for user '{}'.", task.getId(), userId); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Method updateTask() updated task '{}' for user '{}'.", task.getId(), userId); + } if (HistoryEventManager.isHistoryEnabled()) { @@ -443,7 +442,6 @@ public class TaskServiceImpl implements TaskService { } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from claim()"); } return task; } @@ -482,10 +480,6 @@ public class TaskServiceImpl implements TaskService { public Task selectAndClaim(TaskQuery taskQuery) throws NotAuthorizedException, InvalidOwnerException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("entry to selectAndClaim(taskQuery = {})", taskQuery); - } - try { taskanaEngine.openConnection(); @@ -505,7 +499,6 @@ public class TaskServiceImpl implements TaskService { } catch (InvalidStateException | TaskNotFoundException e) { throw new SystemException("Caught exception ", e); } finally { - LOGGER.debug("exit from selectAndClaim()"); taskanaEngine.returnConnection(); } } @@ -513,9 +506,6 @@ public class TaskServiceImpl implements TaskService { @Override public BulkOperationResults deleteTasks(List taskIds) throws InvalidArgumentException, NotAuthorizedException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("entry to deleteTasks(tasks = {})", taskIds); - } taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.ADMIN); @@ -553,7 +543,6 @@ public class TaskServiceImpl implements TaskService { } return bulkLog; } finally { - LOGGER.debug("exit from deleteTasks()"); taskanaEngine.returnConnection(); } } @@ -574,12 +563,7 @@ public class TaskServiceImpl implements TaskService { public List updateTasks( ObjectReference selectionCriteria, Map customFieldsToUpdate) throws InvalidArgumentException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to updateTasks(selectionCriteria = {}, customFieldsToUpdate = {})", - selectionCriteria, - customFieldsToUpdate); - } + ObjectReference.validate(selectionCriteria, "ObjectReference", "updateTasks call"); validateCustomFields(customFieldsToUpdate); TaskCustomPropertySelector fieldSelector = new TaskCustomPropertySelector(); @@ -600,11 +584,12 @@ public class TaskServiceImpl implements TaskService { } } else { - LOGGER.debug("updateTasks() found no tasks for update "); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("updateTasks() found no tasks for update "); + } } return changedTasks; } finally { - LOGGER.debug("exit from updateTasks()."); taskanaEngine.returnConnection(); } } @@ -613,12 +598,6 @@ public class TaskServiceImpl implements TaskService { public List updateTasks( List taskIds, Map customFieldsToUpdate) throws InvalidArgumentException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to updateTasks(taskIds = {}, customFieldsToUpdate = {})", - taskIds, - customFieldsToUpdate); - } validateCustomFields(customFieldsToUpdate); TaskCustomPropertySelector fieldSelector = new TaskCustomPropertySelector(); @@ -639,11 +618,12 @@ public class TaskServiceImpl implements TaskService { } } else { - LOGGER.debug("updateTasks() found no tasks for update "); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("updateTasks() found no tasks for update "); + } } return changedTasks; } finally { - LOGGER.debug("exit from updateTasks()."); taskanaEngine.returnConnection(); } } @@ -685,9 +665,7 @@ public class TaskServiceImpl implements TaskService { @Override public BulkOperationResults setCallbackStateForTasks( List externalIds, CallbackState state) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("entry to setCallbackStateForTasks(externalIds = {})", externalIds); - } + try { taskanaEngine.openConnection(); @@ -708,7 +686,6 @@ public class TaskServiceImpl implements TaskService { } return bulkLog; } finally { - LOGGER.debug("exit from setCallbckStateForTasks()"); taskanaEngine.returnConnection(); } } @@ -716,9 +693,7 @@ public class TaskServiceImpl implements TaskService { @Override public BulkOperationResults setOwnerOfTasks( String owner, List argTaskIds) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("entry to setOwnerOfTasks(owner = {}, tasks = {})", owner, argTaskIds); - } + BulkOperationResults bulkLog = new BulkOperationResults<>(); if (argTaskIds == null || argTaskIds.isEmpty()) { return bulkLog; @@ -756,7 +731,6 @@ public class TaskServiceImpl implements TaskService { } return bulkLog; } finally { - LOGGER.debug("exit from setOwnerOfTasks()"); taskanaEngine.returnConnection(); } } @@ -764,10 +738,6 @@ public class TaskServiceImpl implements TaskService { @Override public BulkOperationResults setPlannedPropertyOfTasks( Instant planned, List argTaskIds) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to setPlannedPropertyOfTasks(planned = {}, tasks = {})", planned, argTaskIds); - } BulkLog bulkLog = new BulkLog(); if (argTaskIds == null || argTaskIds.isEmpty()) { @@ -783,7 +753,6 @@ public class TaskServiceImpl implements TaskService { bulkLog.addAllErrors(errorsFromProcessing); return bulkLog; } finally { - LOGGER.debug("exit from setPlannedPropertyOfTasks"); taskanaEngine.returnConnection(); } } @@ -791,7 +760,6 @@ public class TaskServiceImpl implements TaskService { @Override public Task cancelTask(String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException { - LOGGER.debug("entry to cancelTask(task = {})", taskId); Task cancelledTask; @@ -808,7 +776,6 @@ public class TaskServiceImpl implements TaskService { } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from cancelTask()"); } return cancelledTask; @@ -817,7 +784,6 @@ public class TaskServiceImpl implements TaskService { @Override public Task terminateTask(String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException { - LOGGER.debug("entry to terminateTask(task = {})", taskId); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.ADMIN, TaskanaRole.TASK_ADMIN); @@ -837,15 +803,11 @@ public class TaskServiceImpl implements TaskService { } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from terminateTask()"); } return terminatedTask; } public List findTasksIdsAffectedByClassificationChange(String classificationId) { - LOGGER.debug( - "entry to findTasksIdsAffectedByClassificationChange(classificationId = {})", - classificationId); // tasks directly affected List tasksAffectedDirectly = createTaskQuery() @@ -883,15 +845,11 @@ public class TaskServiceImpl implements TaskService { classificationId, affectedTaskIds); } - LOGGER.debug("exit from findTasksIdsAffectedByClassificationChange(). "); return affectedTaskIds; } public void refreshPriorityAndDueDatesOfTasksOnClassificationUpdate( List taskIds, boolean serviceLevelChanged, boolean priorityChanged) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("entry to refreshPriorityAndDueDateOfTasks(tasks = {})", taskIds); - } Pair, BulkLog> resultsPair = getMinimalTaskSummaries(taskIds); List tasks = resultsPair.getLeft(); try { @@ -912,7 +870,6 @@ public class TaskServiceImpl implements TaskService { }); } } finally { - LOGGER.debug("exit from refreshPriorityAndDueDateOfTasks"); taskanaEngine.returnConnection(); } } @@ -975,12 +932,6 @@ public class TaskServiceImpl implements TaskService { void removeNonExistingTasksFromTaskIdList( List taskIds, BulkOperationResults bulkLog) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to removeNonExistingTasksFromTaskIdList(targetWbId = {}, taskIds = {})", - taskIds, - bulkLog); - } Iterator taskIdIterator = taskIds.iterator(); while (taskIdIterator.hasNext()) { @@ -991,16 +942,11 @@ public class TaskServiceImpl implements TaskService { taskIdIterator.remove(); } } - LOGGER.debug("exit from removeNonExistingTasksFromTaskIdList()"); } List augmentTaskSummariesByContainedSummariesWithPartitioning( List taskSummaries) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to augmentTaskSummariesByContainedSummariesWithPartitioning(taskSummaries= {})", - taskSummaries); - } + // splitting Augmentation into steps of maximal 32000 tasks // reason: DB2 has a maximum for parameters in a query List result = @@ -1009,7 +955,6 @@ public class TaskServiceImpl implements TaskService { .flatMap(Collection::stream) .collect(Collectors.toList()); - LOGGER.debug("exit from to augmentTaskSummariesByContainedSummariesWithPartitioning()"); return result; } @@ -1044,7 +989,6 @@ public class TaskServiceImpl implements TaskService { private BulkOperationResults completeTasks( List taskIds, boolean forced) throws InvalidArgumentException { try { - LOGGER.debug("entry to completeTasks(taskIds = {})", taskIds); taskanaEngine.openConnection(); if (taskIds == null) { throw new InvalidArgumentException("TaskIds can't be used as NULL-Parameter."); @@ -1080,7 +1024,6 @@ public class TaskServiceImpl implements TaskService { return bulkLog; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from to completeTasks(taskIds = {})", taskIds); } } @@ -1154,10 +1097,12 @@ public class TaskServiceImpl implements TaskService { task.setCompleted(now); task.setState(targetState); taskMapper.update(task); - LOGGER.debug( - "Task '{}' cancelled by user '{}'.", - taskId, - taskanaEngine.getEngine().getCurrentUserContext().getUserid()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Task '{}' cancelled by user '{}'.", + taskId, + taskanaEngine.getEngine().getCurrentUserContext().getUserid()); + } return task; } @@ -1189,8 +1134,6 @@ public class TaskServiceImpl implements TaskService { throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException { String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid(); - LOGGER.debug( - "entry to claim(id = {}, userId = {}, forceClaim = {})", taskId, userId, forceClaim); TaskImpl task; try { taskanaEngine.openConnection(); @@ -1200,7 +1143,9 @@ public class TaskServiceImpl implements TaskService { checkPreconditionsForClaimTask(task, forceClaim); claimActionsOnTask(task, userId, now); taskMapper.update(task); - LOGGER.debug("Task '{}' claimed by user '{}'.", taskId, userId); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Task '{}' claimed by user '{}'.", taskId, userId); + } if (HistoryEventManager.isHistoryEnabled()) { historyEventManager.createEvent( new TaskClaimedEvent( @@ -1210,7 +1155,6 @@ public class TaskServiceImpl implements TaskService { } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from claim()"); } return task; } @@ -1283,11 +1227,6 @@ public class TaskServiceImpl implements TaskService { throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException { String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid(); - LOGGER.debug( - "entry to cancelClaim(taskId = {}), userId = {}, forceUnclaim = {})", - taskId, - userId, - forceUnclaim); TaskImpl task; try { taskanaEngine.openConnection(); @@ -1308,7 +1247,9 @@ public class TaskServiceImpl implements TaskService { task.setRead(true); task.setState(TaskState.READY); taskMapper.update(task); - LOGGER.debug("Task '{}' unclaimed by user '{}'.", taskId, userId); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Task '{}' unclaimed by user '{}'.", taskId, userId); + } if (HistoryEventManager.isHistoryEnabled()) { historyEventManager.createEvent( new TaskClaimCancelledEvent( @@ -1318,7 +1259,6 @@ public class TaskServiceImpl implements TaskService { } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from cancelClaim()"); } return task; } @@ -1327,8 +1267,6 @@ public class TaskServiceImpl implements TaskService { throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, NotAuthorizedException { String userId = taskanaEngine.getEngine().getCurrentUserContext().getUserid(); - LOGGER.debug( - "entry to completeTask(id = {}, userId = {}, isForced = {})", taskId, userId, isForced); TaskImpl task; try { taskanaEngine.openConnection(); @@ -1349,7 +1287,9 @@ public class TaskServiceImpl implements TaskService { Instant now = Instant.now(); completeActionsOnTask(task, userId, now); taskMapper.update(task); - LOGGER.debug("Task '{}' completed by user '{}'.", taskId, userId); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Task '{}' completed by user '{}'.", taskId, userId); + } if (HistoryEventManager.isHistoryEnabled()) { historyEventManager.createEvent( new TaskCompletedEvent( @@ -1359,14 +1299,12 @@ public class TaskServiceImpl implements TaskService { } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from completeTask()"); } return task; } private void deleteTask(String taskId, boolean forceDelete) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException { - LOGGER.debug("entry to deleteTask(taskId = {} , forceDelete = {})", taskId, forceDelete); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.ADMIN); TaskImpl task; try { @@ -1393,10 +1331,11 @@ public class TaskServiceImpl implements TaskService { historyEventManager.deleteEvents(Collections.singletonList(taskId)); } - LOGGER.debug("Task {} deleted.", taskId); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Task {} deleted.", taskId); + } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from deleteTask()."); } } @@ -1404,7 +1343,6 @@ public class TaskServiceImpl implements TaskService { BulkOperationResults bulkLog, List taskSummaries, Iterator taskIdIterator) { - LOGGER.debug("entry to removeSingleTask()"); String currentTaskId = taskIdIterator.next(); if (currentTaskId == null || currentTaskId.equals("")) { bulkLog.addError( @@ -1438,7 +1376,6 @@ public class TaskServiceImpl implements TaskService { } } } - LOGGER.debug("exit from removeSingleTask()"); } private void removeSingleTaskForCallbackStateByExternalId( @@ -1446,7 +1383,6 @@ public class TaskServiceImpl implements TaskService { List taskSummaries, Iterator externalIdIterator, CallbackState desiredCallbackState) { - LOGGER.debug("entry to removeSingleTask()"); String currentExternalId = externalIdIterator.next(); if (currentExternalId == null || currentExternalId.equals("")) { bulkLog.addError( @@ -1472,7 +1408,6 @@ public class TaskServiceImpl implements TaskService { externalIdIterator.remove(); } } - LOGGER.debug("exit from removeSingleTask()"); } private boolean desiredCallbackStateCanBeSetForFoundSummary( @@ -1503,7 +1438,6 @@ public class TaskServiceImpl implements TaskService { private void standardSettings(TaskImpl task, Classification classification) throws InvalidArgumentException { TaskImpl task1 = task; - LOGGER.debug("entry to standardSettings()"); final Instant now = Instant.now(); task1.setId(IdGenerator.generateWithPrefix(IdGenerator.ID_PREFIX_TASK)); if (task1.getExternalId() == null) { @@ -1549,7 +1483,6 @@ public class TaskServiceImpl implements TaskService { throw new SystemException( "Internal error when trying to insert new Attachments on Task Creation.", e); } - LOGGER.debug("exit from standardSettings()"); } private void setCallbackStateOnTaskCreation(TaskImpl task) throws InvalidArgumentException { @@ -1571,9 +1504,7 @@ public class TaskServiceImpl implements TaskService { } private void updateTasksToBeCompleted(Stream taskSummaries, Instant now) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("entry to updateTasksToBeCompleted()"); - } + List taskIds = new ArrayList<>(); List updateClaimedTaskIds = new ArrayList<>(); List taskSummaryList = @@ -1607,20 +1538,12 @@ public class TaskServiceImpl implements TaskService { createTasksCompletedEvents(taskSummaryList); } } - LOGGER.debug("exit from updateTasksToBeCompleted()"); } private void addClassificationSummariesToTaskSummaries( List tasks, List classifications) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to addClassificationSummariesToTaskSummaries(tasks = {}, classifications = {})", - tasks, - classifications); - } if (tasks == null || tasks.isEmpty()) { - LOGGER.debug("exit from addClassificationSummariesToTaskSummaries()"); return; } // assign query results to appropriate tasks. @@ -1642,12 +1565,10 @@ public class TaskServiceImpl implements TaskService { // set the classification on the task object task.setClassificationSummary(classificationSummary); } - LOGGER.debug("exit from addClassificationSummariesToTaskSummaries()"); } private List findClassificationsForTasksAndAttachments( List taskSummaries, List attachmentSummaries) { - LOGGER.debug("entry to findClassificationsForTasksAndAttachments()"); if (taskSummaries == null || taskSummaries.isEmpty()) { return new ArrayList<>(); } @@ -1662,13 +1583,11 @@ public class TaskServiceImpl implements TaskService { classificationIdSet.add(att.getClassificationSummary().getId()); } } - LOGGER.debug("exit from findClassificationsForTasksAndAttachments()"); return queryClassificationsForTasksAndAttachments(classificationIdSet); } private List findClassificationForTaskImplAndAttachments( TaskImpl task, List attachmentImpls) { - LOGGER.debug("entry to transferBulk()"); Set classificationIdSet = new HashSet<>(Collections.singletonList(task.getClassificationSummary().getId())); if (attachmentImpls != null && !attachmentImpls.isEmpty()) { @@ -1676,7 +1595,6 @@ public class TaskServiceImpl implements TaskService { classificationIdSet.add(att.getClassificationSummary().getId()); } } - LOGGER.debug("exit from findClassificationForTaskImplAndAttachments()"); return queryClassificationsForTasksAndAttachments(classificationIdSet); } @@ -1685,8 +1603,10 @@ public class TaskServiceImpl implements TaskService { String[] classificationIdArray = classificationIdSet.toArray(new String[0]); - LOGGER.debug( - "getClassificationsForTasksAndAttachments() about to query classifications and exit"); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "getClassificationsForTasksAndAttachments() about to query classifications and exit"); + } // perform classification query return this.classificationService .createClassificationQuery() @@ -1695,7 +1615,6 @@ public class TaskServiceImpl implements TaskService { } private void addWorkbasketSummariesToTaskSummaries(List taskSummaries) { - LOGGER.debug("entry to addWorkbasketSummariesToTaskSummaries()"); if (taskSummaries == null || taskSummaries.isEmpty()) { return; } @@ -1705,7 +1624,9 @@ public class TaskServiceImpl implements TaskService { .map(t -> t.getWorkbasketSummary().getId()) .distinct() .toArray(String[]::new); - LOGGER.debug("addWorkbasketSummariesToTaskSummaries() about to query workbaskets"); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("addWorkbasketSummariesToTaskSummaries() about to query workbaskets"); + } WorkbasketQueryImpl query = (WorkbasketQueryImpl) workbasketService.createWorkbasketQuery(); query.setUsedToAugmentTasks(true); @@ -1728,21 +1649,12 @@ public class TaskServiceImpl implements TaskService { task.setWorkbasketSummary(workbasketSummary); } - LOGGER.debug("exit from addWorkbasketSummariesToTaskSummaries()"); } private void addAttachmentSummariesToTaskSummaries( List taskSummaries, List attachmentSummaries, List classifications) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to addAttachmentSummariesToTaskSummaries(taskSummaries = {}, " - + "attachmentSummaries = {}, classifications = {})", - taskSummaries, - attachmentSummaries, - classifications); - } if (taskSummaries == null || taskSummaries.isEmpty()) { return; @@ -1762,21 +1674,17 @@ public class TaskServiceImpl implements TaskService { } } } - - LOGGER.debug("exit from addAttachmentSummariesToTaskSummaries()"); } private void addClassificationSummariesToAttachmentSummaries( List attachmentSummaries, List taskSummaries, List classifications) { - LOGGER.debug("entry to addClassificationSummariesToAttachmentSummaries()"); // prereq: in each attachmentSummary, the classificationSummary.key property is set. if (attachmentSummaries == null || attachmentSummaries.isEmpty() || taskSummaries == null || taskSummaries.isEmpty()) { - LOGGER.debug("exit from addClassificationSummariesToAttachmentSummaries()"); return; } // iterate over all attachment summaries an add the appropriate classification summary to each @@ -1792,20 +1700,12 @@ public class TaskServiceImpl implements TaskService { } att.setClassificationSummary(classificationSummary); } - LOGGER.debug("exit from addClassificationSummariesToAttachmentSummaries()"); } private List addClassificationSummariesToAttachments( List attachmentImpls, List classifications) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to addClassificationSummariesToAttachments(targetWbId = {}, taskIds = {})", - attachmentImpls, - classifications); - } if (attachmentImpls == null || attachmentImpls.isEmpty()) { - LOGGER.debug("exit from addClassificationSummariesToAttachments()"); return new ArrayList<>(); } @@ -1824,21 +1724,12 @@ public class TaskServiceImpl implements TaskService { att.setClassificationSummary(classificationSummary); result.add(att); } - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("exit from addClassificationSummariesToAttachments(), returning {}", result); - } return result; } private TaskImpl initUpdatedTask( Map customFieldsToUpdate, TaskCustomPropertySelector fieldSelector) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to initUpdatedTask(customFieldsToUpdate = {}, fieldSelector = {})", - customFieldsToUpdate, - fieldSelector); - } TaskImpl newTask = new TaskImpl(); newTask.setModified(Instant.now()); @@ -1848,25 +1739,16 @@ public class TaskServiceImpl implements TaskService { fieldSelector.setCustomProperty(key, true); newTask.setCustomAttribute(key, entry.getValue()); } - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("exit from initUpdatedTask(), returning {}", newTask); - } - return newTask; } private void validateCustomFields(Map customFieldsToUpdate) throws InvalidArgumentException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to validateCustomFields(customFieldsToUpdate = {})", customFieldsToUpdate); - } if (customFieldsToUpdate == null || customFieldsToUpdate.isEmpty()) { throw new InvalidArgumentException( "The customFieldsToUpdate argument to updateTasks must not be empty."); } - LOGGER.debug("exit from validateCustomFields()"); } private List getTasksToChange(List taskIds) { diff --git a/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskTransferrer.java b/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskTransferrer.java index 034c986b5..29276dde8 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskTransferrer.java +++ b/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskTransferrer.java @@ -61,11 +61,6 @@ class TaskTransferrer { String taskId, String destinationWorkbasketKey, String domain, boolean setTransferFlag) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException { - LOGGER.debug( - "entry to transfer(taskId = {}, destinationWorkbasketKey = {}, domain = {})", - taskId, - destinationWorkbasketKey, - domain); TaskImpl task = null; WorkbasketSummary oldWorkbasketSummary = null; try { @@ -105,10 +100,12 @@ class TaskTransferrer { task.setState(TaskState.READY); task.setOwner(null); taskMapper.update(task); - LOGGER.debug( - "Method transfer() transferred Task '{}' to destination workbasket {}", - taskId, - destinationWorkbasket.getId()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Method transfer() transferred Task '{}' to destination workbasket {}", + taskId, + destinationWorkbasket.getId()); + } if (HistoryEventManager.isHistoryEnabled()) { createTaskTransferredEvent( task, oldWorkbasketSummary.getId(), destinationWorkbasket.asSummary().getId()); @@ -116,17 +113,13 @@ class TaskTransferrer { return task; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from transfer(). Returning result {} ", task); } } Task transfer(String taskId, String destinationWorkbasketId, boolean setTransferFlag) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException { - LOGGER.debug( - "entry to transfer(taskId = {}, destinationWorkbasketId = {})", - taskId, - destinationWorkbasketId); + TaskImpl task = null; WorkbasketSummary oldWorkbasketSummary = null; try { @@ -162,17 +155,18 @@ class TaskTransferrer { task.setState(TaskState.READY); task.setOwner(null); taskMapper.update(task); - LOGGER.debug( - "Method transfer() transferred Task '{}' to destination workbasket {}", - taskId, - destinationWorkbasketId); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Method transfer() transferred Task '{}' to destination workbasket {}", + taskId, + destinationWorkbasketId); + } if (HistoryEventManager.isHistoryEnabled()) { createTaskTransferredEvent(task, oldWorkbasketSummary.getId(), destinationWorkbasketId); } return task; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from transfer(). Returning result {} ", task); } } @@ -184,13 +178,6 @@ class TaskTransferrer { throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException { try { taskanaEngine.openConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to transferTasks(targetWbKey = {}, domain = {}, taskIds = {})", - destinationWorkbasketKey, - destinationWorkbasketDomain, - taskIds); - } // Check pre-conditions with trowing Exceptions if (destinationWorkbasketKey == null || destinationWorkbasketDomain == null) { @@ -202,15 +189,6 @@ class TaskTransferrer { return transferTasks(taskIds, destinationWorkbasket, setTransferFlag); } finally { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from transferTasks(targetWbKey = {}, targetWbDomain = {}, " - + "destination taskIds = {})", - destinationWorkbasketKey, - destinationWorkbasketDomain, - taskIds); - } - taskanaEngine.returnConnection(); } } @@ -220,12 +198,6 @@ class TaskTransferrer { throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException { try { taskanaEngine.openConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to transferTasks(targetWbId = {}, taskIds = {})", - destinationWorkbasketId, - taskIds); - } // Check pre-conditions with trowing Exceptions if (destinationWorkbasketId == null || destinationWorkbasketId.isEmpty()) { @@ -235,13 +207,6 @@ class TaskTransferrer { return transferTasks(taskIds, destinationWorkbasket, setTransferFlag); } finally { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from transferTasks(targetWbKey = {}, taskIds = {})", - destinationWorkbasketId, - taskIds); - } - taskanaEngine.returnConnection(); } } @@ -251,12 +216,6 @@ class TaskTransferrer { Workbasket destinationWorkbasket, boolean setTransferFlag) throws InvalidArgumentException, WorkbasketNotFoundException, NotAuthorizedException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to transferTasks(taskIdsToBeTransferred = {}, destinationWorkbasket = {})", - taskIdsToBeTransferred, - destinationWorkbasket); - } workbasketService.checkAuthorization( destinationWorkbasket.getId(), WorkbasketPermission.APPEND); @@ -276,10 +235,6 @@ class TaskTransferrer { taskSummaries = taskMapper.findExistingTasks(taskIds, null); checkIfTransferConditionsAreFulfilled(taskIds, taskSummaries, bulkLog); updateTasksToBeTransferred(taskIds, taskSummaries, destinationWorkbasket, setTransferFlag); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("exit from transferTasks(), returning {}", bulkLog); - } - return bulkLog; } @@ -287,14 +242,6 @@ class TaskTransferrer { List taskIds, List taskSummaries, BulkOperationResults bulkLog) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to checkIfTransferConditionsAreFulfilled(taskIds = {}, " - + "taskSummaries = {}, bulkLog = {})", - taskIds, - taskSummaries, - bulkLog); - } Set workbasketIds = new HashSet<>(); taskSummaries.forEach(t -> workbasketIds.add(t.getWorkbasketId())); @@ -311,7 +258,6 @@ class TaskTransferrer { .list(); } checkIfTasksMatchTransferCriteria(taskIds, taskSummaries, sourceWorkbaskets, bulkLog); - LOGGER.debug("exit from checkIfTransferConditionsAreFulfilled()"); } private void checkIfTasksMatchTransferCriteria( @@ -319,15 +265,6 @@ class TaskTransferrer { List taskSummaries, List sourceWorkbaskets, BulkOperationResults bulkLog) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to checkIfTasksMatchTransferCriteria(taskIds = {}, taskSummaries = {}, " - + "sourceWorkbaskets = {}, bulkLog = {})", - taskIds, - taskSummaries, - sourceWorkbaskets, - bulkLog); - } Iterator taskIdIterator = taskIds.iterator(); while (taskIdIterator.hasNext()) { @@ -359,7 +296,6 @@ class TaskTransferrer { taskIdIterator.remove(); } } - LOGGER.debug("exit from checkIfTasksMatchTransferCriteria()"); } private void createTaskTransferredEvent( @@ -378,14 +314,6 @@ class TaskTransferrer { List taskSummaries, Workbasket destinationWorkbasket, boolean setTransferFlag) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to updateTasksToBeTransferred(taskIds = {}, taskSummaries = {}, " - + "destinationWorkbasket = {})", - taskIds, - taskSummaries, - destinationWorkbasket.getId()); - } taskSummaries = taskSummaries.stream() @@ -406,7 +334,6 @@ class TaskTransferrer { createTasksTransferredEvents(taskSummaries, updateObject); } } - LOGGER.debug("exit from updateTasksToBeTransferred()"); } private void createTasksTransferredEvents( diff --git a/lib/taskana-core/src/main/java/pro/taskana/task/internal/jobs/TaskCleanupJob.java b/lib/taskana-core/src/main/java/pro/taskana/task/internal/jobs/TaskCleanupJob.java index f1800a656..511e74654 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/task/internal/jobs/TaskCleanupJob.java +++ b/lib/taskana-core/src/main/java/pro/taskana/task/internal/jobs/TaskCleanupJob.java @@ -82,7 +82,6 @@ public class TaskCleanupJob extends AbstractTaskanaJob { } private List getTasksCompletedBefore(Instant untilDate) { - LOGGER.debug("entry to getTasksCompletedBefore(untilDate = {})", untilDate); List tasksToDelete = taskanaEngineImpl @@ -127,17 +126,10 @@ public class TaskCleanupJob extends AbstractTaskanaJob { .collect(Collectors.toList()); } - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("exit from getTasksCompletedBefore(), returning {}", tasksToDelete); - } - return tasksToDelete; } private int deleteTasksTransactionally(List tasksToBeDeleted) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("entry to deleteTasksTransactionally(tasksToBeDeleted = {})", tasksToBeDeleted); - } int deletedTaskCount = 0; if (txProvider != null) { @@ -152,7 +144,6 @@ public class TaskCleanupJob extends AbstractTaskanaJob { return 0; } }); - LOGGER.debug("exit from deleteTasksTransactionally(), returning {}", count); return count; } else { try { @@ -161,21 +152,19 @@ public class TaskCleanupJob extends AbstractTaskanaJob { LOGGER.warn("Could not delete tasks.", e); } } - LOGGER.debug("exit from deleteTasksTransactionally(), returning {}", deletedTaskCount); return deletedTaskCount; } private int deleteTasks(List tasksToBeDeleted) throws InvalidArgumentException, NotAuthorizedException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("entry to deleteTasks(tasksToBeDeleted = {})", tasksToBeDeleted); - } List tasksIdsToBeDeleted = tasksToBeDeleted.stream().map(TaskSummary::getId).collect(Collectors.toList()); BulkOperationResults results = taskanaEngineImpl.getTaskService().deleteTasks(tasksIdsToBeDeleted); - LOGGER.debug("{} tasks deleted.", tasksIdsToBeDeleted.size() - results.getFailedIds().size()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("{} tasks deleted.", tasksIdsToBeDeleted.size() - results.getFailedIds().size()); + } for (String failedId : results.getFailedIds()) { if (LOGGER.isWarnEnabled()) { LOGGER.warn( @@ -184,18 +173,13 @@ public class TaskCleanupJob extends AbstractTaskanaJob { LogSanitizer.stripLineBreakingChars(results.getErrorForId(failedId))); } } - LOGGER.debug( - "exit from deleteTasks(), returning {}", - tasksIdsToBeDeleted.size() - results.getFailedIds().size()); return tasksIdsToBeDeleted.size() - results.getFailedIds().size(); } private void scheduleNextCleanupJob() { - LOGGER.debug("Entry to scheduleNextCleanupJob."); ScheduledJob job = new ScheduledJob(); job.setType(ScheduledJob.Type.TASKCLEANUPJOB); job.setDue(getNextDueForCleanupJob()); taskanaEngineImpl.getJobService().createJob(job); - LOGGER.debug("Exit from scheduleNextCleanupJob."); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/AbstractWorkbasketAccessItemQueryImpl.java b/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/AbstractWorkbasketAccessItemQueryImpl.java index 779237852..6d7da4121 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/AbstractWorkbasketAccessItemQueryImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/AbstractWorkbasketAccessItemQueryImpl.java @@ -5,8 +5,6 @@ import java.util.Arrays; import java.util.List; import org.apache.ibatis.exceptions.PersistenceException; import org.apache.ibatis.session.RowBounds; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import pro.taskana.common.api.exceptions.TaskanaRuntimeException; import pro.taskana.common.internal.InternalTaskanaEngine; @@ -27,8 +25,6 @@ abstract class AbstractWorkbasketAccessItemQueryImpl< private static final String LINK_TO_COUNTER = "pro.taskana.workbasket.internal.WorkbasketQueryMapper.countQueryWorkbasketAccessItems"; - private static final Logger LOGGER = - LoggerFactory.getLogger(AbstractWorkbasketAccessItemQueryImpl.class); private AccessItemQueryColumnName columnName; private String[] accessIdIn; private String[] workbasketIdIn; @@ -80,7 +76,6 @@ abstract class AbstractWorkbasketAccessItemQueryImpl< @Override public List list() { - LOGGER.debug("entry to list(), this = {}", _this()); List result = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -90,16 +85,11 @@ abstract class AbstractWorkbasketAccessItemQueryImpl< return result; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from list(). Returning {} resulting Objects: {} ", result.size(), result); - } } } @Override public List list(int offset, int limit) { - LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, _this()); List result = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -119,19 +109,12 @@ abstract class AbstractWorkbasketAccessItemQueryImpl< throw e; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from list(offset,limit). Returning {} resulting Objects: {} ", - result.size(), - result); - } } } @Override public List listValues( AccessItemQueryColumnName columnName, SortDirection sortDirection) { - LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, _this()); List result = null; try { taskanaEngine.openConnection(); @@ -142,19 +125,11 @@ abstract class AbstractWorkbasketAccessItemQueryImpl< return result; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - int numberOfResultObjects = result == null ? 0 : result.size(); - LOGGER.debug( - "Exit from listValues. Returning {} resulting Objects: {} ", - numberOfResultObjects, - result); - } } } @Override public T single() { - LOGGER.debug("entry to single(), this = {}", _this()); T accessItem = null; try { taskanaEngine.openConnection(); @@ -162,13 +137,11 @@ abstract class AbstractWorkbasketAccessItemQueryImpl< return accessItem; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from single(). Returning result {} ", accessItem); } } @Override public long count() { - LOGGER.debug("entry to count(), this = {}", _this()); Long rowCount = null; try { taskanaEngine.openConnection(); @@ -176,7 +149,6 @@ abstract class AbstractWorkbasketAccessItemQueryImpl< return (rowCount == null) ? 0L : rowCount; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from count(). Returning result {} ", rowCount); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketAccessItemQueryImpl.java b/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketAccessItemQueryImpl.java index a0aedc84b..959a2be6f 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketAccessItemQueryImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketAccessItemQueryImpl.java @@ -5,8 +5,6 @@ import java.util.Arrays; import java.util.List; import org.apache.ibatis.exceptions.PersistenceException; import org.apache.ibatis.session.RowBounds; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import pro.taskana.common.api.exceptions.TaskanaRuntimeException; import pro.taskana.common.internal.InternalTaskanaEngine; @@ -24,7 +22,6 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery "pro.taskana.workbasket.internal.WorkbasketQueryMapper.countQueryWorkbasketAccessItems"; private static final String LINK_TO_VALUEMAPPER = "pro.taskana.workbasket.internal.WorkbasketQueryMapper.queryWorkbasketAccessItemColumnValues"; - private static final Logger LOGGER = LoggerFactory.getLogger(WorkbasketQueryImpl.class); private AccessItemQueryColumnName columnName; private String[] accessIdIn; private String[] accessIdLike; @@ -102,19 +99,14 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery @Override public List list() { - LOGGER.debug("entry to list(), this = {}", this); List result = taskanaEngine.openAndReturnConnection( () -> new ArrayList<>(taskanaEngine.getSqlSession().selectList(LINK_TO_MAPPER, this))); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("exit from list(). Returning {} resulting Objects: {} ", result.size(), result); - } return result; } @Override public List list(int offset, int limit) { - LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this); List result = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -134,19 +126,12 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery throw e; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from list(offset,limit). Returning {} resulting Objects: {} ", - result.size(), - result); - } } } @Override public List listValues( AccessItemQueryColumnName columnName, SortDirection sortDirection) { - LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this); List result = null; try { taskanaEngine.openConnection(); @@ -157,19 +142,11 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery return result; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - int numberOfResultObjects = result == null ? 0 : result.size(); - LOGGER.debug( - "Exit from listValues. Returning {} resulting Objects: {} ", - numberOfResultObjects, - result); - } } } @Override public WorkbasketAccessItem single() { - LOGGER.debug("entry to single(), this = {}", this); WorkbasketAccessItem accessItm = null; try { taskanaEngine.openConnection(); @@ -177,13 +154,11 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery return accessItm; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from single(). Returning result {} ", accessItm); } } @Override public long count() { - LOGGER.debug("entry to count(), this = {}", this); Long rowCount = null; try { taskanaEngine.openConnection(); @@ -191,7 +166,6 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery return (rowCount == null) ? 0L : rowCount; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from count(). Returning result {} ", rowCount); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketQueryImpl.java b/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketQueryImpl.java index 0a44c9831..33d77cbff 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketQueryImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketQueryImpl.java @@ -5,8 +5,6 @@ import java.util.Arrays; import java.util.List; import org.apache.ibatis.exceptions.PersistenceException; import org.apache.ibatis.session.RowBounds; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import pro.taskana.TaskanaEngineConfiguration; import pro.taskana.common.api.TaskanaRole; @@ -32,7 +30,6 @@ public class WorkbasketQueryImpl implements WorkbasketQuery { "pro.taskana.workbasket.internal.WorkbasketQueryMapper.countQueryWorkbaskets"; private static final String LINK_TO_VALUEMAPPER = "pro.taskana.workbasket.internal.WorkbasketQueryMapper.queryWorkbasketColumnValues"; - private static final Logger LOGGER = LoggerFactory.getLogger(WorkbasketQueryImpl.class); private WorkbasketQueryColumnName columnName; private String[] accessId; private String[] idIn; @@ -362,7 +359,6 @@ public class WorkbasketQueryImpl implements WorkbasketQuery { @Override public List list() { - LOGGER.debug("entry to list(), this = {}", this); List workbaskets = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -371,19 +367,11 @@ public class WorkbasketQueryImpl implements WorkbasketQuery { return workbaskets; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - int numberOfResultObjects = workbaskets == null ? 0 : workbaskets.size(); - LOGGER.debug( - "exit from list(). Returning {} resulting Objects: {} ", - numberOfResultObjects, - workbaskets); - } } } @Override public List list(int offset, int limit) { - LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this); List workbaskets = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -402,18 +390,11 @@ public class WorkbasketQueryImpl implements WorkbasketQuery { throw e; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from list(offset,limit). Returning {} resulting Objects: {} ", - workbaskets.size(), - workbaskets); - } } } public List listValues( WorkbasketQueryColumnName columnName, SortDirection sortDirection) { - LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this); List result = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -424,16 +405,11 @@ public class WorkbasketQueryImpl implements WorkbasketQuery { return result; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "Exit from listValues. Returning {} resulting Objects: {} ", result.size(), result); - } } } @Override public WorkbasketSummary single() { - LOGGER.debug("entry to single(), this = {}", this); WorkbasketSummary workbasket = null; try { taskanaEngine.openConnection(); @@ -442,13 +418,11 @@ public class WorkbasketQueryImpl implements WorkbasketQuery { return workbasket; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from single(). Returning result {} ", workbasket); } } @Override public long count() { - LOGGER.debug("entry to count(), this = {}", this); Long rowCount = null; try { taskanaEngine.openConnection(); @@ -457,7 +431,6 @@ public class WorkbasketQueryImpl implements WorkbasketQuery { return (rowCount == null) ? 0L : rowCount; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from count(). Returning result {} ", rowCount); } } @@ -669,7 +642,6 @@ public class WorkbasketQueryImpl implements WorkbasketQuery { lowercaseAccessIds(this.accessId); } } - LOGGER.debug("exit from handleCallerRolesAndAccessIds, now this is {}", this); } private WorkbasketQuery addOrderCriteria(String colName, SortDirection sortDirection) { diff --git a/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketServiceImpl.java b/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketServiceImpl.java index 4080fd495..794f53108 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketServiceImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/WorkbasketServiceImpl.java @@ -78,7 +78,6 @@ public class WorkbasketServiceImpl implements WorkbasketService { @Override public Workbasket getWorkbasket(String workbasketId) throws WorkbasketNotFoundException, NotAuthorizedException { - LOGGER.debug("entry to getWorkbasket(workbasketId = {})", workbasketId); Workbasket result = null; try { taskanaEngine.openConnection(); @@ -95,14 +94,12 @@ public class WorkbasketServiceImpl implements WorkbasketService { return result; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from getWorkbasket(workbasketId). Returning result {} ", result); } } @Override public Workbasket getWorkbasket(String workbasketKey, String domain) throws WorkbasketNotFoundException, NotAuthorizedException { - LOGGER.debug("entry to getWorkbasketByKey(workbasketKey = {})", workbasketKey); Workbasket result = null; try { taskanaEngine.openConnection(); @@ -121,7 +118,6 @@ public class WorkbasketServiceImpl implements WorkbasketService { return result; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from getWorkbasket(workbasketId). Returning result {} ", result); } } @@ -129,7 +125,6 @@ public class WorkbasketServiceImpl implements WorkbasketService { public Workbasket createWorkbasket(Workbasket newWorkbasket) throws InvalidWorkbasketException, NotAuthorizedException, WorkbasketAlreadyExistException, DomainNotFoundException { - LOGGER.debug("entry to createWorkbasket(workbasket) with Workbasket {}", newWorkbasket); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); WorkbasketImpl workbasket = (WorkbasketImpl) newWorkbasket; @@ -163,11 +158,12 @@ public class WorkbasketServiceImpl implements WorkbasketService { taskanaEngine.getEngine().getCurrentUserContext().getUserid(), details)); } - LOGGER.debug("Method createWorkbasket() created Workbasket '{}'", workbasket); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Method createWorkbasket() created Workbasket '{}'", workbasket); + } return workbasket; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from createWorkbasket(workbasket). Returning result {} ", workbasket); } } @@ -176,8 +172,6 @@ public class WorkbasketServiceImpl implements WorkbasketService { throws NotAuthorizedException, WorkbasketNotFoundException, ConcurrencyException, InvalidWorkbasketException { - LOGGER.debug("entry to updateWorkbasket(Workbasket = {})", workbasketToUpdate); - taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); WorkbasketImpl workbasketImplToUpdate = (WorkbasketImpl) workbasketToUpdate; validateNameAndType(workbasketToUpdate); @@ -209,13 +203,14 @@ public class WorkbasketServiceImpl implements WorkbasketService { details)); } - LOGGER.debug( - "Method updateWorkbasket() updated workbasket '{}'", workbasketImplToUpdate.getId()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Method updateWorkbasket() updated workbasket '{}'", workbasketImplToUpdate.getId()); + } return workbasketImplToUpdate; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from updateWorkbasket(). Returning result {} ", workbasketImplToUpdate); } } @@ -235,8 +230,7 @@ public class WorkbasketServiceImpl implements WorkbasketService { public WorkbasketAccessItem createWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem) throws InvalidArgumentException, NotAuthorizedException, WorkbasketNotFoundException, WorkbasketAccessItemAlreadyExistException { - LOGGER.debug( - "entry to createWorkbasketAccessItemn(workbasketAccessItem = {})", workbasketAccessItem); + taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); WorkbasketAccessItemImpl accessItem = (WorkbasketAccessItemImpl) workbasketAccessItem; try { @@ -276,11 +270,15 @@ public class WorkbasketServiceImpl implements WorkbasketService { taskanaEngine.getEngine().getCurrentUserContext().getUserid(), details)); } - LOGGER.debug( - "Method createWorkbasketAccessItem() created workbaskteAccessItem {}", accessItem); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Method createWorkbasketAccessItem() created workbaskteAccessItem {}", accessItem); + } } catch (PersistenceException e) { - LOGGER.debug( - "when trying to insert WorkbasketAccessItem {} caught exception", accessItem, e); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "when trying to insert WorkbasketAccessItem {} caught exception", accessItem, e); + } Stream accessItemExistsIdentifier = Stream.of( "SQLCODE=-803", // DB2 @@ -295,17 +293,13 @@ public class WorkbasketServiceImpl implements WorkbasketService { return accessItem; } finally { taskanaEngine.returnConnection(); - LOGGER.debug( - "exit from createWorkbasketAccessItem(workbasketAccessItem). Returning result {}", - accessItem); } } @Override public WorkbasketAccessItem updateWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem) throws InvalidArgumentException, NotAuthorizedException { - LOGGER.debug( - "entry to updateWorkbasketAccessItem(workbasketAccessItem = {}", workbasketAccessItem); + taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); WorkbasketAccessItemImpl accessItem = (WorkbasketAccessItemImpl) workbasketAccessItem; try { @@ -337,19 +331,18 @@ public class WorkbasketServiceImpl implements WorkbasketService { details)); } - LOGGER.debug( - "Method updateWorkbasketAccessItem() updated workbasketAccessItem {}", accessItem); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Method updateWorkbasketAccessItem() updated workbasketAccessItem {}", accessItem); + } return accessItem; } finally { taskanaEngine.returnConnection(); - LOGGER.debug( - "exit from updateWorkbasketAccessItem(workbasketAccessItem). Returning {}", accessItem); } } @Override public void deleteWorkbasketAccessItem(String accessItemId) throws NotAuthorizedException { - LOGGER.debug("entry to deleteWorkbasketAccessItem(id = {})", accessItemId); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); try { taskanaEngine.openConnection(); @@ -376,12 +369,13 @@ public class WorkbasketServiceImpl implements WorkbasketService { details)); } - LOGGER.debug( - "Method deleteWorkbasketAccessItem() deleted workbasketAccessItem wit Id {}", - accessItemId); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Method deleteWorkbasketAccessItem() deleted workbasketAccessItem wit Id {}", + accessItemId); + } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from deleteWorkbasketAccessItem(id)."); } } @@ -431,7 +425,6 @@ public class WorkbasketServiceImpl implements WorkbasketService { } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from checkAuthorization(). User is authorized = {}.", isAuthorized); } } @@ -486,14 +479,12 @@ public class WorkbasketServiceImpl implements WorkbasketService { } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from checkAuthorization(). User is authorized = {}.", isAuthorized); } } @Override public List getWorkbasketAccessItems(String workbasketId) throws NotAuthorizedException { - LOGGER.debug("entry to getWorkbasketAccessItems(workbasketId = {})", workbasketId); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); List result = new ArrayList<>(); try { @@ -504,12 +495,6 @@ public class WorkbasketServiceImpl implements WorkbasketService { return result; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "exit from getWorkbasketAccessItems(workbasketId). Returning {} resulting Objects: {} ", - result.size(), - result); - } } } @@ -518,7 +503,6 @@ public class WorkbasketServiceImpl implements WorkbasketService { String workbasketId, List wbAccessItems) throws NotAuthorizedException, WorkbasketAccessItemAlreadyExistException, InvalidArgumentException { - LOGGER.debug("entry to setWorkbasketAccessItems(workbasketAccessItems = {})", wbAccessItems); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); Set ids = new HashSet<>(); @@ -554,7 +538,6 @@ public class WorkbasketServiceImpl implements WorkbasketService { } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from setWorkbasketAccessItems(workbasketAccessItems = {})", wbAccessItems); } } @@ -588,7 +571,6 @@ public class WorkbasketServiceImpl implements WorkbasketService { @Override public List getDistributionTargets(String workbasketId) throws NotAuthorizedException, WorkbasketNotFoundException { - LOGGER.debug("entry to getDistributionTargets(workbasketId = {})", workbasketId); List result = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -605,21 +587,13 @@ public class WorkbasketServiceImpl implements WorkbasketService { return result; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - int numberOfResultObjects = result.size(); - LOGGER.debug( - "exit from getDistributionTargets(workbasketId). Returning {} resulting Objects: {} ", - numberOfResultObjects, - result); - } } } @Override public List getDistributionTargets(String workbasketKey, String domain) throws NotAuthorizedException, WorkbasketNotFoundException { - LOGGER.debug( - "entry to getDistributionTargets(workbasketKey = {}, domain = {})", workbasketKey, domain); + List result = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -636,25 +610,13 @@ public class WorkbasketServiceImpl implements WorkbasketService { return result; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - int numberOfResultObjects = result.size(); - LOGGER.debug( - "exit from getDistributionTargets(workbasketId). Returning {} resulting Objects: {} ", - numberOfResultObjects, - result); - } } } @Override public void setDistributionTargets(String sourceWorkbasketId, List targetWorkbasketIds) throws WorkbasketNotFoundException, NotAuthorizedException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "entry to setDistributionTargets(sourceWorkbasketId = {}, targetWorkazketIds = {})", - sourceWorkbasketId, - targetWorkbasketIds); - } + taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); try { taskanaEngine.openConnection(); @@ -677,11 +639,13 @@ public class WorkbasketServiceImpl implements WorkbasketService { // check for existence of target workbasket getWorkbasket(targetId); distributionTargetMapper.insert(sourceWorkbasketId, targetId); - LOGGER.debug( - "Method setDistributionTargets() created distribution target " - + "for source '{}' and target {}", - sourceWorkbasketId, - targetId); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Method setDistributionTargets() created distribution target " + + "for source '{}' and target {}", + sourceWorkbasketId, + targetId); + } } if (HistoryEventManager.isHistoryEnabled() && !targetWorkbasketIds.isEmpty()) { @@ -713,10 +677,7 @@ public class WorkbasketServiceImpl implements WorkbasketService { @Override public void addDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId) throws NotAuthorizedException, WorkbasketNotFoundException { - LOGGER.debug( - "entry to addDistributionTarget(sourceWorkbasketId = {}, targetWorkbasketId = {})", - sourceWorkbasketId, - targetWorkbasketId); + taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); try { taskanaEngine.openConnection(); @@ -729,9 +690,11 @@ public class WorkbasketServiceImpl implements WorkbasketService { distributionTargetMapper.getNumberOfDistributionTargets( sourceWorkbasketId, targetWorkbasketId); if (numOfDistTargets > 0) { - LOGGER.debug( - "addDistributionTarget detected that the specified " - + "distribution target exists already. Doing nothing."); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "addDistributionTarget detected that the specified " + + "distribution target exists already. Doing nothing."); + } } else { distributionTargetMapper.insert(sourceWorkbasketId, targetWorkbasketId); @@ -747,27 +710,25 @@ public class WorkbasketServiceImpl implements WorkbasketService { taskanaEngine.getEngine().getCurrentUserContext().getUserid(), details)); } - LOGGER.debug( - "addDistributionTarget inserted distribution target sourceId = {}, targetId = {}", - sourceWorkbasketId, - targetWorkbasketId); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "addDistributionTarget inserted distribution target sourceId = {}, targetId = {}", + sourceWorkbasketId, + targetWorkbasketId); + } sourceWorkbasket.setModified(Instant.now()); workbasketMapper.update(sourceWorkbasket); } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from addDistributionTarget"); } } @Override public void removeDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId) throws NotAuthorizedException { - LOGGER.debug( - "entry to removeDistributionTarget(sourceWorkbasketId = {}, targetWorkbasketId = {})", - sourceWorkbasketId, - targetWorkbasketId); + taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); try { taskanaEngine.openConnection(); @@ -797,30 +758,35 @@ public class WorkbasketServiceImpl implements WorkbasketService { details)); } } - LOGGER.debug( - "removeDistributionTarget deleted distribution target sourceId = {}, targetId = {}", - sourceWorkbasketId, - targetWorkbasketId); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "removeDistributionTarget deleted distribution target sourceId = {}, targetId = {}", + sourceWorkbasketId, + targetWorkbasketId); + } try { WorkbasketImpl sourceWorkbasket = (WorkbasketImpl) getWorkbasket(sourceWorkbasketId); sourceWorkbasket.setModified(Instant.now()); workbasketMapper.update(sourceWorkbasket); } catch (WorkbasketNotFoundException e) { - LOGGER.debug( - "removeDistributionTarget found that the source workbasket {} " - + "doesn't exist. Ignoring the request... ", - sourceWorkbasketId); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "removeDistributionTarget found that the source workbasket {} " + + "doesn't exist. Ignoring the request... ", + sourceWorkbasketId); + } } } else { - LOGGER.debug( - "removeDistributionTarget detected that the specified distribution " - + "target doesn't exist. Doing nothing..."); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "removeDistributionTarget detected that the specified distribution " + + "target doesn't exist. Doing nothing..."); + } } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from addDistributionTarget"); } } @@ -828,7 +794,6 @@ public class WorkbasketServiceImpl implements WorkbasketService { public boolean deleteWorkbasket(String workbasketId) throws NotAuthorizedException, WorkbasketNotFoundException, WorkbasketInUseException, InvalidArgumentException { - LOGGER.debug("entry to deleteWorkbasket(workbasketId = {})", workbasketId); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); validateId(workbasketId); @@ -840,7 +805,9 @@ public class WorkbasketServiceImpl implements WorkbasketService { try { workbasketToDelete = this.getWorkbasket(workbasketId); } catch (WorkbasketNotFoundException ex) { - LOGGER.debug("Workbasket with workbasketId = {} is already deleted?", workbasketId); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Workbasket with workbasketId = {} is already deleted?", workbasketId); + } throw ex; } @@ -886,15 +853,11 @@ public class WorkbasketServiceImpl implements WorkbasketService { return canBeDeletedNow; } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from deleteWorkbasket(workbasketId = {})", workbasketId); } } public BulkOperationResults deleteWorkbaskets( List workbasketsIds) throws NotAuthorizedException, InvalidArgumentException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("entry to deleteWorkbaskets(workbasketId = {})", workbasketsIds); - } taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); @@ -936,7 +899,6 @@ public class WorkbasketServiceImpl implements WorkbasketService { } return bulkLog; } finally { - LOGGER.debug("exit from deleteWorkbaskets()"); taskanaEngine.returnConnection(); } } @@ -944,7 +906,6 @@ public class WorkbasketServiceImpl implements WorkbasketService { @Override public List getDistributionSources(String workbasketId) throws NotAuthorizedException, WorkbasketNotFoundException { - LOGGER.debug("entry to getDistributionSources(workbasketId = {})", workbasketId); List result = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -959,21 +920,13 @@ public class WorkbasketServiceImpl implements WorkbasketService { return result; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - int numberOfResultObjects = result.size(); - LOGGER.debug( - "exit from getDistributionSources(workbasketId). Returning {} resulting Objects: {} ", - numberOfResultObjects, - result); - } } } @Override public List getDistributionSources(String workbasketKey, String domain) throws NotAuthorizedException, WorkbasketNotFoundException { - LOGGER.debug( - "entry to getDistributionSources(workbasketKey = {}, domain = {})", workbasketKey, domain); + List result = new ArrayList<>(); try { taskanaEngine.openConnection(); @@ -988,20 +941,12 @@ public class WorkbasketServiceImpl implements WorkbasketService { return result; } finally { taskanaEngine.returnConnection(); - if (LOGGER.isDebugEnabled()) { - int numberOfResultObjects = result.size(); - LOGGER.debug( - "exit from getDistributionSources(workbasketId). Returning {} resulting Objects: {} ", - numberOfResultObjects, - result); - } } } @Override public void deleteWorkbasketAccessItemsForAccessId(String accessId) throws NotAuthorizedException { - LOGGER.debug("entry to deleteWorkbasketAccessItemsForAccessId(accessId = {})", accessId); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); try { taskanaEngine.openConnection(); @@ -1035,7 +980,6 @@ public class WorkbasketServiceImpl implements WorkbasketService { } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from deleteWorkbasketAccessItemsForAccessId(accessId={}).", accessId); } } @@ -1119,18 +1063,24 @@ public class WorkbasketServiceImpl implements WorkbasketService { // Skip permission check if security is not enabled if (!taskanaEngine.getEngine().getConfiguration().isSecurityEnabled()) { - LOGGER.debug("Skipping permissions check since security is disabled."); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Skipping permissions check since security is disabled."); + } return true; } if (Arrays.asList(requestedPermissions).contains(WorkbasketPermission.READ)) { if (taskanaEngine.getEngine().isUserInRole(TaskanaRole.ADMIN)) { - LOGGER.debug("Skipping read permissions check since user is in role ADMIN"); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Skipping read permissions check since user is in role ADMIN"); + } return true; } } else if (taskanaEngine.getEngine().isUserInRole(TaskanaRole.ADMIN, TaskanaRole.TASK_ADMIN)) { - LOGGER.debug("Skipping permissions check since user is in role ADMIN or TASK_ADMIN."); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Skipping permissions check since user is in role ADMIN or TASK_ADMIN."); + } return true; } @@ -1195,7 +1145,6 @@ public class WorkbasketServiceImpl implements WorkbasketService { private void markWorkbasketForDeletion(String workbasketId) throws NotAuthorizedException, InvalidArgumentException { - LOGGER.debug("entry to markWorkbasketForDeletion(workbasketId = {})", workbasketId); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); try { taskanaEngine.openConnection(); @@ -1214,7 +1163,6 @@ public class WorkbasketServiceImpl implements WorkbasketService { } } finally { taskanaEngine.returnConnection(); - LOGGER.debug("exit from markWorkbasketForDeletion(workbasketId = {}).", workbasketId); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/jobs/WorkbasketCleanupJob.java b/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/jobs/WorkbasketCleanupJob.java index ff7351867..f60b5d3b9 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/jobs/WorkbasketCleanupJob.java +++ b/lib/taskana-core/src/main/java/pro/taskana/workbasket/internal/jobs/WorkbasketCleanupJob.java @@ -105,8 +105,10 @@ public class WorkbasketCleanupJob extends AbstractTaskanaJob { BulkOperationResults results = taskanaEngineImpl.getWorkbasketService().deleteWorkbaskets(workbasketsToBeDeleted); - LOGGER.debug( - "{} workbasket deleted.", workbasketsToBeDeleted.size() - results.getFailedIds().size()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "{} workbasket deleted.", workbasketsToBeDeleted.size() - results.getFailedIds().size()); + } for (String failedId : results.getFailedIds()) { LOGGER.warn( "Workbasket with id {} could not be deleted. Reason:", @@ -117,11 +119,9 @@ public class WorkbasketCleanupJob extends AbstractTaskanaJob { } private void scheduleNextCleanupJob() { - LOGGER.debug("Entry to scheduleNextCleanupJob."); ScheduledJob job = new ScheduledJob(); job.setType(ScheduledJob.Type.WORKBASKETCLEANUPJOB); job.setDue(getNextDueForCleanupJob()); taskanaEngineImpl.getJobService().createJob(job); - LOGGER.debug("Exit from scheduleNextCleanupJob."); } } diff --git a/lib/taskana-core/src/test/java/acceptance/ArchitectureTest.java b/lib/taskana-core/src/test/java/acceptance/ArchitectureTest.java index bdc2bfd39..805df0bf2 100644 --- a/lib/taskana-core/src/test/java/acceptance/ArchitectureTest.java +++ b/lib/taskana-core/src/test/java/acceptance/ArchitectureTest.java @@ -9,6 +9,7 @@ import static org.assertj.core.api.Assertions.assertThat; import com.tngtech.archunit.base.Optional; import com.tngtech.archunit.core.domain.JavaClass; +import com.tngtech.archunit.core.domain.JavaClass.Predicates; import com.tngtech.archunit.core.domain.JavaClasses; import com.tngtech.archunit.core.domain.JavaMethod; import com.tngtech.archunit.core.importer.ClassFileImporter; @@ -33,6 +34,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestFactory; import org.junit.jupiter.api.function.ThrowingConsumer; +import pro.taskana.common.internal.logging.LoggingAspect; + /** * Test architecture of classes in taskana. For more info and examples see * https://www.archunit.org/userguide/html/000_Index.html. @@ -75,8 +78,9 @@ class ArchitectureTest { .and() .resideInAPackage("..api..") .should() - .onlyDependOnClassesThat() - .resideOutsideOfPackage("..internal.."); + .onlyDependOnClassesThat( + Predicates.resideOutsideOfPackage("..pro.taskana..internal..") + .or(Predicates.assignableTo(LoggingAspect.class))); myRule.check(importedClasses); } diff --git a/lib/taskana-core/src/test/java/acceptance/PojoTest.java b/lib/taskana-core/src/test/java/acceptance/PojoTest.java index 5ec5cbbae..e678fa340 100644 --- a/lib/taskana-core/src/test/java/acceptance/PojoTest.java +++ b/lib/taskana-core/src/test/java/acceptance/PojoTest.java @@ -19,7 +19,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.Warning; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.Test; @@ -28,21 +27,16 @@ import org.junit.jupiter.api.TestFactory; /** check classes with a custom equals and hashcode implementation for correctness. */ class PojoTest { - private static List> pojoClasses; - - @BeforeAll - static void setup() { - pojoClasses = getPojoClasses(); - } + private static final List> POJO_CLASSES = getPojoClasses(); @Test void testsThatPojoClassesAreFound() { - assertThat(pojoClasses).isNotEmpty(); + assertThat(POJO_CLASSES).isNotEmpty(); } @TestFactory Stream equalsContract() { - return pojoClasses.stream() + return POJO_CLASSES.stream() .map( cl -> DynamicTest.dynamicTest( @@ -52,7 +46,7 @@ class PojoTest { @TestFactory Stream validateGetters() { - return pojoClasses.stream() + return POJO_CLASSES.stream() .map( cl -> DynamicTest.dynamicTest( @@ -62,7 +56,7 @@ class PojoTest { @TestFactory Stream validateSetters() { - return pojoClasses.stream() + return POJO_CLASSES.stream() .map( cl -> DynamicTest.dynamicTest( @@ -73,7 +67,7 @@ class PojoTest { @TestFactory @Disabled("because of the truncation of all Instant member variables") Stream validateGetAndSet() { - return pojoClasses.stream() + return POJO_CLASSES.stream() .map( cl -> DynamicTest.dynamicTest( @@ -83,7 +77,7 @@ class PojoTest { @TestFactory Stream validateNoStaticExceptFinalFields() { - return pojoClasses.stream() + return POJO_CLASSES.stream() .map( cl -> DynamicTest.dynamicTest( @@ -93,7 +87,7 @@ class PojoTest { @TestFactory Stream validateNoPublicFields() { - return pojoClasses.stream() + return POJO_CLASSES.stream() .map( cl -> DynamicTest.dynamicTest( diff --git a/lib/taskana-core/src/test/java/acceptance/task/SelectAndClaimTaskAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/SelectAndClaimTaskAccTest.java index 37c7100db..811560422 100644 --- a/lib/taskana-core/src/test/java/acceptance/task/SelectAndClaimTaskAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/task/SelectAndClaimTaskAccTest.java @@ -41,7 +41,7 @@ class SelectAndClaimTaskAccTest extends AbstractAccTest { Runnable test = getRunnableTest(selectedAndClaimedTasks, accessIds); - Thread[] threads = new Thread[4]; + Thread[] threads = new Thread[accessIds.size()]; for (int i = 0; i < threads.length; i++) { threads[i] = new Thread(test); threads[i].start(); diff --git a/lib/taskana-spring-example/pom.xml b/lib/taskana-spring-example/pom.xml index fe07b1686..91eb26b22 100644 --- a/lib/taskana-spring-example/pom.xml +++ b/lib/taskana-spring-example/pom.xml @@ -15,6 +15,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + org.springframework.boot spring-boot-starter-web diff --git a/lib/taskana-spring/pom.xml b/lib/taskana-spring/pom.xml index a892dbab6..325777a61 100644 --- a/lib/taskana-spring/pom.xml +++ b/lib/taskana-spring/pom.xml @@ -15,6 +15,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + pro.taskana taskana-core @@ -72,4 +77,4 @@ test - \ No newline at end of file + diff --git a/pom.xml b/pom.xml index 7bef61515..78ea2a0fc 100644 --- a/pom.xml +++ b/pom.xml @@ -89,6 +89,10 @@ 1.2.0 2.0.11 + + 1.12.6 + 1.9.6 + 11.1.1.1 @@ -135,6 +139,51 @@ + + aspectj-logging + + + !skipAspectJ + + + + + + com.nickwongdev + aspectj-maven-plugin + ${version.aspectj-maven-plugin} + + ${java.version} + 11 + 8 + false + true + + + pro.taskana + taskana-common-logging + + + + + + + compile + test-compile + + + + + + org.aspectj + aspectjtools + ${version.aspectj} + + + + + + jdk8-compatibility @@ -261,6 +310,7 @@ + diff --git a/rest/taskana-rest-spring-example-boot/pom.xml b/rest/taskana-rest-spring-example-boot/pom.xml index bb689f4b0..5147c4b0f 100644 --- a/rest/taskana-rest-spring-example-boot/pom.xml +++ b/rest/taskana-rest-spring-example-boot/pom.xml @@ -16,6 +16,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + com.h2database h2 @@ -41,9 +46,6 @@ history.plugin - - false - pro.taskana.history @@ -84,9 +86,6 @@ historyLogging.plugin - - false - pro.taskana.history diff --git a/rest/taskana-rest-spring-example-common/pom.xml b/rest/taskana-rest-spring-example-common/pom.xml index ff26382e0..90c2af48a 100644 --- a/rest/taskana-rest-spring-example-common/pom.xml +++ b/rest/taskana-rest-spring-example-common/pom.xml @@ -20,6 +20,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + pro.taskana taskana-rest-spring @@ -112,4 +117,4 @@ - \ No newline at end of file + diff --git a/rest/taskana-rest-spring-example-common/src/main/java/pro/taskana/example/jobs/JobScheduler.java b/rest/taskana-rest-spring-example-common/src/main/java/pro/taskana/example/jobs/JobScheduler.java index 56c2c0d14..e2a710309 100644 --- a/rest/taskana-rest-spring-example-common/src/main/java/pro/taskana/example/jobs/JobScheduler.java +++ b/rest/taskana-rest-spring-example-common/src/main/java/pro/taskana/example/jobs/JobScheduler.java @@ -42,7 +42,6 @@ public class JobScheduler { public void scheduleCleanupJob() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException { - LOGGER.debug("Entry to scheduleCleanupJob."); TaskCleanupJob.initializeSchedule(taskanaEngine); WorkbasketCleanupJob.initializeSchedule(taskanaEngine); @@ -53,7 +52,6 @@ public class JobScheduler { .getDeclaredMethod("initializeSchedule", TaskanaEngine.class) .invoke(null, taskanaEngine); } - LOGGER.debug("Exit from scheduleCleanupJob."); } @Scheduled(cron = "${taskana.jobscheduler.async.cron}") diff --git a/rest/taskana-rest-spring-example-common/src/main/java/pro/taskana/example/rest/controllers/LoginController.java b/rest/taskana-rest-spring-example-common/src/main/java/pro/taskana/example/rest/controllers/LoginController.java index 531026b61..1a6f4b714 100644 --- a/rest/taskana-rest-spring-example-common/src/main/java/pro/taskana/example/rest/controllers/LoginController.java +++ b/rest/taskana-rest-spring-example-common/src/main/java/pro/taskana/example/rest/controllers/LoginController.java @@ -1,7 +1,5 @@ package pro.taskana.example.rest.controllers; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.core.Ordered; import org.springframework.stereotype.Controller; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; @@ -10,13 +8,10 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; /** The login controller. */ @Controller public class LoginController implements WebMvcConfigurer { - private static final Logger LOGGER = LoggerFactory.getLogger(LoginController.class); @Override public void addViewControllers(ViewControllerRegistry registry) { - LOGGER.debug("Entry to addViewControllers()"); registry.addViewController("/login").setViewName("login"); registry.setOrder(Ordered.HIGHEST_PRECEDENCE); - LOGGER.debug("Exit from addViewControllers()"); } } diff --git a/rest/taskana-rest-spring-example-wildfly/pom.xml b/rest/taskana-rest-spring-example-wildfly/pom.xml index df4059c0b..f46545d57 100644 --- a/rest/taskana-rest-spring-example-wildfly/pom.xml +++ b/rest/taskana-rest-spring-example-wildfly/pom.xml @@ -39,6 +39,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + org.springframework.boot spring-boot-starter-web @@ -294,4 +299,4 @@ http://repository.jboss.org/nexus/content/groups/public-jboss/ - \ No newline at end of file + diff --git a/rest/taskana-rest-spring/pom.xml b/rest/taskana-rest-spring/pom.xml index d6121aada..1a8e9e29f 100644 --- a/rest/taskana-rest-spring/pom.xml +++ b/rest/taskana-rest-spring/pom.xml @@ -15,6 +15,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + pro.taskana taskana-spring @@ -239,4 +244,4 @@ - \ No newline at end of file + diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationController.java index 19d4def27..52a78eb7a 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationController.java @@ -4,8 +4,6 @@ import java.beans.ConstructorProperties; import java.util.List; import java.util.function.BiConsumer; import javax.servlet.http.HttpServletRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.hateoas.MediaTypes; import org.springframework.hateoas.config.EnableHypermediaSupport; @@ -48,8 +46,6 @@ import pro.taskana.common.rest.util.QueryParamsValidator; @EnableHypermediaSupport(type = HypermediaType.HAL) public class ClassificationController { - private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationController.class); - private final ClassificationService classificationService; private final ClassificationRepresentationModelAssembler modelAssembler; private final ClassificationSummaryRepresentationModelAssembler summaryModelAssembler; @@ -97,10 +93,6 @@ public class ClassificationController { ResponseEntity.ok( summaryModelAssembler.toPagedModel( classificationSummaries, pagingParameter.getPageMetadata())); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getClassifications(), returning {}", response); - } - return response; } @@ -116,17 +108,9 @@ public class ClassificationController { @Transactional(readOnly = true, rollbackFor = Exception.class) public ResponseEntity getClassification( @PathVariable String classificationId) throws ClassificationNotFoundException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Entry to getClassification(classificationId= {})", classificationId); - } - Classification classification = classificationService.getClassification(classificationId); ResponseEntity response = ResponseEntity.ok(modelAssembler.toModel(classification)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getClassification(), returning {}", response); - } - return response; } @@ -149,17 +133,11 @@ public class ClassificationController { @RequestBody ClassificationRepresentationModel repModel) throws NotAuthorizedException, ClassificationAlreadyExistException, DomainNotFoundException, InvalidArgumentException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Entry to createClassification(repModel= {})", repModel); - } Classification classification = modelAssembler.toEntityModel(repModel); classification = classificationService.createClassification(classification); ResponseEntity response = ResponseEntity.status(HttpStatus.CREATED).body(modelAssembler.toModel(classification)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from createClassification(), returning {}", response); - } return response; } @@ -184,12 +162,6 @@ public class ClassificationController { @RequestBody ClassificationRepresentationModel resource) throws NotAuthorizedException, ClassificationNotFoundException, ConcurrencyException, InvalidArgumentException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "Entry to updateClassification(classificationId= {}, resource= {})", - classificationId, - resource); - } if (!classificationId.equals(resource.getClassificationId())) { throw new InvalidArgumentException( String.format( @@ -202,10 +174,6 @@ public class ClassificationController { ResponseEntity result = ResponseEntity.ok(modelAssembler.toModel(classification)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from updateClassification(), returning {}", result); - } - return result; } @@ -225,10 +193,8 @@ public class ClassificationController { public ResponseEntity deleteClassification( @PathVariable String classificationId) throws ClassificationNotFoundException, ClassificationInUseException, NotAuthorizedException { - LOGGER.debug("Entry to deleteClassification(classificationId= {})", classificationId); classificationService.deleteClassification(classificationId); ResponseEntity response = ResponseEntity.noContent().build(); - LOGGER.debug("Exit from deleteClassification(), returning {}", response); return response; } diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationDefinitionController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationDefinitionController.java index 209c8c6df..e264b3a6c 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationDefinitionController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationDefinitionController.java @@ -5,7 +5,6 @@ import static pro.taskana.common.internal.util.CheckedFunction.wrap; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -13,8 +12,6 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DuplicateKeyException; import org.springframework.hateoas.config.EnableHypermediaSupport; @@ -48,9 +45,6 @@ import pro.taskana.common.rest.RestEndpoints; @EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL) public class ClassificationDefinitionController { - private static final Logger LOGGER = - LoggerFactory.getLogger(ClassificationDefinitionController.class); - private final ObjectMapper mapper; private final ClassificationService classificationService; private final ClassificationDefinitionRepresentationModelAssembler assembler; @@ -76,9 +70,6 @@ public class ClassificationDefinitionController { @Transactional(readOnly = true, rollbackFor = Exception.class) public ResponseEntity exportClassifications(@RequestParam(required = false) String[] domain) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Entry to exportClassifications(domain= {})", Arrays.toString(domain)); - } ClassificationQuery query = classificationService.createClassificationQuery(); List summaries = @@ -94,9 +85,6 @@ public class ClassificationDefinitionController { ResponseEntity response = ResponseEntity.ok(collectionModel); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from exportClassifications(), returning {}", response); - } return response; } @@ -122,7 +110,6 @@ public class ClassificationDefinitionController { throws InvalidArgumentException, NotAuthorizedException, ConcurrencyException, ClassificationNotFoundException, ClassificationAlreadyExistException, DomainNotFoundException, IOException { - LOGGER.debug("Entry to importClassifications()"); Map systemIds = getSystemIds(); ClassificationDefinitionCollectionRepresentationModel collection = extractClassificationResourcesFromFile(file); @@ -133,7 +120,6 @@ public class ClassificationDefinitionController { insertOrUpdateClassificationsWithoutParent(collection.getContent(), systemIds); updateParentChildrenRelations(childrenInFile); ResponseEntity response = ResponseEntity.noContent().build(); - LOGGER.debug("Exit from importClassifications(), returning {}", response); return response; } @@ -171,7 +157,6 @@ public class ClassificationDefinitionController { private Map mapChildrenToParentKeys( Collection definitionList, Map systemIds) { - LOGGER.debug("Entry to mapChildrenToParentKeys()"); Map childrenInFile = new HashMap<>(); Set newKeysWithDomain = new HashSet<>(); definitionList.stream() @@ -200,10 +185,6 @@ public class ClassificationDefinitionController { childrenInFile.put(assembler.toEntityModel(def), cl.getParentKey()); } } - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from mapChildrenToParentKeys(), returning {}", childrenInFile); - } - return childrenInFile; } @@ -212,8 +193,6 @@ public class ClassificationDefinitionController { Map systemIds) throws ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException, ClassificationAlreadyExistException, DomainNotFoundException, ConcurrencyException { - LOGGER.debug("Entry to insertOrUpdateClassificationsWithoutParent()"); - for (ClassificationDefinitionRepresentationModel definition : definitionList) { ClassificationRepresentationModel classificationRepModel = definition.getClassification(); classificationRepModel.setParentKey(null); @@ -230,14 +209,11 @@ public class ClassificationDefinitionController { classificationService.createClassification(newClassification); } } - LOGGER.debug("Exit from insertOrUpdateClassificationsWithoutParent()"); } private void updateParentChildrenRelations(Map childrenInFile) throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException, InvalidArgumentException { - LOGGER.debug("Entry to updateParentChildrenRelations()"); - for (Map.Entry entry : childrenInFile.entrySet()) { Classification childRes = entry.getKey(); String parentKey = entry.getValue(); @@ -256,13 +232,11 @@ public class ClassificationDefinitionController { classificationService.updateClassification(child); } - LOGGER.debug("Exit from updateParentChildrenRelations()"); } private void updateExistingClassification(Classification newClassification, String systemId) throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException, InvalidArgumentException { - LOGGER.debug("Entry to updateExistingClassification()"); Classification currentClassification = classificationService.getClassification(systemId); if (newClassification.getType() != null && !newClassification.getType().equals(currentClassification.getType())) { @@ -302,6 +276,5 @@ public class ClassificationDefinitionController { ClassificationCustomField.CUSTOM_8, newClassification.getCustomAttribute(ClassificationCustomField.CUSTOM_8)); classificationService.updateClassification(currentClassification); - LOGGER.debug("Exit from updateExistingClassification()"); } } diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/AccessIdController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/AccessIdController.java index 020a6e19f..21dbcdf1f 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/AccessIdController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/AccessIdController.java @@ -1,8 +1,6 @@ package pro.taskana.common.rest; import java.util.List; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.hateoas.config.EnableHypermediaSupport; import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType; @@ -23,8 +21,6 @@ import pro.taskana.common.rest.models.AccessIdRepresentationModel; @EnableHypermediaSupport(type = HypermediaType.HAL) public class AccessIdController { - private static final Logger LOGGER = LoggerFactory.getLogger(AccessIdController.class); - private final LdapClient ldapClient; private final TaskanaEngine taskanaEngine; @@ -48,18 +44,10 @@ public class AccessIdController { public ResponseEntity> searchUsersAndGroups( @RequestParam("search-for") String searchFor) throws InvalidArgumentException, NotAuthorizedException { - - LOGGER.debug("Entry to validateAccessIds(search-for= {})", searchFor); - taskanaEngine.checkRoleMembership(TaskanaRole.ADMIN, TaskanaRole.BUSINESS_ADMIN); List accessIdUsers = ldapClient.searchUsersAndGroups(searchFor); - ResponseEntity> response = ResponseEntity.ok(accessIdUsers); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from validateAccessIds(), returning {}", response); - } - - return response; + return ResponseEntity.ok(accessIdUsers); } /** @@ -81,30 +69,17 @@ public class AccessIdController { public ResponseEntity> searchUsersByNameOrAccessIdForRole( @RequestParam("search-for") String nameOrAccessId, @RequestParam("role") String role) throws InvalidArgumentException, NotAuthorizedException { - - LOGGER.debug( - "Entry to searchUsersByNameOrAccessIdForRole(search-for= {}, role= {})", - nameOrAccessId, - role); - taskanaEngine.checkRoleMembership( TaskanaRole.USER, TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); - if (role.equals("user")) { - List accessIdUsers = - ldapClient.searchUsersByNameOrAccessIdInUserRole(nameOrAccessId); - ResponseEntity> response = ResponseEntity.ok(accessIdUsers); - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from searchUsersByNameOrAccessIdForRole(), returning {}", response); - } - - return response; - } else { + if (!role.equals("user")) { throw new InvalidArgumentException( String.format( "Requested users for not supported role %s. Only role 'user' is supported'", role)); } + List accessIdUsers = + ldapClient.searchUsersByNameOrAccessIdInUserRole(nameOrAccessId); + return ResponseEntity.ok(accessIdUsers); } /** @@ -120,9 +95,6 @@ public class AccessIdController { public ResponseEntity> getGroupsByAccessId( @RequestParam("access-id") String accessId) throws InvalidArgumentException, NotAuthorizedException { - - LOGGER.debug("Entry to getGroupsByAccessId(access-id= {})", accessId); - taskanaEngine.checkRoleMembership(TaskanaRole.ADMIN, TaskanaRole.BUSINESS_ADMIN); if (!ldapClient.validateAccessId(accessId)) { @@ -131,11 +103,7 @@ public class AccessIdController { List accessIds = ldapClient.searchGroupsAccessIdIsMemberOf(accessId); - ResponseEntity> response = ResponseEntity.ok(accessIds); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getGroupsByAccessId(), returning {}", response); - } - return response; + return ResponseEntity.ok(accessIds); } } diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/SpringSecurityToJaasFilter.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/SpringSecurityToJaasFilter.java index 429a3f3fe..aa3e8eda8 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/SpringSecurityToJaasFilter.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/SpringSecurityToJaasFilter.java @@ -29,7 +29,9 @@ public class SpringSecurityToJaasFilter extends GenericFilterBean { throws IOException, ServletException { Optional authentication = getCurrentAuthentication(); if (authentication.isPresent()) { - LOGGER.debug("Authentication found in Spring security context: {}", authentication); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Authentication found in Spring security context: {}", authentication); + } obtainSubject() .ifPresent( subject -> { @@ -37,8 +39,10 @@ public class SpringSecurityToJaasFilter extends GenericFilterBean { initializeGroupPrincipalsFromAuthentication(authentication.get(), subject); }); } else { - LOGGER.debug( - "No authentication found in Spring security context. Continuing unauthenticatic."); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "No authentication found in Spring security context. Continuing unauthenticatic."); + } } chain.doFilter(request, response); @@ -74,12 +78,17 @@ public class SpringSecurityToJaasFilter extends GenericFilterBean { private void initializeUserPrincipalFromAuthentication( Authentication authentication, Subject subject) { if (subject.getPrincipals().isEmpty()) { - LOGGER.debug("Setting the principal of the subject with {}.", authentication.getPrincipal()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Setting the principal of the subject with {}.", authentication.getPrincipal()); + } subject .getPrincipals() .add(new UserPrincipal(((UserDetails) authentication.getPrincipal()).getUsername())); } else { - LOGGER.debug("Principal of the subject is already set to {}.", subject.getPrincipals()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Principal of the subject is already set to {}.", subject.getPrincipals()); + } throw new SystemException("Finding an existing principal is unexpected. Please investigate."); } } @@ -87,7 +96,9 @@ public class SpringSecurityToJaasFilter extends GenericFilterBean { private void initializeGroupPrincipalsFromAuthentication( Authentication authentication, Subject subject) { - LOGGER.debug("Adding roles {} to subject.", authentication.getAuthorities()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Adding roles {} to subject.", authentication.getAuthorities()); + } authentication .getAuthorities() @@ -95,6 +106,8 @@ public class SpringSecurityToJaasFilter extends GenericFilterBean { grantedAuthority -> subject.getPrincipals().add(new GroupPrincipal(grantedAuthority.getAuthority()))); - LOGGER.debug("{}", subject.getPublicCredentials(GroupPrincipal.class)); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("{}", subject.getPublicCredentials(GroupPrincipal.class)); + } } } diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/TaskanaEngineController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/TaskanaEngineController.java index f829d6c5e..5cb53a765 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/TaskanaEngineController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/TaskanaEngineController.java @@ -2,8 +2,6 @@ package pro.taskana.common.rest; import java.util.List; import java.util.Map; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.hateoas.config.EnableHypermediaSupport; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -21,8 +19,6 @@ import pro.taskana.common.rest.models.VersionRepresentationModel; @EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL) public class TaskanaEngineController { - private static final Logger LOGGER = LoggerFactory.getLogger(TaskanaEngineController.class); - private final TaskanaEngineConfiguration taskanaEngineConfiguration; private final TaskanaEngine taskanaEngine; @@ -40,12 +36,7 @@ public class TaskanaEngineController { */ @GetMapping(path = RestEndpoints.URL_DOMAIN) public ResponseEntity> getDomains() { - ResponseEntity> response = - ResponseEntity.ok(taskanaEngineConfiguration.getDomains()); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getDomains(), returning {}", response); - } - return response; + return ResponseEntity.ok(taskanaEngineConfiguration.getDomains()); } /** @@ -59,21 +50,11 @@ public class TaskanaEngineController { @GetMapping(path = RestEndpoints.URL_CLASSIFICATION_CATEGORIES) public ResponseEntity> getClassificationCategories( @RequestParam(required = false) String type) { - LOGGER.debug("Entry to getClassificationCategories(type = {})", type); ResponseEntity> response; if (type != null) { - response = - ResponseEntity.ok(taskanaEngineConfiguration.getClassificationCategoriesByType(type)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getClassificationCategories(), returning {}", response); - } - return response; + return ResponseEntity.ok(taskanaEngineConfiguration.getClassificationCategoriesByType(type)); } - response = ResponseEntity.ok(taskanaEngineConfiguration.getAllClassificationCategories()); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getClassificationCategories(), returning {}", response); - } - return response; + return ResponseEntity.ok(taskanaEngineConfiguration.getAllClassificationCategories()); } /** @@ -83,12 +64,7 @@ public class TaskanaEngineController { */ @GetMapping(path = RestEndpoints.URL_CLASSIFICATION_TYPES) public ResponseEntity> getClassificationTypes() { - ResponseEntity> response = - ResponseEntity.ok(taskanaEngineConfiguration.getClassificationTypes()); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getClassificationTypes(), returning {}", response); - } - return response; + return ResponseEntity.ok(taskanaEngineConfiguration.getClassificationTypes()); } /** @@ -99,12 +75,7 @@ public class TaskanaEngineController { */ @GetMapping(path = RestEndpoints.URL_CLASSIFICATION_CATEGORIES_BY_TYPES) public ResponseEntity>> getClassificationCategoriesByTypeMap() { - ResponseEntity>> response = - ResponseEntity.ok(taskanaEngineConfiguration.getClassificationCategoriesByTypeMap()); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getClassificationCategoriesByTypeMap(), returning {}", response); - } - return response; + return ResponseEntity.ok(taskanaEngineConfiguration.getClassificationCategoriesByTypeMap()); } /** @@ -114,7 +85,6 @@ public class TaskanaEngineController { */ @GetMapping(path = RestEndpoints.URL_CURRENT_USER) public ResponseEntity getCurrentUserInfo() { - LOGGER.debug("Entry to getCurrentUserInfo()"); TaskanaUserInfoRepresentationModel resource = new TaskanaUserInfoRepresentationModel(); resource.setUserId(taskanaEngine.getCurrentUserContext().getUserid()); resource.setGroupIds(taskanaEngine.getCurrentUserContext().getGroupIds()); @@ -123,12 +93,7 @@ public class TaskanaEngineController { resource.getRoles().add(role); } } - ResponseEntity response = ResponseEntity.ok(resource); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getCurrentUserInfo(), returning {}", response); - } - - return response; + return ResponseEntity.ok(resource); } /** @@ -138,9 +103,7 @@ public class TaskanaEngineController { */ @GetMapping(path = RestEndpoints.URL_HISTORY_ENABLED) public ResponseEntity getIsHistoryProviderEnabled() { - ResponseEntity response = ResponseEntity.ok(taskanaEngine.isHistoryEnabled()); - LOGGER.debug("Exit from getIsHistoryProviderEnabled(), returning {}", response); - return response; + return ResponseEntity.ok(taskanaEngine.isHistoryEnabled()); } /** @@ -150,11 +113,8 @@ public class TaskanaEngineController { */ @GetMapping(path = RestEndpoints.URL_VERSION) public ResponseEntity currentVersion() { - LOGGER.debug("Entry to currentVersion()"); VersionRepresentationModel resource = new VersionRepresentationModel(); resource.setVersion(TaskanaEngineConfiguration.class.getPackage().getImplementationVersion()); - ResponseEntity response = ResponseEntity.ok(resource); - LOGGER.debug("Exit from currentVersion(), returning {}", response); - return response; + return ResponseEntity.ok(resource); } } diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/ldap/LdapClient.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/ldap/LdapClient.java index 736bc1bd5..7031773d5 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/ldap/LdapClient.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/ldap/LdapClient.java @@ -65,7 +65,6 @@ public class LdapClient { */ public List searchUsersAndGroups(final String name) throws InvalidArgumentException { - LOGGER.debug("entry to searchUsersAndGroups(name = {})", name); isInitOrFail(); testMinSearchForLength(name); @@ -80,15 +79,7 @@ public class LdapClient { accessIds.addAll(searchGroupsByName(name)); } sortListOfAccessIdResources(accessIds); - List result = getFirstPageOfaResultList(accessIds); - - LOGGER.debug( - "exit from searchUsersAndGroups(name = {}). Returning {} users and groups: {}", - name, - accessIds.size(), - result); - - return result; + return getFirstPageOfaResultList(accessIds); } public List searchUsersByNameOrAccessIdInUserRole( @@ -137,7 +128,6 @@ public class LdapClient { public List searchUsersByNameOrAccessId(final String name) throws InvalidArgumentException { - LOGGER.debug("entry to searchUsersByNameOrAccessId(name = {}).", name); isInitOrFail(); testMinSearchForLength(name); @@ -151,20 +141,15 @@ public class LdapClient { orFilter.or(new WhitespaceWildcardsFilter(getUserIdAttribute(), name)); andFilter.and(orFilter); - final List accessIds = - ldapTemplate.search( - getUserSearchBase(), - andFilter.encode(), - SearchControls.SUBTREE_SCOPE, - getLookUpUserAttributesToReturn(), - new UserContextMapper()); - LOGGER.debug( - "exit from searchUsersByNameOrAccessId. Retrieved the following users: {}.", accessIds); - return accessIds; + return ldapTemplate.search( + getUserSearchBase(), + andFilter.encode(), + SearchControls.SUBTREE_SCOPE, + getLookUpUserAttributesToReturn(), + new UserContextMapper()); } public List getUsersByAccessId(final String accessId) { - LOGGER.debug("entry to searchUsersByAccessId(name = {}).", accessId); isInitOrFail(); final AndFilter andFilter = new AndFilter(); @@ -175,20 +160,16 @@ public class LdapClient { getUserFirstnameAttribute(), getUserLastnameAttribute(), getUserIdAttribute() }; - final List accessIds = - ldapTemplate.search( - getUserSearchBase(), - andFilter.encode(), - SearchControls.SUBTREE_SCOPE, - userAttributesToReturn, - new UserContextMapper()); - LOGGER.debug("exit from searchUsersByAccessId. Retrieved the following users: {}.", accessIds); - return accessIds; + return ldapTemplate.search( + getUserSearchBase(), + andFilter.encode(), + SearchControls.SUBTREE_SCOPE, + userAttributesToReturn, + new UserContextMapper()); } public List searchGroupsByName(final String name) throws InvalidArgumentException { - LOGGER.debug("entry to searchGroupsByName(name = {}).", name); isInitOrFail(); testMinSearchForLength(name); @@ -201,37 +182,31 @@ public class LdapClient { } andFilter.and(orFilter); - final List accessIds = - ldapTemplate.search( - getGroupSearchBase(), - andFilter.encode(), - SearchControls.SUBTREE_SCOPE, - getLookUpGroupAttributesToReturn(), - new GroupContextMapper()); - LOGGER.debug("Exit from searchGroupsByName. Retrieved the following groups: {}", accessIds); - return accessIds; + return ldapTemplate.search( + getGroupSearchBase(), + andFilter.encode(), + SearchControls.SUBTREE_SCOPE, + getLookUpGroupAttributesToReturn(), + new GroupContextMapper()); } public AccessIdRepresentationModel searchAccessIdByDn(final String dn) { - LOGGER.debug("entry to searchGroupByDn(name = {}).", dn); isInitOrFail(); // Obviously Spring LdapTemplate does have a inconsistency and always adds the base name to the // given DN. // https://stackoverflow.com/questions/55285743/spring-ldaptemplate-how-to-lookup-fully-qualified-dn-with-configured-base-dn // Therefore we have to remove the base name from the dn before performing the lookup String nameWithoutBaseDn = getNameWithoutBaseDn(dn); - LOGGER.debug( - "Removed baseDN {} from given DN. New DN to be used: {}", getBaseDn(), nameWithoutBaseDn); - final AccessIdRepresentationModel accessId = - ldapTemplate.lookup( - nameWithoutBaseDn, getLookUpUserAndGroupAttributesToReturn(), new DnContextMapper()); - LOGGER.debug("Exit from searchGroupByDn. Retrieved the following group: {}", accessId); - return accessId; + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Removed baseDN {} from given DN. New DN to be used: {}", getBaseDn(), nameWithoutBaseDn); + } + return ldapTemplate.lookup( + nameWithoutBaseDn, getLookUpUserAndGroupAttributesToReturn(), new DnContextMapper()); } public List searchGroupsAccessIdIsMemberOf(final String accessId) throws InvalidArgumentException { - LOGGER.debug("entry to searchGroupsAccessIdIsMemberOf(name = {}).", accessId); isInitOrFail(); testMinSearchForLength(accessId); @@ -252,18 +227,12 @@ public class LdapClient { String[] userAttributesToReturn = {getUserIdAttribute(), getGroupNameAttribute()}; - final List accessIds = - ldapTemplate.search( - getGroupSearchBase(), - andFilter.encode(), - SearchControls.SUBTREE_SCOPE, - userAttributesToReturn, - new GroupContextMapper()); - - LOGGER.debug( - "exit from searchGroupsAccessIdIsMemberOf. Retrieved the following accessIds: {}.", - accessIds); - return accessIds; + return ldapTemplate.search( + getGroupSearchBase(), + andFilter.encode(), + SearchControls.SUBTREE_SCOPE, + userAttributesToReturn, + new GroupContextMapper()); } /** @@ -273,9 +242,6 @@ public class LdapClient { * @return whether the given name is valid or not */ public boolean validateAccessId(final String name) { - - LOGGER.debug("entry to validateAccessId(name = {})", name); - isInitOrFail(); if (nameIsDn(name)) { @@ -446,7 +412,6 @@ public class LdapClient { @PostConstruct void init() { - LOGGER.debug("Entry to init()"); minSearchForLength = calcMinSearchForLength(3); maxNumberOfReturnedAccessIds = calcMaxNumberOfReturnedAccessIds(50); @@ -459,8 +424,6 @@ public class LdapClient { throw new SystemException(message); } active = true; - - LOGGER.debug("Exit from init()"); } List checkForMissingConfigurations() { diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/monitor/rest/MonitorController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/monitor/rest/MonitorController.java index 2c0c851e2..cb6c9d2b1 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/monitor/rest/MonitorController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/monitor/rest/MonitorController.java @@ -5,8 +5,6 @@ import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.Stream; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.hateoas.config.EnableHypermediaSupport; import org.springframework.http.HttpStatus; @@ -31,8 +29,6 @@ import pro.taskana.task.api.TaskState; @EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL) public class MonitorController { - private static final Logger LOGGER = LoggerFactory.getLogger(MonitorController.class); - private final MonitorService monitorService; private final ReportRepresentationModelAssembler reportRepresentationModelAssembler; @@ -56,7 +52,6 @@ public class MonitorController { * @param states Filter the report values by Task states. * @param workbasketIds Filter the report values by Workbasket Ids. * @param priorityMinimum Filter the report values by a minimum priority. - * * @return the computed TaskStatusReport * @throws NotAuthorizedException if the current user is not authorized to compute the report * @title Get a Task Status Report @@ -69,26 +64,20 @@ public class MonitorController { @RequestParam(name = "workbasket-ids", required = false) List workbasketIds, @RequestParam(name = "priority-minimum", required = false) Integer priorityMinimum) throws NotAuthorizedException { - LOGGER.debug("Entry to getTasksStatusReport(), states to include {}", states); - ResponseEntity response = - ResponseEntity.ok( - reportRepresentationModelAssembler.toModel( - monitorService - .createTaskStatusReportBuilder() - .stateIn(states) - .domainIn(domains) - .workbasketIdsIn(workbasketIds) - .priorityMinimum(priorityMinimum) - .buildReport(), - domains, - states, - workbasketIds, - priorityMinimum)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getTasksStatusReport(), returning {}", response); - } - return response; + return ResponseEntity.ok( + reportRepresentationModelAssembler.toModel( + monitorService + .createTaskStatusReportBuilder() + .stateIn(states) + .domainIn(domains) + .workbasketIdsIn(workbasketIds) + .priorityMinimum(priorityMinimum) + .buildReport(), + domains, + states, + workbasketIds, + priorityMinimum)); } /** @@ -111,7 +100,6 @@ public class MonitorController { @RequestParam List states, @RequestParam(required = false) TaskTimestamp taskTimestamp) throws NotAuthorizedException, InvalidArgumentException { - LOGGER.debug("Entry to getTasksWorkbasketReport(), states to include {}", states); if (taskTimestamp == null) { taskTimestamp = TaskTimestamp.DUE; } @@ -126,10 +114,6 @@ public class MonitorController { states, taskTimestamp); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getTasksWorkbasketReport(), returning {}", report); - } - return ResponseEntity.status(HttpStatus.OK).body(report); } @@ -140,12 +124,6 @@ public class MonitorController { @RequestParam(value = "daysInPast") int daysInPast, @RequestParam(value = "states") List states) throws NotAuthorizedException, InvalidArgumentException { - LOGGER.debug( - "Entry to getTasksWorkbasketPlannedDateReport(), " - + "upto {} days in the past, states to include {}", - daysInPast, - states); - ReportRepresentationModel report = reportRepresentationModelAssembler.toModel( monitorService @@ -155,9 +133,6 @@ public class MonitorController { .buildReport(TaskTimestamp.PLANNED), daysInPast, states); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getTasksWorkbasketPlannedDateReport(), returning {}", report); - } return ResponseEntity.status(HttpStatus.OK).body(report); } @@ -180,7 +155,6 @@ public class MonitorController { public ResponseEntity getClassificationReport( @RequestParam(required = false) TaskTimestamp taskTimestamp) throws NotAuthorizedException, InvalidArgumentException { - LOGGER.debug("Entry to getClassificationReport()"); if (taskTimestamp == null) { taskTimestamp = TaskTimestamp.DUE; } @@ -193,10 +167,6 @@ public class MonitorController { .buildReport(taskTimestamp), taskTimestamp); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getClassificationReport(), returning {}", report); - } - return ResponseEntity.status(HttpStatus.OK).body(report); } diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskCommentController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskCommentController.java index 25dcd48fb..0dc6e2413 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskCommentController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskCommentController.java @@ -3,8 +3,6 @@ package pro.taskana.task.rest; import java.util.Comparator; import java.util.List; import java.util.Optional; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.hateoas.config.EnableHypermediaSupport; import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType; @@ -39,8 +37,6 @@ import pro.taskana.task.rest.models.TaskCommentRepresentationModel; @EnableHypermediaSupport(type = HypermediaType.HAL) public class TaskCommentController { - private static final Logger LOGGER = LoggerFactory.getLogger(TaskCommentController.class); - private final TaskService taskService; private final TaskCommentRepresentationModelAssembler taskCommentRepresentationModelAssembler; @@ -69,23 +65,12 @@ public class TaskCommentController { @PathVariable String taskCommentId) throws NotAuthorizedException, TaskNotFoundException, TaskCommentNotFoundException, InvalidArgumentException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Entry to getTaskComment(taskCommentId= {})", taskCommentId); - } - TaskComment taskComment = taskService.getTaskComment(taskCommentId); TaskCommentRepresentationModel taskCommentRepresentationModel = taskCommentRepresentationModelAssembler.toModel(taskComment); - ResponseEntity response = - ResponseEntity.ok(taskCommentRepresentationModel); - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getTaskComment(), returning {}", response); - } - - return response; + return ResponseEntity.ok(taskCommentRepresentationModel); } /** @@ -113,11 +98,6 @@ public class TaskCommentController { @RequestParam(name = "sort-by", required = false) List sortBy, @RequestParam(required = false) List order) throws NotAuthorizedException, TaskNotFoundException, InvalidArgumentException { - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Entry to getTaskComments(taskId= {})", taskId); - } - Optional> comparator = getTaskCommentComparator(sortBy, order); List taskComments = taskService.getTaskComments(taskId); comparator.ifPresent(taskComments::sort); @@ -125,14 +105,7 @@ public class TaskCommentController { TaskCommentCollectionRepresentationModel taskCommentListResource = taskCommentRepresentationModelAssembler.toTaskanaCollectionModel(taskComments); - ResponseEntity response = - ResponseEntity.ok(taskCommentListResource); - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getTaskComments(), returning {}", response); - } - - return response; + return ResponseEntity.ok(taskCommentListResource); } /** @@ -153,19 +126,9 @@ public class TaskCommentController { @PathVariable String taskCommentId) throws NotAuthorizedException, TaskNotFoundException, TaskCommentNotFoundException, InvalidArgumentException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Entry to deleteTaskComment(taskCommentId= {})", taskCommentId); - } - taskService.deleteTaskComment(taskCommentId); - ResponseEntity result = ResponseEntity.noContent().build(); - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from deleteTaskComment(), returning {}", result); - } - - return result; + return ResponseEntity.noContent().build(); } /** @@ -189,12 +152,6 @@ public class TaskCommentController { @RequestBody TaskCommentRepresentationModel taskCommentRepresentationModel) throws NotAuthorizedException, TaskNotFoundException, TaskCommentNotFoundException, InvalidArgumentException, ConcurrencyException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "Entry to updateTaskComment(taskCommentId= {}, taskCommentResource= {})", - taskCommentId, - taskCommentRepresentationModel); - } if (!taskCommentId.equals(taskCommentRepresentationModel.getTaskCommentId())) { throw new InvalidArgumentException( String.format( @@ -207,14 +164,8 @@ public class TaskCommentController { taskCommentRepresentationModelAssembler.toEntityModel(taskCommentRepresentationModel); taskComment = taskService.updateTaskComment(taskComment); - ResponseEntity result = - ResponseEntity.ok(taskCommentRepresentationModelAssembler.toModel(taskComment)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from updateTaskComment(), returning {}", result); - } - - return result; + return ResponseEntity.ok(taskCommentRepresentationModelAssembler.toModel(taskComment)); } /** @@ -234,31 +185,14 @@ public class TaskCommentController { @PathVariable String taskId, @RequestBody TaskCommentRepresentationModel taskCommentRepresentationModel) throws NotAuthorizedException, InvalidArgumentException, TaskNotFoundException { - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "Entry to createTaskComment(taskId= {}, taskCommentResource= {})", - taskId, - taskCommentRepresentationModel); - } - taskCommentRepresentationModel.setTaskId(taskId); TaskComment taskCommentFromResource = taskCommentRepresentationModelAssembler.toEntityModel(taskCommentRepresentationModel); TaskComment createdTaskComment = taskService.createTaskComment(taskCommentFromResource); - ResponseEntity result; - - result = - ResponseEntity.status(HttpStatus.CREATED) - .body(taskCommentRepresentationModelAssembler.toModel(createdTaskComment)); - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from createTaskComment(), returning {}", result); - } - - return result; + return ResponseEntity.status(HttpStatus.CREATED) + .body(taskCommentRepresentationModelAssembler.toModel(createdTaskComment)); } private Optional> getTaskCommentComparator( diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskController.java index 1a1e7ff71..3d182d81b 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskController.java @@ -5,8 +5,6 @@ import java.util.List; import java.util.function.BiConsumer; import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.hateoas.config.EnableHypermediaSupport; import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType; @@ -54,8 +52,6 @@ import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException; @EnableHypermediaSupport(type = HypermediaType.HAL) public class TaskController { - private static final Logger LOGGER = LoggerFactory.getLogger(TaskController.class); - private final TaskService taskService; private final TaskRepresentationModelAssembler taskRepresentationModelAssembler; private final TaskSummaryRepresentationModelAssembler taskSummaryRepresentationModelAssembler; @@ -104,12 +100,7 @@ public class TaskController { TaskSummaryPagedRepresentationModel pagedModels = taskSummaryRepresentationModelAssembler.toPagedModel( taskSummaries, pagingParameter.getPageMetadata()); - ResponseEntity response = ResponseEntity.ok(pagedModels); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getTasks(), returning {}", response); - } - - return response; + return ResponseEntity.ok(pagedModels); } /** @@ -144,14 +135,9 @@ public class TaskController { .filter(summary -> !result.getFailedIds().contains(summary.getId())) .collect(Collectors.toList()); - ResponseEntity response = - ResponseEntity.ok( - taskSummaryRepresentationModelAssembler.toTaskanaCollectionModel( - successfullyDeletedTaskSummaries)); - - LOGGER.debug("Exit from deleteTasks(), returning {}", response); - - return response; + return ResponseEntity.ok( + taskSummaryRepresentationModelAssembler.toTaskanaCollectionModel( + successfullyDeletedTaskSummaries)); } /** @@ -167,15 +153,9 @@ public class TaskController { @Transactional(readOnly = true, rollbackFor = Exception.class) public ResponseEntity getTask(@PathVariable String taskId) throws TaskNotFoundException, NotAuthorizedException { - LOGGER.debug("Entry to getTask(taskId= {})", taskId); Task task = taskService.getTask(taskId); - ResponseEntity result = - ResponseEntity.ok(taskRepresentationModelAssembler.toModel(task)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getTask(), returning {}", result); - } - return result; + return ResponseEntity.ok(taskRepresentationModelAssembler.toModel(task)); } /** @@ -197,17 +177,10 @@ public class TaskController { @PathVariable String taskId, @RequestBody(required = false) String userName) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException { - LOGGER.debug("Entry to claimTask(taskId= {}, userName= {})", taskId, userName); // TODO verify user taskService.claim(taskId); Task updatedTask = taskService.getTask(taskId); - ResponseEntity result = - ResponseEntity.ok(taskRepresentationModelAssembler.toModel(updatedTask)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from claimTask(), returning {}", result); - } - - return result; + return ResponseEntity.ok(taskRepresentationModelAssembler.toModel(updatedTask)); } /** @@ -226,8 +199,6 @@ public class TaskController { public ResponseEntity selectAndClaimTask( TaskQueryFilterParameter filterParameter, TaskQuerySortParameter sortParameter) throws InvalidOwnerException, NotAuthorizedException { - LOGGER.debug("Entry to selectAndClaimTask"); - TaskQuery query = taskService.createTaskQuery(); filterParameter.applyToQuery(query); @@ -235,13 +206,7 @@ public class TaskController { Task selectedAndClaimedTask = taskService.selectAndClaim(query); - ResponseEntity result = - ResponseEntity.ok(taskRepresentationModelAssembler.toModel(selectedAndClaimedTask)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from selectAndClaimTask(), returning {}", result); - } - - return result; + return ResponseEntity.ok(taskRepresentationModelAssembler.toModel(selectedAndClaimedTask)); } /** @@ -262,17 +227,9 @@ public class TaskController { public ResponseEntity cancelClaimTask(@PathVariable String taskId) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException { - - LOGGER.debug("Entry to cancelClaimTask(taskId= {}", taskId); - Task updatedTask = taskService.cancelClaim(taskId); - ResponseEntity result = - ResponseEntity.ok(taskRepresentationModelAssembler.toModel(updatedTask)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from cancelClaimTask(), returning {}", result); - } - return result; + return ResponseEntity.ok(taskRepresentationModelAssembler.toModel(updatedTask)); } /** @@ -292,17 +249,8 @@ public class TaskController { public ResponseEntity forceCancelClaimTask(@PathVariable String taskId) throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException { - - LOGGER.debug("Entry to forceCancelClaimTask(taskId= {}", taskId); - Task updatedTask = taskService.forceCancelClaim(taskId); - - ResponseEntity result = - ResponseEntity.ok(taskRepresentationModelAssembler.toModel(updatedTask)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from forceCancelClaimTask(), returning {}", result); - } - return result; + return ResponseEntity.ok(taskRepresentationModelAssembler.toModel(updatedTask)); } /** @@ -322,16 +270,10 @@ public class TaskController { public ResponseEntity completeTask(@PathVariable String taskId) throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, NotAuthorizedException { - LOGGER.debug("Entry to completeTask(taskId= {})", taskId); Task updatedTask = taskService.forceCompleteTask(taskId); - ResponseEntity result = - ResponseEntity.ok(taskRepresentationModelAssembler.toModel(updatedTask)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from completeTask(), returning {}", result); - } - return result; + return ResponseEntity.ok(taskRepresentationModelAssembler.toModel(updatedTask)); } /** @@ -349,11 +291,9 @@ public class TaskController { @Transactional(rollbackFor = Exception.class) public ResponseEntity deleteTask(@PathVariable String taskId) throws TaskNotFoundException, InvalidStateException, NotAuthorizedException { - LOGGER.debug("Entry to deleteTask(taskId= {})", taskId); taskService.forceDeleteTask(taskId); - ResponseEntity result = ResponseEntity.noContent().build(); - LOGGER.debug("Exit from deleteTask(), returning {}", result); - return result; + + return ResponseEntity.noContent().build(); } /** @@ -372,16 +312,10 @@ public class TaskController { @Transactional(rollbackFor = Exception.class) public ResponseEntity cancelTask(@PathVariable String taskId) throws TaskNotFoundException, NotAuthorizedException, InvalidStateException { - LOGGER.debug("Entry to cancelTask(taskId= {})", taskId); Task cancelledTask = taskService.cancelTask(taskId); - ResponseEntity result = - ResponseEntity.ok(taskRepresentationModelAssembler.toModel(cancelledTask)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from cancelTask(), returning {}", result); - } - return result; + return ResponseEntity.ok(taskRepresentationModelAssembler.toModel(cancelledTask)); } /** @@ -403,21 +337,11 @@ public class TaskController { @RequestBody TaskRepresentationModel taskRepresentationModel) throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException, TaskAlreadyExistException, InvalidArgumentException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Entry to createTask(params= {})", taskRepresentationModel); - } - Task fromResource = taskRepresentationModelAssembler.toEntityModel(taskRepresentationModel); Task createdTask = taskService.createTask(fromResource); - ResponseEntity result = - ResponseEntity.status(HttpStatus.CREATED) - .body(taskRepresentationModelAssembler.toModel(createdTask)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from createTask(), returning {}", result); - } - - return result; + return ResponseEntity.status(HttpStatus.CREATED) + .body(taskRepresentationModelAssembler.toModel(createdTask)); } /** @@ -441,17 +365,10 @@ public class TaskController { @RequestBody(required = false) Boolean setTransferFlag) throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException { - LOGGER.debug("Entry to transferTask(taskId= {}, workbasketId= {})", taskId, workbasketId); - Task updatedTask = taskService.transfer(taskId, workbasketId, setTransferFlag == null || setTransferFlag); - ResponseEntity result = - ResponseEntity.ok(taskRepresentationModelAssembler.toModel(updatedTask)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from transferTask(), returning {}", result); - } - return result; + return ResponseEntity.ok(taskRepresentationModelAssembler.toModel(updatedTask)); } /** @@ -480,26 +397,16 @@ public class TaskController { throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, NotAuthorizedException, AttachmentPersistenceException, InvalidStateException { - LOGGER.debug( - "Entry to updateTask(taskId= {}, taskResource= {})", taskId, taskRepresentationModel); - ResponseEntity result; - if (taskId.equals(taskRepresentationModel.getTaskId())) { - Task task = taskRepresentationModelAssembler.toEntityModel(taskRepresentationModel); - task = taskService.updateTask(task); - result = ResponseEntity.ok(taskRepresentationModelAssembler.toModel(task)); - } else { + if (!taskId.equals(taskRepresentationModel.getTaskId())) { throw new InvalidArgumentException( String.format( "TaskId ('%s') is not identical with the taskId of to " + "object in the payload which should be updated. ID=('%s')", taskId, taskRepresentationModel.getTaskId())); } - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from updateTask(), returning {}", result); - } - - return result; + Task task = taskRepresentationModelAssembler.toEntityModel(taskRepresentationModel); + task = taskService.updateTask(task); + return ResponseEntity.ok(taskRepresentationModelAssembler.toModel(task)); } public enum TaskQuerySortBy implements QuerySortBy { diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketAccessItemController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketAccessItemController.java index cdbd6963c..97e84bfc1 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketAccessItemController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketAccessItemController.java @@ -4,8 +4,6 @@ import java.beans.ConstructorProperties; import java.util.List; import java.util.function.BiConsumer; import javax.servlet.http.HttpServletRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.hateoas.config.EnableHypermediaSupport; import org.springframework.http.ResponseEntity; @@ -34,9 +32,6 @@ import pro.taskana.workbasket.rest.models.WorkbasketAccessItemPagedRepresentatio @EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL) public class WorkbasketAccessItemController { - private static final Logger LOGGER = - LoggerFactory.getLogger(WorkbasketAccessItemController.class); - private final LdapClient ldapClient; private final WorkbasketService workbasketService; private final WorkbasketAccessItemRepresentationModelAssembler modelAssembler; @@ -85,13 +80,7 @@ public class WorkbasketAccessItemController { WorkbasketAccessItemPagedRepresentationModel pagedResources = modelAssembler.toPagedModel(workbasketAccessItems, pagingParameter.getPageMetadata()); - ResponseEntity response = - ResponseEntity.ok(pagedResources); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getWorkbasketAccessItems(), returning {}", response); - } - - return response; + return ResponseEntity.ok(pagedResources); } /** @@ -107,7 +96,6 @@ public class WorkbasketAccessItemController { public ResponseEntity removeWorkbasketAccessItems( @RequestParam("access-id") String accessId) throws NotAuthorizedException, InvalidArgumentException { - LOGGER.debug("Entry to removeWorkbasketAccessItems(access-id= {})", accessId); if (ldapClient.isUser(accessId)) { List workbasketAccessItemList = workbasketService.createWorkbasketAccessItemQuery().accessIdIn(accessId).list(); @@ -122,9 +110,7 @@ public class WorkbasketAccessItemController { accessId)); } - ResponseEntity response = ResponseEntity.noContent().build(); - LOGGER.debug("Exit from removeWorkbasketAccessItems(), returning {}", response); - return response; + return ResponseEntity.noContent().build(); } public enum WorkbasketAccessItemSortBy implements QuerySortBy { diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketController.java index c7afffd6e..4e501040a 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketController.java @@ -113,13 +113,7 @@ public class WorkbasketController { workbasketSummaryRepresentationModelAssembler.toPagedModel( workbasketSummaries, pagingParameter.getPageMetadata()); - ResponseEntity response = - ResponseEntity.ok(pagedModels); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getWorkbaskets(), returning {}", response); - } - - return response; + return ResponseEntity.ok(pagedModels); } /** @@ -137,15 +131,9 @@ public class WorkbasketController { public ResponseEntity getWorkbasket( @PathVariable(value = "workbasketId") String workbasketId) throws WorkbasketNotFoundException, NotAuthorizedException { - LOGGER.debug("Entry to getWorkbasket(workbasketId= {})", workbasketId); - ResponseEntity result; Workbasket workbasket = workbasketService.getWorkbasket(workbasketId); - result = ResponseEntity.ok(workbasketRepresentationModelAssembler.toModel(workbasket)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getWorkbasket(), returning {}", result); - } - return result; + return ResponseEntity.ok(workbasketRepresentationModelAssembler.toModel(workbasket)); } /** @@ -174,22 +162,21 @@ public class WorkbasketController { @PathVariable(value = "workbasketId") String workbasketId) throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, WorkbasketInUseException { - LOGGER.debug("Entry to markWorkbasketForDeletion(workbasketId= {})", workbasketId); - ResponseEntity response; boolean workbasketDeleted = workbasketService.deleteWorkbasket(workbasketId); if (workbasketDeleted) { - LOGGER.debug("Workbasket successfully deleted."); - response = ResponseEntity.noContent().build(); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Workbasket successfully deleted."); + } + return ResponseEntity.noContent().build(); } else { - LOGGER.debug( - "Workbasket was only marked for deletion and will be physically deleted later on."); - response = ResponseEntity.accepted().build(); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug( + "Workbasket was only marked for deletion and will be physically deleted later on."); + } + return ResponseEntity.accepted().build(); } - - LOGGER.debug("Exit from markWorkbasketForDeletion(), returning {}", response); - return response; } /** @@ -210,22 +197,12 @@ public class WorkbasketController { @RequestBody WorkbasketRepresentationModel workbasketRepresentationModel) throws InvalidWorkbasketException, NotAuthorizedException, WorkbasketAlreadyExistException, DomainNotFoundException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "Entry to createWorkbasket(workbasketResource= {})", workbasketRepresentationModel); - } - Workbasket workbasket = workbasketRepresentationModelAssembler.toEntityModel(workbasketRepresentationModel); workbasket = workbasketService.createWorkbasket(workbasket); - ResponseEntity response = - ResponseEntity.status(HttpStatus.CREATED) - .body(workbasketRepresentationModelAssembler.toModel(workbasket)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from createWorkbasket(), returning {}", response); - } - return response; + return ResponseEntity.status(HttpStatus.CREATED) + .body(workbasketRepresentationModelAssembler.toModel(workbasket)); } /** @@ -249,7 +226,6 @@ public class WorkbasketController { @RequestBody WorkbasketRepresentationModel workbasketRepresentationModel) throws InvalidWorkbasketException, WorkbasketNotFoundException, NotAuthorizedException, ConcurrencyException { - LOGGER.debug("Entry to updateWorkbasket(workbasketId= {})", workbasketId); if (!workbasketId.equals(workbasketRepresentationModel.getWorkbasketId())) { throw new InvalidWorkbasketException( "Target-WB-ID('" @@ -261,14 +237,8 @@ public class WorkbasketController { Workbasket workbasket = workbasketRepresentationModelAssembler.toEntityModel(workbasketRepresentationModel); workbasket = workbasketService.updateWorkbasket(workbasket); - ResponseEntity result = - ResponseEntity.ok(workbasketRepresentationModelAssembler.toModel(workbasket)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from updateWorkbasket(), returning {}", result); - } - - return result; + return ResponseEntity.ok(workbasketRepresentationModelAssembler.toModel(workbasket)); } /** @@ -288,19 +258,12 @@ public class WorkbasketController { public ResponseEntity getWorkbasketAccessItems( @PathVariable(value = "workbasketId") String workbasketId) throws NotAuthorizedException, WorkbasketNotFoundException { - LOGGER.debug("Entry to getWorkbasketAccessItems(workbasketId= {})", workbasketId); - List accessItems = workbasketService.getWorkbasketAccessItems(workbasketId); - final ResponseEntity result = - ResponseEntity.ok( - workbasketAccessItemRepresentationModelAssembler - .toTaskanaCollectionModelForSingleWorkbasket(workbasketId, accessItems)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getWorkbasketAccessItems(), returning {}", result); - } - return result; + return ResponseEntity.ok( + workbasketAccessItemRepresentationModelAssembler + .toTaskanaCollectionModelForSingleWorkbasket(workbasketId, accessItems)); } /** @@ -325,7 +288,6 @@ public class WorkbasketController { @RequestBody WorkbasketAccessItemCollectionRepresentationModel workbasketAccessItemRepModels) throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, WorkbasketAccessItemAlreadyExistException { - LOGGER.debug("Entry to setWorkbasketAccessItems(workbasketId= {})", workbasketId); if (workbasketAccessItemRepModels == null) { throw new InvalidArgumentException("Can´t create something with NULL body-value."); } @@ -338,15 +300,9 @@ public class WorkbasketController { List updatedWbAccessItems = workbasketService.getWorkbasketAccessItems(workbasketId); - ResponseEntity response = - ResponseEntity.ok( - workbasketAccessItemRepresentationModelAssembler - .toTaskanaCollectionModelForSingleWorkbasket(workbasketId, updatedWbAccessItems)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from setWorkbasketAccessItems(), returning {}", response); - } - - return response; + return ResponseEntity.ok( + workbasketAccessItemRepresentationModelAssembler + .toTaskanaCollectionModelForSingleWorkbasket(workbasketId, updatedWbAccessItems)); } /** @@ -366,19 +322,12 @@ public class WorkbasketController { public ResponseEntity getDistributionTargets( @PathVariable(value = "workbasketId") String workbasketId) throws WorkbasketNotFoundException, NotAuthorizedException { - - LOGGER.debug("Entry to getDistributionTargets(workbasketId= {})", workbasketId); List distributionTargets = workbasketService.getDistributionTargets(workbasketId); DistributionTargetsCollectionRepresentationModel distributionTargetRepModels = workbasketSummaryRepresentationModelAssembler.toTaskanaCollectionModel(distributionTargets); - ResponseEntity result = - ResponseEntity.ok(distributionTargetRepModels); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getDistributionTargets(), returning {}", result); - } - return result; + return ResponseEntity.ok(distributionTargetRepModels); } /** @@ -399,26 +348,14 @@ public class WorkbasketController { @PathVariable(value = "workbasketId") String sourceWorkbasketId, @RequestBody List targetWorkbasketIds) throws WorkbasketNotFoundException, NotAuthorizedException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "Entry to getTasksStatusReport(workbasketId= {}, targetWorkbasketIds´= {})", - sourceWorkbasketId, - targetWorkbasketIds); - } - workbasketService.setDistributionTargets(sourceWorkbasketId, targetWorkbasketIds); List distributionTargets = workbasketService.getDistributionTargets(sourceWorkbasketId); - ResponseEntity response = - ResponseEntity.ok( - workbasketSummaryRepresentationModelAssembler.toTaskanaCollectionModel( - distributionTargets)); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from getTasksStatusReport(), returning {}", response); - } - return response; + return ResponseEntity.ok( + workbasketSummaryRepresentationModelAssembler.toTaskanaCollectionModel( + distributionTargets)); } /** @@ -435,18 +372,13 @@ public class WorkbasketController { public ResponseEntity removeDistributionTargetForWorkbasketId( @PathVariable(value = "workbasketId") String targetWorkbasketId) throws WorkbasketNotFoundException, NotAuthorizedException { - LOGGER.debug( - "Entry to removeDistributionTargetForWorkbasketId(workbasketId= {})", targetWorkbasketId); - List sourceWorkbaskets = workbasketService.getDistributionSources(targetWorkbasketId); for (WorkbasketSummary source : sourceWorkbaskets) { workbasketService.removeDistributionTarget(source.getId(), targetWorkbasketId); } - ResponseEntity response = ResponseEntity.noContent().build(); - LOGGER.debug("Exit from removeDistributionTargetForWorkbasketId(), returning {}", response); - return response; + return ResponseEntity.noContent().build(); } public enum WorkbasketQuerySortBy implements QuerySortBy { diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketDefinitionController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketDefinitionController.java index 4708e51aa..40811cdec 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketDefinitionController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketDefinitionController.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -15,8 +14,6 @@ import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DuplicateKeyException; import org.springframework.hateoas.config.EnableHypermediaSupport; @@ -56,9 +53,6 @@ import pro.taskana.workbasket.rest.models.WorkbasketRepresentationModel; @EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL) public class WorkbasketDefinitionController { - private static final Logger LOGGER = - LoggerFactory.getLogger(WorkbasketDefinitionController.class); - private final WorkbasketService workbasketService; private final WorkbasketDefinitionRepresentationModelAssembler workbasketDefinitionAssembler; private final WorkbasketRepresentationModelAssembler workbasketAssembler; @@ -91,9 +85,6 @@ public class WorkbasketDefinitionController { @Transactional(readOnly = true, rollbackFor = Exception.class) public ResponseEntity exportWorkbaskets( @RequestParam(required = false) String[] domain) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Entry to exportWorkbaskets(domain= {})", Arrays.toString(domain)); - } WorkbasketQuery query = workbasketService.createWorkbasketQuery(); Optional.ofNullable(domain).ifPresent(query::domainIn); @@ -107,13 +98,7 @@ public class WorkbasketDefinitionController { Collectors.collectingAndThen( Collectors.toList(), workbasketDefinitionAssembler::toTaskanaCollectionModel)); - ResponseEntity response = - ResponseEntity.ok(pageModel); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Exit from exportWorkbaskets(), returning {}", response); - } - - return response; + return ResponseEntity.ok(pageModel); } /** @@ -147,7 +132,6 @@ public class WorkbasketDefinitionController { InvalidWorkbasketException, WorkbasketAlreadyExistException, WorkbasketNotFoundException, InvalidArgumentException, WorkbasketAccessItemAlreadyExistException, ConcurrencyException { - LOGGER.debug("Entry to importWorkbaskets()"); WorkbasketDefinitionCollectionRepresentationModel definitions = mapper.readValue( file.getInputStream(), @@ -228,9 +212,7 @@ public class WorkbasketDefinitionController { // no verification necessary since the workbasket was already imported in step 1. idConversion.get(definition.getWorkbasket().getWorkbasketId()), distributionTargets); } - ResponseEntity response = ResponseEntity.noContent().build(); - LOGGER.debug("Exit from importWorkbaskets(), returning {}", response); - return response; + return ResponseEntity.noContent().build(); } private Workbasket removeId(Workbasket importedWb) { diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/classification/rest/ClassificationDefinitionControllerIntTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/classification/rest/ClassificationDefinitionControllerIntTest.java index e55611fa1..6cde56d13 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/classification/rest/ClassificationDefinitionControllerIntTest.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/classification/rest/ClassificationDefinitionControllerIntTest.java @@ -383,7 +383,9 @@ class ClassificationDefinitionControllerIntTest { ResponseEntity response = importRequest(clList); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT); Thread.sleep(10); - LOGGER.debug("Wait 10 ms to give the system a chance to update"); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Wait 10 ms to give the system a chance to update"); + } ClassificationRepresentationModel childWithNewParent = this.getClassificationWithKeyAndDomain("L110105", "DOMAIN_A"); @@ -415,7 +417,9 @@ class ClassificationDefinitionControllerIntTest { private ResponseEntity importRequest(ClassificationCollectionRepresentationModel clList) throws Exception { - LOGGER.debug("Start Import"); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Start Import"); + } File tmpFile = File.createTempFile("test", ".tmp"); try (FileOutputStream out = new FileOutputStream(tmpFile); OutputStreamWriter writer = new OutputStreamWriter(out, StandardCharsets.UTF_8)) { diff --git a/routing/taskana-spi-routing-dmn-router/pom.xml b/routing/taskana-spi-routing-dmn-router/pom.xml index 3978fd749..3b7840d11 100644 --- a/routing/taskana-spi-routing-dmn-router/pom.xml +++ b/routing/taskana-spi-routing-dmn-router/pom.xml @@ -16,6 +16,11 @@ + + pro.taskana + taskana-common-logging + ${project.version} + pro.taskana taskana-core diff --git a/web/pom.xml b/web/pom.xml index cf604da8c..b2bb19c4a 100644 --- a/web/pom.xml +++ b/web/pom.xml @@ -18,6 +18,14 @@ true + + + pro.taskana + taskana-common-logging + ${project.version} + + +