TSK-1596: Automatic TraceLogging (#1577)
This commit is contained in:
parent
2f1c0972d6
commit
bfcabea610
|
@ -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,\
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
|
||||
<dependencies>
|
||||
<!-- all common dependencies -->
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common</artifactId>
|
||||
|
|
|
@ -21,5 +21,6 @@
|
|||
<module>taskana-common-security</module>
|
||||
<module>taskana-common-data</module>
|
||||
<module>taskana-common-test</module>
|
||||
<module>taskana-common-logging</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
|
@ -52,4 +57,4 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
@ -51,43 +51,29 @@ public class SampleDataGenerator {
|
|||
}
|
||||
|
||||
public void generateSampleData() {
|
||||
LOGGER.debug("entry to generateSampleData()");
|
||||
clearDb();
|
||||
Stream<String> 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<String> scripts = SampleDataProvider.getTestDataScripts();
|
||||
executeAndCacheScripts(scripts, CACHED_TEST);
|
||||
LOGGER.debug("exit from generateTestData()");
|
||||
}
|
||||
|
||||
public void generateMonitorData() {
|
||||
LOGGER.debug("entry to generateMonitorData()");
|
||||
Stream<String> scripts = SampleDataProvider.getMonitorDataScripts();
|
||||
executeAndCacheScripts(scripts, CACHED_MONITOR);
|
||||
LOGGER.debug("exit from generateMonitorData()");
|
||||
}
|
||||
|
||||
public void clearDb() {
|
||||
LOGGER.debug("entry to clearDb()");
|
||||
Stream<String> scripts = SampleDataProvider.getScriptsToClearDatabase();
|
||||
executeAndCacheScripts(scripts, CACHED_CLEAR_DB);
|
||||
LOGGER.debug("exit from clearDb()");
|
||||
}
|
||||
|
||||
public void dropDb() {
|
||||
LOGGER.debug("entry to dropDb()");
|
||||
Stream<String> scripts = SampleDataProvider.getScriptsToDropDatabase();
|
||||
executeAndCacheScripts(scripts, CACHED_DROP_DB);
|
||||
LOGGER.debug("exit from dropDb()");
|
||||
}
|
||||
|
||||
private List<String> parseScripts(Stream<String> scripts) {
|
||||
|
@ -127,7 +113,6 @@ public class SampleDataGenerator {
|
|||
}
|
||||
|
||||
private void executeAndCacheScripts(Stream<String> 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(
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
|
||||
<name>${project.groupId}:${project.artifactId}</name>
|
||||
<description>The global trace logging implementation</description>
|
||||
|
||||
<parent>
|
||||
<artifactId>taskana-common-parent</artifactId>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<version>4.6.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjrt</artifactId>
|
||||
<version>${version.aspectj}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.org.lidalia</groupId>
|
||||
<artifactId>slf4j-test</artifactId>
|
||||
<version>${version.slf4j-test}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.nickwongdev</groupId>
|
||||
<artifactId>aspectj-maven-plugin</artifactId>
|
||||
<version>${version.aspectj-maven-plugin}</version>
|
||||
<configuration>
|
||||
<aspectLibraries combine.self="override"/>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -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<String, Logger> 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<String, Object> 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<String, Object> parameter : parametersNameToValue.entrySet()) {
|
||||
stringBuilder.append(parameter.getKey()).append(" = ").append(parameter.getValue());
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
}
|
|
@ -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 {}
|
|
@ -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 {}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="info">
|
||||
<Appenders>
|
||||
|
||||
<Console name="Console" target="SYSTEM_OUT">
|
||||
<PatternLayout
|
||||
pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
|
||||
</Console>
|
||||
|
||||
</Appenders>
|
||||
|
||||
<Loggers>
|
||||
<Root level="TRACE">
|
||||
<AppenderRef ref="Console" />
|
||||
</Root>
|
||||
|
||||
</Loggers>
|
||||
</Configuration>
|
|
@ -15,6 +15,11 @@
|
|||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
|
|
|
@ -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<Object> 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
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common</artifactId>
|
||||
|
@ -110,4 +115,4 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-security</artifactId>
|
||||
|
@ -36,6 +41,11 @@
|
|||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -22,7 +22,9 @@ public class MapTypeHandler extends BaseTypeHandler<Map<String, Object>> {
|
|||
PreparedStatement ps, int i, Map<String, Object> 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());
|
||||
|
|
|
@ -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 <T> String determineChangesInAttributes(T oldObject, T newObject) {
|
||||
LOGGER.debug(
|
||||
"Entry to determineChangesInAttributes (oldObject = {}, newObject = {}",
|
||||
oldObject,
|
||||
newObject);
|
||||
|
||||
List<Field> 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 <T> 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 "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-core</artifactId>
|
||||
|
@ -59,4 +64,4 @@
|
|||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-core</artifactId>
|
||||
|
|
|
@ -414,7 +414,6 @@ public class ClassificationHistoryQueryImpl implements ClassificationHistoryQuer
|
|||
|
||||
@Override
|
||||
public List<ClassificationHistoryEvent> list() {
|
||||
LOGGER.debug("entry to list(), this = {}", this);
|
||||
List<ClassificationHistoryEvent> 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<ClassificationHistoryEvent> list(int offset, int limit) {
|
||||
LOGGER.debug("entry to list({},{}), this = {}", offset, limit, this);
|
||||
List<ClassificationHistoryEvent> 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<String> listValues(
|
||||
ClassificationHistoryQueryColumnName dbColumnName, SortDirection sortDirection) {
|
||||
LOGGER.debug(
|
||||
"entry to listValues() of column {} with sortDirection {}, this {}",
|
||||
dbColumnName,
|
||||
sortDirection,
|
||||
this);
|
||||
List<String> result = new ArrayList<>();
|
||||
this.columnName = dbColumnName;
|
||||
List<String> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<String> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -625,7 +625,6 @@ public class TaskHistoryQueryImpl implements TaskHistoryQuery {
|
|||
|
||||
@Override
|
||||
public List<TaskHistoryEvent> list() {
|
||||
LOGGER.debug("entry to list(), this = {}", this);
|
||||
List<TaskHistoryEvent> 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<TaskHistoryEvent> list(int offset, int limit) {
|
||||
LOGGER.debug("entry to list({},{}), this = {}", offset, limit, this);
|
||||
List<TaskHistoryEvent> 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<String> listValues(
|
||||
TaskHistoryQueryColumnName dbColumnName, SortDirection sortDirection) {
|
||||
LOGGER.debug(
|
||||
"entry to listValues() of column {} with sortDirection {}, this {}",
|
||||
dbColumnName,
|
||||
sortDirection,
|
||||
this);
|
||||
List<String> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -466,7 +466,6 @@ public class WorkbasketHistoryQueryImpl implements WorkbasketHistoryQuery {
|
|||
|
||||
@Override
|
||||
public List<WorkbasketHistoryEvent> list() {
|
||||
LOGGER.debug("entry to list(), this = {}", this);
|
||||
List<WorkbasketHistoryEvent> 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<WorkbasketHistoryEvent> list(int offset, int limit) {
|
||||
LOGGER.debug("entry to list({},{}), this = {}", offset, limit, this);
|
||||
List<WorkbasketHistoryEvent> 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<String> listValues(
|
||||
WorkbasketHistoryQueryColumnName dbColumnName, SortDirection sortDirection) {
|
||||
LOGGER.debug(
|
||||
"entry to listValues() of column {} with sortDirection {}, this {}",
|
||||
dbColumnName,
|
||||
sortDirection,
|
||||
this);
|
||||
List<String> result = new ArrayList<>();
|
||||
this.columnName = dbColumnName;
|
||||
List<String> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -196,12 +196,6 @@ public class HistoryCleanupJob extends AbstractTaskanaJob {
|
|||
}
|
||||
|
||||
private int deleteHistoryEventsTransactionally(List<String> 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<String> 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) {
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pro.taskana.history</groupId>
|
||||
<artifactId>taskana-simplehistory-provider</artifactId>
|
||||
|
|
|
@ -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<TaskHistoryEventPagedRepresentationModel> 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<TaskHistoryEventRepresentationModel> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
|
@ -112,4 +117,4 @@
|
|||
<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common</artifactId>
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -66,7 +66,7 @@ public interface ClassificationService {
|
|||
throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException;
|
||||
|
||||
/**
|
||||
* Inserts a new Classification after adding default values. <br>
|
||||
* Inserts a new Classification after adding default values. <br>
|
||||
* The Classification will be added to master-domain, too - if not already existing. <br>
|
||||
* The default values are:
|
||||
*
|
||||
|
|
|
@ -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<String> orderBy;
|
||||
private final List<String> orderColumns;
|
||||
|
@ -325,7 +323,6 @@ public class ClassificationQueryImpl implements ClassificationQuery {
|
|||
|
||||
@Override
|
||||
public List<ClassificationSummary> list() {
|
||||
LOGGER.debug("entry to list(), this = {}", this);
|
||||
List<ClassificationSummary> 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<ClassificationSummary> list(int offset, int limit) {
|
||||
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
|
||||
List<ClassificationSummary> 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<String> listValues(
|
||||
ClassificationQueryColumnName columnName, SortDirection sortDirection) {
|
||||
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
|
||||
List<String> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,12 +53,14 @@ public class ClassificationChangedJob extends AbstractTaskanaJob {
|
|||
private void scheduleTaskRefreshJobs(List<String> affectedTaskIds) {
|
||||
int batchSize = taskanaEngineImpl.getConfiguration().getMaxNumberOfUpdatesPerTransaction();
|
||||
List<List<String>> 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<String> taskIdBatch : affectedTaskBatches) {
|
||||
Map<String, String> args = new HashMap<>();
|
||||
if (!taskIdBatch.isEmpty()) {
|
||||
|
|
|
@ -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<ScheduledJob> findJobsToRun() {
|
||||
LOGGER.debug("entry to findJobsToRun");
|
||||
List<ScheduledJob> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ public class JobRunner {
|
|||
}
|
||||
|
||||
public void runJobs() {
|
||||
LOGGER.info("entry to runJobs()");
|
||||
try {
|
||||
List<ScheduledJob> 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) {
|
||||
|
|
|
@ -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<Builder, MonitorQueryItem, TimeIntervalColumnHeader>
|
||||
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().");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Builder, MonitorQueryItem, TimeIntervalColumnHeader>
|
||||
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().");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Builder, MonitorQueryItem, TimeIntervalColumnHeader>
|
||||
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().");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<String, String> 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().");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<B, I, H> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TimeIntervalReportBuilder.class);
|
||||
|
||||
protected InternalTaskanaEngine taskanaEngine;
|
||||
protected MonitorMapper monitorMapper;
|
||||
protected List<H> columnHeaders;
|
||||
|
@ -120,12 +116,6 @@ abstract class TimeIntervalReportBuilderImpl<
|
|||
public List<String> listTaskIdsForSelectedItems(
|
||||
List<SelectedItem> 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<String> 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().");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Builder, TimestampQueryItem, TimeIntervalColumnHeader>
|
||||
implements TimestampReport.Builder {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TimestampReportBuilderImpl.class);
|
||||
private List<TaskTimestamp> 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().");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Builder, MonitorQueryItem, TimeIntervalColumnHeader>
|
||||
implements WorkbasketReport.Builder {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(WorkbasketReportBuilderImpl.class);
|
||||
private final WorkbasketService workbasketService;
|
||||
private List<CombinedClassificationFilter> 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<String, String> 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().");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<String> 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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -37,7 +37,6 @@ public class AttachmentHandler {
|
|||
|
||||
List<Attachment> augmentAttachmentsByClassification(
|
||||
List<AttachmentImpl> attachmentImpls, BulkOperationResults<String, Exception> bulkLog) {
|
||||
LOGGER.debug("entry to augmentAttachmentsByClassification()");
|
||||
List<Attachment> 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<Attachment> 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<Attachment> newAttachments = newTaskImpl.getAttachments();
|
||||
List<String> 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()");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<String> orderBy;
|
||||
private ObjectReferenceQueryColumnName columnName;
|
||||
|
@ -70,7 +67,6 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
|
|||
|
||||
@Override
|
||||
public List<ObjectReference> list() {
|
||||
LOGGER.debug("entry to list(), this = {}", this);
|
||||
List<ObjectReference> 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<ObjectReference> list(int offset, int limit) {
|
||||
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
|
||||
List<ObjectReference> 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<String> listValues(
|
||||
ObjectReferenceQueryColumnName columnName, SortDirection sortDirection) {
|
||||
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
|
||||
List<String> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<TaskComment> getTaskComments(String taskId)
|
||||
throws NotAuthorizedException, TaskNotFoundException {
|
||||
|
||||
LOGGER.debug("entry to getTaskComments (taskId = {})", taskId);
|
||||
|
||||
try {
|
||||
|
||||
taskanaEngine.openConnection();
|
||||
|
@ -173,17 +160,14 @@ class TaskCommentServiceImpl {
|
|||
|
||||
List<TaskComment> 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()");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -919,7 +919,6 @@ public class TaskQueryImpl implements TaskQuery {
|
|||
public List<TaskSummary> list() {
|
||||
List<TaskSummary> 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<TaskSummaryImpl> 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<TaskSummary> list(int offset, int limit) {
|
||||
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
|
||||
List<TaskSummary> 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<String> listValues(TaskQueryColumnName columnName, SortDirection sortDirection) {
|
||||
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
|
||||
List<String> 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 {
|
||||
|
|
|
@ -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<String, TaskanaException> deleteTasks(List<String> 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<String> updateTasks(
|
||||
ObjectReference selectionCriteria, Map<TaskCustomField, String> 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<String> updateTasks(
|
||||
List<String> taskIds, Map<TaskCustomField, String> 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<String, TaskanaException> setCallbackStateForTasks(
|
||||
List<String> 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<String, TaskanaException> setOwnerOfTasks(
|
||||
String owner, List<String> argTaskIds) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("entry to setOwnerOfTasks(owner = {}, tasks = {})", owner, argTaskIds);
|
||||
}
|
||||
|
||||
BulkOperationResults<String, TaskanaException> 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<String, TaskanaException> setPlannedPropertyOfTasks(
|
||||
Instant planned, List<String> 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<String> findTasksIdsAffectedByClassificationChange(String classificationId) {
|
||||
LOGGER.debug(
|
||||
"entry to findTasksIdsAffectedByClassificationChange(classificationId = {})",
|
||||
classificationId);
|
||||
// tasks directly affected
|
||||
List<TaskSummary> tasksAffectedDirectly =
|
||||
createTaskQuery()
|
||||
|
@ -883,15 +845,11 @@ public class TaskServiceImpl implements TaskService {
|
|||
classificationId,
|
||||
affectedTaskIds);
|
||||
}
|
||||
LOGGER.debug("exit from findTasksIdsAffectedByClassificationChange(). ");
|
||||
return affectedTaskIds;
|
||||
}
|
||||
|
||||
public void refreshPriorityAndDueDatesOfTasksOnClassificationUpdate(
|
||||
List<String> taskIds, boolean serviceLevelChanged, boolean priorityChanged) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("entry to refreshPriorityAndDueDateOfTasks(tasks = {})", taskIds);
|
||||
}
|
||||
Pair<List<MinimalTaskSummary>, BulkLog> resultsPair = getMinimalTaskSummaries(taskIds);
|
||||
List<MinimalTaskSummary> 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<String> taskIds, BulkOperationResults<String, TaskanaException> bulkLog) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"entry to removeNonExistingTasksFromTaskIdList(targetWbId = {}, taskIds = {})",
|
||||
taskIds,
|
||||
bulkLog);
|
||||
}
|
||||
|
||||
Iterator<String> taskIdIterator = taskIds.iterator();
|
||||
while (taskIdIterator.hasNext()) {
|
||||
|
@ -991,16 +942,11 @@ public class TaskServiceImpl implements TaskService {
|
|||
taskIdIterator.remove();
|
||||
}
|
||||
}
|
||||
LOGGER.debug("exit from removeNonExistingTasksFromTaskIdList()");
|
||||
}
|
||||
|
||||
List<TaskSummary> augmentTaskSummariesByContainedSummariesWithPartitioning(
|
||||
List<TaskSummaryImpl> 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<TaskSummary> 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<String, TaskanaException> completeTasks(
|
||||
List<String> 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<String, TaskanaException> bulkLog,
|
||||
List<MinimalTaskSummary> taskSummaries,
|
||||
Iterator<String> 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<MinimalTaskSummary> taskSummaries,
|
||||
Iterator<String> 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<TaskSummaryImpl> taskSummaries, Instant now) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("entry to updateTasksToBeCompleted()");
|
||||
}
|
||||
|
||||
List<String> taskIds = new ArrayList<>();
|
||||
List<String> updateClaimedTaskIds = new ArrayList<>();
|
||||
List<TaskSummary> taskSummaryList =
|
||||
|
@ -1607,20 +1538,12 @@ public class TaskServiceImpl implements TaskService {
|
|||
createTasksCompletedEvents(taskSummaryList);
|
||||
}
|
||||
}
|
||||
LOGGER.debug("exit from updateTasksToBeCompleted()");
|
||||
}
|
||||
|
||||
private void addClassificationSummariesToTaskSummaries(
|
||||
List<TaskSummaryImpl> tasks, List<ClassificationSummary> 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<ClassificationSummary> findClassificationsForTasksAndAttachments(
|
||||
List<TaskSummaryImpl> taskSummaries, List<AttachmentSummaryImpl> 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<ClassificationSummary> findClassificationForTaskImplAndAttachments(
|
||||
TaskImpl task, List<AttachmentImpl> attachmentImpls) {
|
||||
LOGGER.debug("entry to transferBulk()");
|
||||
Set<String> 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<TaskSummaryImpl> 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<TaskSummaryImpl> taskSummaries,
|
||||
List<AttachmentSummaryImpl> attachmentSummaries,
|
||||
List<ClassificationSummary> 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<AttachmentSummaryImpl> attachmentSummaries,
|
||||
List<TaskSummaryImpl> taskSummaries,
|
||||
List<ClassificationSummary> 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<Attachment> addClassificationSummariesToAttachments(
|
||||
List<AttachmentImpl> attachmentImpls, List<ClassificationSummary> 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<TaskCustomField, String> 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<TaskCustomField, String> 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<TaskSummary> getTasksToChange(List<String> taskIds) {
|
||||
|
|
|
@ -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<String> taskIds,
|
||||
List<MinimalTaskSummary> taskSummaries,
|
||||
BulkOperationResults<String, TaskanaException> bulkLog) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"entry to checkIfTransferConditionsAreFulfilled(taskIds = {}, "
|
||||
+ "taskSummaries = {}, bulkLog = {})",
|
||||
taskIds,
|
||||
taskSummaries,
|
||||
bulkLog);
|
||||
}
|
||||
|
||||
Set<String> 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<MinimalTaskSummary> taskSummaries,
|
||||
List<WorkbasketSummary> sourceWorkbaskets,
|
||||
BulkOperationResults<String, TaskanaException> bulkLog) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"entry to checkIfTasksMatchTransferCriteria(taskIds = {}, taskSummaries = {}, "
|
||||
+ "sourceWorkbaskets = {}, bulkLog = {})",
|
||||
taskIds,
|
||||
taskSummaries,
|
||||
sourceWorkbaskets,
|
||||
bulkLog);
|
||||
}
|
||||
|
||||
Iterator<String> 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<MinimalTaskSummary> 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(
|
||||
|
|
|
@ -82,7 +82,6 @@ public class TaskCleanupJob extends AbstractTaskanaJob {
|
|||
}
|
||||
|
||||
private List<TaskSummary> getTasksCompletedBefore(Instant untilDate) {
|
||||
LOGGER.debug("entry to getTasksCompletedBefore(untilDate = {})", untilDate);
|
||||
|
||||
List<TaskSummary> 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<TaskSummary> 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<TaskSummary> tasksToBeDeleted)
|
||||
throws InvalidArgumentException, NotAuthorizedException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("entry to deleteTasks(tasksToBeDeleted = {})", tasksToBeDeleted);
|
||||
}
|
||||
|
||||
List<String> tasksIdsToBeDeleted =
|
||||
tasksToBeDeleted.stream().map(TaskSummary::getId).collect(Collectors.toList());
|
||||
BulkOperationResults<String, TaskanaException> 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.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<T> list() {
|
||||
LOGGER.debug("entry to list(), this = {}", _this());
|
||||
List<T> 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<T> list(int offset, int limit) {
|
||||
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, _this());
|
||||
List<T> 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<String> listValues(
|
||||
AccessItemQueryColumnName columnName, SortDirection sortDirection) {
|
||||
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, _this());
|
||||
List<String> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<WorkbasketAccessItem> list() {
|
||||
LOGGER.debug("entry to list(), this = {}", this);
|
||||
List<WorkbasketAccessItem> 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<WorkbasketAccessItem> list(int offset, int limit) {
|
||||
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
|
||||
List<WorkbasketAccessItem> 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<String> listValues(
|
||||
AccessItemQueryColumnName columnName, SortDirection sortDirection) {
|
||||
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
|
||||
List<String> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<WorkbasketSummary> list() {
|
||||
LOGGER.debug("entry to list(), this = {}", this);
|
||||
List<WorkbasketSummary> 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<WorkbasketSummary> list(int offset, int limit) {
|
||||
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
|
||||
List<WorkbasketSummary> 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<String> listValues(
|
||||
WorkbasketQueryColumnName columnName, SortDirection sortDirection) {
|
||||
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
|
||||
List<String> 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) {
|
||||
|
|
|
@ -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<String> 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<WorkbasketAccessItem> getWorkbasketAccessItems(String workbasketId)
|
||||
throws NotAuthorizedException {
|
||||
LOGGER.debug("entry to getWorkbasketAccessItems(workbasketId = {})", workbasketId);
|
||||
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
|
||||
List<WorkbasketAccessItem> 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<WorkbasketAccessItem> wbAccessItems)
|
||||
throws NotAuthorizedException, WorkbasketAccessItemAlreadyExistException,
|
||||
InvalidArgumentException {
|
||||
LOGGER.debug("entry to setWorkbasketAccessItems(workbasketAccessItems = {})", wbAccessItems);
|
||||
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
|
||||
|
||||
Set<String> 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<WorkbasketSummary> getDistributionTargets(String workbasketId)
|
||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
||||
LOGGER.debug("entry to getDistributionTargets(workbasketId = {})", workbasketId);
|
||||
List<WorkbasketSummary> 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<WorkbasketSummary> getDistributionTargets(String workbasketKey, String domain)
|
||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
||||
LOGGER.debug(
|
||||
"entry to getDistributionTargets(workbasketKey = {}, domain = {})", workbasketKey, domain);
|
||||
|
||||
List<WorkbasketSummary> 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<String> 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<String, TaskanaException> deleteWorkbaskets(
|
||||
List<String> 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<WorkbasketSummary> getDistributionSources(String workbasketId)
|
||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
||||
LOGGER.debug("entry to getDistributionSources(workbasketId = {})", workbasketId);
|
||||
List<WorkbasketSummary> 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<WorkbasketSummary> getDistributionSources(String workbasketKey, String domain)
|
||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
||||
LOGGER.debug(
|
||||
"entry to getDistributionSources(workbasketKey = {}, domain = {})", workbasketKey, domain);
|
||||
|
||||
List<WorkbasketSummary> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,8 +105,10 @@ public class WorkbasketCleanupJob extends AbstractTaskanaJob {
|
|||
|
||||
BulkOperationResults<String, TaskanaException> 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.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Class<?>> pojoClasses;
|
||||
|
||||
@BeforeAll
|
||||
static void setup() {
|
||||
pojoClasses = getPojoClasses();
|
||||
}
|
||||
private static final List<Class<?>> POJO_CLASSES = getPojoClasses();
|
||||
|
||||
@Test
|
||||
void testsThatPojoClassesAreFound() {
|
||||
assertThat(pojoClasses).isNotEmpty();
|
||||
assertThat(POJO_CLASSES).isNotEmpty();
|
||||
}
|
||||
|
||||
@TestFactory
|
||||
Stream<DynamicTest> equalsContract() {
|
||||
return pojoClasses.stream()
|
||||
return POJO_CLASSES.stream()
|
||||
.map(
|
||||
cl ->
|
||||
DynamicTest.dynamicTest(
|
||||
|
@ -52,7 +46,7 @@ class PojoTest {
|
|||
|
||||
@TestFactory
|
||||
Stream<DynamicTest> validateGetters() {
|
||||
return pojoClasses.stream()
|
||||
return POJO_CLASSES.stream()
|
||||
.map(
|
||||
cl ->
|
||||
DynamicTest.dynamicTest(
|
||||
|
@ -62,7 +56,7 @@ class PojoTest {
|
|||
|
||||
@TestFactory
|
||||
Stream<DynamicTest> 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<DynamicTest> validateGetAndSet() {
|
||||
return pojoClasses.stream()
|
||||
return POJO_CLASSES.stream()
|
||||
.map(
|
||||
cl ->
|
||||
DynamicTest.dynamicTest(
|
||||
|
@ -83,7 +77,7 @@ class PojoTest {
|
|||
|
||||
@TestFactory
|
||||
Stream<DynamicTest> validateNoStaticExceptFinalFields() {
|
||||
return pojoClasses.stream()
|
||||
return POJO_CLASSES.stream()
|
||||
.map(
|
||||
cl ->
|
||||
DynamicTest.dynamicTest(
|
||||
|
@ -93,7 +87,7 @@ class PojoTest {
|
|||
|
||||
@TestFactory
|
||||
Stream<DynamicTest> validateNoPublicFields() {
|
||||
return pojoClasses.stream()
|
||||
return POJO_CLASSES.stream()
|
||||
.map(
|
||||
cl ->
|
||||
DynamicTest.dynamicTest(
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-core</artifactId>
|
||||
|
@ -72,4 +77,4 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
</project>
|
||||
|
|
50
pom.xml
50
pom.xml
|
@ -89,6 +89,10 @@
|
|||
<version.slf4j-test>1.2.0</version.slf4j-test>
|
||||
<version.auto-restdocs>2.0.11</version.auto-restdocs>
|
||||
|
||||
<!-- AspectJ dependencies -->
|
||||
<version.aspectj-maven-plugin>1.12.6</version.aspectj-maven-plugin>
|
||||
<version.aspectj>1.9.6</version.aspectj>
|
||||
|
||||
<!-- database driver versions -->
|
||||
<version.db2>11.1.1.1</version.db2>
|
||||
|
||||
|
@ -135,6 +139,51 @@
|
|||
</dependencyManagement>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>aspectj-logging</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>!skipAspectJ</name>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.nickwongdev</groupId>
|
||||
<artifactId>aspectj-maven-plugin</artifactId>
|
||||
<version>${version.aspectj-maven-plugin}</version>
|
||||
<configuration>
|
||||
<complianceLevel>${java.version}</complianceLevel>
|
||||
<source>11</source>
|
||||
<target>8</target>
|
||||
<showWeaveInfo>false</showWeaveInfo>
|
||||
<verbose>true</verbose>
|
||||
<aspectLibraries>
|
||||
<aspectLibrary>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
</aspectLibrary>
|
||||
</aspectLibraries>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
<goal>test-compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjtools</artifactId>
|
||||
<version>${version.aspectj}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>jdk8-compatibility</id>
|
||||
<activation>
|
||||
|
@ -261,6 +310,7 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- This plugin appends version information into the jar, so
|
||||
that it can be extracted from the jar. See TSK-837 for more information -->
|
||||
<plugin>
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
|
@ -41,9 +46,6 @@
|
|||
<profiles>
|
||||
<profile>
|
||||
<id>history.plugin</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana.history</groupId>
|
||||
|
@ -84,9 +86,6 @@
|
|||
</profile>
|
||||
<profile>
|
||||
<id>historyLogging.plugin</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana.history</groupId>
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-rest-spring</artifactId>
|
||||
|
@ -112,4 +117,4 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
@ -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}")
|
||||
|
|
|
@ -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()");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,11 @@
|
|||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
|
@ -294,4 +299,4 @@
|
|||
<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-spring</artifactId>
|
||||
|
@ -239,4 +244,4 @@
|
|||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
@ -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<ClassificationRepresentationModel> getClassification(
|
||||
@PathVariable String classificationId) throws ClassificationNotFoundException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to getClassification(classificationId= {})", classificationId);
|
||||
}
|
||||
|
||||
Classification classification = classificationService.getClassification(classificationId);
|
||||
ResponseEntity<ClassificationRepresentationModel> 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<ClassificationRepresentationModel> 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<ClassificationRepresentationModel> 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<ClassificationRepresentationModel> deleteClassification(
|
||||
@PathVariable String classificationId)
|
||||
throws ClassificationNotFoundException, ClassificationInUseException, NotAuthorizedException {
|
||||
LOGGER.debug("Entry to deleteClassification(classificationId= {})", classificationId);
|
||||
classificationService.deleteClassification(classificationId);
|
||||
ResponseEntity<ClassificationRepresentationModel> response = ResponseEntity.noContent().build();
|
||||
LOGGER.debug("Exit from deleteClassification(), returning {}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<ClassificationDefinitionCollectionRepresentationModel>
|
||||
exportClassifications(@RequestParam(required = false) String[] domain) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to exportClassifications(domain= {})", Arrays.toString(domain));
|
||||
}
|
||||
ClassificationQuery query = classificationService.createClassificationQuery();
|
||||
|
||||
List<ClassificationSummary> summaries =
|
||||
|
@ -94,9 +85,6 @@ public class ClassificationDefinitionController {
|
|||
|
||||
ResponseEntity<ClassificationDefinitionCollectionRepresentationModel> 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<String, String> systemIds = getSystemIds();
|
||||
ClassificationDefinitionCollectionRepresentationModel collection =
|
||||
extractClassificationResourcesFromFile(file);
|
||||
|
@ -133,7 +120,6 @@ public class ClassificationDefinitionController {
|
|||
insertOrUpdateClassificationsWithoutParent(collection.getContent(), systemIds);
|
||||
updateParentChildrenRelations(childrenInFile);
|
||||
ResponseEntity<Void> response = ResponseEntity.noContent().build();
|
||||
LOGGER.debug("Exit from importClassifications(), returning {}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -171,7 +157,6 @@ public class ClassificationDefinitionController {
|
|||
private Map<Classification, String> mapChildrenToParentKeys(
|
||||
Collection<ClassificationDefinitionRepresentationModel> definitionList,
|
||||
Map<String, String> systemIds) {
|
||||
LOGGER.debug("Entry to mapChildrenToParentKeys()");
|
||||
Map<Classification, String> childrenInFile = new HashMap<>();
|
||||
Set<String> 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<String, String> 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<Classification, String> childrenInFile)
|
||||
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,
|
||||
InvalidArgumentException {
|
||||
LOGGER.debug("Entry to updateParentChildrenRelations()");
|
||||
|
||||
for (Map.Entry<Classification, String> 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()");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<List<AccessIdRepresentationModel>> 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<AccessIdRepresentationModel> accessIdUsers = ldapClient.searchUsersAndGroups(searchFor);
|
||||
ResponseEntity<List<AccessIdRepresentationModel>> 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<List<AccessIdRepresentationModel>> 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<AccessIdRepresentationModel> accessIdUsers =
|
||||
ldapClient.searchUsersByNameOrAccessIdInUserRole(nameOrAccessId);
|
||||
ResponseEntity<List<AccessIdRepresentationModel>> 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<AccessIdRepresentationModel> accessIdUsers =
|
||||
ldapClient.searchUsersByNameOrAccessIdInUserRole(nameOrAccessId);
|
||||
return ResponseEntity.ok(accessIdUsers);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -120,9 +95,6 @@ public class AccessIdController {
|
|||
public ResponseEntity<List<AccessIdRepresentationModel>> 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<AccessIdRepresentationModel> accessIds =
|
||||
ldapClient.searchGroupsAccessIdIsMemberOf(accessId);
|
||||
ResponseEntity<List<AccessIdRepresentationModel>> response = ResponseEntity.ok(accessIds);
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Exit from getGroupsByAccessId(), returning {}", response);
|
||||
}
|
||||
return response;
|
||||
return ResponseEntity.ok(accessIds);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,9 @@ public class SpringSecurityToJaasFilter extends GenericFilterBean {
|
|||
throws IOException, ServletException {
|
||||
Optional<Authentication> 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<List<String>> getDomains() {
|
||||
ResponseEntity<List<String>> 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<List<String>> getClassificationCategories(
|
||||
@RequestParam(required = false) String type) {
|
||||
LOGGER.debug("Entry to getClassificationCategories(type = {})", type);
|
||||
ResponseEntity<List<String>> 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<List<String>> getClassificationTypes() {
|
||||
ResponseEntity<List<String>> 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<Map<String, List<String>>> getClassificationCategoriesByTypeMap() {
|
||||
ResponseEntity<Map<String, List<String>>> 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<TaskanaUserInfoRepresentationModel> 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<TaskanaUserInfoRepresentationModel> 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<Boolean> getIsHistoryProviderEnabled() {
|
||||
ResponseEntity<Boolean> 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<VersionRepresentationModel> currentVersion() {
|
||||
LOGGER.debug("Entry to currentVersion()");
|
||||
VersionRepresentationModel resource = new VersionRepresentationModel();
|
||||
resource.setVersion(TaskanaEngineConfiguration.class.getPackage().getImplementationVersion());
|
||||
ResponseEntity<VersionRepresentationModel> response = ResponseEntity.ok(resource);
|
||||
LOGGER.debug("Exit from currentVersion(), returning {}", response);
|
||||
return response;
|
||||
return ResponseEntity.ok(resource);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,6 @@ public class LdapClient {
|
|||
*/
|
||||
public List<AccessIdRepresentationModel> 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<AccessIdRepresentationModel> result = getFirstPageOfaResultList(accessIds);
|
||||
|
||||
LOGGER.debug(
|
||||
"exit from searchUsersAndGroups(name = {}). Returning {} users and groups: {}",
|
||||
name,
|
||||
accessIds.size(),
|
||||
result);
|
||||
|
||||
return result;
|
||||
return getFirstPageOfaResultList(accessIds);
|
||||
}
|
||||
|
||||
public List<AccessIdRepresentationModel> searchUsersByNameOrAccessIdInUserRole(
|
||||
|
@ -137,7 +128,6 @@ public class LdapClient {
|
|||
|
||||
public List<AccessIdRepresentationModel> 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<AccessIdRepresentationModel> 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<AccessIdRepresentationModel> 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<AccessIdRepresentationModel> 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<AccessIdRepresentationModel> 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<AccessIdRepresentationModel> 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<AccessIdRepresentationModel> 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<AccessIdRepresentationModel> 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<LdapSettings> checkForMissingConfigurations() {
|
||||
|
|
|
@ -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<String> workbasketIds,
|
||||
@RequestParam(name = "priority-minimum", required = false) Integer priorityMinimum)
|
||||
throws NotAuthorizedException {
|
||||
LOGGER.debug("Entry to getTasksStatusReport(), states to include {}", states);
|
||||
ResponseEntity<ReportRepresentationModel> 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<TaskState> 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<TaskState> 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<ReportRepresentationModel> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<TaskCommentRepresentationModel> 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<TaskCommentsSortBy> sortBy,
|
||||
@RequestParam(required = false) List<SortDirection> order)
|
||||
throws NotAuthorizedException, TaskNotFoundException, InvalidArgumentException {
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Entry to getTaskComments(taskId= {})", taskId);
|
||||
}
|
||||
|
||||
Optional<Comparator<TaskComment>> comparator = getTaskCommentComparator(sortBy, order);
|
||||
List<TaskComment> taskComments = taskService.getTaskComments(taskId);
|
||||
comparator.ifPresent(taskComments::sort);
|
||||
|
@ -125,14 +105,7 @@ public class TaskCommentController {
|
|||
TaskCommentCollectionRepresentationModel taskCommentListResource =
|
||||
taskCommentRepresentationModelAssembler.toTaskanaCollectionModel(taskComments);
|
||||
|
||||
ResponseEntity<TaskCommentCollectionRepresentationModel> 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<TaskCommentRepresentationModel> 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<TaskCommentRepresentationModel> 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<TaskCommentRepresentationModel> 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<Comparator<TaskComment>> getTaskCommentComparator(
|
||||
|
|
|
@ -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<TaskSummaryPagedRepresentationModel> 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<TaskSummaryCollectionRepresentationModel> 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<TaskRepresentationModel> getTask(@PathVariable String taskId)
|
||||
throws TaskNotFoundException, NotAuthorizedException {
|
||||
LOGGER.debug("Entry to getTask(taskId= {})", taskId);
|
||||
Task task = taskService.getTask(taskId);
|
||||
ResponseEntity<TaskRepresentationModel> 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<TaskRepresentationModel> 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<TaskRepresentationModel> 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<TaskRepresentationModel> 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<TaskRepresentationModel> cancelClaimTask(@PathVariable String taskId)
|
||||
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
|
||||
NotAuthorizedException {
|
||||
|
||||
LOGGER.debug("Entry to cancelClaimTask(taskId= {}", taskId);
|
||||
|
||||
Task updatedTask = taskService.cancelClaim(taskId);
|
||||
|
||||
ResponseEntity<TaskRepresentationModel> 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<TaskRepresentationModel> forceCancelClaimTask(@PathVariable String taskId)
|
||||
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
|
||||
NotAuthorizedException {
|
||||
|
||||
LOGGER.debug("Entry to forceCancelClaimTask(taskId= {}", taskId);
|
||||
|
||||
Task updatedTask = taskService.forceCancelClaim(taskId);
|
||||
|
||||
ResponseEntity<TaskRepresentationModel> 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<TaskRepresentationModel> completeTask(@PathVariable String taskId)
|
||||
throws TaskNotFoundException, InvalidOwnerException, InvalidStateException,
|
||||
NotAuthorizedException {
|
||||
LOGGER.debug("Entry to completeTask(taskId= {})", taskId);
|
||||
|
||||
Task updatedTask = taskService.forceCompleteTask(taskId);
|
||||
ResponseEntity<TaskRepresentationModel> 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<TaskRepresentationModel> deleteTask(@PathVariable String taskId)
|
||||
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
|
||||
LOGGER.debug("Entry to deleteTask(taskId= {})", taskId);
|
||||
taskService.forceDeleteTask(taskId);
|
||||
ResponseEntity<TaskRepresentationModel> 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<TaskRepresentationModel> cancelTask(@PathVariable String taskId)
|
||||
throws TaskNotFoundException, NotAuthorizedException, InvalidStateException {
|
||||
LOGGER.debug("Entry to cancelTask(taskId= {})", taskId);
|
||||
|
||||
Task cancelledTask = taskService.cancelTask(taskId);
|
||||
ResponseEntity<TaskRepresentationModel> 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<TaskRepresentationModel> 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<TaskRepresentationModel> 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<TaskRepresentationModel> 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<TaskQuery> {
|
||||
|
|
|
@ -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<WorkbasketAccessItemPagedRepresentationModel> 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<Void> removeWorkbasketAccessItems(
|
||||
@RequestParam("access-id") String accessId)
|
||||
throws NotAuthorizedException, InvalidArgumentException {
|
||||
LOGGER.debug("Entry to removeWorkbasketAccessItems(access-id= {})", accessId);
|
||||
if (ldapClient.isUser(accessId)) {
|
||||
List<WorkbasketAccessItem> workbasketAccessItemList =
|
||||
workbasketService.createWorkbasketAccessItemQuery().accessIdIn(accessId).list();
|
||||
|
@ -122,9 +110,7 @@ public class WorkbasketAccessItemController {
|
|||
accessId));
|
||||
}
|
||||
|
||||
ResponseEntity<Void> response = ResponseEntity.noContent().build();
|
||||
LOGGER.debug("Exit from removeWorkbasketAccessItems(), returning {}", response);
|
||||
return response;
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
public enum WorkbasketAccessItemSortBy implements QuerySortBy<WorkbasketAccessItemQuery> {
|
||||
|
|
|
@ -113,13 +113,7 @@ public class WorkbasketController {
|
|||
workbasketSummaryRepresentationModelAssembler.toPagedModel(
|
||||
workbasketSummaries, pagingParameter.getPageMetadata());
|
||||
|
||||
ResponseEntity<WorkbasketSummaryPagedRepresentationModel> 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<WorkbasketRepresentationModel> getWorkbasket(
|
||||
@PathVariable(value = "workbasketId") String workbasketId)
|
||||
throws WorkbasketNotFoundException, NotAuthorizedException {
|
||||
LOGGER.debug("Entry to getWorkbasket(workbasketId= {})", workbasketId);
|
||||
ResponseEntity<WorkbasketRepresentationModel> 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<WorkbasketRepresentationModel> 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<WorkbasketRepresentationModel> 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<WorkbasketRepresentationModel> 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<WorkbasketAccessItemCollectionRepresentationModel> getWorkbasketAccessItems(
|
||||
@PathVariable(value = "workbasketId") String workbasketId)
|
||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
||||
LOGGER.debug("Entry to getWorkbasketAccessItems(workbasketId= {})", workbasketId);
|
||||
|
||||
List<WorkbasketAccessItem> accessItems =
|
||||
workbasketService.getWorkbasketAccessItems(workbasketId);
|
||||
final ResponseEntity<WorkbasketAccessItemCollectionRepresentationModel> 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<WorkbasketAccessItem> updatedWbAccessItems =
|
||||
workbasketService.getWorkbasketAccessItems(workbasketId);
|
||||
|
||||
ResponseEntity<WorkbasketAccessItemCollectionRepresentationModel> 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<DistributionTargetsCollectionRepresentationModel> getDistributionTargets(
|
||||
@PathVariable(value = "workbasketId") String workbasketId)
|
||||
throws WorkbasketNotFoundException, NotAuthorizedException {
|
||||
|
||||
LOGGER.debug("Entry to getDistributionTargets(workbasketId= {})", workbasketId);
|
||||
List<WorkbasketSummary> distributionTargets =
|
||||
workbasketService.getDistributionTargets(workbasketId);
|
||||
DistributionTargetsCollectionRepresentationModel distributionTargetRepModels =
|
||||
workbasketSummaryRepresentationModelAssembler.toTaskanaCollectionModel(distributionTargets);
|
||||
ResponseEntity<DistributionTargetsCollectionRepresentationModel> 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<String> targetWorkbasketIds)
|
||||
throws WorkbasketNotFoundException, NotAuthorizedException {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
"Entry to getTasksStatusReport(workbasketId= {}, targetWorkbasketIds´= {})",
|
||||
sourceWorkbasketId,
|
||||
targetWorkbasketIds);
|
||||
}
|
||||
|
||||
workbasketService.setDistributionTargets(sourceWorkbasketId, targetWorkbasketIds);
|
||||
|
||||
List<WorkbasketSummary> distributionTargets =
|
||||
workbasketService.getDistributionTargets(sourceWorkbasketId);
|
||||
ResponseEntity<DistributionTargetsCollectionRepresentationModel> 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<Void> removeDistributionTargetForWorkbasketId(
|
||||
@PathVariable(value = "workbasketId") String targetWorkbasketId)
|
||||
throws WorkbasketNotFoundException, NotAuthorizedException {
|
||||
LOGGER.debug(
|
||||
"Entry to removeDistributionTargetForWorkbasketId(workbasketId= {})", targetWorkbasketId);
|
||||
|
||||
List<WorkbasketSummary> sourceWorkbaskets =
|
||||
workbasketService.getDistributionSources(targetWorkbasketId);
|
||||
for (WorkbasketSummary source : sourceWorkbaskets) {
|
||||
workbasketService.removeDistributionTarget(source.getId(), targetWorkbasketId);
|
||||
}
|
||||
|
||||
ResponseEntity<Void> response = ResponseEntity.noContent().build();
|
||||
LOGGER.debug("Exit from removeDistributionTargetForWorkbasketId(), returning {}", response);
|
||||
return response;
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
public enum WorkbasketQuerySortBy implements QuerySortBy<WorkbasketQuery> {
|
||||
|
|
|
@ -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<WorkbasketDefinitionCollectionRepresentationModel> 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<WorkbasketDefinitionCollectionRepresentationModel> 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<Void> response = ResponseEntity.noContent().build();
|
||||
LOGGER.debug("Exit from importWorkbaskets(), returning {}", response);
|
||||
return response;
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
private Workbasket removeId(Workbasket importedWb) {
|
||||
|
|
|
@ -383,7 +383,9 @@ class ClassificationDefinitionControllerIntTest {
|
|||
ResponseEntity<Void> 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<Void> 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)) {
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-core</artifactId>
|
||||
|
|
|
@ -18,6 +18,14 @@
|
|||
<sonar.skip>true</sonar.skip>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-common-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
|
Loading…
Reference in New Issue