Merge branch 'master' into taskana-md

This commit is contained in:
Chi Nguyen 2020-10-27 15:56:52 +01:00
commit 0ba4f752e6
343 changed files with 1834 additions and 3048 deletions

View File

@ -1,18 +0,0 @@
pullRequestOpened: |
### For the submitter:
- [ ] I updated the [documentation](https://taskana.atlassian.net/wiki/spaces/TAS/overview) and will supply links to the specific files
- [ ] I did not update the [documentation](https://taskana.atlassian.net/wiki/spaces/TAS/overview)
- [ ] I included a link to the [SonarCloud branch analysis](https://taskana.atlassian.net/wiki/spaces/TAS/pages/1019969636/SonarCloud+Integration)
- [ ] I added a description of changes on the [current release notes](https://taskana.atlassian.net/wiki/spaces/TAS/pages/1281392672/Current+Release+Notes+Taskana)
- [ ] I did not update the [current release notes](https://taskana.atlassian.net/wiki/spaces/TAS/pages/1281392672/Current+Release+Notes+Taskana)
- [ ] I put the ticket in review
- [ ] After integration of the pull request, i verified our [bluemix test environment](http://taskana.mybluemix.net/taskana) is not broken
### Verified by the reviewer:
- [ ] Commit message format → TSK-XXX: Your commit message.
- [ ] Submitter's update to [documentation](https://taskana.atlassian.net/wiki/spaces/TAS/overview) is sufficient
- [ ] SonarCloud analysis meets our standards
- [ ] Update of the [current release notes](https://taskana.atlassian.net/wiki/spaces/TAS/pages/1281392672/Current+Release+Notes+Taskana) reflects changes
- [ ] PR fulfills the ticket
- [ ] Edge cases and unwanted side effects are tested
- [ ] Readability

20
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,20 @@
<!-- if needed please write above the given line -->
---
<!-- please don't delete/modify the checklist -->
### For the submitter:
- [ ] I updated the [documentation](https://taskana.atlassian.net/wiki/spaces/TAS/overview) and will supply links to the specific files
- [ ] I did not update the [documentation](https://taskana.atlassian.net/wiki/spaces/TAS/overview)
- [ ] I included a link to the [SonarCloud branch analysis](https://taskana.atlassian.net/wiki/spaces/TAS/pages/1019969636/SonarCloud+Integration)
- [ ] I added a description of changes on the [current release notes](https://taskana.atlassian.net/wiki/spaces/TAS/pages/1281392672/Current+Release+Notes+Taskana)
- [ ] I did not update the [current release notes](https://taskana.atlassian.net/wiki/spaces/TAS/pages/1281392672/Current+Release+Notes+Taskana)
- [ ] I put the ticket in review
- [ ] After integration of the pull request, I verified our [bluemix test environment](http://taskana.mybluemix.net/taskana) is not broken
### Verified by the reviewer:
- [ ] Commit message format → TSK-XXX: Your commit message.
- [ ] Submitter's update to [documentation](https://taskana.atlassian.net/wiki/spaces/TAS/overview) is sufficient
- [ ] SonarCloud analysis meets our standards
- [ ] Update of the [current release notes](https://taskana.atlassian.net/wiki/spaces/TAS/pages/1281392672/Current+Release+Notes+Taskana) reflects changes
- [ ] PR fulfills the ticket
- [ ] Edge cases and unwanted side effects are tested
- [ ] Readability

View File

@ -69,10 +69,10 @@ jobs:
before_cache: rm -rf "$HOME/.m2/repository/pro/taskana"
- stage: Compile
name: taskana-lib
name: taskana-common + taskana-lib
install: skip
env: MODULE=LIB
script: ci/compile.sh "$MODULE"
script: ci/compile.sh COMMON && ci/compile.sh "$MODULE"
before_cache: rm -rf "$HOME/.m2/repository/pro/taskana"
- stage: Compile
@ -83,7 +83,7 @@ jobs:
before_cache: rm -rf "$HOME/.m2/repository/pro/taskana"
- stage: Compile
name: taskana-simplehistory
name: taskana-history
install: skip
env: MODULE=HISTORY
script: ci/compile.sh "$MODULE"
@ -100,14 +100,14 @@ jobs:
&& ( cd web && npm run build:prod-silent )
&& mvn -q install -T 4C -am -Dasciidoctor.skip -DskipTests -Dcheckstyle.skip -pl :taskana-rest-spring-example-boot,:taskana-cdi
&& mvn -q prepare-package -pl :taskana-rest-spring
&& mvn -q install -f history -T 4C -am -DskipTests -Dmaven.javadoc.skip -Dcheckstyle.skip -pl :taskana-simplehistory-rest-spring-example
&& mvn -q install -f history -T 4C -am -DskipTests -Dmaven.javadoc.skip -Dcheckstyle.skip -pl :taskana-simplehistory-rest-spring
&& mvn -q install -P history.plugin -DskipTests -Dcheckstyle.skip -pl :taskana-rest-spring-example-boot
before_script: ci/verify_docs_jar.sh
script: |
mvn deploy -T 4C -P `[[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "release" || echo "snapshot"` \
--settings ci/mvnsettings.xml -DskipTests -Dcheckstyle.skip -pl !:taskana-spring-example,!:taskana-cdi-example,\
!:taskana-rest-spring-example-boot,!:taskana-rest-spring-example-wildfly,\
!:taskana-simplehistory-rest-spring-example
--settings ci/mvnsettings.xml -DskipTests -Dcheckstyle.skip \
-pl !:taskana-cdi-example,!:taskana-spring-example,\
!:taskana-rest-spring-example-common,!:taskana-rest-spring-example-boot,!:taskana-rest-spring-example-wildfly
before_cache: rm -rf "$HOME/.m2/repository/pro/taskana"
# travis_terminate is necessary since after_success is a job phase which can change the build result.
# it is not documented, so this is a little hack. see: https://docs.travis-ci.com/user/job-lifecycle/#breaking-the-build

View File

@ -11,8 +11,10 @@ set -e # fail fast
#H
#H module:
#H - WEB
#H - COMMON
#H - LIB
#H - REST
#H - HISTORY
# Arguments:
# $1: exit code
function helpAndExit() {
@ -30,9 +32,14 @@ function main() {
(cd $REL/../web && npm run lint)
(cd $REL/../web && npm run build)
;;
LIB)
COMMON)
set -x
mvn -q install -B -f $REL/.. -DskipTests -Dcheckstyle.skip -Dmaven.javadoc.skip -N
mvn -q test-compile -B -f $REL/../common
;;
LIB)
set -x
mvn -q install -B -f $REL/.. -pl :taskana-core -am -DskipTests -Dcheckstyle.skip -Dmaven.javadoc.skip
mvn -q test-compile -B -f $REL/../lib
;;
REST)

View File

@ -85,4 +85,5 @@ function main() {
;;
esac
}
main "$@"

22
common/pom.xml Normal file
View File

@ -0,0 +1,22 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
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-parent</artifactId>
<packaging>pom</packaging>
<name>${project.groupId}:${project.artifactId}</name>
<description>This pom is parent to all taskana common modules and serves the common build.</description>
<parent>
<groupId>pro.taskana</groupId>
<artifactId>taskana-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modules>
<module>taskana-common</module>
<module>taskana-common-data</module>
<module>taskana-common-test</module>
</modules>
</project>

View File

@ -1,15 +1,15 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
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-data</artifactId>
<artifactId>taskana-common-data</artifactId>
<name>${project.groupId}:${project.artifactId}</name>
<description>The helper module to import data for testing.</description>
<parent>
<groupId>pro.taskana</groupId>
<artifactId>taskana-lib-parent</artifactId>
<version>4.1.1-SNAPSHOT</version>
<artifactId>taskana-common-parent</artifactId>
<version>4.2.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -23,6 +23,11 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>pro.taskana</groupId>
<artifactId>taskana-common</artifactId>
<version>${project.version}</version>
</dependency>
<!-- test dependencies -->
<dependency>

View File

@ -18,7 +18,6 @@ import java.util.stream.Stream;
import javax.sql.DataSource;
import org.apache.ibatis.jdbc.RuntimeSqlException;
import org.apache.ibatis.jdbc.ScriptRunner;
import org.apache.ibatis.jdbc.SqlRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -29,17 +28,14 @@ public class SampleDataGenerator {
private static final String CACHED_TEST = "TEST";
private static final String CACHED_SAMPLE = "SAMPLE";
private static final String CACHED_EVENTSAMPLE = "EVENTSAMPLE";
private static final String CACHED_MONITOR = "MONITOR";
private static final String CACHED_CLEARDB = "CLEARDB";
private static final String CACHED_DROPDB = "DROPDB";
private static HashMap<String, List<String>> cachedScripts = new HashMap<>();
private static final String CACHED_CLEAR_DB = "CLEARDB";
private static final String CACHED_DROP_DB = "DROP_DB";
private static final HashMap<String, List<String>> CACHED_SCRIPTS = new HashMap<>();
private final DataSource dataSource;
private final ZonedDateTime now;
/**
* This value cannot be automatically obtained by connection.getSchema(), because setting not yet
* existing schema will result into an SQL Exception.
*/
// This value cannot be automatically obtained by connection.getSchema(), because setting not yet
// existing schema will result into an SQL Exception.
private final String schema;
public SampleDataGenerator(DataSource dataSource, String schema) {
@ -54,21 +50,9 @@ public class SampleDataGenerator {
public void generateSampleData() {
LOGGER.debug("entry to generateSampleData()");
runScripts(
(runner) -> {
clearDb();
Stream<String> scripts;
String cacheKey;
// dbtable constants?
if (tableExists("TASK_HISTORY_EVENT")) {
scripts = SampleDataProvider.getScriptsWithEvents();
cacheKey = CACHED_EVENTSAMPLE;
} else {
scripts = SampleDataProvider.getSampleDataCreationScripts();
cacheKey = CACHED_SAMPLE;
}
executeAndCacheScripts(scripts, cacheKey);
});
clearDb();
Stream<String> scripts = SampleDataProvider.getSampleDataCreationScripts();
executeAndCacheScripts(scripts, CACHED_SAMPLE);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("exit from generateSampleData()");
}
@ -93,30 +77,17 @@ public class SampleDataGenerator {
public void clearDb() {
LOGGER.debug("entry to clearDb()");
Stream<String> scripts = SampleDataProvider.getScriptsToClearDatabase();
executeAndCacheScripts(scripts, CACHED_CLEARDB);
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_DROPDB);
executeAndCacheScripts(scripts, CACHED_DROP_DB);
LOGGER.debug("exit from dropDb()");
}
boolean tableExists(String table) {
try (Connection connection = dataSource.getConnection()) {
connection.setSchema(schema);
SqlRunner runner = new SqlRunner(connection);
String tableSafe = SqlReplacer.getSanitizedTableName(table);
String query = "SELECT 1 FROM " + tableSafe + " LIMIT 1;";
runner.run(query);
return true;
} catch (RuntimeSqlException | SQLException e) {
return false;
}
}
private List<String> parseScripts(Stream<String> scripts) {
try (Connection connection = dataSource.getConnection()) {
String dbProductName = connection.getMetaData().getDatabaseProductName();
@ -156,7 +127,7 @@ public class SampleDataGenerator {
LOGGER.debug("entry to executeAndCacheScripts(scripts = {}, cacheKey = {})", scripts, cacheKey);
runScripts(
runner ->
cachedScripts.computeIfAbsent(cacheKey, key -> parseScripts(scripts)).stream()
CACHED_SCRIPTS.computeIfAbsent(cacheKey, key -> parseScripts(scripts)).stream()
.map(s -> s.getBytes(StandardCharsets.UTF_8))
.map(ByteArrayInputStream::new)
.map(s -> new InputStreamReader(s, StandardCharsets.UTF_8))
@ -174,6 +145,7 @@ public class SampleDataGenerator {
connection.setSchema(schema);
runner.setLogWriter(logWriter);
runner.setErrorLogWriter(errorLogWriter);
runner.setStopOnError(true);
return runner;
}
}

View File

@ -43,11 +43,8 @@ public final class SampleDataProvider {
SAMPLE_TASK_COMMENT,
SAMPLE_ATTACHMENT,
SAMPLE_WORKBASKET_ACCESS_LIST,
SAMPLE_OBJECT_REFERENCE);
}
static Stream<String> getScriptsWithEvents() {
return Stream.concat(getSampleDataCreationScripts(), Stream.of(SAMPLE_TASK_HISTORY_EVENT));
SAMPLE_OBJECT_REFERENCE,
SAMPLE_TASK_HISTORY_EVENT);
}
static Stream<String> getScriptsToClearDatabase() {

View File

@ -10,6 +10,8 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import pro.taskana.common.internal.configuration.DB;
/** This class replaces boolean values with int values if the database is db2. */
final class SqlReplacer {
@ -18,20 +20,13 @@ final class SqlReplacer {
static final DateTimeFormatter DATE_TIME_FORMATTER =
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
// to prevent initialization
private SqlReplacer() {}
static String getScriptAsSql(String dbProductName, ZonedDateTime now, String scriptPath) {
return parseAndReplace(getScriptBufferedStream(scriptPath), now, dbProductName);
}
static boolean isPostgreSql(String databaseProductName) {
return "PostgreSQL".equals(databaseProductName);
}
static boolean isDb2(String dbProductName) {
return dbProductName != null && dbProductName.contains("DB2");
}
/**
* This method resolves the custom sql function defined through this regex: {@value
* RELATIVE_DATE_REGEX}. Its parameter is a digit representing the relative offset of a given
@ -65,17 +60,13 @@ final class SqlReplacer {
.orElse(null);
}
static String getSanitizedTableName(String table) {
return table.replaceAll("[^a-zA-Z0-9_]", "__");
}
private static String replaceBooleanWithInteger(String sql) {
return sql.replaceAll("(?i)true", "1").replaceAll("(?i)false", "0");
}
private static String parseAndReplace(
BufferedReader bufferedReader, ZonedDateTime now, String dbProductname) {
boolean isDb2 = isDb2(dbProductname);
boolean isDb2 = DB.isDb2(dbProductname);
String sql = bufferedReader.lines().collect(Collectors.joining(System.lineSeparator()));
if (isDb2) {
sql = replaceBooleanWithInteger(sql);

View File

@ -11,6 +11,5 @@ DELETE FROM WORKBASKET;
DELETE FROM DISTRIBUTION_TARGETS;
DELETE FROM CLASSIFICATION;
DELETE FROM OBJECT_REFERENCE;
-- do not clean JOB table
-- DELETE FROM SCHEDULED_JOB;
DELETE FROM SCHEDULED_JOB;
COMMIT;

View File

@ -0,0 +1,46 @@
-- TASK_HISTORY_EVENT TABLE (ID , BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, TASK_ID , EVENT_TYPE, CREATED , USER_ID , DOMAIN , WORKBASKET_KEY , POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE , TASK_CLASSIFICATION_KEY, TASK_CLASSIFICATION_CATEGORY, ATTACHMENT_CLASSIFICATION_KEY, OLD_VALUE , NEW_VALUE , CUSTOM_1 , CUSTOM_2 , CUSTOM_3 , CUSTOM_4 , DETAILS );
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000000', 'BPI:01' , '' , 'TKI:000000000000000000000000000000000000', 'CREATED' , RELATIVE_DATE(0) , 'USER_2_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', 'L140101' , 'TASK' , '' , 'old_val12', 'new_val12', 'custom1', 'custom2', 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000001', 'BPI:02' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-2), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '65464564', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000002', 'BPI:03' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000003', 'BPI:04' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000004', 'BPI:03' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000005', 'BPI:02' , '' , 'TKI:000000000000000000000000000000000000', 'CREATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000006', 'BPI:06' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000007', 'BPI:02' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000008', 'BPI:04' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'CREATED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000009', 'BPI:02' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000010', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000011', 'BPI:03' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000012', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000013', 'BPI:03' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000014', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000015', 'BPI:05' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000016', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'CREATED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000017', 'BPI:04' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000018', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000019', 'BPI:03' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000020', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000021', 'BPI:05' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000022', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000023', 'BPI:05' , '' , 'TKI:000000000000000000000000000000000000', 'CREATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000024', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000025', 'BPI:03' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000026', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'CREATED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000027', 'BPI:04' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000028', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000029', 'BPI:03' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000030', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000031', 'BPI:05' , '' , 'TKI:000000000000000000000000000000000000', 'CREATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000032', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000033', 'BPI:06' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000034', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'CREATED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000035', 'BPI:04' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000036', 'BPI:03' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000037', 'BPI:02' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000038', 'BPI:03' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000039', 'BPI:02' , '' , 'TKI:000000000000000000000000000000000000', 'CREATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000040', 'BPI:06' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000041', 'BPI:02' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000042', 'BPI:03' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000043', 'BPI:04' , '' , 'TKI:000000000000000000000000000000000000', 'CREATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
INSERT INTO TASK_HISTORY_EVENT VALUES ('THI:000000000000000000000000000000000044', 'BPI:03' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');

View File

@ -1,17 +1,17 @@
INSERT INTO TASK_HISTORY_EVENT (ID,BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, TASK_ID, EVENT_TYPE, CREATED, USER_ID, DOMAIN, WORKBASKET_KEY, POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, TASK_CLASSIFICATION_KEY,
TASK_CLASSIFICATION_CATEGORY, ATTACHMENT_CLASSIFICATION_KEY, OLD_VALUE, NEW_VALUE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, DETAILS) VALUES
-- BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, TASK_ID, EVENT_TYPE, CREATED, USER_ID, DOMAIN, WORKBASKET_KEY, POR_COMPANY , POR_SYSTEM, POR_INSTANCE , POR_TYPE , POR_VALUE , TASK_CLASSIFICATION_KEY, TASK_CLASSIFICATION_CATEGORY , ATTACHMENT_CLASSIFICATION_KEY , OLD_VALUE , NEW_VALUE , CUSTOM_1 , CUSTOM_2 , CUSTOM_3 , CUSTOM_4, details
('HEI:000000000000000000000000000000000000','BPI:01' ,'' ,'TKI:000000000000000000000000000000000000', 'UPDATED', '2018-01-29 15:55:00' , 'admin', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', 'L140101' , 'TASK' ,'' ,'old_val' ,'new_val' ,'custom1' ,'custom2' , 'custom3' ,'custom4', '{"changes":[{"newValue":"BPI:01","fieldName":"businessProcessId","oldValue":"BPI:02"},{"newValue":"admin","fieldName":"owner","oldValue":"owner1"}]}' ),
('HEI:000000000000000000000000000000000001','BPI:02' ,'' ,'TKI:000000000000000000000000000000000000', 'CREATED', '2018-01-29 15:55:01','peter', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'someDetails' ),
('HEI:000000000000000000000000000000000002','BPI:03' ,'BPI:01','TKI:000000000000000000000000000000000036','CREATED', '2018-01-29 15:55:02' , 'admin', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'someDetails' ),
('HEI:000000000000000000000000000000000003','BPI:02' ,'' ,'TKI:000000000000000000000000000000000036', 'CREATED', '2018-01-29 15:55:03','peter', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'someDetails' ),
('HEI:000000000000000000000000000000000004','BPI:03' ,'BPI:01','TKI:000000000000000000000000000000000037','CREATED', '2018-01-29 15:55:04' , 'admin', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'someDetails' ),
('HEI:000000000000000000000000000000000005','BPI:02' ,'' ,'TKI:000000000000000000000000000000000038', 'CREATED', '2018-01-29 15:55:05','peter', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'someDetails' ),
('HEI:000000000000000000000000000000000006','BPI:03' ,'BPI:01','TKI:000000000000000000000000000000000038','CREATED', '2018-01-29 15:55:06' , 'admin', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'someDetails' ),
('HEI:000000000000000000000000000000000007','BPI:02' ,'' ,'TKI:000000000000000000000000000000000039', 'CREATED', '2018-01-29 15:55:07','peter', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'someDetails' ),
('HEI:000000000000000000000000000000000008','BPI:03' ,'BPI:01','TKI:000000000000000000000000000000000039','CREATED', '2018-01-29 15:55:08' , 'admin', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'someDetails' ),
('HEI:000000000000000000000000000000000009','BPI:02' ,'' ,'TKI:000000000000000000000000000000000040', 'CREATED', '2018-01-29 15:55:09','peter', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'someDetails' ),
('HEI:000000000000000000000000000000000010','BPI:03' ,'BPI:01','TKI:000000000000000000000000000000000040','CREATED', '2018-01-29 15:55:10' , 'admin', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'someDetails' ),
('HEI:000000000000000000000000000000000011','BPI:02' ,'' ,'TKI:000000000000000000000000000000000066', 'CREATED', '2018-01-29 15:55:11','peter', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'someDetails' ),
('HEI:000000000000000000000000000000000012','BPI:03' ,'BPI:01','TKI:000000000000000000000000000000000066','CREATED', '2018-01-29 15:55:12' , 'admin', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'someDetails' )
('THI:000000000000000000000000000000000000','BPI:01' ,'' ,'TKI:000000000000000000000000000000000000', 'UPDATED', '2018-01-29 15:55:00' , 'admin', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', 'L140101' , 'TASK' ,'' ,'old_val' ,'new_val' ,'custom1' ,'custom2' , 'custom3' ,'custom4', '{"changes":[{"newValue":"BPI:01","fieldName":"businessProcessId","oldValue":"BPI:02"},{"newValue":"admin","fieldName":"owner","oldValue":"owner1"}]}' ),
('THI:000000000000000000000000000000000001','BPI:02' ,'' ,'TKI:000000000000000000000000000000000000', 'CREATED', '2018-01-29 15:55:01','peter', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'someDetails' ),
('THI:000000000000000000000000000000000002','BPI:03' ,'BPI:01','TKI:000000000000000000000000000000000036','CREATED', '2018-01-29 15:55:02' , 'admin', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'someDetails' ),
('THI:000000000000000000000000000000000003','BPI:02' ,'' ,'TKI:000000000000000000000000000000000036', 'CREATED', '2018-01-29 15:55:03','peter', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'someDetails' ),
('THI:000000000000000000000000000000000004','BPI:03' ,'BPI:01','TKI:000000000000000000000000000000000037','CREATED', '2018-01-29 15:55:04' , 'admin', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'someDetails' ),
('THI:000000000000000000000000000000000005','BPI:02' ,'' ,'TKI:000000000000000000000000000000000038', 'CREATED', '2018-01-29 15:55:05','peter', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'someDetails' ),
('THI:000000000000000000000000000000000006','BPI:03' ,'BPI:01','TKI:000000000000000000000000000000000038','CREATED', '2018-01-29 15:55:06' , 'admin', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'someDetails' ),
('THI:000000000000000000000000000000000007','BPI:02' ,'' ,'TKI:000000000000000000000000000000000039', 'CREATED', '2018-01-29 15:55:07','peter', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'someDetails' ),
('THI:000000000000000000000000000000000008','BPI:03' ,'BPI:01','TKI:000000000000000000000000000000000039','CREATED', '2018-01-29 15:55:08' , 'admin', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'someDetails' ),
('THI:000000000000000000000000000000000009','BPI:02' ,'' ,'TKI:000000000000000000000000000000000040', 'CREATED', '2018-01-29 15:55:09','peter', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'someDetails' ),
('THI:000000000000000000000000000000000010','BPI:03' ,'BPI:01','TKI:000000000000000000000000000000000040','CREATED', '2018-01-29 15:55:10' , 'admin', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'someDetails' ),
('THI:000000000000000000000000000000000011','BPI:02' ,'' ,'TKI:000000000000000000000000000000000066', 'CREATED', '2018-01-29 15:55:11','peter', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom2' ,'' ,'someDetails' ),
('THI:000000000000000000000000000000000012','BPI:03' ,'BPI:01','TKI:000000000000000000000000000000000066','CREATED', '2018-01-29 15:55:12' , 'admin', 'DOMAIN_A', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'' ,'someDetails' )
;

View File

@ -10,19 +10,17 @@ class SampleDataProviderTest {
@Test
void getScriptsNotNull() {
assertThat(SampleDataProvider.getSampleDataCreationScripts()).isNotNull();
assertThat(SampleDataProvider.getScriptsWithEvents()).isNotNull();
}
@Test
void getScriptsNotEmpty() {
assertThat(SampleDataProvider.getSampleDataCreationScripts().count() > 0).isTrue();
assertThat(SampleDataProvider.getScriptsWithEvents().count() > 0).isTrue();
assertThat(SampleDataProvider.getSampleDataCreationScripts()).isNotEmpty();
}
@Test
void getScriptsFileExists() {
SampleDataProvider.getSampleDataCreationScripts()
.map(SqlReplacer::getScriptBufferedStream)
.forEach(script -> assertThat(script).isNotNull());
assertThat(SampleDataProvider.getSampleDataCreationScripts())
.extracting(SqlReplacer::getScriptBufferedStream)
.doesNotContainNull();
}
}

View File

@ -0,0 +1,93 @@
<?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-test</artifactId>
<name>${project.groupId}:${project.artifactId}</name>
<description>The helper module for test utils</description>
<parent>
<artifactId>taskana-common-parent</artifactId>
<groupId>pro.taskana</groupId>
<version>4.2.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>pro.taskana</groupId>
<artifactId>taskana-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>pro.taskana</groupId>
<artifactId>taskana-common-data</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-parameter-names</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-mockmvc</artifactId>
</dependency>
<!-- TEST DEPENDENCIES -->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,4 +1,4 @@
package pro.taskana.doc.api;
package pro.taskana.common.test.doc.api;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
@ -13,9 +13,9 @@ import org.springframework.context.annotation.Import;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.context.WebApplicationContext;
import pro.taskana.common.rest.RestHelper;
import pro.taskana.common.rest.TaskanaSpringBootTest;
import pro.taskana.doc.api.BaseRestDocumentation.ResultHandlerConfiguration;
import pro.taskana.common.test.doc.api.BaseRestDocumentation.ResultHandlerConfiguration;
import pro.taskana.common.test.rest.RestHelper;
import pro.taskana.common.test.rest.TaskanaSpringBootTest;
/** Base class for Rest Documentation tests. */
@TaskanaSpringBootTest

View File

@ -1,4 +1,4 @@
package pro.taskana.common.rest;
package pro.taskana.common.test.rest;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

View File

@ -1,4 +1,4 @@
package pro.taskana.common.rest;
package pro.taskana.common.test.rest;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
@ -10,8 +10,6 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ActiveProfiles;
import pro.taskana.TestConfiguration;
/** Use this annotation to test with a spring context and a standardized configuration. */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)

View File

@ -1,10 +1,11 @@
package pro.taskana;
package pro.taskana.common.test.rest;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.DependsOn;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
@ -12,6 +13,7 @@ import org.springframework.transaction.PlatformTransactionManager;
import pro.taskana.sampledata.SampleDataGenerator;
@SpringBootApplication
@ComponentScan("pro.taskana")
@DependsOn("getTaskanaEngine") // wait for schema to be created BEFORE inserting test data
public class TestConfiguration {

View File

@ -1,4 +1,4 @@
package acceptance.security;
package pro.taskana.common.test.security;
import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated;
import static pro.taskana.common.internal.util.CheckedFunction.wrap;
@ -36,8 +36,8 @@ import org.junit.platform.commons.JUnitException;
import org.junit.platform.commons.support.AnnotationSupport;
import pro.taskana.common.api.exceptions.SystemException;
import pro.taskana.common.internal.security.GroupPrincipal;
import pro.taskana.common.internal.security.UserPrincipal;
import pro.taskana.common.api.security.GroupPrincipal;
import pro.taskana.common.api.security.UserPrincipal;
/** Runner for integration tests that enables JAAS subject. */
public class JaasExtension implements InvocationInterceptor, TestTemplateInvocationContextProvider {

View File

@ -1,4 +1,4 @@
package acceptance.security;
package pro.taskana.common.test.security;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;

View File

@ -1,4 +1,4 @@
package acceptance.security;
package pro.taskana.common.test.security;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

View File

@ -281,4 +281,3 @@ dn: cn=Organisationseinheit B,cn=organisation,OU=Test,O=TASKANA
cn: Organisationseinheit B
objectclass: groupofuniquenames
objectclass: top

View File

@ -1,4 +1,4 @@
package pro.taskana.common.internal.security;
package pro.taskana.common.test.security;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.DynamicContainer.dynamicContainer;
@ -23,37 +23,42 @@ import org.junit.jupiter.api.TestFactory;
import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.security.CurrentUserContext;
import pro.taskana.common.internal.security.CurrentUserContextImpl;
@ExtendWith(JaasExtension.class)
class JaasExtensionTest {
private static final String INSIDE_DYNAMIC_TEST_USER = "insidedynamictest";
private static final CurrentUserContext CURRENT_USER_CONTEXT = new CurrentUserContextImpl(true);
private static final DynamicTest NOT_NULL_DYNAMIC_TEST =
dynamicTest("dynamic test", () -> assertThat(CurrentUserContext.getUserid()).isNotNull());
dynamicTest("dynamic test", () -> assertThat(CURRENT_USER_CONTEXT.getUserid()).isNotNull());
private static final DynamicTest NULL_DYNAMIC_TEST =
dynamicTest("dynamic test", () -> assertThat(CurrentUserContext.getUserid()).isEqualTo(null));
dynamicTest(
"dynamic test", () -> assertThat(CURRENT_USER_CONTEXT.getUserid()).isNull());
private static final DynamicTest DYNAMIC_TEST_USER_DYNAMIC_TEST =
dynamicTest(
"dynamic test",
() -> assertThat(CurrentUserContext.getUserid()).isEqualTo(INSIDE_DYNAMIC_TEST_USER));
() -> assertThat(CURRENT_USER_CONTEXT.getUserid()).isEqualTo(INSIDE_DYNAMIC_TEST_USER));
// region JaasExtension#interceptBeforeAllMethod
@BeforeAll
static void should_NotSetJaasSubject_When_AnnotationIsMissing_On_BeforeAll() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
assertThat(CURRENT_USER_CONTEXT.getUserid()).isNull();
}
@WithAccessId(user = "beforeall")
@BeforeAll
static void should_SetJaasSubject_When_AnnotationExists_On_BeforeAll() {
assertThat(CurrentUserContext.getUserid()).isEqualTo("beforeall");
assertThat(CURRENT_USER_CONTEXT.getUserid()).isEqualTo("beforeall");
}
@WithAccessId(user = "beforeall")
@WithAccessId(user = "beforeall2")
@BeforeAll
static void should_NotSetJaasSubject_When_MultipleAnnotationsExist_On_BeforeAll() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
assertThat(CURRENT_USER_CONTEXT.getUserid()).isNull();
}
// endregion
@ -62,20 +67,20 @@ class JaasExtensionTest {
@BeforeEach
void should_NotSetJaasSubject_When_AnnotationIsMissing_On_BeforeEach() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
assertThat(CURRENT_USER_CONTEXT.getUserid()).isNull();
}
@WithAccessId(user = "beforeeach")
@BeforeEach
void should_SetJaasSubject_When_AnnotationExists_On_BeforeEach() {
assertThat(CurrentUserContext.getUserid()).isEqualTo("beforeeach");
assertThat(CURRENT_USER_CONTEXT.getUserid()).isEqualTo("beforeeach");
}
@WithAccessId(user = "beforeeach")
@WithAccessId(user = "beforeeach2")
@BeforeEach
void should_NotSetJaasSubject_When_MultipleAnnotationsExist_On_BeforeEach() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
assertThat(CURRENT_USER_CONTEXT.getUserid()).isNull();
}
// endregion
@ -84,20 +89,20 @@ class JaasExtensionTest {
@AfterEach
void should_NotSetJaasSubject_When_AnnotationIsMissing_On_AfterEach() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
assertThat(CURRENT_USER_CONTEXT.getUserid()).isNull();
}
@WithAccessId(user = "aftereach")
@AfterEach
void should_SetJaasSubject_When_AnnotationExists_On_AfterEach() {
assertThat(CurrentUserContext.getUserid()).isEqualTo("aftereach");
assertThat(CURRENT_USER_CONTEXT.getUserid()).isEqualTo("aftereach");
}
@WithAccessId(user = "aftereach")
@WithAccessId(user = "afterach2")
@AfterEach
void should_NotSetJaasSubject_When_MultipleAnnotationsExist_On_AfterEach() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
assertThat(CURRENT_USER_CONTEXT.getUserid()).isNull();
}
// endregion
@ -106,20 +111,20 @@ class JaasExtensionTest {
@AfterAll
static void should_NotSetJaasSubject_When_AnnotationIsMissing_On_AfterAll() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
assertThat(CURRENT_USER_CONTEXT.getUserid()).isNull();
}
@WithAccessId(user = "afterall")
@AfterAll
static void should_SetJaasSubject_When_AnnotationExists_On_AfterAll() {
assertThat(CurrentUserContext.getUserid()).isEqualTo("afterall");
assertThat(CURRENT_USER_CONTEXT.getUserid()).isEqualTo("afterall");
}
@WithAccessId(user = "afterall")
@WithAccessId(user = "afterall2")
@AfterAll
static void should_NotSetJaasSubject_When_MultipleAnnotationsExist_On_AfterAll() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
assertThat(CURRENT_USER_CONTEXT.getUserid()).isNull();
}
// endregion
@ -128,14 +133,14 @@ class JaasExtensionTest {
@Test
void should_NotSetJaasSubject_When_AnnotationIsMissing_On_Test() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
assertThat(CURRENT_USER_CONTEXT.getUserid()).isNull();
}
@WithAccessId(user = "user")
@Test
void should_SetJaasSubject_When_AnnotationExists_On_Test() {
assertThat(CurrentUserContext.getUserid()).isEqualTo("user");
assertThat(CurrentUserContext.getGroupIds()).isEmpty();
assertThat(CURRENT_USER_CONTEXT.getUserid()).isEqualTo("user");
assertThat(CURRENT_USER_CONTEXT.getGroupIds()).isEmpty();
}
@WithAccessId(
@ -143,15 +148,15 @@ class JaasExtensionTest {
groups = {"group1", "group2"})
@Test
void should_SetJaasSubjectWithGroups_When_AnnotationExistsWithGroups_On_Test() {
assertThat(CurrentUserContext.getUserid()).isEqualTo("user");
assertThat(CurrentUserContext.getGroupIds()).containsExactlyInAnyOrder("group1", "group2");
assertThat(CURRENT_USER_CONTEXT.getUserid()).isEqualTo("user");
assertThat(CURRENT_USER_CONTEXT.getGroupIds()).containsExactlyInAnyOrder("group1", "group2");
}
@WithAccessId(user = "user")
@Test
@Disabled("this can be tested with a org.junit.platform.launcher.TestExecutionListener")
void should_NotInjectParameter_When_ParameterIsPresent_On_Test(WithAccessId accessId) {
assertThat(CurrentUserContext.getUserid()).isEqualTo("user");
assertThat(CURRENT_USER_CONTEXT.getUserid()).isEqualTo("user");
}
@WithAccessId(user = "user")
@ -159,7 +164,7 @@ class JaasExtensionTest {
@Test
@Disabled("this can be tested with a org.junit.platform.launcher.TestExecutionListener")
void should_ThrowException_When_MultipleAnnotationsExist_On_Test() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
assertThat(CURRENT_USER_CONTEXT.getUserid()).isNull();
}
// endregion
@ -168,14 +173,14 @@ class JaasExtensionTest {
@TestFactory
List<DynamicTest> should_NotSetJaasSubject_When_AnnotationIsMissing_On_TestFactory() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
assertThat(CURRENT_USER_CONTEXT.getUserid()).isNull();
return Collections.emptyList();
}
@WithAccessId(user = "testfactory")
@TestFactory
List<DynamicTest> should_SetJaasSubject_When_AnnotationExists_On_TestFactory() {
assertThat(CurrentUserContext.getUserid()).isEqualTo("testfactory");
assertThat(CURRENT_USER_CONTEXT.getUserid()).isEqualTo("testfactory");
return Collections.emptyList();
}
@ -184,7 +189,7 @@ class JaasExtensionTest {
@TestFactory
List<DynamicTest>
should_SetJaasSubjectFromFirstAnnotation_When_MultipleAnnotationsExists_On_TestFactory() {
assertThat(CurrentUserContext.getUserid()).isEqualTo("testfactory1");
assertThat(CURRENT_USER_CONTEXT.getUserid()).isEqualTo("testfactory1");
return Collections.emptyList();
}
@ -195,13 +200,13 @@ class JaasExtensionTest {
@TestTemplate
@Disabled("this can be tested with a org.junit.platform.launcher.TestExecutionListener")
void should_NotFindContextProvider_When_AnnotationIsMissing_On_TestTemplate() {
assertThat(CurrentUserContext.getUserid()).isNotNull();
assertThat(CURRENT_USER_CONTEXT.getUserid()).isNotNull();
}
@WithAccessId(user = "testtemplate")
@TestTemplate
void should_SetJaasSubject_When_AnnotationExists_On_TestTemplate() {
assertThat(CurrentUserContext.getUserid()).isEqualTo("testtemplate");
assertThat(CURRENT_USER_CONTEXT.getUserid()).isEqualTo("testtemplate");
}
@WithAccessId(user = "testtemplate1")
@ -210,7 +215,7 @@ class JaasExtensionTest {
@TestTemplate
void should_SetMultipleJaasSubjects_When_MultipleAnnotationsExist_On_TestTemplate(
WithAccessId accessId) {
assertThat(CurrentUserContext.getUserid()).isEqualTo(accessId.user());
assertThat(CURRENT_USER_CONTEXT.getUserid()).isEqualTo(accessId.user());
}
@WithAccessId(user = "testtemplate1", groups = "abc")
@ -703,12 +708,12 @@ class JaasExtensionTest {
@Nested
class ConstructorWithoutAccessId {
ConstructorWithoutAccessId() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
assertThat(CURRENT_USER_CONTEXT.getUserid()).isNull();
}
@Test
void should_NotSetJaasSubject_When_AnnotationIsMissing_On_Constructor() {
assertThat(CurrentUserContext.getUserid()).isNull();
assertThat(CURRENT_USER_CONTEXT.getUserid()).isNull();
}
}
@ -716,12 +721,12 @@ class JaasExtensionTest {
class ConstructorWithAccessId {
@WithAccessId(user = "constructor")
ConstructorWithAccessId() {
assertThat(CurrentUserContext.getUserid()).isEqualTo("constructor");
assertThat(CURRENT_USER_CONTEXT.getUserid()).isEqualTo("constructor");
}
@Test
void should_SetJaasSubject_When_AnnotationExists_On_Constructor() {
assertThat(CurrentUserContext.getUserid()).isNull();
assertThat(CURRENT_USER_CONTEXT.getUserid()).isNull();
}
}

View File

@ -0,0 +1,46 @@
<?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</artifactId>
<name>${project.groupId}:${project.artifactId}</name>
<description>The global helper module</description>
<parent>
<artifactId>taskana-common-parent</artifactId>
<groupId>pro.taskana</groupId>
<version>4.2.1-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>${version.json}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${version.mybatis}</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,33 @@
package pro.taskana.common.api.security;
import java.util.List;
/**
* Provides the context information about the current (calling) user. The context is gathered from
* the JAAS subject.
*/
public interface CurrentUserContext {
/**
* Returns the userid of the current user.
*
* @return String the userid. null if there is no JAAS subject.
*/
public String getUserid();
/**
* Returns all groupIds of the current user.
*
* @return list containing all groupIds of the current user. Empty if the current user belongs to
* no groups or no JAAS Subject set.
*/
public List<String> getGroupIds();
/**
* Returns all accessIds of the current user. This combines the userId and all groupIds of the
* current user.
*
* @return list containing all accessIds of the current user. Empty if there is no JAAS subject.
*/
public List<String> getAccessIds();
}

View File

@ -1,4 +1,4 @@
package pro.taskana.common.internal.security;
package pro.taskana.common.api.security;
import java.security.Principal;
import java.security.acl.Group;

View File

@ -1,4 +1,4 @@
package pro.taskana.common.internal.security;
package pro.taskana.common.api.security;
import java.security.Principal;

View File

@ -1,6 +1,5 @@
package pro.taskana.common.internal.security;
import static pro.taskana.TaskanaEngineConfiguration.shouldUseLowerCaseForAccessIds;
import static pro.taskana.common.internal.util.CheckedFunction.wrap;
import java.lang.reflect.Method;
@ -17,38 +16,37 @@ import javax.security.auth.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Provides the context information about the current (calling) user. The context is gathered from
* the JAAS subject.
*
* @author Holger Hagen
*/
public final class CurrentUserContext {
import pro.taskana.common.api.security.CurrentUserContext;
public class CurrentUserContextImpl implements CurrentUserContext {
private static final String GET_UNIQUE_SECURITY_NAME_METHOD = "getUniqueSecurityName";
private static final String GET_CALLER_SUBJECT_METHOD = "getCallerSubject";
private static final String WSSUBJECT_CLASSNAME = "com.ibm.websphere.security.auth.WSSubject";
private static final Logger LOGGER = LoggerFactory.getLogger(CurrentUserContext.class);
private final boolean shouldUseLowerCaseForAccessIds;
private boolean runningOnWebSphere;
private static Boolean runningOnWebSphere = null;
private CurrentUserContext() {}
/**
* Returns the userid of the current user.
*
* @return String the userid. null if there is no JAAS subject.
*/
public static String getUserid() {
if (runningOnWebSphere()) {
return getUserIdFromWsSubject();
} else {
return getUserIdFromJaasSubject();
public CurrentUserContextImpl(boolean shouldUseLowerCaseForAccessIds) {
this.shouldUseLowerCaseForAccessIds = shouldUseLowerCaseForAccessIds;
try {
Class.forName(WSSUBJECT_CLASSNAME);
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.");
runningOnWebSphere = false;
}
}
public static List<String> getGroupIds() {
@Override
public String getUserid() {
return runningOnWebSphere ? getUserIdFromWsSubject() : getUserIdFromJaasSubject();
}
@Override
public List<String> getGroupIds() {
Subject subject = Subject.getSubject(AccessController.getContext());
LOGGER.trace("Subject of caller: {}", subject);
if (subject != null) {
@ -57,14 +55,15 @@ public final class CurrentUserContext {
return groups.stream()
.map(Principal::getName)
.filter(Objects::nonNull)
.map(CurrentUserContext::convertAccessId)
.map(this::convertAccessId)
.collect(Collectors.toList());
}
LOGGER.trace("No groupIds found in subject!");
return Collections.emptyList();
}
public static List<String> getAccessIds() {
@Override
public List<String> getAccessIds() {
List<String> accessIds = new ArrayList<>(getGroupIds());
accessIds.add(getUserid());
return accessIds;
@ -76,7 +75,7 @@ public final class CurrentUserContext {
*
* @return the userid of the caller. If the userid could not be obtained, null is returned.
*/
private static String getUserIdFromWsSubject() {
private String getUserIdFromWsSubject() {
try {
Class<?> wsSubjectClass = Class.forName(WSSUBJECT_CLASSNAME);
Method getCallerSubjectMethod =
@ -99,7 +98,7 @@ public final class CurrentUserContext {
LOGGER.debug(
"Returning the unique security name of first public credential: {}", o))
.map(Object::toString)
.map(CurrentUserContext::convertAccessId)
.map(this::convertAccessId)
.findFirst()
.orElse(null);
}
@ -109,26 +108,7 @@ public final class CurrentUserContext {
return null;
}
/**
* Checks, whether Taskana is running on IBM WebSphere.
*
* @return true, if it is running on IBM WebSphere
*/
private static boolean runningOnWebSphere() {
if (runningOnWebSphere == null) {
try {
Class.forName(WSSUBJECT_CLASSNAME);
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.");
runningOnWebSphere = false;
}
}
return runningOnWebSphere;
}
private static String getUserIdFromJaasSubject() {
private String getUserIdFromJaasSubject() {
Subject subject = Subject.getSubject(AccessController.getContext());
LOGGER.trace("Subject of caller: {}", subject);
if (subject != null) {
@ -138,7 +118,7 @@ public final class CurrentUserContext {
.filter(principal -> !(principal instanceof Group))
.map(Principal::getName)
.filter(Objects::nonNull)
.map(CurrentUserContext::convertAccessId)
.map(this::convertAccessId)
.findFirst()
.orElse(null);
}
@ -146,9 +126,9 @@ public final class CurrentUserContext {
return null;
}
private static String convertAccessId(String accessId) {
private String convertAccessId(String accessId) {
String toReturn = accessId;
if (shouldUseLowerCaseForAccessIds()) {
if (shouldUseLowerCaseForAccessIds) {
toReturn = accessId.toLowerCase();
}
LOGGER.trace("Found AccessId '{}'. Returning AccessId '{}' ", accessId, toReturn);

View File

@ -0,0 +1,38 @@
package pro.taskana.common.internal.util;
import java.util.UUID;
/** This class contains util methods for generating ids. */
public final class IdGenerator {
public static final String ID_PREFIX_CLASSIFICATION = "CLI";
public static final String ID_PREFIX_WORKBASKET = "WBI";
public static final String ID_PREFIX_WORKBASKET_AUTHORIZATION = "WAI";
public static final String ID_PREFIX_TASK = "TKI";
public static final String ID_PREFIX_EXT_TASK = "ETI";
public static final String ID_PREFIX_BUSINESS_PROCESS = "BPI";
public static final String ID_PREFIX_ATTACHMENT = "TAI";
public static final String ID_PREFIX_TASK_COMMENT = "TCI";
public static final String ID_PREFIX_CLASSIFICATION_HISTORY_EVENT = "CHI";
public static final String ID_PREFIX_WORKBASKET_HISTORY_EVENT = "WHI";
public static final String ID_PREFIX_TASK_HISTORY_EVENT = "THI";
private static final String SEPARATOR = ":";
// disable initialization
private IdGenerator() {}
/**
* This method create an id with an specific prefix.
*
* @param prefix only 3 characters!
* @return a String with a length of 40 characters
*/
public static String generateWithPrefix(String prefix) {
return prefix + SEPARATOR + UUID.randomUUID();
}
}

Some files were not shown because too many files have changed in this diff Show More