From 8a46f4b9ec592c88fb1d96c416a9fcd4e7cbf811 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 6 Mar 2017 07:33:40 +0100 Subject: [PATCH 01/29] Add drop table if exsist statement --- etc/activitytracker_create.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/activitytracker_create.sql b/etc/activitytracker_create.sql index 84179e3..170580f 100644 --- a/etc/activitytracker_create.sql +++ b/etc/activitytracker_create.sql @@ -1,5 +1,7 @@ SET FOREIGN_KEY_CHECKS = 0; +DROP TABLE IF EXISTS activity; + -- tables -- Table activity CREATE TABLE IF NOT EXISTS activity ( From ae0e144689423f6bf0a17ba79772772fb18e2d8e Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 6 Mar 2017 07:40:16 +0100 Subject: [PATCH 02/29] Add truncate table before replace with new demo items --- etc/activitytracker_demo_data.sql | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/etc/activitytracker_demo_data.sql b/etc/activitytracker_demo_data.sql index 60dc90e..0add33c 100644 --- a/etc/activitytracker_demo_data.sql +++ b/etc/activitytracker_demo_data.sql @@ -1,42 +1,44 @@ SET FOREIGN_KEY_CHECKS = 0; +TRUNCATE TABLE `reqbaztrack`.`activity`; + REPLACE INTO `reqbaztrack`.`activity` (`Id`, `creation_time`, `activity_action`, `data_url`, `data_type`, `data_frontend_url`, `parent_data_url`, `parent_data_type`, `user_url`) VALUES - ('1', '2015-10-21 07:00:00', 'CREATE', 'http://localhost:8080/bazaar/projects/1', 'PROJECT', + (1, '2015-10-21 07:00:00', 'CREATE', 'http://localhost:8080/bazaar/projects/1', 'PROJECT', 'http://localhost:5000/#!/projects/1', NULL, NULL, 'http://localhost:8080/bazaar/users/2'), - ('2', '2015-10-21 07:00:00', 'CREATE', 'http://localhost:8080/bazaar/components/1', 'COMPONENT', + (2, '2015-10-21 07:00:00', 'CREATE', 'http://localhost:8080/bazaar/components/1', 'COMPONENT', 'http://localhost:5000/#!/projects/1/components/1', 'http://localhost:8080/bazaar/projects/1', 'PROJECT', 'http://localhost:8080/bazaar/users/2'), - ('3', '2015-10-21 08:00:00', 'CREATE', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', + (3, '2015-10-21 08:00:00', 'CREATE', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:5000/#!/projects/1/components/1/requirements/1', 'http://localhost:8080/bazaar/components/1', 'COMPONENT', 'http://localhost:8080/bazaar/users/2'), - ('4', '2015-10-21 09:00:00', 'UPDATE', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', + (4, '2015-10-21 09:00:00', 'UPDATE', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:5000/#!/projects/1/components/1/requirements/1', 'http://localhost:8080/bazaar/components/1', 'COMPONENT', 'http://localhost:8080/bazaar/users/2'), - ('5', '2015-10-21 10:00:00', 'DELETE', NULL, 'REQUIREMENT', + (5, '2015-10-21 10:00:00', 'DELETE', NULL, 'REQUIREMENT', NULL, 'http://localhost:8080/bazaar/components/1', 'COMPONENT', 'http://localhost:8080/bazaar/users/2'), - ('6', '2015-10-21 10:00:00', 'CREATE', 'http://localhost:8080/bazaar/projects/2', 'PROJECT', + (6, '2015-10-21 10:00:00', 'CREATE', 'http://localhost:8080/bazaar/projects/2', 'PROJECT', 'http://localhost:5000/#!/projects/2', NULL, NULL, 'http://localhost:8080/bazaar/users/2'), - ('7', '2015-10-21 10:00:00', 'CREATE', 'http://localhost:8080/bazaar/components/2', 'COMPONENT', + (7, '2015-10-21 10:00:00', 'CREATE', 'http://localhost:8080/bazaar/components/2', 'COMPONENT', 'http://localhost:5000/#!/projects/2/components/2', 'http://localhost:8080/bazaar/projects/2', 'PROJECT', 'http://localhost:8080/bazaar/users/2'), - ('8', '2015-10-21 11:00:00', 'CREATE', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', + (8, '2015-10-21 11:00:00', 'CREATE', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', 'http://localhost:5000/#!/projects/1/components/1/requirements/1', 'http://localhost:8080/bazaar/components/1', 'COMPONENT', 'http://localhost:8080/bazaar/users/2'), - ('9', '2015-10-21 12:00:00', 'UPDATE', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', + (9, '2015-10-21 12:00:00', 'UPDATE', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', 'http://localhost:5000/#!/projects/1/components/1/requirements/1', 'http://localhost:8080/bazaar/components/1', 'COMPONENT', 'http://localhost:8080/bazaar/users/2'), - ('10', '2015-10-21 13:00:00', 'CREATE', 'http://localhost:8080/bazaar/comments/1', 'COMMENT', + (10, '2015-10-21 13:00:00', 'CREATE', 'http://localhost:8080/bazaar/comments/1', 'COMMENT', 'http://localhost:5000/#!/projects/1/components/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'), - ('11', '2015-10-21 14:00:00', 'CREATE', 'http://localhost:8080/bazaar/comments/2', 'COMMENT', + (11, '2015-10-21 14:00:00', 'CREATE', 'http://localhost:8080/bazaar/comments/2', 'COMMENT', 'http://localhost:5000/#!/projects/1/components/1/requirements/2', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'), - ('12', '2015-10-21 15:00:00', 'CREATE', 'http://localhost:8080/bazaar/requirements/1', 'VOTE', + (12, '2015-10-21 15:00:00', 'CREATE', 'http://localhost:8080/bazaar/requirements/1', 'VOTE', 'http://localhost:5000/#!/projects/1/components/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'), - ('13', '2015-10-21 15:00:00', 'DELETE', NULL, 'VOTE', + (13, '2015-10-21 15:00:00', 'DELETE', NULL, 'VOTE', 'http://localhost:5000/#!/projects/1/components/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'); From e8e3b85680eebde64906caa0ac1a9b363344032c Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Wed, 8 Mar 2017 15:56:52 +0100 Subject: [PATCH 03/29] Used database name, used same naming convention like reqbaz in create and demo data script --- etc/activitytracker_create.sql | 26 ++++++++++++++------------ etc/activitytracker_demo_data.sql | 4 ++-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/etc/activitytracker_create.sql b/etc/activitytracker_create.sql index 170580f..61b65ca 100644 --- a/etc/activitytracker_create.sql +++ b/etc/activitytracker_create.sql @@ -1,20 +1,22 @@ SET FOREIGN_KEY_CHECKS = 0; -DROP TABLE IF EXISTS activity; +CREATE DATABASE IF NOT EXISTS reqbaztrack; + +DROP TABLE IF EXISTS reqbaztrack.activity; -- tables -- Table activity -CREATE TABLE IF NOT EXISTS activity ( - Id INT NOT NULL AUTO_INCREMENT, - creation_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - activity_action VARCHAR(255) NOT NULL, - data_url VARCHAR(255) NULL, - data_type VARCHAR(255) NOT NULL, - data_frontend_url VARCHAR(255) NULL, - parent_data_url VARCHAR(255) NULL, - parent_data_type VARCHAR(255) NULL, - user_url VARCHAR(255) NULL, - CONSTRAINT activity_pk PRIMARY KEY (Id) +CREATE TABLE IF NOT EXISTS reqbaztrack.activity ( + id INT NOT NULL AUTO_INCREMENT, + creation_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + activity_action VARCHAR(255) NOT NULL, + data_url VARCHAR(255) NULL, + data_type VARCHAR(255) NOT NULL, + data_frontend_url VARCHAR(255) NULL, + parent_data_url VARCHAR(255) NULL, + parent_data_type VARCHAR(255) NULL, + user_url VARCHAR(255) NULL, + CONSTRAINT activity_pk PRIMARY KEY (id) ); SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file diff --git a/etc/activitytracker_demo_data.sql b/etc/activitytracker_demo_data.sql index 0add33c..c7e72f2 100644 --- a/etc/activitytracker_demo_data.sql +++ b/etc/activitytracker_demo_data.sql @@ -2,8 +2,8 @@ SET FOREIGN_KEY_CHECKS = 0; TRUNCATE TABLE `reqbaztrack`.`activity`; -REPLACE INTO `reqbaztrack`.`activity` (`Id`, `creation_time`, `activity_action`, `data_url`, `data_type`, - `data_frontend_url`, `parent_data_url`, `parent_data_type`, `user_url`) +REPLACE INTO `reqbaztrack`.`activity` (`id`, `creation_time`, `activity_action`, `data_url`, `data_type`, + `data_frontend_url`, `parent_data_url`, `parent_data_type`, `user_url`) VALUES (1, '2015-10-21 07:00:00', 'CREATE', 'http://localhost:8080/bazaar/projects/1', 'PROJECT', 'http://localhost:5000/#!/projects/1', NULL, NULL, 'http://localhost:8080/bazaar/users/2'), From a9690cdb61ef12bcc0a4db87efab11c00f23318a Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Wed, 8 Mar 2017 15:59:58 +0100 Subject: [PATCH 04/29] Removed apostrophe to make the script more readable --- etc/activitytracker_demo_data.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/activitytracker_demo_data.sql b/etc/activitytracker_demo_data.sql index c7e72f2..95138f3 100644 --- a/etc/activitytracker_demo_data.sql +++ b/etc/activitytracker_demo_data.sql @@ -1,9 +1,9 @@ SET FOREIGN_KEY_CHECKS = 0; -TRUNCATE TABLE `reqbaztrack`.`activity`; +TRUNCATE TABLE reqbaztrack.activity; -REPLACE INTO `reqbaztrack`.`activity` (`id`, `creation_time`, `activity_action`, `data_url`, `data_type`, - `data_frontend_url`, `parent_data_url`, `parent_data_type`, `user_url`) +REPLACE INTO reqbaztrack.activity (id, creation_time, activity_action, data_url, data_type, + data_frontend_url, parent_data_url, parent_data_type, user_url) VALUES (1, '2015-10-21 07:00:00', 'CREATE', 'http://localhost:8080/bazaar/projects/1', 'PROJECT', 'http://localhost:5000/#!/projects/1', NULL, NULL, 'http://localhost:8080/bazaar/users/2'), From efacb2bcdf5966948b286a21290ea22019d9d87c Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Thu, 9 Mar 2017 09:50:08 +0100 Subject: [PATCH 05/29] Update jooq to version 3.9.1 --- .classpath | 6 +++--- bin/JOOQGeneration/activitytracker_generation_info.xml | 2 +- bin/JOOQGeneration/run.bat | 2 +- bin/JOOQGeneration/run.sh | 2 +- etc/ivy/ivy.xml | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.classpath b/.classpath index c76565d..26fda49 100644 --- a/.classpath +++ b/.classpath @@ -47,9 +47,9 @@ - - - + + + diff --git a/bin/JOOQGeneration/activitytracker_generation_info.xml b/bin/JOOQGeneration/activitytracker_generation_info.xml index c8d598d..53bc5b3 100644 --- a/bin/JOOQGeneration/activitytracker_generation_info.xml +++ b/bin/JOOQGeneration/activitytracker_generation_info.xml @@ -1,5 +1,5 @@ - + com.mysql.jdbc.Driver diff --git a/bin/JOOQGeneration/run.bat b/bin/JOOQGeneration/run.bat index a78426e..8ac09e7 100644 --- a/bin/JOOQGeneration/run.bat +++ b/bin/JOOQGeneration/run.bat @@ -1 +1 @@ -java -classpath ../../lib/jooq-3.8.2.jar;../../lib/jooq-meta-3.8.2.jar;../../lib/jooq-codegen-3.8.2.jar;../../lib/mysql-connector-java-5.1.6.jar;. org.jooq.util.GenerationTool /activitytracker_generation_info.xml +java -classpath ../../lib/jooq-3.9.1.jar;../../lib/jooq-meta-3.9.1.jar;../../lib/jooq-codegen-3.9.1.jar;../../lib/mysql-connector-java-5.1.6.jar;. org.jooq.util.GenerationTool /activitytracker_generation_info.xml diff --git a/bin/JOOQGeneration/run.sh b/bin/JOOQGeneration/run.sh index f6d6d0b..706343a 100644 --- a/bin/JOOQGeneration/run.sh +++ b/bin/JOOQGeneration/run.sh @@ -1 +1 @@ -java -classpath ../../lib/jooq-3.8.2.jar:../../lib/jooq-meta-3.8.2.jar:../../lib/jooq-codegen-3.8.2.jar:../../lib/mysql-connector-java-5.1.6.jar:. org.jooq.util.GenerationTool /reqbaz_generation_info.xml \ No newline at end of file +java -classpath ../../lib/jooq-3.9.1.jar:../../lib/jooq-meta-3.9.1.jar:../../lib/jooq-codegen-3.9.1.jar:../../lib/mysql-connector-java-5.1.6.jar:. org.jooq.util.GenerationTool /reqbaz_generation_info.xml \ No newline at end of file diff --git a/etc/ivy/ivy.xml b/etc/ivy/ivy.xml index 20a4320..ea6a926 100644 --- a/etc/ivy/ivy.xml +++ b/etc/ivy/ivy.xml @@ -17,9 +17,9 @@ - - - + + + From 7028008d34a5dec4611729883da835642bb9d839 Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Thu, 9 Mar 2017 09:53:05 +0100 Subject: [PATCH 06/29] Set jooq location to ./service in generation script --- bin/JOOQGeneration/run.bat | 2 +- bin/JOOQGeneration/run.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/JOOQGeneration/run.bat b/bin/JOOQGeneration/run.bat index 8ac09e7..70311fb 100644 --- a/bin/JOOQGeneration/run.bat +++ b/bin/JOOQGeneration/run.bat @@ -1 +1 @@ -java -classpath ../../lib/jooq-3.9.1.jar;../../lib/jooq-meta-3.9.1.jar;../../lib/jooq-codegen-3.9.1.jar;../../lib/mysql-connector-java-5.1.6.jar;. org.jooq.util.GenerationTool /activitytracker_generation_info.xml +java -classpath ../../service/jooq-3.9.1.jar;../../service/jooq-meta-3.9.1.jar;../../service/jooq-codegen-3.9.1.jar;../../service/mysql-connector-java-5.1.6.jar;. org.jooq.util.GenerationTool /activitytracker_generation_info.xml diff --git a/bin/JOOQGeneration/run.sh b/bin/JOOQGeneration/run.sh index 706343a..e532de6 100644 --- a/bin/JOOQGeneration/run.sh +++ b/bin/JOOQGeneration/run.sh @@ -1 +1 @@ -java -classpath ../../lib/jooq-3.9.1.jar:../../lib/jooq-meta-3.9.1.jar:../../lib/jooq-codegen-3.9.1.jar:../../lib/mysql-connector-java-5.1.6.jar:. org.jooq.util.GenerationTool /reqbaz_generation_info.xml \ No newline at end of file +java -classpath ../../service/jooq-3.9.1.jar:../../service/jooq-meta-3.9.1.jar:../../service/jooq-codegen-3.9.1.jar:../../service/mysql-connector-java-5.1.6.jar:. org.jooq.util.GenerationTool /reqbaz_generation_info.xml \ No newline at end of file From 1b964d74d210f36556349c63447e5109a3d17afa Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Thu, 9 Mar 2017 09:57:07 +0100 Subject: [PATCH 07/29] New generated jooq objects --- .../service/dal/entities/Activity.java | 1 - .../service/dal/jooq/DefaultCatalog.java | 60 ++ .../service/dal/jooq/Keys.java | 56 +- .../service/dal/jooq/Reqbaztrack.java | 81 +- .../service/dal/jooq/Tables.java | 24 +- .../service/dal/jooq/tables/Activity.java | 266 +++--- .../jooq/tables/records/ActivityRecord.java | 874 +++++++++--------- 7 files changed, 723 insertions(+), 639 deletions(-) create mode 100644 src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/DefaultCatalog.java diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java index a9da9ce..0b5080c 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java @@ -13,7 +13,6 @@ public class Activity extends EntityBase { private final String parentDataType; private final String userUrl; - public Date getCreationTime() { return creationTime; } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/DefaultCatalog.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/DefaultCatalog.java new file mode 100644 index 0000000..c284f53 --- /dev/null +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/DefaultCatalog.java @@ -0,0 +1,60 @@ +/* + * This file is generated by jOOQ. +*/ +package de.rwth.dbis.acis.activitytracker.service.dal.jooq; + + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Generated; + +import org.jooq.Schema; +import org.jooq.impl.CatalogImpl; + + +/** + * This class is generated by jOOQ. + */ +@Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" +) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class DefaultCatalog extends CatalogImpl { + + private static final long serialVersionUID = 1525292833; + + /** + * The reference instance of + */ + public static final DefaultCatalog DEFAULT_CATALOG = new DefaultCatalog(); + + /** + * The schema reqbaztrack. + */ + public final Reqbaztrack REQBAZTRACK = de.rwth.dbis.acis.activitytracker.service.dal.jooq.Reqbaztrack.REQBAZTRACK; + + /** + * No further instances allowed + */ + private DefaultCatalog() { + super(""); + } + + @Override + public final List getSchemas() { + List result = new ArrayList(); + result.addAll(getSchemas0()); + return result; + } + + private final List getSchemas0() { + return Arrays.asList( + Reqbaztrack.REQBAZTRACK); + } +} diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Keys.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Keys.java index 70a60d5..71248dc 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Keys.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Keys.java @@ -1,6 +1,6 @@ -/** - * This class is generated by jOOQ - */ +/* + * This file is generated by jOOQ. +*/ package de.rwth.dbis.acis.activitytracker.service.dal.jooq; @@ -19,41 +19,41 @@ * schema */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.6.2" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Keys { - // ------------------------------------------------------------------------- - // IDENTITY definitions - // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- + // IDENTITY definitions + // ------------------------------------------------------------------------- - public static final Identity IDENTITY_ACTIVITY = Identities0.IDENTITY_ACTIVITY; + public static final Identity IDENTITY_ACTIVITY = Identities0.IDENTITY_ACTIVITY; - // ------------------------------------------------------------------------- - // UNIQUE and PRIMARY KEY definitions - // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- + // UNIQUE and PRIMARY KEY definitions + // ------------------------------------------------------------------------- - public static final UniqueKey KEY_ACTIVITY_PRIMARY = UniqueKeys0.KEY_ACTIVITY_PRIMARY; + public static final UniqueKey KEY_ACTIVITY_PRIMARY = UniqueKeys0.KEY_ACTIVITY_PRIMARY; - // ------------------------------------------------------------------------- - // FOREIGN KEY definitions - // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- + // FOREIGN KEY definitions + // ------------------------------------------------------------------------- - // ------------------------------------------------------------------------- - // [#1459] distribute members to avoid static initialisers > 64kb - // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- + // [#1459] distribute members to avoid static initialisers > 64kb + // ------------------------------------------------------------------------- - private static class Identities0 extends AbstractKeys { - public static Identity IDENTITY_ACTIVITY = createIdentity(Activity.ACTIVITY, Activity.ACTIVITY.ID); - } + private static class Identities0 extends AbstractKeys { + public static Identity IDENTITY_ACTIVITY = createIdentity(Activity.ACTIVITY, Activity.ACTIVITY.ID); + } - private static class UniqueKeys0 extends AbstractKeys { - public static final UniqueKey KEY_ACTIVITY_PRIMARY = createUniqueKey(Activity.ACTIVITY, Activity.ACTIVITY.ID); - } + private static class UniqueKeys0 extends AbstractKeys { + public static final UniqueKey KEY_ACTIVITY_PRIMARY = createUniqueKey(Activity.ACTIVITY, "KEY_activity_PRIMARY", Activity.ACTIVITY.ID); + } } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Reqbaztrack.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Reqbaztrack.java index 39519bb..0ba8645 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Reqbaztrack.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Reqbaztrack.java @@ -1,6 +1,6 @@ -/** - * This class is generated by jOOQ - */ +/* + * This file is generated by jOOQ. +*/ package de.rwth.dbis.acis.activitytracker.service.dal.jooq; @@ -12,6 +12,7 @@ import javax.annotation.Generated; +import org.jooq.Catalog; import org.jooq.Table; import org.jooq.impl.SchemaImpl; @@ -20,38 +21,52 @@ * This class is generated by jOOQ. */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.6.2" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Reqbaztrack extends SchemaImpl { - private static final long serialVersionUID = 996265567; - - /** - * The reference instance of reqbaztrack - */ - public static final Reqbaztrack REQBAZTRACK = new Reqbaztrack(); - - /** - * No further instances allowed - */ - private Reqbaztrack() { - super("reqbaztrack"); - } - - @Override - public final List> getTables() { - List result = new ArrayList(); - result.addAll(getTables0()); - return result; - } - - private final List> getTables0() { - return Arrays.>asList( - Activity.ACTIVITY); - } + private static final long serialVersionUID = -1601202747; + + /** + * The reference instance of reqbaztrack + */ + public static final Reqbaztrack REQBAZTRACK = new Reqbaztrack(); + + /** + * The table reqbaztrack.activity. + */ + public final Activity ACTIVITY = de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.Activity.ACTIVITY; + + /** + * No further instances allowed + */ + private Reqbaztrack() { + super("reqbaztrack", null); + } + + + /** + * {@inheritDoc} + */ + @Override + public Catalog getCatalog() { + return DefaultCatalog.DEFAULT_CATALOG; + } + + @Override + public final List> getTables() { + List result = new ArrayList(); + result.addAll(getTables0()); + return result; + } + + private final List> getTables0() { + return Arrays.>asList( + Activity.ACTIVITY); + } } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Tables.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Tables.java index b0f8e99..155e2fd 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Tables.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Tables.java @@ -1,6 +1,6 @@ -/** - * This class is generated by jOOQ - */ +/* + * This file is generated by jOOQ. +*/ package de.rwth.dbis.acis.activitytracker.service.dal.jooq; @@ -13,17 +13,17 @@ * Convenience access to all tables in reqbaztrack */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.6.2" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Tables { - /** - * The table reqbaztrack.activity - */ - public static final Activity ACTIVITY = de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.Activity.ACTIVITY; + /** + * The table reqbaztrack.activity. + */ + public static final Activity ACTIVITY = de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.Activity.ACTIVITY; } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java index 3d79ce0..b876592 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java @@ -1,6 +1,6 @@ -/** - * This class is generated by jOOQ - */ +/* + * This file is generated by jOOQ. +*/ package de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables; @@ -16,6 +16,7 @@ import org.jooq.Field; import org.jooq.Identity; +import org.jooq.Schema; import org.jooq.Table; import org.jooq.TableField; import org.jooq.UniqueKey; @@ -26,133 +27,142 @@ * This class is generated by jOOQ. */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.6.2" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Activity extends TableImpl { - private static final long serialVersionUID = 1527543309; - - /** - * The reference instance of reqbaztrack.activity - */ - public static final Activity ACTIVITY = new Activity(); - - /** - * The class holding records for this type - */ - @Override - public Class getRecordType() { - return ActivityRecord.class; - } - - /** - * The column reqbaztrack.activity.Id. - */ - public final TableField ID = createField("Id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); - - /** - * The column reqbaztrack.activity.creation_time. - */ - public final TableField CREATION_TIME = createField("creation_time", org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaulted(true), this, ""); - - /** - * The column reqbaztrack.activity.activity_action. - */ - public final TableField ACTIVITY_ACTION = createField("activity_action", org.jooq.impl.SQLDataType.VARCHAR.length(255).nullable(false), this, ""); - - /** - * The column reqbaztrack.activity.data_url. - */ - public final TableField DATA_URL = createField("data_url", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); - - /** - * The column reqbaztrack.activity.data_type. - */ - public final TableField DATA_TYPE = createField("data_type", org.jooq.impl.SQLDataType.VARCHAR.length(255).nullable(false), this, ""); - - /** - * The column reqbaztrack.activity.data_frontend_url. - */ - public final TableField DATA_FRONTEND_URL = createField("data_frontend_url", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); - - /** - * The column reqbaztrack.activity.parent_data_url. - */ - public final TableField PARENT_DATA_URL = createField("parent_data_url", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); - - /** - * The column reqbaztrack.activity.parent_data_type. - */ - public final TableField PARENT_DATA_TYPE = createField("parent_data_type", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); - - /** - * The column reqbaztrack.activity.user_url. - */ - public final TableField USER_URL = createField("user_url", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); - - /** - * Create a reqbaztrack.activity table reference - */ - public Activity() { - this("activity", null); - } - - /** - * Create an aliased reqbaztrack.activity table reference - */ - public Activity(String alias) { - this(alias, ACTIVITY); - } - - private Activity(String alias, Table aliased) { - this(alias, aliased, null); - } - - private Activity(String alias, Table aliased, Field[] parameters) { - super(alias, Reqbaztrack.REQBAZTRACK, aliased, parameters, ""); - } - - /** - * {@inheritDoc} - */ - @Override - public Identity getIdentity() { - return Keys.IDENTITY_ACTIVITY; - } - - /** - * {@inheritDoc} - */ - @Override - public UniqueKey getPrimaryKey() { - return Keys.KEY_ACTIVITY_PRIMARY; - } - - /** - * {@inheritDoc} - */ - @Override - public List> getKeys() { - return Arrays.>asList(Keys.KEY_ACTIVITY_PRIMARY); - } - - /** - * {@inheritDoc} - */ - @Override - public Activity as(String alias) { - return new Activity(alias, this); - } - - /** - * Rename this table - */ - public Activity rename(String name) { - return new Activity(name, null); - } + private static final long serialVersionUID = -656680500; + + /** + * The reference instance of reqbaztrack.activity + */ + public static final Activity ACTIVITY = new Activity(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ActivityRecord.class; + } + + /** + * The column reqbaztrack.activity.Id. + */ + public final TableField ID = createField("Id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column reqbaztrack.activity.creation_time. + */ + public final TableField CREATION_TIME = createField("creation_time", org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.inline("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, ""); + + /** + * The column reqbaztrack.activity.activity_action. + */ + public final TableField ACTIVITY_ACTION = createField("activity_action", org.jooq.impl.SQLDataType.VARCHAR.length(255).nullable(false), this, ""); + + /** + * The column reqbaztrack.activity.data_url. + */ + public final TableField DATA_URL = createField("data_url", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); + + /** + * The column reqbaztrack.activity.data_type. + */ + public final TableField DATA_TYPE = createField("data_type", org.jooq.impl.SQLDataType.VARCHAR.length(255).nullable(false), this, ""); + + /** + * The column reqbaztrack.activity.data_frontend_url. + */ + public final TableField DATA_FRONTEND_URL = createField("data_frontend_url", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); + + /** + * The column reqbaztrack.activity.parent_data_url. + */ + public final TableField PARENT_DATA_URL = createField("parent_data_url", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); + + /** + * The column reqbaztrack.activity.parent_data_type. + */ + public final TableField PARENT_DATA_TYPE = createField("parent_data_type", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); + + /** + * The column reqbaztrack.activity.user_url. + */ + public final TableField USER_URL = createField("user_url", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); + + /** + * Create a reqbaztrack.activity table reference + */ + public Activity() { + this("activity", null); + } + + /** + * Create an aliased reqbaztrack.activity table reference + */ + public Activity(String alias) { + this(alias, ACTIVITY); + } + + private Activity(String alias, Table aliased) { + this(alias, aliased, null); + } + + private Activity(String alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, ""); + } + + /** + * {@inheritDoc} + */ + @Override + public Schema getSchema() { + return Reqbaztrack.REQBAZTRACK; + } + + /** + * {@inheritDoc} + */ + @Override + public Identity getIdentity() { + return Keys.IDENTITY_ACTIVITY; + } + + /** + * {@inheritDoc} + */ + @Override + public UniqueKey getPrimaryKey() { + return Keys.KEY_ACTIVITY_PRIMARY; + } + + /** + * {@inheritDoc} + */ + @Override + public List> getKeys() { + return Arrays.>asList(Keys.KEY_ACTIVITY_PRIMARY); + } + + /** + * {@inheritDoc} + */ + @Override + public Activity as(String alias) { + return new Activity(alias, this); + } + + /** + * Rename this table + */ + @Override + public Activity rename(String name) { + return new Activity(name, null); + } } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java index b187294..69ea6b6 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java @@ -1,6 +1,6 @@ -/** - * This class is generated by jOOQ - */ +/* + * This file is generated by jOOQ. +*/ package de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.records; @@ -21,442 +21,442 @@ * This class is generated by jOOQ. */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.6.2" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class ActivityRecord extends UpdatableRecordImpl implements Record9 { - private static final long serialVersionUID = -1474032516; - - /** - * Setter for reqbaztrack.activity.Id. - */ - public void setId(Integer value) { - setValue(0, value); - } - - /** - * Getter for reqbaztrack.activity.Id. - */ - public Integer getId() { - return (Integer) getValue(0); - } - - /** - * Setter for reqbaztrack.activity.creation_time. - */ - public void setCreationTime(Timestamp value) { - setValue(1, value); - } - - /** - * Getter for reqbaztrack.activity.creation_time. - */ - public Timestamp getCreationTime() { - return (Timestamp) getValue(1); - } - - /** - * Setter for reqbaztrack.activity.activity_action. - */ - public void setActivityAction(String value) { - setValue(2, value); - } - - /** - * Getter for reqbaztrack.activity.activity_action. - */ - public String getActivityAction() { - return (String) getValue(2); - } - - /** - * Setter for reqbaztrack.activity.data_url. - */ - public void setDataUrl(String value) { - setValue(3, value); - } - - /** - * Getter for reqbaztrack.activity.data_url. - */ - public String getDataUrl() { - return (String) getValue(3); - } - - /** - * Setter for reqbaztrack.activity.data_type. - */ - public void setDataType(String value) { - setValue(4, value); - } - - /** - * Getter for reqbaztrack.activity.data_type. - */ - public String getDataType() { - return (String) getValue(4); - } - - /** - * Setter for reqbaztrack.activity.data_frontend_url. - */ - public void setDataFrontendUrl(String value) { - setValue(5, value); - } - - /** - * Getter for reqbaztrack.activity.data_frontend_url. - */ - public String getDataFrontendUrl() { - return (String) getValue(5); - } - - /** - * Setter for reqbaztrack.activity.parent_data_url. - */ - public void setParentDataUrl(String value) { - setValue(6, value); - } - - /** - * Getter for reqbaztrack.activity.parent_data_url. - */ - public String getParentDataUrl() { - return (String) getValue(6); - } - - /** - * Setter for reqbaztrack.activity.parent_data_type. - */ - public void setParentDataType(String value) { - setValue(7, value); - } - - /** - * Getter for reqbaztrack.activity.parent_data_type. - */ - public String getParentDataType() { - return (String) getValue(7); - } - - /** - * Setter for reqbaztrack.activity.user_url. - */ - public void setUserUrl(String value) { - setValue(8, value); - } - - /** - * Getter for reqbaztrack.activity.user_url. - */ - public String getUserUrl() { - return (String) getValue(8); - } - - // ------------------------------------------------------------------------- - // Primary key information - // ------------------------------------------------------------------------- - - /** - * {@inheritDoc} - */ - @Override - public Record1 key() { - return (Record1) super.key(); - } - - // ------------------------------------------------------------------------- - // Record9 type implementation - // ------------------------------------------------------------------------- - - /** - * {@inheritDoc} - */ - @Override - public Row9 fieldsRow() { - return (Row9) super.fieldsRow(); - } - - /** - * {@inheritDoc} - */ - @Override - public Row9 valuesRow() { - return (Row9) super.valuesRow(); - } - - /** - * {@inheritDoc} - */ - @Override - public Field field1() { - return Activity.ACTIVITY.ID; - } - - /** - * {@inheritDoc} - */ - @Override - public Field field2() { - return Activity.ACTIVITY.CREATION_TIME; - } - - /** - * {@inheritDoc} - */ - @Override - public Field field3() { - return Activity.ACTIVITY.ACTIVITY_ACTION; - } - - /** - * {@inheritDoc} - */ - @Override - public Field field4() { - return Activity.ACTIVITY.DATA_URL; - } - - /** - * {@inheritDoc} - */ - @Override - public Field field5() { - return Activity.ACTIVITY.DATA_TYPE; - } - - /** - * {@inheritDoc} - */ - @Override - public Field field6() { - return Activity.ACTIVITY.DATA_FRONTEND_URL; - } - - /** - * {@inheritDoc} - */ - @Override - public Field field7() { - return Activity.ACTIVITY.PARENT_DATA_URL; - } - - /** - * {@inheritDoc} - */ - @Override - public Field field8() { - return Activity.ACTIVITY.PARENT_DATA_TYPE; - } - - /** - * {@inheritDoc} - */ - @Override - public Field field9() { - return Activity.ACTIVITY.USER_URL; - } - - /** - * {@inheritDoc} - */ - @Override - public Integer value1() { - return getId(); - } - - /** - * {@inheritDoc} - */ - @Override - public Timestamp value2() { - return getCreationTime(); - } - - /** - * {@inheritDoc} - */ - @Override - public String value3() { - return getActivityAction(); - } - - /** - * {@inheritDoc} - */ - @Override - public String value4() { - return getDataUrl(); - } - - /** - * {@inheritDoc} - */ - @Override - public String value5() { - return getDataType(); - } - - /** - * {@inheritDoc} - */ - @Override - public String value6() { - return getDataFrontendUrl(); - } - - /** - * {@inheritDoc} - */ - @Override - public String value7() { - return getParentDataUrl(); - } - - /** - * {@inheritDoc} - */ - @Override - public String value8() { - return getParentDataType(); - } - - /** - * {@inheritDoc} - */ - @Override - public String value9() { - return getUserUrl(); - } - - /** - * {@inheritDoc} - */ - @Override - public ActivityRecord value1(Integer value) { - setId(value); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ActivityRecord value2(Timestamp value) { - setCreationTime(value); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ActivityRecord value3(String value) { - setActivityAction(value); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ActivityRecord value4(String value) { - setDataUrl(value); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ActivityRecord value5(String value) { - setDataType(value); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ActivityRecord value6(String value) { - setDataFrontendUrl(value); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ActivityRecord value7(String value) { - setParentDataUrl(value); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ActivityRecord value8(String value) { - setParentDataType(value); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ActivityRecord value9(String value) { - setUserUrl(value); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ActivityRecord values(Integer value1, Timestamp value2, String value3, String value4, String value5, String value6, String value7, String value8, String value9) { - value1(value1); - value2(value2); - value3(value3); - value4(value4); - value5(value5); - value6(value6); - value7(value7); - value8(value8); - value9(value9); - return this; - } - - // ------------------------------------------------------------------------- - // Constructors - // ------------------------------------------------------------------------- - - /** - * Create a detached ActivityRecord - */ - public ActivityRecord() { - super(Activity.ACTIVITY); - } - - /** - * Create a detached, initialised ActivityRecord - */ - public ActivityRecord(Integer id, Timestamp creationTime, String activityAction, String dataUrl, String dataType, String dataFrontendUrl, String parentDataUrl, String parentDataType, String userUrl) { - super(Activity.ACTIVITY); - - setValue(0, id); - setValue(1, creationTime); - setValue(2, activityAction); - setValue(3, dataUrl); - setValue(4, dataType); - setValue(5, dataFrontendUrl); - setValue(6, parentDataUrl); - setValue(7, parentDataType); - setValue(8, userUrl); - } + private static final long serialVersionUID = -1859331784; + + /** + * Setter for reqbaztrack.activity.Id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for reqbaztrack.activity.Id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for reqbaztrack.activity.creation_time. + */ + public void setCreationTime(Timestamp value) { + set(1, value); + } + + /** + * Getter for reqbaztrack.activity.creation_time. + */ + public Timestamp getCreationTime() { + return (Timestamp) get(1); + } + + /** + * Setter for reqbaztrack.activity.activity_action. + */ + public void setActivityAction(String value) { + set(2, value); + } + + /** + * Getter for reqbaztrack.activity.activity_action. + */ + public String getActivityAction() { + return (String) get(2); + } + + /** + * Setter for reqbaztrack.activity.data_url. + */ + public void setDataUrl(String value) { + set(3, value); + } + + /** + * Getter for reqbaztrack.activity.data_url. + */ + public String getDataUrl() { + return (String) get(3); + } + + /** + * Setter for reqbaztrack.activity.data_type. + */ + public void setDataType(String value) { + set(4, value); + } + + /** + * Getter for reqbaztrack.activity.data_type. + */ + public String getDataType() { + return (String) get(4); + } + + /** + * Setter for reqbaztrack.activity.data_frontend_url. + */ + public void setDataFrontendUrl(String value) { + set(5, value); + } + + /** + * Getter for reqbaztrack.activity.data_frontend_url. + */ + public String getDataFrontendUrl() { + return (String) get(5); + } + + /** + * Setter for reqbaztrack.activity.parent_data_url. + */ + public void setParentDataUrl(String value) { + set(6, value); + } + + /** + * Getter for reqbaztrack.activity.parent_data_url. + */ + public String getParentDataUrl() { + return (String) get(6); + } + + /** + * Setter for reqbaztrack.activity.parent_data_type. + */ + public void setParentDataType(String value) { + set(7, value); + } + + /** + * Getter for reqbaztrack.activity.parent_data_type. + */ + public String getParentDataType() { + return (String) get(7); + } + + /** + * Setter for reqbaztrack.activity.user_url. + */ + public void setUserUrl(String value) { + set(8, value); + } + + /** + * Getter for reqbaztrack.activity.user_url. + */ + public String getUserUrl() { + return (String) get(8); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record9 type implementation + // ------------------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public Row9 fieldsRow() { + return (Row9) super.fieldsRow(); + } + + /** + * {@inheritDoc} + */ + @Override + public Row9 valuesRow() { + return (Row9) super.valuesRow(); + } + + /** + * {@inheritDoc} + */ + @Override + public Field field1() { + return Activity.ACTIVITY.ID; + } + + /** + * {@inheritDoc} + */ + @Override + public Field field2() { + return Activity.ACTIVITY.CREATION_TIME; + } + + /** + * {@inheritDoc} + */ + @Override + public Field field3() { + return Activity.ACTIVITY.ACTIVITY_ACTION; + } + + /** + * {@inheritDoc} + */ + @Override + public Field field4() { + return Activity.ACTIVITY.DATA_URL; + } + + /** + * {@inheritDoc} + */ + @Override + public Field field5() { + return Activity.ACTIVITY.DATA_TYPE; + } + + /** + * {@inheritDoc} + */ + @Override + public Field field6() { + return Activity.ACTIVITY.DATA_FRONTEND_URL; + } + + /** + * {@inheritDoc} + */ + @Override + public Field field7() { + return Activity.ACTIVITY.PARENT_DATA_URL; + } + + /** + * {@inheritDoc} + */ + @Override + public Field field8() { + return Activity.ACTIVITY.PARENT_DATA_TYPE; + } + + /** + * {@inheritDoc} + */ + @Override + public Field field9() { + return Activity.ACTIVITY.USER_URL; + } + + /** + * {@inheritDoc} + */ + @Override + public Integer value1() { + return getId(); + } + + /** + * {@inheritDoc} + */ + @Override + public Timestamp value2() { + return getCreationTime(); + } + + /** + * {@inheritDoc} + */ + @Override + public String value3() { + return getActivityAction(); + } + + /** + * {@inheritDoc} + */ + @Override + public String value4() { + return getDataUrl(); + } + + /** + * {@inheritDoc} + */ + @Override + public String value5() { + return getDataType(); + } + + /** + * {@inheritDoc} + */ + @Override + public String value6() { + return getDataFrontendUrl(); + } + + /** + * {@inheritDoc} + */ + @Override + public String value7() { + return getParentDataUrl(); + } + + /** + * {@inheritDoc} + */ + @Override + public String value8() { + return getParentDataType(); + } + + /** + * {@inheritDoc} + */ + @Override + public String value9() { + return getUserUrl(); + } + + /** + * {@inheritDoc} + */ + @Override + public ActivityRecord value1(Integer value) { + setId(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ActivityRecord value2(Timestamp value) { + setCreationTime(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ActivityRecord value3(String value) { + setActivityAction(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ActivityRecord value4(String value) { + setDataUrl(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ActivityRecord value5(String value) { + setDataType(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ActivityRecord value6(String value) { + setDataFrontendUrl(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ActivityRecord value7(String value) { + setParentDataUrl(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ActivityRecord value8(String value) { + setParentDataType(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ActivityRecord value9(String value) { + setUserUrl(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ActivityRecord values(Integer value1, Timestamp value2, String value3, String value4, String value5, String value6, String value7, String value8, String value9) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + value5(value5); + value6(value6); + value7(value7); + value8(value8); + value9(value9); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ActivityRecord + */ + public ActivityRecord() { + super(Activity.ACTIVITY); + } + + /** + * Create a detached, initialised ActivityRecord + */ + public ActivityRecord(Integer id, Timestamp creationTime, String activityAction, String dataUrl, String dataType, String dataFrontendUrl, String parentDataUrl, String parentDataType, String userUrl) { + super(Activity.ACTIVITY); + + set(0, id); + set(1, creationTime); + set(2, activityAction); + set(3, dataUrl); + set(4, dataType); + set(5, dataFrontendUrl); + set(6, parentDataUrl); + set(7, parentDataType); + set(8, userUrl); + } } From ba62ab3ec02f6541f28fb16b721ea79f9fdd7200 Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Wed, 12 Apr 2017 18:06:54 +0200 Subject: [PATCH 08/29] Update jooq version in service dependency --- etc/ant_configuration/service.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/ant_configuration/service.properties b/etc/ant_configuration/service.properties index 5a8e2a6..6ec0084 100644 --- a/etc/ant_configuration/service.properties +++ b/etc/ant_configuration/service.properties @@ -3,4 +3,4 @@ service.name=de.rwth.dbis.acis.activitytracker.service service.path=de/rwth/dbis/acis/activitytracker/service service.class=ActivityTrackerService service.passphrase=Passphrase -service.dependencies=commons-codec;version="1.9",commons-dbcp2;version="2.0",commons-io;version="2.4",commons-logging;version="1.2",commons-pool2;version="2.2",gson;version="2.3",httpclient;version="4.5.1",httpcore;version="4.4.3",jooq;version="3.8.2",jooq-codegen;version="3.8.2",jooq-meta;version="3.8.2",mysql-connector-java;version="5.1.6" +service.dependencies=commons-codec;version="1.9",commons-dbcp2;version="2.0",commons-io;version="2.4",commons-logging;version="1.2",commons-pool2;version="2.2",gson;version="2.3",httpclient;version="4.5.1",httpcore;version="4.4.3",jooq;version="3.9.1",jooq-codegen;version="3.9.1",jooq-meta;version="3.9.1",mysql-connector-java;version="5.1.6" From 2994c75b1844c8cdb3a04efc85c8c16f00f05cff Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Wed, 12 Apr 2017 18:07:18 +0200 Subject: [PATCH 09/29] Rename creationTime to creationDate #RB-496 --- etc/activitytracker_create.sql | 2 +- etc/activitytracker_demo_data.sql | 2 +- .../service/dal/entities/Activity.java | 14 +++++------ .../service/dal/entities/ActivityEx.java | 6 ++--- .../service/dal/jooq/tables/Activity.java | 10 ++++---- .../jooq/tables/records/ActivityRecord.java | 24 +++++++++---------- .../dal/transform/ActivityTransformator.java | 10 ++++---- 7 files changed, 34 insertions(+), 34 deletions(-) diff --git a/etc/activitytracker_create.sql b/etc/activitytracker_create.sql index 61b65ca..4c9d23a 100644 --- a/etc/activitytracker_create.sql +++ b/etc/activitytracker_create.sql @@ -8,7 +8,7 @@ DROP TABLE IF EXISTS reqbaztrack.activity; -- Table activity CREATE TABLE IF NOT EXISTS reqbaztrack.activity ( id INT NOT NULL AUTO_INCREMENT, - creation_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, activity_action VARCHAR(255) NOT NULL, data_url VARCHAR(255) NULL, data_type VARCHAR(255) NOT NULL, diff --git a/etc/activitytracker_demo_data.sql b/etc/activitytracker_demo_data.sql index 95138f3..b1fcfe0 100644 --- a/etc/activitytracker_demo_data.sql +++ b/etc/activitytracker_demo_data.sql @@ -2,7 +2,7 @@ SET FOREIGN_KEY_CHECKS = 0; TRUNCATE TABLE reqbaztrack.activity; -REPLACE INTO reqbaztrack.activity (id, creation_time, activity_action, data_url, data_type, +REPLACE INTO reqbaztrack.activity (id, creation_date, activity_action, data_url, data_type, data_frontend_url, parent_data_url, parent_data_type, user_url) VALUES (1, '2015-10-21 07:00:00', 'CREATE', 'http://localhost:8080/bazaar/projects/1', 'PROJECT', diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java index 0b5080c..bed27ec 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java @@ -4,7 +4,7 @@ public class Activity extends EntityBase { - private final Date creationTime; + private final Date creationDate; private final String activityAction; private final String dataUrl; private final String dataType; @@ -13,8 +13,8 @@ public class Activity extends EntityBase { private final String parentDataType; private final String userUrl; - public Date getCreationTime() { - return creationTime; + public Date getCreationDate() { + return creationDate; } public String getActivityAction() { @@ -47,7 +47,7 @@ public String getUserUrl() { protected Activity(Builder builder) { super(builder); - this.creationTime = builder.creationTime; + this.creationDate = builder.creationDate; this.activityAction = builder.activityAction; this.dataUrl = builder.dataUrl; this.dataType = builder.dataType; @@ -64,7 +64,7 @@ public static Builder getBuilder() { public static class Builder { protected int id; - protected Date creationTime; + protected Date creationDate; protected String activityAction; protected String dataUrl; protected String dataType; @@ -78,8 +78,8 @@ public Builder id(int id) { return this; } - public Builder creationTime(Date creationTime) { - this.creationTime = creationTime; + public Builder creationDate(Date creationDate) { + this.creationDate = creationDate; return this; } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/ActivityEx.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/ActivityEx.java index 7bfafea..d13193b 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/ActivityEx.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/ActivityEx.java @@ -55,7 +55,7 @@ public BuilderEx() { public BuilderEx activity(Activity activity) { id(activity.getId()); - creationTime(activity.getCreationTime()); + creationDate(activity.getCreationDate()); activityAction(activity.getActivityAction()); dataUrl(activity.getDataUrl()); dataType(activity.getDataType()); @@ -82,8 +82,8 @@ public BuilderEx user(Object user) { } @Override - public BuilderEx creationTime(Date creationTime) { - this.creationTime = creationTime; + public BuilderEx creationDate(Date creationDate) { + this.creationDate = creationDate; return this; } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java index b876592..41fd11d 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java @@ -36,7 +36,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Activity extends TableImpl { - private static final long serialVersionUID = -656680500; + private static final long serialVersionUID = -1015172083; /** * The reference instance of reqbaztrack.activity @@ -52,14 +52,14 @@ public Class getRecordType() { } /** - * The column reqbaztrack.activity.Id. + * The column reqbaztrack.activity.id. */ - public final TableField ID = createField("Id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + public final TableField ID = createField("id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); /** - * The column reqbaztrack.activity.creation_time. + * The column reqbaztrack.activity.creation_date. */ - public final TableField CREATION_TIME = createField("creation_time", org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.inline("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, ""); + public final TableField CREATION_DATE = createField("creation_date", org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.inline("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, ""); /** * The column reqbaztrack.activity.activity_action. diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java index 69ea6b6..7dee9e9 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java @@ -30,33 +30,33 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class ActivityRecord extends UpdatableRecordImpl implements Record9 { - private static final long serialVersionUID = -1859331784; + private static final long serialVersionUID = -1489974951; /** - * Setter for reqbaztrack.activity.Id. + * Setter for reqbaztrack.activity.id. */ public void setId(Integer value) { set(0, value); } /** - * Getter for reqbaztrack.activity.Id. + * Getter for reqbaztrack.activity.id. */ public Integer getId() { return (Integer) get(0); } /** - * Setter for reqbaztrack.activity.creation_time. + * Setter for reqbaztrack.activity.creation_date. */ - public void setCreationTime(Timestamp value) { + public void setCreationDate(Timestamp value) { set(1, value); } /** - * Getter for reqbaztrack.activity.creation_time. + * Getter for reqbaztrack.activity.creation_date. */ - public Timestamp getCreationTime() { + public Timestamp getCreationDate() { return (Timestamp) get(1); } @@ -203,7 +203,7 @@ public Field field1() { */ @Override public Field field2() { - return Activity.ACTIVITY.CREATION_TIME; + return Activity.ACTIVITY.CREATION_DATE; } /** @@ -275,7 +275,7 @@ public Integer value1() { */ @Override public Timestamp value2() { - return getCreationTime(); + return getCreationDate(); } /** @@ -348,7 +348,7 @@ public ActivityRecord value1(Integer value) { */ @Override public ActivityRecord value2(Timestamp value) { - setCreationTime(value); + setCreationDate(value); return this; } @@ -446,11 +446,11 @@ public ActivityRecord() { /** * Create a detached, initialised ActivityRecord */ - public ActivityRecord(Integer id, Timestamp creationTime, String activityAction, String dataUrl, String dataType, String dataFrontendUrl, String parentDataUrl, String parentDataType, String userUrl) { + public ActivityRecord(Integer id, Timestamp creationDate, String activityAction, String dataUrl, String dataType, String dataFrontendUrl, String parentDataUrl, String parentDataType, String userUrl) { super(Activity.ACTIVITY); set(0, id); - set(1, creationTime); + set(1, creationDate); set(2, activityAction); set(3, dataUrl); set(4, dataType); diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformator.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformator.java index 00d18d2..5b84e61 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformator.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformator.java @@ -16,7 +16,7 @@ public class ActivityTransformator implements Transformator getUpdateMap(Activity entity) { public Collection> getSortFields(Pageable.SortDirection sortDirection) { switch (sortDirection) { case DEFAULT: - return Arrays.asList(ACTIVITY.CREATION_TIME.desc(), + return Arrays.asList(ACTIVITY.CREATION_DATE.desc(), ACTIVITY.ID.desc()); case ASC: - return Arrays.asList(ACTIVITY.CREATION_TIME.asc(), + return Arrays.asList(ACTIVITY.CREATION_DATE.asc(), ACTIVITY.ID.asc()); case DESC: - return Arrays.asList(ACTIVITY.CREATION_TIME.desc(), + return Arrays.asList(ACTIVITY.CREATION_DATE.desc(), ACTIVITY.ID.desc()); } return null; From b04c5d97faa32c21e7b7fcb6b47ab6ec3ec7b22a Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Wed, 12 Apr 2017 18:16:08 +0200 Subject: [PATCH 10/29] Correct spelling errors in code and comments #RB-506 --- .../service/ActivityTrackerService.java | 8 +-- .../repositories/ActivityRepositoryImpl.java | 4 +- .../service/dal/repositories/Repository.java | 2 +- .../dal/repositories/RepositoryImpl.java | 69 +++++++++---------- ...formator.java => ActivityTransformer.java} | 2 +- .../{Transformator.java => Transformer.java} | 2 +- .../service/exception/ErrorCode.java | 2 +- .../service/exception/ExceptionLocation.java | 4 +- 8 files changed, 46 insertions(+), 47 deletions(-) rename src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/{ActivityTransformator.java => ActivityTransformer.java} (97%) rename src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/{Transformator.java => Transformer.java} (96%) diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java index 1a5bc8d..bbcfd87 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java @@ -74,7 +74,7 @@ protected void initResources() { } /** - * Create Activty over RMI + * Create Activity over RMI * * @param activity as JSON string * @return @@ -141,7 +141,7 @@ public Response getActivities( DALFacade dalFacade = null; try { if (before != -1 && after != -1) { - ExceptionHandler.getInstance().throwException(ExceptionLocation.ACTIVITIESERVICE, ErrorCode.WRONG_PARAMETER, "both: before and after parameter not possible"); + ExceptionHandler.getInstance().throwException(ExceptionLocation.ACTIVITYTRACKERSERVICE, ErrorCode.WRONG_PARAMETER, "both: before and after parameter not possible"); } int cursor = before != -1 ? before : after; Pageable.SortDirection sortDirection = after != -1 ? Pageable.SortDirection.ASC : Pageable.SortDirection.DESC; @@ -194,7 +194,7 @@ public Response getActivities( } catch (ActivityTrackerException atException) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ExceptionHandler.getInstance().toJSON(atException)).build(); } catch (Exception ex) { - ActivityTrackerException atException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.ACTIVITIESERVICE, ErrorCode.UNKNOWN, ex.getMessage()); + ActivityTrackerException atException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.ACTIVITYTRACKERSERVICE, ErrorCode.UNKNOWN, ex.getMessage()); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ExceptionHandler.getInstance().toJSON(atException)).build(); } finally { service.closeDBConnection(dalFacade); @@ -233,7 +233,7 @@ private Activity storeActivity(Activity activity) throws ActivityTrackerExceptio Activity createdActivity = dalFacade.createActivity(activity); return createdActivity; } catch (Exception ex) { - ActivityTrackerException atException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.ACTIVITIESERVICE, ErrorCode.UNKNOWN, ""); + ActivityTrackerException atException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.ACTIVITYTRACKERSERVICE, ErrorCode.UNKNOWN, ""); throw atException; } finally { this.closeDBConnection(dalFacade); diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/ActivityRepositoryImpl.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/ActivityRepositoryImpl.java index 3feb902..2307447 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/ActivityRepositoryImpl.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/ActivityRepositoryImpl.java @@ -2,13 +2,13 @@ import de.rwth.dbis.acis.activitytracker.service.dal.entities.Activity; import de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.records.ActivityRecord; -import de.rwth.dbis.acis.activitytracker.service.dal.transform.ActivityTransformator; +import de.rwth.dbis.acis.activitytracker.service.dal.transform.ActivityTransformer; import org.jooq.DSLContext; public class ActivityRepositoryImpl extends RepositoryImpl implements ActivityRepository { public ActivityRepositoryImpl(DSLContext jooq) { - super(jooq, new ActivityTransformator()); + super(jooq, new ActivityTransformer()); } } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/Repository.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/Repository.java index 6f4647f..4186f65 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/Repository.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/Repository.java @@ -8,7 +8,7 @@ import java.util.List; /** - * @param Type of the Entity, which should be added, deleted, updated, getted using the repo. + * @param Type of the Entity, which should be added, deleted, updated, got using the repo. */ public interface Repository { /** diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java index 52966e0..27790b2 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java @@ -3,7 +3,7 @@ import de.rwth.dbis.acis.activitytracker.service.dal.entities.EntityBase; import de.rwth.dbis.acis.activitytracker.service.dal.helpers.Pageable; import de.rwth.dbis.acis.activitytracker.service.dal.helpers.PaginationResult; -import de.rwth.dbis.acis.activitytracker.service.dal.transform.Transformator; +import de.rwth.dbis.acis.activitytracker.service.dal.transform.Transformer; import de.rwth.dbis.acis.activitytracker.service.exception.ActivityTrackerException; import de.rwth.dbis.acis.activitytracker.service.exception.ErrorCode; import de.rwth.dbis.acis.activitytracker.service.exception.ExceptionHandler; @@ -15,20 +15,19 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.concurrent.locks.*; public class RepositoryImpl implements Repository { protected final DSLContext jooq; - protected final Transformator transformator; + protected final Transformer transformer; /** * @param jooq DSLContext for JOOQ connection - * @param transformator Transformator object to create mapping between JOOQ record and our entities + * @param transformer Transformer object to create mapping between JOOQ record and our entities */ - public RepositoryImpl(DSLContext jooq, Transformator transformator) { + public RepositoryImpl(DSLContext jooq, Transformer transformer) { this.jooq = jooq; - this.transformator = transformator; + this.transformer = transformer; } /** @@ -41,12 +40,12 @@ public E add(E entity) throws ActivityTrackerException { E transformedEntity = null; try { R persisted; - persisted = jooq.insertInto(transformator.getTable()) - .set(transformator.createRecord(entity)) + persisted = jooq.insertInto(transformer.getTable()) + .set(transformer.createRecord(entity)) .returning() .fetchOne(); - transformedEntity = transformator.mapToEntity(persisted); + transformedEntity = transformer.mapToEntity(persisted); } catch (DataAccessException e) { ExceptionHandler.getInstance().convertAndThrowException(e, ExceptionLocation.REPOSITORY, ErrorCode.UNKNOWN, e.getMessage()); } @@ -66,8 +65,8 @@ public E delete(int id) throws ActivityTrackerException { try { deleted = this.findById(id); - int deletedRecordCount = jooq.delete(transformator.getTable()) - .where(transformator.getTableId().equal(id)) + int deletedRecordCount = jooq.delete(transformer.getTable()) + .where(transformer.getTableId().equal(id)) .execute(); } catch (ActivityTrackerException ex) { ExceptionHandler.getInstance().convertAndThrowException(ex); @@ -88,10 +87,10 @@ public List findAll() throws ActivityTrackerException { try { entries = new ArrayList<>(); - List queryResults = jooq.selectFrom(transformator.getTable()).fetchInto(transformator.getRecordClass()); + List queryResults = jooq.selectFrom(transformer.getTable()).fetchInto(transformer.getRecordClass()); for (R queryResult : queryResults) { - E entry = transformator.mapToEntity(queryResult); + E entry = transformer.mapToEntity(queryResult); entries.add(entry); } } catch (DataAccessException e) { @@ -112,23 +111,23 @@ public PaginationResult findAll(Pageable pageable) throws ActivityTrackerExce try { List entries = new ArrayList<>(); - Condition condition = transformator.getTableId().notEqual(-1); + Condition condition = transformer.getTableId().notEqual(-1); if (pageable.getCursor() != -1) { if (pageable.getSortDirection() == Pageable.SortDirection.ASC) { - condition = transformator.getTableId().greaterThan(pageable.getCursor()); + condition = transformer.getTableId().greaterThan(pageable.getCursor()); } else { - condition = transformator.getTableId().lessThan(pageable.getCursor()); + condition = transformer.getTableId().lessThan(pageable.getCursor()); } } - List queryResults = jooq.selectFrom(transformator.getTable()) + List queryResults = jooq.selectFrom(transformer.getTable()) .where(condition) - .orderBy(transformator.getSortFields(pageable.getSortDirection())) + .orderBy(transformer.getSortFields(pageable.getSortDirection())) .limit(pageable.getLimit()) - .fetchInto(transformator.getRecordClass()); + .fetchInto(transformer.getRecordClass()); for (R queryResult : queryResults) { - E entry = transformator.mapToEntity(queryResult); + E entry = transformer.mapToEntity(queryResult); entries.add(entry); } @@ -152,24 +151,24 @@ public PaginationResult searchAll(String searchTerm, Pageable pageable) throw try { List entries = new ArrayList<>(); - Condition condition = transformator.getTableId().notEqual(-1); + Condition condition = transformer.getTableId().notEqual(-1); if (pageable.getCursor() != -1) { if (pageable.getSortDirection() == Pageable.SortDirection.ASC) { - condition = transformator.getTableId().greaterThan(pageable.getCursor()); + condition = transformer.getTableId().greaterThan(pageable.getCursor()); } else { - condition = transformator.getTableId().lessThan(pageable.getCursor()); + condition = transformer.getTableId().lessThan(pageable.getCursor()); } } String likeExpression = "%" + searchTerm + "%"; - List queryResults = jooq.selectFrom(transformator.getTable()) - .where(transformator.getSearchFields(likeExpression)).and(condition) - .orderBy(transformator.getSortFields(pageable.getSortDirection())) + List queryResults = jooq.selectFrom(transformer.getTable()) + .where(transformer.getSearchFields(likeExpression)).and(condition) + .orderBy(transformer.getSortFields(pageable.getSortDirection())) .limit(pageable.getLimit()) - .fetchInto(transformator.getRecordClass()); + .fetchInto(transformer.getRecordClass()); for (R queryResult : queryResults) { - E entry = transformator.mapToEntity(queryResult); + E entry = transformer.mapToEntity(queryResult); entries.add(entry); } @@ -192,12 +191,12 @@ public PaginationResult searchAll(String searchTerm, Pageable pageable) throw public E findById(int id) throws ActivityTrackerException { R queryResult = null; try { - queryResult = jooq.selectFrom(transformator.getTable()) - .where(transformator.getTableId().equal(id)) + queryResult = jooq.selectFrom(transformer.getTable()) + .where(transformer.getTableId().equal(id)) .fetchOne(); if (queryResult == null) { - throw new Exception("No " + transformator.getRecordClass() + " found with id: " + id); + throw new Exception("No " + transformer.getRecordClass() + " found with id: " + id); } } catch (ActivityTrackerException ex) { ExceptionHandler.getInstance().convertAndThrowException(ex); @@ -205,7 +204,7 @@ public E findById(int id) throws ActivityTrackerException { ExceptionHandler.getInstance().convertAndThrowException(e, ExceptionLocation.REPOSITORY, ErrorCode.NOT_FOUND); } - return transformator.mapToEntity(queryResult); + return transformer.mapToEntity(queryResult); } /** @@ -218,8 +217,8 @@ public E findById(int id) throws ActivityTrackerException { public E update(E entity) throws ActivityTrackerException { E byId = null; try { - UpdateSetFirstStep update = jooq.update(transformator.getTable()); - Map map = transformator.getUpdateMap(entity); + UpdateSetFirstStep update = jooq.update(transformer.getTable()); + Map map = transformer.getUpdateMap(entity); UpdateSetMoreStep moreStep = null; for (Map.Entry item : map.entrySet()) { Field key = item.getKey(); @@ -230,7 +229,7 @@ public E update(E entity) throws ActivityTrackerException { moreStep.set(key,value); } assert moreStep != null; - moreStep.where(transformator.getTableId().equal(entity.getId())).execute(); + moreStep.where(transformer.getTableId().equal(entity.getId())).execute(); byId = findById(entity.getId()); } catch (ActivityTrackerException ex) { ExceptionHandler.getInstance().convertAndThrowException(ex); diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformator.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java similarity index 97% rename from src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformator.java rename to src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java index 5b84e61..8835e6f 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformator.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java @@ -12,7 +12,7 @@ import static de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.Activity.ACTIVITY; -public class ActivityTransformator implements Transformator { +public class ActivityTransformer implements Transformer { @Override public ActivityRecord createRecord(Activity entity) { ActivityRecord activityRecord = new ActivityRecord(); diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/Transformator.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/Transformer.java similarity index 96% rename from src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/Transformator.java rename to src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/Transformer.java index b482c7c..b892d1b 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/Transformator.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/Transformer.java @@ -10,7 +10,7 @@ * @param type parameter for the entity * @param type parameter for the record */ -public interface Transformator { +public interface Transformer { /** * @param entity object, which holds the prototype values for the newly created record. * @return a record object, which has the same value of the entity diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ErrorCode.java b/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ErrorCode.java index 052f74f..6479d69 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ErrorCode.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ErrorCode.java @@ -8,7 +8,7 @@ public enum ErrorCode { DB_COMM("004", "Error during communicating to database. Possibly wrong connection parameters"), NOT_FOUND("005", "The item was not found"), NETWORK_PROBLEM("006", "Error while trying to receive activity content"), - WRONG_PARAMETER("006", "Wrong paramer given"); + WRONG_PARAMETER("006", "Wrong parameter given"); private final String code; private final String message; diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ExceptionLocation.java b/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ExceptionLocation.java index a580c0e..496d0fc 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ExceptionLocation.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ExceptionLocation.java @@ -2,9 +2,9 @@ public enum ExceptionLocation { REPOSITORY("01", "Repository"), - TRANSFORMATOR("02", "Transformator"), + TRANSFORMATOR("02", "Transformer"), DALFACADE("03", "DAL facade implementation"), - ACTIVITIESERVICE("04", "ActivityTracker service"), + ACTIVITYTRACKERSERVICE("04", "ActivityTracker service"), NETWORK("5", "Network"); private final String code; From b718baeab2fcd6eeec2f0f87516fc10c792f97c1 Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Wed, 12 Apr 2017 18:21:50 +0200 Subject: [PATCH 11/29] =?UTF-8?q?Optimise=20imports=20and=20remove=20publi?= =?UTF-8?q?c=20from=20interface=20signatures=20#fr=C3=BChjahrsputz?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ActivityTrackerService.java | 2 +- .../activitytracker/service/dal/DALFacadeImpl.java | 4 ++-- .../service/dal/entities/IdentifiedById.java | 2 +- .../service/dal/jooq/DefaultCatalog.java | 9 ++++----- .../activitytracker/service/dal/jooq/Keys.java | 5 ++--- .../service/dal/jooq/Reqbaztrack.java | 10 ++++------ .../service/dal/jooq/tables/Activity.java | 13 +++---------- .../dal/jooq/tables/records/ActivityRecord.java | 8 +++----- .../service/dal/repositories/Repository.java | 14 +++++++------- .../service/dal/repositories/RepositoryImpl.java | 1 - .../service/dal/transform/ActivityTransformer.java | 2 +- .../service/network/HttpRequestCallable.java | 3 --- 12 files changed, 28 insertions(+), 45 deletions(-) diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java index bbcfd87..4dcc46a 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java @@ -21,7 +21,7 @@ import i5.las2peer.restMapper.annotations.ServicePath; import i5.las2peer.security.L2pSecurityException; import io.swagger.annotations.*; -import org.apache.commons.dbcp2.*; +import org.apache.commons.dbcp2.BasicDataSource; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.utils.URIBuilder; import org.apache.http.impl.client.CloseableHttpClient; diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/DALFacadeImpl.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/DALFacadeImpl.java index 2148cab..f1115fc 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/DALFacadeImpl.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/DALFacadeImpl.java @@ -6,11 +6,11 @@ import de.rwth.dbis.acis.activitytracker.service.dal.repositories.ActivityRepository; import de.rwth.dbis.acis.activitytracker.service.dal.repositories.ActivityRepositoryImpl; import de.rwth.dbis.acis.activitytracker.service.exception.ActivityTrackerException; -import org.jooq.*; +import org.jooq.DSLContext; +import org.jooq.SQLDialect; import org.jooq.impl.DSL; import javax.sql.DataSource; -import java.util.List; public class DALFacadeImpl implements DALFacade { diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/IdentifiedById.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/IdentifiedById.java index 106acbc..a8e5d7e 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/IdentifiedById.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/IdentifiedById.java @@ -4,5 +4,5 @@ public interface IdentifiedById { /** * @return Returns the identifier of the implementer. All entities should implement this. */ - public int getId(); + int getId(); } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/DefaultCatalog.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/DefaultCatalog.java index c284f53..9eefc7b 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/DefaultCatalog.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/DefaultCatalog.java @@ -4,15 +4,14 @@ package de.rwth.dbis.acis.activitytracker.service.dal.jooq; +import org.jooq.Schema; +import org.jooq.impl.CatalogImpl; + +import javax.annotation.Generated; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.annotation.Generated; - -import org.jooq.Schema; -import org.jooq.impl.CatalogImpl; - /** * This class is generated by jOOQ. diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Keys.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Keys.java index 71248dc..744d59e 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Keys.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Keys.java @@ -6,13 +6,12 @@ import de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.Activity; import de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.records.ActivityRecord; - -import javax.annotation.Generated; - import org.jooq.Identity; import org.jooq.UniqueKey; import org.jooq.impl.AbstractKeys; +import javax.annotation.Generated; + /** * A class modelling foreign key relationships between tables of the reqbaztrack diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Reqbaztrack.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Reqbaztrack.java index 0ba8645..86d1c8a 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Reqbaztrack.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Reqbaztrack.java @@ -5,17 +5,15 @@ import de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.Activity; +import org.jooq.Catalog; +import org.jooq.Table; +import org.jooq.impl.SchemaImpl; +import javax.annotation.Generated; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.annotation.Generated; - -import org.jooq.Catalog; -import org.jooq.Table; -import org.jooq.impl.SchemaImpl; - /** * This class is generated by jOOQ. diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java index 41fd11d..84b414f 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java @@ -7,21 +7,14 @@ import de.rwth.dbis.acis.activitytracker.service.dal.jooq.Keys; import de.rwth.dbis.acis.activitytracker.service.dal.jooq.Reqbaztrack; import de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.records.ActivityRecord; +import org.jooq.*; +import org.jooq.impl.TableImpl; +import javax.annotation.Generated; import java.sql.Timestamp; import java.util.Arrays; import java.util.List; -import javax.annotation.Generated; - -import org.jooq.Field; -import org.jooq.Identity; -import org.jooq.Schema; -import org.jooq.Table; -import org.jooq.TableField; -import org.jooq.UniqueKey; -import org.jooq.impl.TableImpl; - /** * This class is generated by jOOQ. diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java index 7dee9e9..765b033 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java @@ -5,17 +5,15 @@ import de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.Activity; - -import java.sql.Timestamp; - -import javax.annotation.Generated; - import org.jooq.Field; import org.jooq.Record1; import org.jooq.Record9; import org.jooq.Row9; import org.jooq.impl.UpdatableRecordImpl; +import javax.annotation.Generated; +import java.sql.Timestamp; + /** * This class is generated by jOOQ. diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/Repository.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/Repository.java index 4186f65..8d5b0ff 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/Repository.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/Repository.java @@ -16,7 +16,7 @@ public interface Repository { * @return the persisted entity * @throws ActivityTrackerException */ - public E add(E entity) throws ActivityTrackerException; + E add(E entity) throws ActivityTrackerException; /** @@ -24,14 +24,14 @@ public interface Repository { * @return the deleted entity. It is not anymore in the database! * @throws ActivityTrackerException */ - public E delete(int id) throws ActivityTrackerException; + E delete(int id) throws ActivityTrackerException; /** * @return all the entities currently in the database * @throws ActivityTrackerException */ - public List findAll() throws ActivityTrackerException; + List findAll() throws ActivityTrackerException; /** @@ -39,7 +39,7 @@ public interface Repository { * @return PaginationResult with all the entities currently in the database * @throws ActivityTrackerException */ - public PaginationResult findAll(Pageable pageable) throws ActivityTrackerException; + PaginationResult findAll(Pageable pageable) throws ActivityTrackerException; /** @@ -48,14 +48,14 @@ public interface Repository { * @return PaginationResult with all the entities currently in the database matching the searchTerm * @throws ActivityTrackerException */ - public PaginationResult searchAll(String searchTerm, Pageable pageable) throws ActivityTrackerException; + PaginationResult searchAll(String searchTerm, Pageable pageable) throws ActivityTrackerException; /** * @param id of the entity we are looking for * @return the entity from the database with the given Id * @throws ActivityTrackerException */ - public E findById(int id) throws ActivityTrackerException; + E findById(int id) throws ActivityTrackerException; /** @@ -63,5 +63,5 @@ public interface Repository { * @return the entity after the database * @throws ActivityTrackerException */ - public E update(E entity) throws ActivityTrackerException; + E update(E entity) throws ActivityTrackerException; } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java index 27790b2..cc291f5 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java @@ -9,7 +9,6 @@ import de.rwth.dbis.acis.activitytracker.service.exception.ExceptionHandler; import de.rwth.dbis.acis.activitytracker.service.exception.ExceptionLocation; import org.jooq.*; -import org.jooq.Condition; import org.jooq.exception.DataAccessException; import java.util.ArrayList; diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java index 8835e6f..03d57ba 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java @@ -1,7 +1,7 @@ package de.rwth.dbis.acis.activitytracker.service.dal.transform; import de.rwth.dbis.acis.activitytracker.service.dal.entities.Activity; -import de.rwth.dbis.acis.activitytracker.service.dal.helpers.*; +import de.rwth.dbis.acis.activitytracker.service.dal.helpers.Pageable; import de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.records.ActivityRecord; import org.jooq.*; diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/network/HttpRequestCallable.java b/src/main/de/rwth/dbis/acis/activitytracker/service/network/HttpRequestCallable.java index cd5663a..2f1ddcf 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/network/HttpRequestCallable.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/network/HttpRequestCallable.java @@ -1,11 +1,9 @@ package de.rwth.dbis.acis.activitytracker.service.network; -import de.rwth.dbis.acis.activitytracker.service.ActivityTrackerService; import de.rwth.dbis.acis.activitytracker.service.exception.ActivityTrackerException; import de.rwth.dbis.acis.activitytracker.service.exception.ErrorCode; import de.rwth.dbis.acis.activitytracker.service.exception.ExceptionHandler; import de.rwth.dbis.acis.activitytracker.service.exception.ExceptionLocation; -import i5.las2peer.logging.L2pLogger; import org.apache.commons.io.IOUtils; import org.apache.http.HttpEntity; import org.apache.http.StatusLine; @@ -18,7 +16,6 @@ import java.io.StringWriter; import java.net.HttpURLConnection; import java.util.concurrent.Callable; -import java.util.logging.Level; public class HttpRequestCallable implements Callable { From 214bd7e2bd579b64c1b33412b815d2752b4a4bed Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Wed, 12 Apr 2017 20:58:17 +0200 Subject: [PATCH 12/29] Use reqbaz category instead component in demo data --- etc/activitytracker_demo_data.sql | 34 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/etc/activitytracker_demo_data.sql b/etc/activitytracker_demo_data.sql index b1fcfe0..f05e873 100644 --- a/etc/activitytracker_demo_data.sql +++ b/etc/activitytracker_demo_data.sql @@ -7,39 +7,39 @@ REPLACE INTO reqbaztrack.activity (id, creation_date, activity_action, data_url, VALUES (1, '2015-10-21 07:00:00', 'CREATE', 'http://localhost:8080/bazaar/projects/1', 'PROJECT', 'http://localhost:5000/#!/projects/1', NULL, NULL, 'http://localhost:8080/bazaar/users/2'), - (2, '2015-10-21 07:00:00', 'CREATE', 'http://localhost:8080/bazaar/components/1', 'COMPONENT', - 'http://localhost:5000/#!/projects/1/components/1', 'http://localhost:8080/bazaar/projects/1', + (2, '2015-10-21 07:00:00', 'CREATE', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', + 'http://localhost:5000/#!/projects/1/categories/1', 'http://localhost:8080/bazaar/projects/1', 'PROJECT', 'http://localhost:8080/bazaar/users/2'), (3, '2015-10-21 08:00:00', 'CREATE', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', - 'http://localhost:5000/#!/projects/1/components/1/requirements/1', 'http://localhost:8080/bazaar/components/1', - 'COMPONENT', 'http://localhost:8080/bazaar/users/2'), + 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', + 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), (4, '2015-10-21 09:00:00', 'UPDATE', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', - 'http://localhost:5000/#!/projects/1/components/1/requirements/1', 'http://localhost:8080/bazaar/components/1', - 'COMPONENT', 'http://localhost:8080/bazaar/users/2'), + 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', + 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), (5, '2015-10-21 10:00:00', 'DELETE', NULL, 'REQUIREMENT', - NULL, 'http://localhost:8080/bazaar/components/1', 'COMPONENT', 'http://localhost:8080/bazaar/users/2'), + NULL, 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), (6, '2015-10-21 10:00:00', 'CREATE', 'http://localhost:8080/bazaar/projects/2', 'PROJECT', 'http://localhost:5000/#!/projects/2', NULL, NULL, 'http://localhost:8080/bazaar/users/2'), - (7, '2015-10-21 10:00:00', 'CREATE', 'http://localhost:8080/bazaar/components/2', 'COMPONENT', - 'http://localhost:5000/#!/projects/2/components/2', 'http://localhost:8080/bazaar/projects/2', + (7, '2015-10-21 10:00:00', 'CREATE', 'http://localhost:8080/bazaar/categories/2', 'CATEGORY', + 'http://localhost:5000/#!/projects/2/categories/2', 'http://localhost:8080/bazaar/projects/2', 'PROJECT', 'http://localhost:8080/bazaar/users/2'), (8, '2015-10-21 11:00:00', 'CREATE', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', - 'http://localhost:5000/#!/projects/1/components/1/requirements/1', 'http://localhost:8080/bazaar/components/1', - 'COMPONENT', 'http://localhost:8080/bazaar/users/2'), + 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', + 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), (9, '2015-10-21 12:00:00', 'UPDATE', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', - 'http://localhost:5000/#!/projects/1/components/1/requirements/1', 'http://localhost:8080/bazaar/components/1', - 'COMPONENT', 'http://localhost:8080/bazaar/users/2'), + 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', + 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), (10, '2015-10-21 13:00:00', 'CREATE', 'http://localhost:8080/bazaar/comments/1', 'COMMENT', - 'http://localhost:5000/#!/projects/1/components/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', + 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'), (11, '2015-10-21 14:00:00', 'CREATE', 'http://localhost:8080/bazaar/comments/2', 'COMMENT', - 'http://localhost:5000/#!/projects/1/components/1/requirements/2', 'http://localhost:8080/bazaar/requirements/2', + 'http://localhost:5000/#!/projects/1/categories/1/requirements/2', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'), (12, '2015-10-21 15:00:00', 'CREATE', 'http://localhost:8080/bazaar/requirements/1', 'VOTE', - 'http://localhost:5000/#!/projects/1/components/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', + 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'), (13, '2015-10-21 15:00:00', 'DELETE', NULL, 'VOTE', - 'http://localhost:5000/#!/projects/1/components/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', + 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'); SET FOREIGN_KEY_CHECKS = 1; From 868c0d2973407dc5bd77d6fd9275f79134d6752b Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Wed, 12 Apr 2017 21:00:43 +0200 Subject: [PATCH 13/29] Removed ActivityEx class #RB-507 (sadly also auto formatted the code :-<) --- .../service/ActivityTrackerService.java | 323 +++++++++--------- .../service/dal/entities/Activity.java | 96 ++++-- .../service/dal/entities/ActivityEx.java | 137 -------- .../service/dal/entities/EntityBase.java | 14 +- .../service/dal/jooq/DefaultCatalog.java | 18 +- .../service/dal/jooq/Keys.java | 14 +- .../service/dal/jooq/Reqbaztrack.java | 18 +- .../service/dal/jooq/Tables.java | 12 +- .../service/dal/jooq/tables/Activity.java | 40 +-- .../jooq/tables/records/ActivityRecord.java | 132 +++---- .../dal/repositories/ActivityRepository.java | 2 +- .../dal/repositories/RepositoryImpl.java | 6 +- .../exception/ActivityTrackerException.java | 4 +- .../service/exception/ErrorCode.java | 10 +- .../service/exception/ExceptionLocation.java | 10 +- .../service/network/HttpRequestCallable.java | 3 +- .../service/ActivityTrackerTest.java | 33 +- 17 files changed, 373 insertions(+), 499 deletions(-) delete mode 100644 src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/ActivityEx.java diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java index 4dcc46a..fe177a2 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java @@ -5,7 +5,6 @@ import de.rwth.dbis.acis.activitytracker.service.dal.DALFacade; import de.rwth.dbis.acis.activitytracker.service.dal.DALFacadeImpl; import de.rwth.dbis.acis.activitytracker.service.dal.entities.Activity; -import de.rwth.dbis.acis.activitytracker.service.dal.entities.ActivityEx; import de.rwth.dbis.acis.activitytracker.service.dal.helpers.PageInfo; import de.rwth.dbis.acis.activitytracker.service.dal.helpers.Pageable; import de.rwth.dbis.acis.activitytracker.service.dal.helpers.PaginationResult; @@ -52,22 +51,32 @@ @ServicePath("activities") public class ActivityTrackerService extends RESTService { + private final L2pLogger logger = L2pLogger.getInstance(ActivityTrackerService.class.getName()); //CONFIG PROPERTIES protected String dbUserName; protected String dbPassword; protected String dbUrl; protected String baseURL; - private DataSource dataSource; - private final L2pLogger logger = L2pLogger.getInstance(ActivityTrackerService.class.getName()); - public ActivityTrackerService() throws Exception { setFieldValues(); Class.forName("com.mysql.jdbc.Driver").newInstance(); dataSource = setupDataSource(dbUrl, dbUserName, dbPassword); } + private static DataSource setupDataSource(String dbUrl, String dbUserName, String dbPassword) { + BasicDataSource dataSource = new BasicDataSource(); + dataSource.setDriverClassName("com.mysql.jdbc.Driver"); + dataSource.setUrl(dbUrl); + dataSource.setUsername(dbUserName); + dataSource.setPassword(dbPassword); + dataSource.setValidationQuery("SELECT 1;"); + dataSource.setTestOnBorrow(true); // test each connection when borrowing from the pool with the validation query + dataSource.setMaxConnLifetimeMillis(1000 * 60 * 60); // max connection life time 1h. mysql drops connection after 8h. + return dataSource; + } + @Override protected void initResources() { getResourceConfig().register(Resource.class); @@ -94,137 +103,6 @@ public String createActivity(String activity) throws InvocationTargetException, } } - @Api(value = "/activities", description = "Activities resource") - @SwaggerDefinition( - info = @Info( - title = "LAS2peer Activity Service", - version = "0.2", - description = "An activity tracker for LAS2peer and other web services.", - termsOfService = "http://requirements-bazaar.org", - contact = @Contact( - name = "Requirements Bazaar Dev Team", - url = "http://requirements-bazaar.org", - email = "info@requirements-bazaar.org" - ), - license = @License( - name = "Apache2", - url = "http://requirements-bazaar.org/license" - ) - )) - - @Path("/") - public static class Resource { - - private final ActivityTrackerService service = (ActivityTrackerService) Context.getCurrent().getService(); - - // ////////////////////////////////////////////////////////////////////////////////////// - // Service methods. - // ////////////////////////////////////////////////////////////////////////////////////// - - @GET - @Path("/") - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "This method returns a list of activities", - notes = "Default the latest ten activities will be returned") - @ApiResponses(value = { - @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a list of activities"), - @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found"), - @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal server problems") - }) - //TODO add filter - public Response getActivities( - @ApiParam(value = "Before cursor pagination", required = false) @DefaultValue("-1") @QueryParam("before") int before, - @ApiParam(value = "After cursor pagination", required = false) @DefaultValue("-1") @QueryParam("after") int after, - @ApiParam(value = "Limit of elements of components", required = false) @DefaultValue("10") @QueryParam("limit") int limit, - @ApiParam(value = "User authorization token", required = false) @DefaultValue("") @HeaderParam("authorization") String authorizationToken) { - - DALFacade dalFacade = null; - try { - if (before != -1 && after != -1) { - ExceptionHandler.getInstance().throwException(ExceptionLocation.ACTIVITYTRACKERSERVICE, ErrorCode.WRONG_PARAMETER, "both: before and after parameter not possible"); - } - int cursor = before != -1 ? before : after; - Pageable.SortDirection sortDirection = after != -1 ? Pageable.SortDirection.ASC : Pageable.SortDirection.DESC; - - PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); - cm.setMaxTotal(20); - CloseableHttpClient httpclient = HttpClients.custom() - .setConnectionManager(cm) - .build(); - - dalFacade = service.getDBConnection(); - Gson gson = new Gson(); - ExecutorService executor = Executors.newCachedThreadPool(); - - Map tempObjectStorage = new HashMap<>(); - - int getObjectCount = 0; - PaginationResult activities; - List activitiesEx = new ArrayList<>(); - Pageable pageInfo = new PageInfo(cursor, limit, "", sortDirection); - while (activitiesEx.size() < limit && getObjectCount < 5) { - pageInfo = new PageInfo(cursor, limit, "", sortDirection); - activities = dalFacade.findActivities(pageInfo); - getObjectCount++; - cursor = sortDirection == Pageable.SortDirection.ASC ? cursor + limit : cursor - limit; - if (cursor < 0) { - cursor = 0; - } - activitiesEx.addAll(service.getObjectBodies(httpclient, executor, authorizationToken, activities.getElements(), tempObjectStorage)); - } - - executor.shutdown(); - if (activitiesEx.size() > limit) { - activitiesEx = activitiesEx.subList(0, limit); - } - - PaginationResult activitiesExResult = new PaginationResult<>(pageInfo, activitiesEx); - - Map parameter = new HashMap<>(); - parameter.put("limit", String.valueOf(limit)); - - Response.ResponseBuilder responseBuilder = Response.ok(); - responseBuilder = responseBuilder.entity(gson.toJson(activitiesExResult.getElements())); - responseBuilder = service.paginationLinks(responseBuilder, activitiesExResult, "", parameter); - responseBuilder = service.xHeaderFields(responseBuilder, activitiesExResult); - Response response = responseBuilder.build(); - - return response; - - } catch (ActivityTrackerException atException) { - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ExceptionHandler.getInstance().toJSON(atException)).build(); - } catch (Exception ex) { - ActivityTrackerException atException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.ACTIVITYTRACKERSERVICE, ErrorCode.UNKNOWN, ex.getMessage()); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ExceptionHandler.getInstance().toJSON(atException)).build(); - } finally { - service.closeDBConnection(dalFacade); - } - } - - @POST - @Path("/") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "This method allows to create an activity", - notes = "Returns the created activity") - @ApiResponses(value = { - @ApiResponse(code = HttpURLConnection.HTTP_CREATED, message = "Activity created"), - @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal server problems") - }) - public Response createActivity(@ApiParam(value = "Activity" + - " entity as JSON", required = true) String activity) { - try { - Gson gson = new Gson(); - Activity activityToCreate = gson.fromJson(activity, Activity.class); - Activity createdActivity = service.storeActivity(activityToCreate); - return Response.status(Response.Status.CREATED).entity(gson.toJson(createdActivity)).build(); - } catch (ActivityTrackerException atException) { - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ExceptionHandler.getInstance().toJSON(atException)).build(); - } - } - - } - private Activity storeActivity(Activity activity) throws ActivityTrackerException { //TODO validate activity DALFacade dalFacade = null; @@ -240,19 +118,18 @@ private Activity storeActivity(Activity activity) throws ActivityTrackerExceptio } } - private List getObjectBodies(CloseableHttpClient httpclient, ExecutorService executor, String authorizationToken, + private List getObjectBodies(CloseableHttpClient httpclient, ExecutorService executor, String authorizationToken, List activities, Map tempObjectStorage) throws Exception { - List activitiesEx = new ArrayList<>(); + List activitiesWithObjectBodies = new ArrayList<>(); JsonParser parser = new JsonParser(); - for (int i = 0; i < activities.size(); i++) { - Activity activity = activities.get(i); - ActivityEx activityEx = ActivityEx.getBuilderEx().activity(activity).build(); + for (Activity activity : activities) { + Activity.Builder builder = Activity.getBuilder().activity(activity); try { if (activity.getDataUrl() != null && !activity.getDataUrl().isEmpty()) { if (tempObjectStorage.containsKey(activity.getDataUrl())) { - activityEx.setData(tempObjectStorage.get(activity.getDataUrl())); + builder.data(tempObjectStorage.get(activity.getDataUrl())); } else { URI uri = new URIBuilder(activity.getDataUrl()).build(); HttpGet httpget = new HttpGet(uri); @@ -261,14 +138,14 @@ private List getObjectBodies(CloseableHttpClient httpclient, Executo } Future dataFuture = executor.submit(new HttpRequestCallable(httpclient, httpget)); if (dataFuture != null) { - activityEx.setData(parser.parse(dataFuture.get())); - tempObjectStorage.put(activity.getDataUrl(), activityEx.getData()); + builder.data(parser.parse(dataFuture.get())); + tempObjectStorage.put(activity.getDataUrl(), parser.parse(dataFuture.get())); } } } if (activity.getParentDataUrl() != null && !activity.getParentDataUrl().isEmpty()) { if (tempObjectStorage.containsKey(activity.getParentDataUrl())) { - activityEx.setParentData(tempObjectStorage.get(activity.getParentDataUrl())); + builder.parentData(tempObjectStorage.get(activity.getParentDataUrl())); } else { URI uri = new URIBuilder(activity.getParentDataUrl()).build(); @@ -278,14 +155,14 @@ private List getObjectBodies(CloseableHttpClient httpclient, Executo } Future parentDataFuture = executor.submit(new HttpRequestCallable(httpclient, httpget)); if (parentDataFuture != null) { - activityEx.setParentData(parser.parse(parentDataFuture.get())); - tempObjectStorage.put(activity.getParentDataUrl(), activityEx.getParentData()); + builder.parentData(parser.parse(parentDataFuture.get())); + tempObjectStorage.put(activity.getParentDataUrl(), parser.parse(parentDataFuture.get())); } } } if (activity.getUserUrl() != null && !activity.getUserUrl().isEmpty()) { if (tempObjectStorage.containsKey(activity.getUserUrl())) { - activityEx.setUser(tempObjectStorage.get(activity.getUserUrl())); + builder.user(tempObjectStorage.get(activity.getUserUrl())); } else { URI uri = new URIBuilder(activity.getUserUrl()).build(); HttpGet httpget = new HttpGet(uri); @@ -294,12 +171,12 @@ private List getObjectBodies(CloseableHttpClient httpclient, Executo } Future userFuture = executor.submit(new HttpRequestCallable(httpclient, httpget)); if (userFuture != null) { - activityEx.setUser(parser.parse(userFuture.get())); - tempObjectStorage.put(activity.getUserUrl(), activityEx.getUser()); + builder.user(parser.parse(userFuture.get())); + tempObjectStorage.put(activity.getUserUrl(), userFuture.get()); } } } - activitiesEx.add(activityEx); + activitiesWithObjectBodies.add(builder.build()); } catch (Exception ex) { Throwable exCause = ex.getCause(); if (exCause instanceof ActivityTrackerException && @@ -313,7 +190,7 @@ private List getObjectBodies(CloseableHttpClient httpclient, Executo } } } - return activitiesEx; + return activitiesWithObjectBodies; } public Response.ResponseBuilder paginationLinks(Response.ResponseBuilder responseBuilder, PaginationResult paginationResult, String path, Map httpParameter) throws URISyntaxException { @@ -366,19 +243,6 @@ public Response.ResponseBuilder xHeaderFields(Response.ResponseBuilder responseB return responseBuilder; } - private static DataSource setupDataSource(String dbUrl, String dbUserName, String dbPassword) { - BasicDataSource dataSource = new BasicDataSource(); - dataSource.setDriverClassName("com.mysql.jdbc.Driver"); - dataSource.setUrl(dbUrl); - dataSource.setUsername(dbUserName); - dataSource.setPassword(dbPassword); - dataSource.setValidationQuery("SELECT 1;"); - dataSource.setTestOnBorrow(true); // test each connection when borrowing from the pool with the validation query - dataSource.setMaxConnLifetimeMillis(1000 * 60 * 60); // max connection life time 1h. mysql drops connection after 8h. - return dataSource; - } - - public DALFacade getDBConnection() throws Exception { return new DALFacadeImpl(dataSource, SQLDialect.MYSQL); } @@ -388,4 +252,135 @@ public void closeDBConnection(DALFacade dalFacade) { dalFacade.close(); } + @Api(value = "/activities", description = "Activities resource") + @SwaggerDefinition( + info = @Info( + title = "LAS2peer Activity Service", + version = "0.2", + description = "An activity tracker for LAS2peer and other web services.", + termsOfService = "http://requirements-bazaar.org", + contact = @Contact( + name = "Requirements Bazaar Dev Team", + url = "http://requirements-bazaar.org", + email = "info@requirements-bazaar.org" + ), + license = @License( + name = "Apache2", + url = "http://requirements-bazaar.org/license" + ) + )) + + @Path("/") + public static class Resource { + + private final ActivityTrackerService service = (ActivityTrackerService) Context.getCurrent().getService(); + + // ////////////////////////////////////////////////////////////////////////////////////// + // Service methods. + // ////////////////////////////////////////////////////////////////////////////////////// + + @GET + @Path("/") + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "This method returns a list of activities", + notes = "Default the latest ten activities will be returned") + @ApiResponses(value = { + @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a list of activities"), + @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found"), + @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal server problems") + }) + //TODO add filter + public Response getActivities( + @ApiParam(value = "Before cursor pagination", required = false) @DefaultValue("-1") @QueryParam("before") int before, + @ApiParam(value = "After cursor pagination", required = false) @DefaultValue("-1") @QueryParam("after") int after, + @ApiParam(value = "Limit of elements of components", required = false) @DefaultValue("10") @QueryParam("limit") int limit, + @ApiParam(value = "User authorization token", required = false) @DefaultValue("") @HeaderParam("authorization") String authorizationToken) { + + DALFacade dalFacade = null; + try { + if (before != -1 && after != -1) { + ExceptionHandler.getInstance().throwException(ExceptionLocation.ACTIVITYTRACKERSERVICE, ErrorCode.WRONG_PARAMETER, "both: before and after parameter not possible"); + } + int cursor = before != -1 ? before : after; + Pageable.SortDirection sortDirection = after != -1 ? Pageable.SortDirection.ASC : Pageable.SortDirection.DESC; + + PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); + cm.setMaxTotal(20); + CloseableHttpClient httpclient = HttpClients.custom() + .setConnectionManager(cm) + .build(); + + dalFacade = service.getDBConnection(); + Gson gson = new Gson(); + ExecutorService executor = Executors.newCachedThreadPool(); + + Map tempObjectStorage = new HashMap<>(); + + int getObjectCount = 0; + PaginationResult activitiesPaginationResult = null; + List activities = new ArrayList<>(); + Pageable pageInfo = null; + while (activities.size() < limit && getObjectCount < 5) { + pageInfo = new PageInfo(cursor, limit, "", sortDirection); + activitiesPaginationResult = dalFacade.findActivities(pageInfo); + getObjectCount++; + cursor = sortDirection == Pageable.SortDirection.ASC ? cursor + limit : cursor - limit; + if (cursor < 0) { + cursor = 0; + } + activities.addAll(service.getObjectBodies(httpclient, executor, authorizationToken, activitiesPaginationResult.getElements(), tempObjectStorage)); + } + + executor.shutdown(); + if (activities.size() > limit) { + activities = activities.subList(0, limit); + } + + activitiesPaginationResult = new PaginationResult<>(pageInfo, activities); + + Map parameter = new HashMap<>(); + parameter.put("limit", String.valueOf(limit)); + + Response.ResponseBuilder responseBuilder = Response.ok(); + responseBuilder = responseBuilder.entity(gson.toJson(activitiesPaginationResult.getElements())); + responseBuilder = service.paginationLinks(responseBuilder, activitiesPaginationResult, "", parameter); + responseBuilder = service.xHeaderFields(responseBuilder, activitiesPaginationResult); + Response response = responseBuilder.build(); + + return response; + + } catch (ActivityTrackerException atException) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ExceptionHandler.getInstance().toJSON(atException)).build(); + } catch (Exception ex) { + ActivityTrackerException atException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.ACTIVITYTRACKERSERVICE, ErrorCode.UNKNOWN, ex.getMessage()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ExceptionHandler.getInstance().toJSON(atException)).build(); + } finally { + service.closeDBConnection(dalFacade); + } + } + + @POST + @Path("/") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "This method allows to create an activity", + notes = "Returns the created activity") + @ApiResponses(value = { + @ApiResponse(code = HttpURLConnection.HTTP_CREATED, message = "Activity created"), + @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal server problems") + }) + public Response createActivity(@ApiParam(value = "Activity" + + " entity as JSON", required = true) String activity) { // TODO: use Activity Calss and remove gson + try { + Gson gson = new Gson(); + Activity activityToCreate = gson.fromJson(activity, Activity.class); + Activity createdActivity = service.storeActivity(activityToCreate); + return Response.status(Response.Status.CREATED).entity(gson.toJson(createdActivity)).build(); + } catch (ActivityTrackerException atException) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ExceptionHandler.getInstance().toJSON(atException)).build(); + } + } + + } + } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java index bed27ec..218e63a 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java @@ -4,6 +4,7 @@ public class Activity extends EntityBase { + private final int id; private final Date creationDate; private final String activityAction; private final String dataUrl; @@ -12,6 +13,32 @@ public class Activity extends EntityBase { private final String parentDataUrl; private final String parentDataType; private final String userUrl; + private final Object data; + private final Object parentData; + private final Object user; + + protected Activity(Builder builder) { + this.id = builder.id; + this.creationDate = builder.creationDate; + this.activityAction = builder.activityAction; + this.dataUrl = builder.dataUrl; + this.dataType = builder.dataType; + this.dataFrontendUrl = builder.dataFrontendUrl; + this.parentDataUrl = builder.parentDataUrl; + this.parentDataType = builder.parentDataType; + this.userUrl = builder.userUrl; + this.data = builder.data; + this.parentData = builder.parentData; + this.user = builder.user; + } + + public static Builder getBuilder() { + return new Builder(); + } + + public int getId() { + return id; + } public Date getCreationDate() { return creationDate; @@ -45,33 +72,45 @@ public String getUserUrl() { return userUrl; } - protected Activity(Builder builder) { - super(builder); - this.creationDate = builder.creationDate; - this.activityAction = builder.activityAction; - this.dataUrl = builder.dataUrl; - this.dataType = builder.dataType; - this.dataFrontendUrl = builder.dataFrontendUrl; - this.parentDataUrl = builder.parentDataUrl; - this.parentDataType = builder.parentDataType; - this.userUrl = builder.userUrl; + public Object getData() { + return data; } - public static Builder getBuilder() { - return new Builder(); + public Object getParentData() { + return parentData; + } + + public Object getUser() { + return user; } public static class Builder { - protected int id; - protected Date creationDate; - protected String activityAction; - protected String dataUrl; - protected String dataType; - protected String dataFrontendUrl; - protected String parentDataUrl; - protected String parentDataType; - protected String userUrl; + private int id; + private Date creationDate; + private String activityAction; + private String dataUrl; + private String dataType; + private String dataFrontendUrl; + private String parentDataUrl; + private String parentDataType; + private String userUrl; + private Object data; + private Object parentData; + private Object user; + + public Builder activity(Activity activity) { + id(activity.getId()); + creationDate(activity.getCreationDate()); + activityAction(activity.getActivityAction()); + dataUrl(activity.getDataUrl()); + dataType(activity.getDataType()); + dataFrontendUrl(activity.getDataFrontendUrl()); + parentDataUrl(activity.getParentDataUrl()); + parentDataType(activity.getParentDataType()); + userUrl(activity.getUserUrl()); + return this; + } public Builder id(int id) { this.id = id; @@ -118,6 +157,21 @@ public Builder userUrl(String userUrl) { return this; } + public Activity.Builder data(Object data) { + this.data = data; + return this; + } + + public Activity.Builder parentData(Object parentData) { + this.parentData = parentData; + return this; + } + + public Activity.Builder user(Object user) { + this.user = user; + return this; + } + public Activity build() { Activity created = new Activity(this); return created; diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/ActivityEx.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/ActivityEx.java deleted file mode 100644 index d13193b..0000000 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/ActivityEx.java +++ /dev/null @@ -1,137 +0,0 @@ -package de.rwth.dbis.acis.activitytracker.service.dal.entities; - -import java.util.Date; - -public class ActivityEx extends Activity { - - private Object data; - private Object parentData; - private Object user; - - private ActivityEx(BuilderEx builderEx) { - super(builderEx); - this.data = builderEx.data; - this.parentData = builderEx.parentData; - this.user = builderEx.user; - } - - public Object getData() { - return data; - } - - public void setData(Object data) { - this.data = data; - } - - public Object getParentData() { - return parentData; - } - - public void setParentData(Object parentData) { - this.parentData = parentData; - } - - public Object getUser() { - return user; - } - - public void setUser(Object user) { - this.user = user; - } - - public static BuilderEx getBuilderEx() { - return new BuilderEx(); - } - - public static class BuilderEx extends Builder { - - private Object data; - private Object parentData; - private Object user; - - public BuilderEx() { - super(); - } - - public BuilderEx activity(Activity activity) { - id(activity.getId()); - creationDate(activity.getCreationDate()); - activityAction(activity.getActivityAction()); - dataUrl(activity.getDataUrl()); - dataType(activity.getDataType()); - dataFrontendUrl(activity.getDataFrontendUrl()); - parentDataUrl(activity.getParentDataUrl()); - parentDataType(activity.getParentDataType()); - userUrl(activity.getUserUrl()); - return this; - } - - public BuilderEx data(Object data) { - this.data = data; - return this; - } - - public BuilderEx parentData(Object parentData) { - this.parentData = parentData; - return this; - } - - public BuilderEx user(Object user) { - this.user = user; - return this; - } - - @Override - public BuilderEx creationDate(Date creationDate) { - this.creationDate = creationDate; - return this; - } - - @Override - public BuilderEx activityAction(String activityAction) { - this.activityAction = activityAction; - return this; - } - - @Override - public BuilderEx dataUrl(String dataUrl) { - this.dataUrl = dataUrl; - return this; - } - - @Override - public BuilderEx dataType(String dataType) { - this.dataType = dataType; - return this; - } - - @Override - public Builder dataFrontendUrl(String dataFrontendUrl) { - this.dataFrontendUrl = dataFrontendUrl; - return this; - } - - @Override - public Builder parentDataUrl(String parentDataUrl) { - this.parentDataUrl = parentDataUrl; - return this; - } - - @Override - public Builder parentDataType(String parentDataType) { - this.parentDataType = parentDataType; - return this; - } - - @Override - public BuilderEx userUrl(String userUrl) { - this.userUrl = userUrl; - return this; - } - - @Override - public ActivityEx build() { - return new ActivityEx(this); - } - } -} diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/EntityBase.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/EntityBase.java index 0183c12..958e4dc 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/EntityBase.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/EntityBase.java @@ -4,20 +4,8 @@ public abstract class EntityBase implements IdentifiedById { - private final int id; - - public EntityBase(Activity.Builder builder) { - this.id = builder.id; - } - - @Override - public int getId() { - return id; - } - + // TODO: use this method in Activity public String toJSON() { return new Gson().toJson(this); } - - // TODO: Add an abstract Builder to avoid import Activity.Builder here } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/DefaultCatalog.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/DefaultCatalog.java index 9eefc7b..63ec42d 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/DefaultCatalog.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/DefaultCatalog.java @@ -17,22 +17,20 @@ * This class is generated by jOOQ. */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.9.1" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) -@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +@SuppressWarnings({"all", "unchecked", "rawtypes"}) public class DefaultCatalog extends CatalogImpl { - private static final long serialVersionUID = 1525292833; - /** * The reference instance of */ public static final DefaultCatalog DEFAULT_CATALOG = new DefaultCatalog(); - + private static final long serialVersionUID = 1525292833; /** * The schema reqbaztrack. */ @@ -54,6 +52,6 @@ public final List getSchemas() { private final List getSchemas0() { return Arrays.asList( - Reqbaztrack.REQBAZTRACK); + Reqbaztrack.REQBAZTRACK); } } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Keys.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Keys.java index 744d59e..3b9d67a 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Keys.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Keys.java @@ -14,17 +14,17 @@ /** - * A class modelling foreign key relationships between tables of the reqbaztrack + * A class modelling foreign key relationships between tables of the reqbaztrack * schema */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.9.1" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) -@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +@SuppressWarnings({"all", "unchecked", "rawtypes"}) public class Keys { // ------------------------------------------------------------------------- diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Reqbaztrack.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Reqbaztrack.java index 86d1c8a..3f8953f 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Reqbaztrack.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Reqbaztrack.java @@ -19,22 +19,20 @@ * This class is generated by jOOQ. */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.9.1" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) -@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +@SuppressWarnings({"all", "unchecked", "rawtypes"}) public class Reqbaztrack extends SchemaImpl { - private static final long serialVersionUID = -1601202747; - /** * The reference instance of reqbaztrack */ public static final Reqbaztrack REQBAZTRACK = new Reqbaztrack(); - + private static final long serialVersionUID = -1601202747; /** * The table reqbaztrack.activity. */ @@ -65,6 +63,6 @@ public final List> getTables() { private final List> getTables0() { return Arrays.>asList( - Activity.ACTIVITY); + Activity.ACTIVITY); } } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Tables.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Tables.java index 155e2fd..e28eb5f 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Tables.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Tables.java @@ -13,13 +13,13 @@ * Convenience access to all tables in reqbaztrack */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.9.1" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) -@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +@SuppressWarnings({"all", "unchecked", "rawtypes"}) public class Tables { /** diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java index 84b414f..bed11ff 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java @@ -20,70 +20,52 @@ * This class is generated by jOOQ. */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.9.1" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) -@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +@SuppressWarnings({"all", "unchecked", "rawtypes"}) public class Activity extends TableImpl { - private static final long serialVersionUID = -1015172083; - /** * The reference instance of reqbaztrack.activity */ public static final Activity ACTIVITY = new Activity(); - - /** - * The class holding records for this type - */ - @Override - public Class getRecordType() { - return ActivityRecord.class; - } - + private static final long serialVersionUID = -1015172083; /** * The column reqbaztrack.activity.id. */ public final TableField ID = createField("id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); - /** * The column reqbaztrack.activity.creation_date. */ public final TableField CREATION_DATE = createField("creation_date", org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.inline("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, ""); - /** * The column reqbaztrack.activity.activity_action. */ public final TableField ACTIVITY_ACTION = createField("activity_action", org.jooq.impl.SQLDataType.VARCHAR.length(255).nullable(false), this, ""); - /** * The column reqbaztrack.activity.data_url. */ public final TableField DATA_URL = createField("data_url", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); - /** * The column reqbaztrack.activity.data_type. */ public final TableField DATA_TYPE = createField("data_type", org.jooq.impl.SQLDataType.VARCHAR.length(255).nullable(false), this, ""); - /** * The column reqbaztrack.activity.data_frontend_url. */ public final TableField DATA_FRONTEND_URL = createField("data_frontend_url", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); - /** * The column reqbaztrack.activity.parent_data_url. */ public final TableField PARENT_DATA_URL = createField("parent_data_url", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); - /** * The column reqbaztrack.activity.parent_data_type. */ public final TableField PARENT_DATA_TYPE = createField("parent_data_type", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); - /** * The column reqbaztrack.activity.user_url. */ @@ -111,6 +93,14 @@ private Activity(String alias, Table aliased, Field[] paramet super(alias, null, aliased, parameters, ""); } + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ActivityRecord.class; + } + /** * {@inheritDoc} */ diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java index 765b033..8f2ee3a 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java @@ -19,22 +19,39 @@ * This class is generated by jOOQ. */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.9.1" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) -@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +@SuppressWarnings({"all", "unchecked", "rawtypes"}) public class ActivityRecord extends UpdatableRecordImpl implements Record9 { private static final long serialVersionUID = -1489974951; /** - * Setter for reqbaztrack.activity.id. + * Create a detached ActivityRecord */ - public void setId(Integer value) { - set(0, value); + public ActivityRecord() { + super(Activity.ACTIVITY); + } + + /** + * Create a detached, initialised ActivityRecord + */ + public ActivityRecord(Integer id, Timestamp creationDate, String activityAction, String dataUrl, String dataType, String dataFrontendUrl, String parentDataUrl, String parentDataType, String userUrl) { + super(Activity.ACTIVITY); + + set(0, id); + set(1, creationDate); + set(2, activityAction); + set(3, dataUrl); + set(4, dataType); + set(5, dataFrontendUrl); + set(6, parentDataUrl); + set(7, parentDataType); + set(8, userUrl); } /** @@ -45,10 +62,10 @@ public Integer getId() { } /** - * Setter for reqbaztrack.activity.creation_date. + * Setter for reqbaztrack.activity.id. */ - public void setCreationDate(Timestamp value) { - set(1, value); + public void setId(Integer value) { + set(0, value); } /** @@ -59,10 +76,10 @@ public Timestamp getCreationDate() { } /** - * Setter for reqbaztrack.activity.activity_action. + * Setter for reqbaztrack.activity.creation_date. */ - public void setActivityAction(String value) { - set(2, value); + public void setCreationDate(Timestamp value) { + set(1, value); } /** @@ -73,10 +90,10 @@ public String getActivityAction() { } /** - * Setter for reqbaztrack.activity.data_url. + * Setter for reqbaztrack.activity.activity_action. */ - public void setDataUrl(String value) { - set(3, value); + public void setActivityAction(String value) { + set(2, value); } /** @@ -87,10 +104,10 @@ public String getDataUrl() { } /** - * Setter for reqbaztrack.activity.data_type. + * Setter for reqbaztrack.activity.data_url. */ - public void setDataType(String value) { - set(4, value); + public void setDataUrl(String value) { + set(3, value); } /** @@ -101,10 +118,10 @@ public String getDataType() { } /** - * Setter for reqbaztrack.activity.data_frontend_url. + * Setter for reqbaztrack.activity.data_type. */ - public void setDataFrontendUrl(String value) { - set(5, value); + public void setDataType(String value) { + set(4, value); } /** @@ -115,10 +132,10 @@ public String getDataFrontendUrl() { } /** - * Setter for reqbaztrack.activity.parent_data_url. + * Setter for reqbaztrack.activity.data_frontend_url. */ - public void setParentDataUrl(String value) { - set(6, value); + public void setDataFrontendUrl(String value) { + set(5, value); } /** @@ -129,10 +146,10 @@ public String getParentDataUrl() { } /** - * Setter for reqbaztrack.activity.parent_data_type. + * Setter for reqbaztrack.activity.parent_data_url. */ - public void setParentDataType(String value) { - set(7, value); + public void setParentDataUrl(String value) { + set(6, value); } /** @@ -143,12 +160,16 @@ public String getParentDataType() { } /** - * Setter for reqbaztrack.activity.user_url. + * Setter for reqbaztrack.activity.parent_data_type. */ - public void setUserUrl(String value) { - set(8, value); + public void setParentDataType(String value) { + set(7, value); } + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + /** * Getter for reqbaztrack.activity.user_url. */ @@ -157,9 +178,16 @@ public String getUserUrl() { } // ------------------------------------------------------------------------- - // Primary key information + // Record9 type implementation // ------------------------------------------------------------------------- + /** + * Setter for reqbaztrack.activity.user_url. + */ + public void setUserUrl(String value) { + set(8, value); + } + /** * {@inheritDoc} */ @@ -168,10 +196,6 @@ public Record1 key() { return (Record1) super.key(); } - // ------------------------------------------------------------------------- - // Record9 type implementation - // ------------------------------------------------------------------------- - /** * {@inheritDoc} */ @@ -404,6 +428,10 @@ public ActivityRecord value8(String value) { return this; } + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + /** * {@inheritDoc} */ @@ -429,32 +457,4 @@ public ActivityRecord values(Integer value1, Timestamp value2, String value3, St value9(value9); return this; } - - // ------------------------------------------------------------------------- - // Constructors - // ------------------------------------------------------------------------- - - /** - * Create a detached ActivityRecord - */ - public ActivityRecord() { - super(Activity.ACTIVITY); - } - - /** - * Create a detached, initialised ActivityRecord - */ - public ActivityRecord(Integer id, Timestamp creationDate, String activityAction, String dataUrl, String dataType, String dataFrontendUrl, String parentDataUrl, String parentDataType, String userUrl) { - super(Activity.ACTIVITY); - - set(0, id); - set(1, creationDate); - set(2, activityAction); - set(3, dataUrl); - set(4, dataType); - set(5, dataFrontendUrl); - set(6, parentDataUrl); - set(7, parentDataType); - set(8, userUrl); - } } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/ActivityRepository.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/ActivityRepository.java index 0f2bf7f..3b61536 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/ActivityRepository.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/ActivityRepository.java @@ -2,5 +2,5 @@ import de.rwth.dbis.acis.activitytracker.service.dal.entities.Activity; -public interface ActivityRepository extends Repository{ +public interface ActivityRepository extends Repository { } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java index cc291f5..c3ab235 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java @@ -21,7 +21,7 @@ public class RepositoryImpl implements R protected final Transformer transformer; /** - * @param jooq DSLContext for JOOQ connection + * @param jooq DSLContext for JOOQ connection * @param transformer Transformer object to create mapping between JOOQ record and our entities */ public RepositoryImpl(DSLContext jooq, Transformer transformer) { @@ -222,10 +222,10 @@ public E update(E entity) throws ActivityTrackerException { for (Map.Entry item : map.entrySet()) { Field key = item.getKey(); Object value = item.getValue(); - if(moreStep == null) + if (moreStep == null) moreStep = update.set(key, value); else - moreStep.set(key,value); + moreStep.set(key, value); } assert moreStep != null; moreStep.where(transformer.getTableId().equal(entity.getId())).execute(); diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ActivityTrackerException.java b/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ActivityTrackerException.java index 6822763..00b9833 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ActivityTrackerException.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ActivityTrackerException.java @@ -3,12 +3,12 @@ import com.google.gson.annotations.Expose; public class ActivityTrackerException extends Exception { + @Expose + private final ExceptionLocation location; @Expose private String message; @Expose private ErrorCode errorCode; - @Expose - private final ExceptionLocation location; protected ActivityTrackerException(ExceptionLocation location) { this.location = location; diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ErrorCode.java b/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ErrorCode.java index 6479d69..fcd1e69 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ErrorCode.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ErrorCode.java @@ -13,6 +13,11 @@ public enum ErrorCode { private final String code; private final String message; + private ErrorCode(String code, String message) { + this.code = code; + this.message = message; + } + public String asCode() { return code; } @@ -20,9 +25,4 @@ public String asCode() { public String getMessage() { return message; } - - private ErrorCode(String code, String message) { - this.code = code; - this.message = message; - } } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ExceptionLocation.java b/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ExceptionLocation.java index 496d0fc..a53476b 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ExceptionLocation.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/exception/ExceptionLocation.java @@ -10,6 +10,11 @@ public enum ExceptionLocation { private final String code; private final String message; + ExceptionLocation(String code, String message) { + this.code = code; + this.message = message; + } + public String asCode() { return code; } @@ -17,9 +22,4 @@ public String asCode() { public String getMessage() { return message; } - - ExceptionLocation(String code, String message) { - this.code = code; - this.message = message; - } } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/network/HttpRequestCallable.java b/src/main/de/rwth/dbis/acis/activitytracker/service/network/HttpRequestCallable.java index 2f1ddcf..186e5c1 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/network/HttpRequestCallable.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/network/HttpRequestCallable.java @@ -59,8 +59,7 @@ public Object call() throws Exception { throw ate; } catch (Exception e) { throw ExceptionHandler.getInstance().convert(e, ExceptionLocation.NETWORK, ErrorCode.UNKNOWN, ""); - } - finally { + } finally { if (response != null) { response.close(); } diff --git a/src/test/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerTest.java b/src/test/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerTest.java index ca0d362..2fc9a06 100644 --- a/src/test/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerTest.java +++ b/src/test/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerTest.java @@ -1,24 +1,17 @@ package de.rwth.dbis.acis.activitytracker.service; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - import i5.las2peer.p2p.LocalNode; import i5.las2peer.p2p.ServiceNameVersion; import i5.las2peer.security.ServiceAgent; import i5.las2peer.security.UserAgent; import i5.las2peer.testing.MockAgentFactory; import i5.las2peer.webConnector.WebConnector; -import i5.las2peer.webConnector.client.ClientResponse; -import i5.las2peer.webConnector.client.MiniClient; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; /** * Example Test Class demonstrating a basic JUnit test structure. @@ -27,18 +20,14 @@ public class ActivityTrackerTest { private static final String HTTP_ADDRESS = "http://127.0.0.1"; private static final int HTTP_PORT = WebConnector.DEFAULT_HTTP_PORT; - - private static LocalNode node; - private static WebConnector connector; - private static ByteArrayOutputStream logStream; - - private static UserAgent testAgent; private static final String testPass = "adamspass"; - // during testing, the specified service version does not matter private static final ServiceNameVersion activityTrackerService = new ServiceNameVersion(ActivityTrackerService.class.getCanonicalName(), "1.0"); - private static final String mainPath = "template/"; + private static LocalNode node; + private static WebConnector connector; + private static ByteArrayOutputStream logStream; + private static UserAgent testAgent; /** * Called before the tests start. @@ -102,7 +91,7 @@ public static void shutDownServer() throws Exception { @Test public void testGet() { /* - MiniClient c = new MiniClient(); + MiniClient c = new MiniClient(); c.setAddressPort(HTTP_ADDRESS, HTTP_PORT); try From 71a078fce286103fee714d9d638aa604bc3ef346 Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Wed, 12 Apr 2017 21:37:53 +0200 Subject: [PATCH 14/29] Change default passwort for debuging --- build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 18ede85..6a2bd6e 100644 --- a/build.xml +++ b/build.xml @@ -307,7 +307,7 @@ - + From cf0ccd916e5dcedd32f34f322c9c34a449b04af3 Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Wed, 12 Apr 2017 21:52:26 +0200 Subject: [PATCH 15/29] Use Actitvity creation from jersey for POST /activities --- .../service/ActivityTrackerService.java | 11 ++++---- .../service/dal/entities/Activity.java | 27 ++++++++++--------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java index fe177a2..fb76dcb 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java @@ -96,7 +96,7 @@ public String createActivity(String activity) throws InvocationTargetException, try { Gson gson = new Gson(); Activity activityToCreate = gson.fromJson(activity, Activity.class); - Activity createdActivity = this.storeActivity(activityToCreate); + this.storeActivity(activityToCreate); return new Integer(Response.Status.CREATED.getStatusCode()).toString(); } catch (ActivityTrackerException atException) { return new Integer(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).toString(); @@ -255,9 +255,9 @@ public void closeDBConnection(DALFacade dalFacade) { @Api(value = "/activities", description = "Activities resource") @SwaggerDefinition( info = @Info( - title = "LAS2peer Activity Service", + title = "las2peer Activity Service", version = "0.2", - description = "An activity tracker for LAS2peer and other web services.", + description = "An activity tracker for las2peer and other web services.", termsOfService = "http://requirements-bazaar.org", contact = @Contact( name = "Requirements Bazaar Dev Team", @@ -370,11 +370,10 @@ public Response getActivities( @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal server problems") }) public Response createActivity(@ApiParam(value = "Activity" + - " entity as JSON", required = true) String activity) { // TODO: use Activity Calss and remove gson + " entity to create", required = true) Activity activity) { try { Gson gson = new Gson(); - Activity activityToCreate = gson.fromJson(activity, Activity.class); - Activity createdActivity = service.storeActivity(activityToCreate); + Activity createdActivity = service.storeActivity(activity); return Response.status(Response.Status.CREATED).entity(gson.toJson(createdActivity)).build(); } catch (ActivityTrackerException atException) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ExceptionHandler.getInstance().toJSON(atException)).build(); diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java index 218e63a..3417406 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java @@ -4,18 +4,21 @@ public class Activity extends EntityBase { - private final int id; - private final Date creationDate; - private final String activityAction; - private final String dataUrl; - private final String dataType; - private final String dataFrontendUrl; - private final String parentDataUrl; - private final String parentDataType; - private final String userUrl; - private final Object data; - private final Object parentData; - private final Object user; + private int id; + private Date creationDate; + private String activityAction; + private String dataUrl; + private String dataType; + private String dataFrontendUrl; + private String parentDataUrl; + private String parentDataType; + private String userUrl; + private Object data; + private Object parentData; + private Object user; + + public Activity() { + } protected Activity(Builder builder) { this.id = builder.id; From 21c9b9f99e3ac734585efdaab7b81f362f554ae7 Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Wed, 12 Apr 2017 21:56:06 +0200 Subject: [PATCH 16/29] Use toJson method from entity class --- .../acis/activitytracker/service/ActivityTrackerService.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java index fb76dcb..4a3908d 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java @@ -372,9 +372,8 @@ public Response getActivities( public Response createActivity(@ApiParam(value = "Activity" + " entity to create", required = true) Activity activity) { try { - Gson gson = new Gson(); Activity createdActivity = service.storeActivity(activity); - return Response.status(Response.Status.CREATED).entity(gson.toJson(createdActivity)).build(); + return Response.status(Response.Status.CREATED).entity(createdActivity.toJSON()).build(); } catch (ActivityTrackerException atException) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ExceptionHandler.getInstance().toJSON(atException)).build(); } From 6891774a8bd2a08cfcaea14260a236892ae1ff12 Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Wed, 12 Apr 2017 23:14:02 +0200 Subject: [PATCH 17/29] Small code improvements --- .../activitytracker/service/ActivityTrackerService.java | 6 +++--- .../activitytracker/service/dal/entities/EntityBase.java | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java index 4a3908d..dac699e 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java @@ -46,7 +46,7 @@ import java.util.concurrent.Future; /** - * LAS2peer Activity Service + * Las2peer Activity Service */ @ServicePath("activities") public class ActivityTrackerService extends RESTService { @@ -293,7 +293,7 @@ public static class Resource { public Response getActivities( @ApiParam(value = "Before cursor pagination", required = false) @DefaultValue("-1") @QueryParam("before") int before, @ApiParam(value = "After cursor pagination", required = false) @DefaultValue("-1") @QueryParam("after") int after, - @ApiParam(value = "Limit of elements of components", required = false) @DefaultValue("10") @QueryParam("limit") int limit, + @ApiParam(value = "Limit of activity elements", required = false) @DefaultValue("10") @QueryParam("limit") int limit, @ApiParam(value = "User authorization token", required = false) @DefaultValue("") @HeaderParam("authorization") String authorizationToken) { DALFacade dalFacade = null; @@ -317,7 +317,7 @@ public Response getActivities( Map tempObjectStorage = new HashMap<>(); int getObjectCount = 0; - PaginationResult activitiesPaginationResult = null; + PaginationResult activitiesPaginationResult; List activities = new ArrayList<>(); Pageable pageInfo = null; while (activities.size() < limit && getObjectCount < 5) { diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/EntityBase.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/EntityBase.java index 958e4dc..4c14127 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/EntityBase.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/EntityBase.java @@ -4,7 +4,6 @@ public abstract class EntityBase implements IdentifiedById { - // TODO: use this method in Activity public String toJSON() { return new Gson().toJson(this); } From 876a9959e471a859c3859bfc53a93a02e851b218 Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Thu, 13 Apr 2017 00:51:23 +0200 Subject: [PATCH 18/29] Activity validation #RB-509 --- .classpath | 3 +++ etc/activitytracker_create.sql | 2 +- etc/ivy/ivy.xml | 1 + .../service/ActivityTrackerService.java | 8 +++++- .../service/dal/entities/Activity.java | 25 +++++++++++++++++++ 5 files changed, 37 insertions(+), 2 deletions(-) diff --git a/.classpath b/.classpath index 26fda49..fc14723 100644 --- a/.classpath +++ b/.classpath @@ -47,6 +47,9 @@ + + + diff --git a/etc/activitytracker_create.sql b/etc/activitytracker_create.sql index 4c9d23a..62e2f73 100644 --- a/etc/activitytracker_create.sql +++ b/etc/activitytracker_create.sql @@ -11,7 +11,7 @@ CREATE TABLE IF NOT EXISTS reqbaztrack.activity ( creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, activity_action VARCHAR(255) NOT NULL, data_url VARCHAR(255) NULL, - data_type VARCHAR(255) NOT NULL, + data_type VARCHAR(255) NULL, data_frontend_url VARCHAR(255) NULL, parent_data_url VARCHAR(255) NULL, parent_data_type VARCHAR(255) NULL, diff --git a/etc/ivy/ivy.xml b/etc/ivy/ivy.xml index ea6a926..8a50955 100644 --- a/etc/ivy/ivy.xml +++ b/etc/ivy/ivy.xml @@ -23,5 +23,6 @@ + diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java index dac699e..e1322b8 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java @@ -20,6 +20,7 @@ import i5.las2peer.restMapper.annotations.ServicePath; import i5.las2peer.security.L2pSecurityException; import io.swagger.annotations.*; +import jodd.vtor.Vtor; import org.apache.commons.dbcp2.BasicDataSource; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.utils.URIBuilder; @@ -104,7 +105,12 @@ public String createActivity(String activity) throws InvocationTargetException, } private Activity storeActivity(Activity activity) throws ActivityTrackerException { - //TODO validate activity + Vtor vtor = new Vtor(); + vtor.validate(activity); + if (vtor.hasViolations()) { + ExceptionHandler.getInstance().throwException(ExceptionLocation.ACTIVITYTRACKERSERVICE, ErrorCode.VALIDATION, vtor.getViolations().toString()); + } + DALFacade dalFacade = null; try { dalFacade = this.getDBConnection(); diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java index 3417406..76f9716 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java @@ -1,20 +1,45 @@ package de.rwth.dbis.acis.activitytracker.service.dal.entities; +import jodd.vtor.constraint.MaxLength; +import jodd.vtor.constraint.NotBlank; +import jodd.vtor.constraint.NotNull; + import java.util.Date; public class Activity extends EntityBase { private int id; + + @NotNull private Date creationDate; + + @NotNull + @NotBlank + @MaxLength(value= 255) private String activityAction; + + @MaxLength(value= 255) private String dataUrl; + + @MaxLength(value= 255) private String dataType; + + @MaxLength(value= 255) private String dataFrontendUrl; + + @MaxLength(value= 255) private String parentDataUrl; + + @MaxLength(value= 255) private String parentDataType; + + @MaxLength(value= 255) private String userUrl; + private Object data; + private Object parentData; + private Object user; public Activity() { From 8984f07790b6c574f8468fe0e4570e41c836a94c Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Thu, 13 Apr 2017 00:53:29 +0200 Subject: [PATCH 19/29] Set default sorting to id field --- .../service/dal/transform/ActivityTransformer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java index 03d57ba..76f1a56 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java @@ -66,13 +66,13 @@ public Map getUpdateMap(Activity entity) { public Collection> getSortFields(Pageable.SortDirection sortDirection) { switch (sortDirection) { case DEFAULT: - return Arrays.asList(ACTIVITY.CREATION_DATE.desc(), + return Arrays.asList(ACTIVITY.ID.desc(), ACTIVITY.ID.desc()); case ASC: - return Arrays.asList(ACTIVITY.CREATION_DATE.asc(), + return Arrays.asList(ACTIVITY.ID.asc(), ACTIVITY.ID.asc()); case DESC: - return Arrays.asList(ACTIVITY.CREATION_DATE.desc(), + return Arrays.asList(ACTIVITY.ID.desc(), ACTIVITY.ID.desc()); } return null; From 963e74383c42dc6120ed59173c0d9a95c481e80f Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Thu, 13 Apr 2017 00:54:07 +0200 Subject: [PATCH 20/29] Add bootstrap option to ant debug target --- build.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.xml b/build.xml index 6a2bd6e..0eb6359 100644 --- a/build.xml +++ b/build.xml @@ -306,6 +306,10 @@ + From 36b8eecffa733408c236ee901d4dae9e4f976c11 Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Fri, 14 Apr 2017 18:07:58 +0200 Subject: [PATCH 21/29] fillChildElements parameter #RB-508 (I also fixed a small bug, that stored user elements are not parsed) --- .../service/ActivityTrackerService.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java index e1322b8..5e00384 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java @@ -125,7 +125,7 @@ private Activity storeActivity(Activity activity) throws ActivityTrackerExceptio } private List getObjectBodies(CloseableHttpClient httpclient, ExecutorService executor, String authorizationToken, - List activities, Map tempObjectStorage) throws Exception { + List activities, Map tempObjectStorage) throws Exception { List activitiesWithObjectBodies = new ArrayList<>(); JsonParser parser = new JsonParser(); @@ -178,7 +178,7 @@ private List getObjectBodies(CloseableHttpClient httpclient, ExecutorS Future userFuture = executor.submit(new HttpRequestCallable(httpclient, httpget)); if (userFuture != null) { builder.user(parser.parse(userFuture.get())); - tempObjectStorage.put(activity.getUserUrl(), userFuture.get()); + tempObjectStorage.put(activity.getUserUrl(), parser.parse(userFuture.get())); } } } @@ -300,6 +300,7 @@ public Response getActivities( @ApiParam(value = "Before cursor pagination", required = false) @DefaultValue("-1") @QueryParam("before") int before, @ApiParam(value = "After cursor pagination", required = false) @DefaultValue("-1") @QueryParam("after") int after, @ApiParam(value = "Limit of activity elements", required = false) @DefaultValue("10") @QueryParam("limit") int limit, + @ApiParam(value = "Parameter to include or exclude the child elements 'data', 'parentData' and 'user'", required = false, allowableValues = "true, false") @DefaultValue("true") @QueryParam("fillChildElements") boolean fillChildElements, @ApiParam(value = "User authorization token", required = false) @DefaultValue("") @HeaderParam("authorization") String authorizationToken) { DALFacade dalFacade = null; @@ -310,14 +311,14 @@ public Response getActivities( int cursor = before != -1 ? before : after; Pageable.SortDirection sortDirection = after != -1 ? Pageable.SortDirection.ASC : Pageable.SortDirection.DESC; + dalFacade = service.getDBConnection(); + PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); cm.setMaxTotal(20); CloseableHttpClient httpclient = HttpClients.custom() .setConnectionManager(cm) .build(); - dalFacade = service.getDBConnection(); - Gson gson = new Gson(); ExecutorService executor = Executors.newCachedThreadPool(); Map tempObjectStorage = new HashMap<>(); @@ -334,7 +335,11 @@ public Response getActivities( if (cursor < 0) { cursor = 0; } - activities.addAll(service.getObjectBodies(httpclient, executor, authorizationToken, activitiesPaginationResult.getElements(), tempObjectStorage)); + if (fillChildElements) { + activities.addAll(service.getObjectBodies(httpclient, executor, authorizationToken, activitiesPaginationResult.getElements(), tempObjectStorage)); + } else { + activities.addAll(activitiesPaginationResult.getElements()); + } } executor.shutdown(); @@ -347,6 +352,8 @@ public Response getActivities( Map parameter = new HashMap<>(); parameter.put("limit", String.valueOf(limit)); + Gson gson = new Gson(); + Response.ResponseBuilder responseBuilder = Response.ok(); responseBuilder = responseBuilder.entity(gson.toJson(activitiesPaginationResult.getElements())); responseBuilder = service.paginationLinks(responseBuilder, activitiesPaginationResult, "", parameter); From 483bff2e16300c9f2c5ff1ec78fd6c1c9fd4f3fa Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Fri, 14 Apr 2017 18:55:10 +0200 Subject: [PATCH 22/29] Add origin field to activity #RB-510 --- etc/activitytracker_create.sql | 1 + etc/activitytracker_demo_data.sql | 32 +-- .../service/ActivityTrackerService.java | 2 +- .../service/dal/entities/Activity.java | 17 ++ .../service/dal/jooq/DefaultCatalog.java | 27 ++- .../service/dal/jooq/Keys.java | 19 +- .../service/dal/jooq/Reqbaztrack.java | 28 ++- .../service/dal/jooq/Tables.java | 12 +- .../service/dal/jooq/tables/Activity.java | 60 +++-- .../jooq/tables/records/ActivityRecord.java | 227 +++++++++++------- .../dal/transform/ActivityTransformer.java | 2 + 11 files changed, 261 insertions(+), 166 deletions(-) diff --git a/etc/activitytracker_create.sql b/etc/activitytracker_create.sql index 62e2f73..104d3bb 100644 --- a/etc/activitytracker_create.sql +++ b/etc/activitytracker_create.sql @@ -10,6 +10,7 @@ CREATE TABLE IF NOT EXISTS reqbaztrack.activity ( id INT NOT NULL AUTO_INCREMENT, creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, activity_action VARCHAR(255) NOT NULL, + origin VARCHAR(255) NOT NULL, data_url VARCHAR(255) NULL, data_type VARCHAR(255) NULL, data_frontend_url VARCHAR(255) NULL, diff --git a/etc/activitytracker_demo_data.sql b/etc/activitytracker_demo_data.sql index f05e873..b82c046 100644 --- a/etc/activitytracker_demo_data.sql +++ b/etc/activitytracker_demo_data.sql @@ -2,43 +2,45 @@ SET FOREIGN_KEY_CHECKS = 0; TRUNCATE TABLE reqbaztrack.activity; -REPLACE INTO reqbaztrack.activity (id, creation_date, activity_action, data_url, data_type, - data_frontend_url, parent_data_url, parent_data_type, user_url) +REPLACE INTO reqbaztrack.activity (id, creation_date, activity_action, origin, data_url, data_type, + data_frontend_url, parent_data_url, parent_data_type, user_url) VALUES - (1, '2015-10-21 07:00:00', 'CREATE', 'http://localhost:8080/bazaar/projects/1', 'PROJECT', + (1, '2015-10-21 07:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', + 'http://localhost:8080/bazaar/projects/1', 'PROJECT', 'http://localhost:5000/#!/projects/1', NULL, NULL, 'http://localhost:8080/bazaar/users/2'), - (2, '2015-10-21 07:00:00', 'CREATE', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', + (2, '2015-10-21 07:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:5000/#!/projects/1/categories/1', 'http://localhost:8080/bazaar/projects/1', 'PROJECT', 'http://localhost:8080/bazaar/users/2'), - (3, '2015-10-21 08:00:00', 'CREATE', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', + (3, '2015-10-21 08:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), - (4, '2015-10-21 09:00:00', 'UPDATE', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', + (4, '2015-10-21 09:00:00', 'UPDATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), - (5, '2015-10-21 10:00:00', 'DELETE', NULL, 'REQUIREMENT', + (5, '2015-10-21 10:00:00', 'DELETE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', NULL, 'REQUIREMENT', NULL, 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), - (6, '2015-10-21 10:00:00', 'CREATE', 'http://localhost:8080/bazaar/projects/2', 'PROJECT', + (6, '2015-10-21 10:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/projects/2', 'PROJECT', 'http://localhost:5000/#!/projects/2', NULL, NULL, 'http://localhost:8080/bazaar/users/2'), - (7, '2015-10-21 10:00:00', 'CREATE', 'http://localhost:8080/bazaar/categories/2', 'CATEGORY', + (7, '2015-10-21 10:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/categories/2', 'CATEGORY', 'http://localhost:5000/#!/projects/2/categories/2', 'http://localhost:8080/bazaar/projects/2', 'PROJECT', 'http://localhost:8080/bazaar/users/2'), - (8, '2015-10-21 11:00:00', 'CREATE', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', + (8, '2015-10-21 11:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), - (9, '2015-10-21 12:00:00', 'UPDATE', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', + (9, '2015-10-21 12:00:00', 'UPDATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), - (10, '2015-10-21 13:00:00', 'CREATE', 'http://localhost:8080/bazaar/comments/1', 'COMMENT', + (10, '2015-10-21 13:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/comments/1', 'COMMENT', 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'), - (11, '2015-10-21 14:00:00', 'CREATE', 'http://localhost:8080/bazaar/comments/2', 'COMMENT', + (11, '2015-10-21 14:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/comments/2', 'COMMENT', 'http://localhost:5000/#!/projects/1/categories/1/requirements/2', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'), - (12, '2015-10-21 15:00:00', 'CREATE', 'http://localhost:8080/bazaar/requirements/1', 'VOTE', + (12, '2015-10-21 15:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', + 'http://localhost:8080/bazaar/requirements/1', 'VOTE', 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'), - (13, '2015-10-21 15:00:00', 'DELETE', NULL, 'VOTE', + (13, '2015-10-21 15:00:00', 'DELETE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', NULL, 'VOTE', 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'); diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java index 5e00384..28fbbb6 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java @@ -295,7 +295,7 @@ public static class Resource { @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found"), @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal server problems") }) - //TODO add filter + //TODO add filter for: activityAction, origin, dataType, parentDataType, parentDataUrl, dataUrl, userURL public Response getActivities( @ApiParam(value = "Before cursor pagination", required = false) @DefaultValue("-1") @QueryParam("before") int before, @ApiParam(value = "After cursor pagination", required = false) @DefaultValue("-1") @QueryParam("after") int after, diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java index 76f9716..f4ccf0d 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/entities/Activity.java @@ -18,6 +18,11 @@ public class Activity extends EntityBase { @MaxLength(value= 255) private String activityAction; + @NotNull + @NotBlank + @MaxLength(value= 255) + private String origin; + @MaxLength(value= 255) private String dataUrl; @@ -49,6 +54,7 @@ protected Activity(Builder builder) { this.id = builder.id; this.creationDate = builder.creationDate; this.activityAction = builder.activityAction; + this.origin = builder.origin; this.dataUrl = builder.dataUrl; this.dataType = builder.dataType; this.dataFrontendUrl = builder.dataFrontendUrl; @@ -76,6 +82,10 @@ public String getActivityAction() { return activityAction; } + public String getOrigin() { + return origin; + } + public String getDataUrl() { return dataUrl; } @@ -117,6 +127,7 @@ public static class Builder { private int id; private Date creationDate; private String activityAction; + private String origin; private String dataUrl; private String dataType; private String dataFrontendUrl; @@ -131,6 +142,7 @@ public Builder activity(Activity activity) { id(activity.getId()); creationDate(activity.getCreationDate()); activityAction(activity.getActivityAction()); + origin(activity.getOrigin()); dataUrl(activity.getDataUrl()); dataType(activity.getDataType()); dataFrontendUrl(activity.getDataFrontendUrl()); @@ -155,6 +167,11 @@ public Builder activityAction(String activityAction) { return this; } + public Builder origin(String origin) { + this.origin = origin; + return this; + } + public Builder dataUrl(String dataUrl) { this.dataUrl = dataUrl; return this; diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/DefaultCatalog.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/DefaultCatalog.java index 63ec42d..c284f53 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/DefaultCatalog.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/DefaultCatalog.java @@ -4,33 +4,36 @@ package de.rwth.dbis.acis.activitytracker.service.dal.jooq; -import org.jooq.Schema; -import org.jooq.impl.CatalogImpl; - -import javax.annotation.Generated; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import javax.annotation.Generated; + +import org.jooq.Schema; +import org.jooq.impl.CatalogImpl; + /** * This class is generated by jOOQ. */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.9.1" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) -@SuppressWarnings({"all", "unchecked", "rawtypes"}) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class DefaultCatalog extends CatalogImpl { + private static final long serialVersionUID = 1525292833; + /** * The reference instance of */ public static final DefaultCatalog DEFAULT_CATALOG = new DefaultCatalog(); - private static final long serialVersionUID = 1525292833; + /** * The schema reqbaztrack. */ @@ -52,6 +55,6 @@ public final List getSchemas() { private final List getSchemas0() { return Arrays.asList( - Reqbaztrack.REQBAZTRACK); + Reqbaztrack.REQBAZTRACK); } } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Keys.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Keys.java index 3b9d67a..71248dc 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Keys.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Keys.java @@ -6,25 +6,26 @@ import de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.Activity; import de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.records.ActivityRecord; + +import javax.annotation.Generated; + import org.jooq.Identity; import org.jooq.UniqueKey; import org.jooq.impl.AbstractKeys; -import javax.annotation.Generated; - /** - * A class modelling foreign key relationships between tables of the reqbaztrack + * A class modelling foreign key relationships between tables of the reqbaztrack * schema */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.9.1" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) -@SuppressWarnings({"all", "unchecked", "rawtypes"}) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Keys { // ------------------------------------------------------------------------- diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Reqbaztrack.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Reqbaztrack.java index 3f8953f..0ba8645 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Reqbaztrack.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Reqbaztrack.java @@ -5,34 +5,38 @@ import de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.Activity; -import org.jooq.Catalog; -import org.jooq.Table; -import org.jooq.impl.SchemaImpl; -import javax.annotation.Generated; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import javax.annotation.Generated; + +import org.jooq.Catalog; +import org.jooq.Table; +import org.jooq.impl.SchemaImpl; + /** * This class is generated by jOOQ. */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.9.1" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) -@SuppressWarnings({"all", "unchecked", "rawtypes"}) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Reqbaztrack extends SchemaImpl { + private static final long serialVersionUID = -1601202747; + /** * The reference instance of reqbaztrack */ public static final Reqbaztrack REQBAZTRACK = new Reqbaztrack(); - private static final long serialVersionUID = -1601202747; + /** * The table reqbaztrack.activity. */ @@ -63,6 +67,6 @@ public final List> getTables() { private final List> getTables0() { return Arrays.>asList( - Activity.ACTIVITY); + Activity.ACTIVITY); } } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Tables.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Tables.java index e28eb5f..155e2fd 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Tables.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/Tables.java @@ -13,13 +13,13 @@ * Convenience access to all tables in reqbaztrack */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.9.1" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) -@SuppressWarnings({"all", "unchecked", "rawtypes"}) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Tables { /** diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java index bed11ff..3477364 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/Activity.java @@ -7,65 +7,95 @@ import de.rwth.dbis.acis.activitytracker.service.dal.jooq.Keys; import de.rwth.dbis.acis.activitytracker.service.dal.jooq.Reqbaztrack; import de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.records.ActivityRecord; -import org.jooq.*; -import org.jooq.impl.TableImpl; -import javax.annotation.Generated; import java.sql.Timestamp; import java.util.Arrays; import java.util.List; +import javax.annotation.Generated; + +import org.jooq.Field; +import org.jooq.Identity; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.TableImpl; + /** * This class is generated by jOOQ. */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.9.1" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) -@SuppressWarnings({"all", "unchecked", "rawtypes"}) +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Activity extends TableImpl { + private static final long serialVersionUID = 1356905870; + /** * The reference instance of reqbaztrack.activity */ public static final Activity ACTIVITY = new Activity(); - private static final long serialVersionUID = -1015172083; + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ActivityRecord.class; + } + /** * The column reqbaztrack.activity.id. */ public final TableField ID = createField("id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + /** * The column reqbaztrack.activity.creation_date. */ public final TableField CREATION_DATE = createField("creation_date", org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaultValue(org.jooq.impl.DSL.inline("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, ""); + /** * The column reqbaztrack.activity.activity_action. */ public final TableField ACTIVITY_ACTION = createField("activity_action", org.jooq.impl.SQLDataType.VARCHAR.length(255).nullable(false), this, ""); + + /** + * The column reqbaztrack.activity.origin. + */ + public final TableField ORIGIN = createField("origin", org.jooq.impl.SQLDataType.VARCHAR.length(255).nullable(false), this, ""); + /** * The column reqbaztrack.activity.data_url. */ public final TableField DATA_URL = createField("data_url", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); + /** * The column reqbaztrack.activity.data_type. */ - public final TableField DATA_TYPE = createField("data_type", org.jooq.impl.SQLDataType.VARCHAR.length(255).nullable(false), this, ""); + public final TableField DATA_TYPE = createField("data_type", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); + /** * The column reqbaztrack.activity.data_frontend_url. */ public final TableField DATA_FRONTEND_URL = createField("data_frontend_url", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); + /** * The column reqbaztrack.activity.parent_data_url. */ public final TableField PARENT_DATA_URL = createField("parent_data_url", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); + /** * The column reqbaztrack.activity.parent_data_type. */ public final TableField PARENT_DATA_TYPE = createField("parent_data_type", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, ""); + /** * The column reqbaztrack.activity.user_url. */ @@ -93,14 +123,6 @@ private Activity(String alias, Table aliased, Field[] paramet super(alias, null, aliased, parameters, ""); } - /** - * The class holding records for this type - */ - @Override - public Class getRecordType() { - return ActivityRecord.class; - } - /** * {@inheritDoc} */ diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java index 8f2ee3a..cbb6bcf 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/jooq/tables/records/ActivityRecord.java @@ -5,53 +5,38 @@ import de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.Activity; + +import java.sql.Timestamp; + +import javax.annotation.Generated; + import org.jooq.Field; import org.jooq.Record1; -import org.jooq.Record9; -import org.jooq.Row9; +import org.jooq.Record10; +import org.jooq.Row10; import org.jooq.impl.UpdatableRecordImpl; -import javax.annotation.Generated; -import java.sql.Timestamp; - /** * This class is generated by jOOQ. */ @Generated( - value = { - "http://www.jooq.org", - "jOOQ version:3.9.1" - }, - comments = "This class is generated by jOOQ" + value = { + "http://www.jooq.org", + "jOOQ version:3.9.1" + }, + comments = "This class is generated by jOOQ" ) -@SuppressWarnings({"all", "unchecked", "rawtypes"}) -public class ActivityRecord extends UpdatableRecordImpl implements Record9 { +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class ActivityRecord extends UpdatableRecordImpl implements Record10 { - private static final long serialVersionUID = -1489974951; + private static final long serialVersionUID = 1381351316; /** - * Create a detached ActivityRecord - */ - public ActivityRecord() { - super(Activity.ACTIVITY); - } - - /** - * Create a detached, initialised ActivityRecord + * Setter for reqbaztrack.activity.id. */ - public ActivityRecord(Integer id, Timestamp creationDate, String activityAction, String dataUrl, String dataType, String dataFrontendUrl, String parentDataUrl, String parentDataType, String userUrl) { - super(Activity.ACTIVITY); - - set(0, id); - set(1, creationDate); - set(2, activityAction); - set(3, dataUrl); - set(4, dataType); - set(5, dataFrontendUrl); - set(6, parentDataUrl); - set(7, parentDataType); - set(8, userUrl); + public void setId(Integer value) { + set(0, value); } /** @@ -62,10 +47,10 @@ public Integer getId() { } /** - * Setter for reqbaztrack.activity.id. + * Setter for reqbaztrack.activity.creation_date. */ - public void setId(Integer value) { - set(0, value); + public void setCreationDate(Timestamp value) { + set(1, value); } /** @@ -76,10 +61,10 @@ public Timestamp getCreationDate() { } /** - * Setter for reqbaztrack.activity.creation_date. + * Setter for reqbaztrack.activity.activity_action. */ - public void setCreationDate(Timestamp value) { - set(1, value); + public void setActivityAction(String value) { + set(2, value); } /** @@ -90,16 +75,16 @@ public String getActivityAction() { } /** - * Setter for reqbaztrack.activity.activity_action. + * Setter for reqbaztrack.activity.origin. */ - public void setActivityAction(String value) { - set(2, value); + public void setOrigin(String value) { + set(3, value); } /** - * Getter for reqbaztrack.activity.data_url. + * Getter for reqbaztrack.activity.origin. */ - public String getDataUrl() { + public String getOrigin() { return (String) get(3); } @@ -107,13 +92,13 @@ public String getDataUrl() { * Setter for reqbaztrack.activity.data_url. */ public void setDataUrl(String value) { - set(3, value); + set(4, value); } /** - * Getter for reqbaztrack.activity.data_type. + * Getter for reqbaztrack.activity.data_url. */ - public String getDataType() { + public String getDataUrl() { return (String) get(4); } @@ -121,13 +106,13 @@ public String getDataType() { * Setter for reqbaztrack.activity.data_type. */ public void setDataType(String value) { - set(4, value); + set(5, value); } /** - * Getter for reqbaztrack.activity.data_frontend_url. + * Getter for reqbaztrack.activity.data_type. */ - public String getDataFrontendUrl() { + public String getDataType() { return (String) get(5); } @@ -135,13 +120,13 @@ public String getDataFrontendUrl() { * Setter for reqbaztrack.activity.data_frontend_url. */ public void setDataFrontendUrl(String value) { - set(5, value); + set(6, value); } /** - * Getter for reqbaztrack.activity.parent_data_url. + * Getter for reqbaztrack.activity.data_frontend_url. */ - public String getParentDataUrl() { + public String getDataFrontendUrl() { return (String) get(6); } @@ -149,13 +134,13 @@ public String getParentDataUrl() { * Setter for reqbaztrack.activity.parent_data_url. */ public void setParentDataUrl(String value) { - set(6, value); + set(7, value); } /** - * Getter for reqbaztrack.activity.parent_data_type. + * Getter for reqbaztrack.activity.parent_data_url. */ - public String getParentDataType() { + public String getParentDataUrl() { return (String) get(7); } @@ -163,31 +148,34 @@ public String getParentDataType() { * Setter for reqbaztrack.activity.parent_data_type. */ public void setParentDataType(String value) { - set(7, value); + set(8, value); } - // ------------------------------------------------------------------------- - // Primary key information - // ------------------------------------------------------------------------- - /** - * Getter for reqbaztrack.activity.user_url. + * Getter for reqbaztrack.activity.parent_data_type. */ - public String getUserUrl() { + public String getParentDataType() { return (String) get(8); } - // ------------------------------------------------------------------------- - // Record9 type implementation - // ------------------------------------------------------------------------- - /** * Setter for reqbaztrack.activity.user_url. */ public void setUserUrl(String value) { - set(8, value); + set(9, value); } + /** + * Getter for reqbaztrack.activity.user_url. + */ + public String getUserUrl() { + return (String) get(9); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + /** * {@inheritDoc} */ @@ -196,20 +184,24 @@ public Record1 key() { return (Record1) super.key(); } + // ------------------------------------------------------------------------- + // Record10 type implementation + // ------------------------------------------------------------------------- + /** * {@inheritDoc} */ @Override - public Row9 fieldsRow() { - return (Row9) super.fieldsRow(); + public Row10 fieldsRow() { + return (Row10) super.fieldsRow(); } /** * {@inheritDoc} */ @Override - public Row9 valuesRow() { - return (Row9) super.valuesRow(); + public Row10 valuesRow() { + return (Row10) super.valuesRow(); } /** @@ -241,7 +233,7 @@ public Field field3() { */ @Override public Field field4() { - return Activity.ACTIVITY.DATA_URL; + return Activity.ACTIVITY.ORIGIN; } /** @@ -249,7 +241,7 @@ public Field field4() { */ @Override public Field field5() { - return Activity.ACTIVITY.DATA_TYPE; + return Activity.ACTIVITY.DATA_URL; } /** @@ -257,7 +249,7 @@ public Field field5() { */ @Override public Field field6() { - return Activity.ACTIVITY.DATA_FRONTEND_URL; + return Activity.ACTIVITY.DATA_TYPE; } /** @@ -265,7 +257,7 @@ public Field field6() { */ @Override public Field field7() { - return Activity.ACTIVITY.PARENT_DATA_URL; + return Activity.ACTIVITY.DATA_FRONTEND_URL; } /** @@ -273,7 +265,7 @@ public Field field7() { */ @Override public Field field8() { - return Activity.ACTIVITY.PARENT_DATA_TYPE; + return Activity.ACTIVITY.PARENT_DATA_URL; } /** @@ -281,6 +273,14 @@ public Field field8() { */ @Override public Field field9() { + return Activity.ACTIVITY.PARENT_DATA_TYPE; + } + + /** + * {@inheritDoc} + */ + @Override + public Field field10() { return Activity.ACTIVITY.USER_URL; } @@ -313,7 +313,7 @@ public String value3() { */ @Override public String value4() { - return getDataUrl(); + return getOrigin(); } /** @@ -321,7 +321,7 @@ public String value4() { */ @Override public String value5() { - return getDataType(); + return getDataUrl(); } /** @@ -329,7 +329,7 @@ public String value5() { */ @Override public String value6() { - return getDataFrontendUrl(); + return getDataType(); } /** @@ -337,7 +337,7 @@ public String value6() { */ @Override public String value7() { - return getParentDataUrl(); + return getDataFrontendUrl(); } /** @@ -345,7 +345,7 @@ public String value7() { */ @Override public String value8() { - return getParentDataType(); + return getParentDataUrl(); } /** @@ -353,6 +353,14 @@ public String value8() { */ @Override public String value9() { + return getParentDataType(); + } + + /** + * {@inheritDoc} + */ + @Override + public String value10() { return getUserUrl(); } @@ -388,7 +396,7 @@ public ActivityRecord value3(String value) { */ @Override public ActivityRecord value4(String value) { - setDataUrl(value); + setOrigin(value); return this; } @@ -397,7 +405,7 @@ public ActivityRecord value4(String value) { */ @Override public ActivityRecord value5(String value) { - setDataType(value); + setDataUrl(value); return this; } @@ -406,7 +414,7 @@ public ActivityRecord value5(String value) { */ @Override public ActivityRecord value6(String value) { - setDataFrontendUrl(value); + setDataType(value); return this; } @@ -415,7 +423,7 @@ public ActivityRecord value6(String value) { */ @Override public ActivityRecord value7(String value) { - setParentDataUrl(value); + setDataFrontendUrl(value); return this; } @@ -424,19 +432,24 @@ public ActivityRecord value7(String value) { */ @Override public ActivityRecord value8(String value) { - setParentDataType(value); + setParentDataUrl(value); return this; } - // ------------------------------------------------------------------------- - // Constructors - // ------------------------------------------------------------------------- - /** * {@inheritDoc} */ @Override public ActivityRecord value9(String value) { + setParentDataType(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ActivityRecord value10(String value) { setUserUrl(value); return this; } @@ -445,7 +458,7 @@ public ActivityRecord value9(String value) { * {@inheritDoc} */ @Override - public ActivityRecord values(Integer value1, Timestamp value2, String value3, String value4, String value5, String value6, String value7, String value8, String value9) { + public ActivityRecord values(Integer value1, Timestamp value2, String value3, String value4, String value5, String value6, String value7, String value8, String value9, String value10) { value1(value1); value2(value2); value3(value3); @@ -455,6 +468,36 @@ public ActivityRecord values(Integer value1, Timestamp value2, String value3, St value7(value7); value8(value8); value9(value9); + value10(value10); return this; } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ActivityRecord + */ + public ActivityRecord() { + super(Activity.ACTIVITY); + } + + /** + * Create a detached, initialised ActivityRecord + */ + public ActivityRecord(Integer id, Timestamp creationDate, String activityAction, String origin, String dataUrl, String dataType, String dataFrontendUrl, String parentDataUrl, String parentDataType, String userUrl) { + super(Activity.ACTIVITY); + + set(0, id); + set(1, creationDate); + set(2, activityAction); + set(3, origin); + set(4, dataUrl); + set(5, dataType); + set(6, dataFrontendUrl); + set(7, parentDataUrl); + set(8, parentDataType); + set(9, userUrl); + } } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java index 76f1a56..2af0184 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java @@ -18,6 +18,7 @@ public ActivityRecord createRecord(Activity entity) { ActivityRecord activityRecord = new ActivityRecord(); activityRecord.setCreationDate(new java.sql.Timestamp(entity.getCreationDate().getTime())); activityRecord.setActivityAction(entity.getActivityAction()); + activityRecord.setOrigin(entity.getOrigin()); activityRecord.setDataUrl(entity.getDataUrl()); activityRecord.setDataType(entity.getDataType()); activityRecord.setDataFrontendUrl(entity.getDataFrontendUrl()); @@ -33,6 +34,7 @@ public Activity mapToEntity(ActivityRecord record) { .id(record.getId()) .creationDate(record.getCreationDate()) .activityAction(record.getActivityAction()) + .origin(record.getOrigin()) .dataUrl(record.getDataUrl()) .dataType(record.getDataType()) .dataFrontendUrl(record.getDataFrontendUrl()) From 6914091afeb7cdb3c4021346f2dfdd9468dd0418 Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Fri, 14 Apr 2017 22:01:09 +0200 Subject: [PATCH 23/29] Filter for get Activities #RB-269 --- .../service/ActivityTrackerService.java | 57 ++++++++++++++++++- .../service/dal/helpers/PageInfo.java | 16 +++--- .../service/dal/helpers/Pageable.java | 4 +- .../dal/repositories/RepositoryImpl.java | 11 ++-- .../dal/transform/ActivityTransformer.java | 34 +++++++++-- .../service/dal/transform/Transformer.java | 10 ++++ 6 files changed, 113 insertions(+), 19 deletions(-) diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java index 28fbbb6..5962355 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java @@ -295,12 +295,18 @@ public static class Resource { @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found"), @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal server problems") }) - //TODO add filter for: activityAction, origin, dataType, parentDataType, parentDataUrl, dataUrl, userURL public Response getActivities( @ApiParam(value = "Before cursor pagination", required = false) @DefaultValue("-1") @QueryParam("before") int before, @ApiParam(value = "After cursor pagination", required = false) @DefaultValue("-1") @QueryParam("after") int after, @ApiParam(value = "Limit of activity elements", required = false) @DefaultValue("10") @QueryParam("limit") int limit, @ApiParam(value = "Parameter to include or exclude the child elements 'data', 'parentData' and 'user'", required = false, allowableValues = "true, false") @DefaultValue("true") @QueryParam("fillChildElements") boolean fillChildElements, + @ApiParam(value = "activityAction filter", required = false) @QueryParam("activityAction") String activityActionFilter, + @ApiParam(value = "origin filter", required = false) @QueryParam("origin") String originFilter, + @ApiParam(value = "dataType filter", required = false) @QueryParam("dataType") String dataTypeFilter, + @ApiParam(value = "dataUrl filter", required = false) @QueryParam("dataUrl") String dataUrlFilter, + @ApiParam(value = "parentDataType filter", required = false) @QueryParam("parentDataType") String parentDataTypeFilter, + @ApiParam(value = "parentDataUrl filter", required = false) @QueryParam("parentDataUrl") String parentDataUrlFilter, + @ApiParam(value = "userUrl filter", required = false) @QueryParam("userUrl") String userUrlFilter, @ApiParam(value = "User authorization token", required = false) @DefaultValue("") @HeaderParam("authorization") String authorizationToken) { DALFacade dalFacade = null; @@ -311,6 +317,29 @@ public Response getActivities( int cursor = before != -1 ? before : after; Pageable.SortDirection sortDirection = after != -1 ? Pageable.SortDirection.ASC : Pageable.SortDirection.DESC; + HashMap filters = new HashMap<>(); + if (activityActionFilter != null) { + filters.put("activityAction", activityActionFilter); + } + if (originFilter != null) { + filters.put("origin", originFilter); + } + if (dataTypeFilter != null) { + filters.put("dataType", dataTypeFilter); + } + if (dataUrlFilter != null) { + filters.put("dataUrl", dataUrlFilter); + } + if (parentDataTypeFilter != null) { + filters.put("parentDataType", parentDataTypeFilter); + } + if (parentDataUrlFilter != null) { + filters.put("parentDataUrl", parentDataUrlFilter); + } + if (userUrlFilter != null) { + filters.put("userUrl", userUrlFilter); + } + dalFacade = service.getDBConnection(); PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); @@ -328,7 +357,7 @@ public Response getActivities( List activities = new ArrayList<>(); Pageable pageInfo = null; while (activities.size() < limit && getObjectCount < 5) { - pageInfo = new PageInfo(cursor, limit, "", sortDirection); + pageInfo = new PageInfo(cursor, limit, filters, sortDirection); activitiesPaginationResult = dalFacade.findActivities(pageInfo); getObjectCount++; cursor = sortDirection == Pageable.SortDirection.ASC ? cursor + limit : cursor - limit; @@ -351,6 +380,30 @@ public Response getActivities( Map parameter = new HashMap<>(); parameter.put("limit", String.valueOf(limit)); + if (fillChildElements == false) { + parameter.put("fillChildElements", String.valueOf(fillChildElements)); + } + if (activityActionFilter != null) { + parameter.put("activityActionFilter", activityActionFilter); + } + if (originFilter != null) { + parameter.put("origin", originFilter); + } + if (dataTypeFilter != null) { + parameter.put("dataType", dataTypeFilter); + } + if (dataUrlFilter != null) { + parameter.put("dataUrl", dataUrlFilter); + } + if (parentDataTypeFilter != null) { + parameter.put("parentDataType", parentDataTypeFilter); + } + if (parentDataUrlFilter != null) { + parameter.put("parentDataUrl", parentDataUrlFilter); + } + if (userUrlFilter != null) { + parameter.put("userURL", userUrlFilter); + } Gson gson = new Gson(); diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/helpers/PageInfo.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/helpers/PageInfo.java index 045ce56..15275ec 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/helpers/PageInfo.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/helpers/PageInfo.java @@ -1,20 +1,22 @@ package de.rwth.dbis.acis.activitytracker.service.dal.helpers; +import java.util.Map; + public class PageInfo implements Pageable { private final int cursor; private final int limit; - private final String filter; + private final Map filters; private final SortDirection sortDirection; - public PageInfo(int cursor, int limit, String filter) { - this(cursor, limit, filter, SortDirection.DEFAULT); + public PageInfo(int cursor, int limit, Map filters) { + this(cursor, limit, filters, SortDirection.DEFAULT); } - public PageInfo(int cursor, int limit, String filter, SortDirection sortDirection) { + public PageInfo(int cursor, int limit, Map filters, SortDirection sortDirection) { this.cursor = cursor; this.limit = limit; - this.filter = filter; + this.filters = filters; this.sortDirection = sortDirection; } @@ -29,8 +31,8 @@ public int getLimit() { } @Override - public String getFilter() { - return filter; + public Map getFilters() { + return filters; } @Override diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/helpers/Pageable.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/helpers/Pageable.java index f5b4764..f4ab6a5 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/helpers/Pageable.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/helpers/Pageable.java @@ -1,11 +1,13 @@ package de.rwth.dbis.acis.activitytracker.service.dal.helpers; +import java.util.Map; + public interface Pageable { int getCursor(); int getLimit(); - String getFilter(); + Map getFilters(); SortDirection getSortDirection(); diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java index c3ab235..e995b12 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java @@ -110,17 +110,18 @@ public PaginationResult findAll(Pageable pageable) throws ActivityTrackerExce try { List entries = new ArrayList<>(); - Condition condition = transformer.getTableId().notEqual(-1); + Condition cursorCondition = transformer.getTableId().notEqual(-1); if (pageable.getCursor() != -1) { if (pageable.getSortDirection() == Pageable.SortDirection.ASC) { - condition = transformer.getTableId().greaterThan(pageable.getCursor()); + cursorCondition = transformer.getTableId().greaterThan(pageable.getCursor()); } else { - condition = transformer.getTableId().lessThan(pageable.getCursor()); + cursorCondition = transformer.getTableId().lessThan(pageable.getCursor()); } } List queryResults = jooq.selectFrom(transformer.getTable()) - .where(condition) + .where(transformer.getFilterConditions(pageable.getFilters())) + .and(cursorCondition) .orderBy(transformer.getSortFields(pageable.getSortDirection())) .limit(pageable.getLimit()) .fetchInto(transformer.getRecordClass()); @@ -131,7 +132,7 @@ public PaginationResult findAll(Pageable pageable) throws ActivityTrackerExce } result = new PaginationResult<>(pageable, entries); - } catch (DataAccessException e) { + } catch (Exception e) { ExceptionHandler.getInstance().convertAndThrowException(e, ExceptionLocation.REPOSITORY, ErrorCode.UNKNOWN, e.getMessage()); } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java index 2af0184..22994ba 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java @@ -5,10 +5,7 @@ import de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.records.ActivityRecord; import org.jooq.*; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; +import java.util.*; import static de.rwth.dbis.acis.activitytracker.service.dal.jooq.tables.Activity.ACTIVITY; @@ -87,4 +84,33 @@ public Collection getSearchFields(String likeExpression) th .or(ACTIVITY.DATA_TYPE.likeIgnoreCase(likeExpression)) ); } + + @Override + public Collection getFilterConditions(Map filters) throws Exception { + List conditions = new ArrayList<>(); + for (Map.Entry filterEntry : filters.entrySet()) { + if (filterEntry.getKey().equals("activityAction")) { + conditions.add(ACTIVITY.ACTIVITY_ACTION.equalIgnoreCase(filterEntry.getValue())); + } + if (filterEntry.getKey().equals("origin")) { + conditions.add(ACTIVITY.ORIGIN.equalIgnoreCase(filterEntry.getValue())); + } + if (filterEntry.getKey().equals("dataType")) { + conditions.add(ACTIVITY.DATA_TYPE.equalIgnoreCase(filterEntry.getValue())); + } + if (filterEntry.getKey().equals("dataUrl")) { + conditions.add(ACTIVITY.DATA_URL.equalIgnoreCase(filterEntry.getValue())); + } + if (filterEntry.getKey().equals("parentDataType")) { + conditions.add(ACTIVITY.PARENT_DATA_TYPE.equalIgnoreCase(filterEntry.getValue())); + } + if (filterEntry.getKey().equals("parentDataUrl")) { + conditions.add(ACTIVITY.PARENT_DATA_URL.equalIgnoreCase(filterEntry.getValue())); + } + if (filterEntry.getKey().equals("userUrl")) { + conditions.add(ACTIVITY.USER_URL.equalIgnoreCase(filterEntry.getValue())); + } + } + return conditions; + } } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/Transformer.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/Transformer.java index b892d1b..0f65fa2 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/Transformer.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/Transformer.java @@ -54,7 +54,17 @@ public interface Transformer { */ Collection> getSortFields(Pageable.SortDirection sortDirection); + /** + * @param likeExpression + * @return condition to fields. + */ Collection getSearchFields(String likeExpression) throws Exception; + /** + * @param filters + * @return a collection of conditions to filter. + */ + Collection getFilterConditions(Map filters) throws Exception; + } From 94989a0a749a23292aec238b2b36ae3d153c8396 Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Fri, 14 Apr 2017 22:57:54 +0200 Subject: [PATCH 24/29] Improve search implementation #RB-512 --- .../service/ActivityTrackerService.java | 6 ++- .../service/dal/helpers/PageInfo.java | 11 ++++- .../service/dal/helpers/Pageable.java | 2 + .../service/dal/repositories/Repository.java | 9 ---- .../dal/repositories/RepositoryImpl.java | 44 +------------------ .../dal/transform/ActivityTransformer.java | 8 ++-- .../service/dal/transform/Transformer.java | 6 +-- 7 files changed, 23 insertions(+), 63 deletions(-) diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java index 5962355..24f3c85 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java @@ -300,6 +300,7 @@ public Response getActivities( @ApiParam(value = "After cursor pagination", required = false) @DefaultValue("-1") @QueryParam("after") int after, @ApiParam(value = "Limit of activity elements", required = false) @DefaultValue("10") @QueryParam("limit") int limit, @ApiParam(value = "Parameter to include or exclude the child elements 'data', 'parentData' and 'user'", required = false, allowableValues = "true, false") @DefaultValue("true") @QueryParam("fillChildElements") boolean fillChildElements, + @ApiParam(value = "Search string", required = false) @QueryParam("search") String search, @ApiParam(value = "activityAction filter", required = false) @QueryParam("activityAction") String activityActionFilter, @ApiParam(value = "origin filter", required = false) @QueryParam("origin") String originFilter, @ApiParam(value = "dataType filter", required = false) @QueryParam("dataType") String dataTypeFilter, @@ -357,7 +358,7 @@ public Response getActivities( List activities = new ArrayList<>(); Pageable pageInfo = null; while (activities.size() < limit && getObjectCount < 5) { - pageInfo = new PageInfo(cursor, limit, filters, sortDirection); + pageInfo = new PageInfo(cursor, limit, filters, sortDirection, search); activitiesPaginationResult = dalFacade.findActivities(pageInfo); getObjectCount++; cursor = sortDirection == Pageable.SortDirection.ASC ? cursor + limit : cursor - limit; @@ -404,6 +405,9 @@ public Response getActivities( if (userUrlFilter != null) { parameter.put("userURL", userUrlFilter); } + if (search != null) { + parameter.put("search", search); + } Gson gson = new Gson(); diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/helpers/PageInfo.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/helpers/PageInfo.java index 15275ec..a336473 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/helpers/PageInfo.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/helpers/PageInfo.java @@ -8,16 +8,18 @@ public class PageInfo implements Pageable { private final int limit; private final Map filters; private final SortDirection sortDirection; + private final String search; public PageInfo(int cursor, int limit, Map filters) { - this(cursor, limit, filters, SortDirection.DEFAULT); + this(cursor, limit, filters, SortDirection.DEFAULT, null); } - public PageInfo(int cursor, int limit, Map filters, SortDirection sortDirection) { + public PageInfo(int cursor, int limit, Map filters, SortDirection sortDirection, String search) { this.cursor = cursor; this.limit = limit; this.filters = filters; this.sortDirection = sortDirection; + this.search = search != null ? search : new String(); } @Override @@ -39,4 +41,9 @@ public Map getFilters() { public SortDirection getSortDirection() { return sortDirection; } + + @Override + public String getSearch() { + return search; + } } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/helpers/Pageable.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/helpers/Pageable.java index f4ab6a5..a9a1d60 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/helpers/Pageable.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/helpers/Pageable.java @@ -11,6 +11,8 @@ public interface Pageable { SortDirection getSortDirection(); + String getSearch(); + enum SortDirection { DEFAULT, ASC, DESC } diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/Repository.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/Repository.java index 8d5b0ff..4cc42d8 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/Repository.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/Repository.java @@ -41,15 +41,6 @@ public interface Repository { */ PaginationResult findAll(Pageable pageable) throws ActivityTrackerException; - - /** - * @param searchTerm - * @param pageable - * @return PaginationResult with all the entities currently in the database matching the searchTerm - * @throws ActivityTrackerException - */ - PaginationResult searchAll(String searchTerm, Pageable pageable) throws ActivityTrackerException; - /** * @param id of the entity we are looking for * @return the entity from the database with the given Id diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java index e995b12..3f7f40b 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/repositories/RepositoryImpl.java @@ -121,6 +121,7 @@ public PaginationResult findAll(Pageable pageable) throws ActivityTrackerExce List queryResults = jooq.selectFrom(transformer.getTable()) .where(transformer.getFilterConditions(pageable.getFilters())) + .and(transformer.getSearchCondition(pageable.getSearch())) .and(cursorCondition) .orderBy(transformer.getSortFields(pageable.getSortDirection())) .limit(pageable.getLimit()) @@ -139,49 +140,6 @@ public PaginationResult findAll(Pageable pageable) throws ActivityTrackerExce return result; } - /** - * @param searchTerm - * @param pageable - * @return PaginationResult with all the entities currently in the database matching the searchTerm - * @throws ActivityTrackerException - */ - @Override - public PaginationResult searchAll(String searchTerm, Pageable pageable) throws ActivityTrackerException { - PaginationResult result = null; - try { - List entries = new ArrayList<>(); - - Condition condition = transformer.getTableId().notEqual(-1); - if (pageable.getCursor() != -1) { - if (pageable.getSortDirection() == Pageable.SortDirection.ASC) { - condition = transformer.getTableId().greaterThan(pageable.getCursor()); - } else { - condition = transformer.getTableId().lessThan(pageable.getCursor()); - } - } - String likeExpression = "%" + searchTerm + "%"; - - List queryResults = jooq.selectFrom(transformer.getTable()) - .where(transformer.getSearchFields(likeExpression)).and(condition) - .orderBy(transformer.getSortFields(pageable.getSortDirection())) - .limit(pageable.getLimit()) - .fetchInto(transformer.getRecordClass()); - - for (R queryResult : queryResults) { - E entry = transformer.mapToEntity(queryResult); - entries.add(entry); - } - - result = new PaginationResult<>(pageable, entries); - } catch (ActivityTrackerException ex) { - ExceptionHandler.getInstance().convertAndThrowException(ex); - } catch (Exception e) { - ExceptionHandler.getInstance().convertAndThrowException(e, ExceptionLocation.REPOSITORY, ErrorCode.UNKNOWN); - } - - return result; - } - /** * @param id of the entity we are looking for * @return the entity from the database with the given Id diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java index 22994ba..4d28a55 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/ActivityTransformer.java @@ -78,11 +78,9 @@ public Collection> getSortFields(Pageable.SortDirection s } @Override - public Collection getSearchFields(String likeExpression) throws Exception { - return Arrays.asList( - ACTIVITY.ACTIVITY_ACTION.likeIgnoreCase(likeExpression) - .or(ACTIVITY.DATA_TYPE.likeIgnoreCase(likeExpression)) - ); + public Condition getSearchCondition(String search) throws Exception { + return ACTIVITY.ACTIVITY_ACTION.likeIgnoreCase("%" + search + "%") + .or(ACTIVITY.DATA_TYPE.likeIgnoreCase("%" + search + "%")); } @Override diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/Transformer.java b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/Transformer.java index 0f65fa2..2c8f1d0 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/Transformer.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/dal/transform/Transformer.java @@ -55,10 +55,10 @@ public interface Transformer { Collection> getSortFields(Pageable.SortDirection sortDirection); /** - * @param likeExpression - * @return condition to fields. + * @param search + * @return condition to search. */ - Collection getSearchFields(String likeExpression) throws Exception; + Condition getSearchCondition(String search) throws Exception; /** * @param filters From 7373c88ccd9fd1b7b166c867e895b4fb89c055f4 Mon Sep 17 00:00:00 2001 From: Martin Hug Date: Sat, 15 Apr 2017 17:32:22 +0200 Subject: [PATCH 25/29] Add logger calls in all p2p and rest endpoints. This could be inproved in the future but its a start. --- .../acis/activitytracker/service/ActivityTrackerService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java index 24f3c85..c5f85d2 100644 --- a/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java +++ b/src/main/de/rwth/dbis/acis/activitytracker/service/ActivityTrackerService.java @@ -100,6 +100,7 @@ public String createActivity(String activity) throws InvocationTargetException, this.storeActivity(activityToCreate); return new Integer(Response.Status.CREATED.getStatusCode()).toString(); } catch (ActivityTrackerException atException) { + logger.log(L2pLogger.DEFAULT_LOGFILE_LEVEL, "Error: " + atException.getMessage()); return new Integer(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).toString(); } } @@ -420,9 +421,11 @@ public Response getActivities( return response; } catch (ActivityTrackerException atException) { + service.logger.log(L2pLogger.DEFAULT_LOGFILE_LEVEL, "Error: " + atException.getMessage()); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ExceptionHandler.getInstance().toJSON(atException)).build(); } catch (Exception ex) { ActivityTrackerException atException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.ACTIVITYTRACKERSERVICE, ErrorCode.UNKNOWN, ex.getMessage()); + service.logger.log(L2pLogger.DEFAULT_LOGFILE_LEVEL, "Error: " + atException.getMessage()); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ExceptionHandler.getInstance().toJSON(atException)).build(); } finally { service.closeDBConnection(dalFacade); @@ -445,6 +448,7 @@ public Response createActivity(@ApiParam(value = "Activity" + Activity createdActivity = service.storeActivity(activity); return Response.status(Response.Status.CREATED).entity(createdActivity.toJSON()).build(); } catch (ActivityTrackerException atException) { + service.logger.log(L2pLogger.DEFAULT_LOGFILE_LEVEL, "Error: " + atException.getMessage()); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ExceptionHandler.getInstance().toJSON(atException)).build(); } } From cb099baba8539943b6282d3e621ed29f73798908 Mon Sep 17 00:00:00 2001 From: Martin Date: Sat, 6 May 2017 14:33:05 +0200 Subject: [PATCH 26/29] Small improve github README.md file #RB-517 --- README.md | 80 +++++++++++++++++++++---------------------------------- 1 file changed, 31 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 1174534..7ff9963 100644 --- a/README.md +++ b/README.md @@ -1,60 +1,44 @@ -LAS2peer-ActivityTracker +las2peer-ActivityTracker =================== -Table of contents -------------- +Idea +------------------- +las2peer-ActivityTracker is a microservice to provide activity information for las2peer services. The service is generically to work with all kinds of microservices. -- [LAS2peer-ActivityTracker](#) - - [Table of contents](#) - - [Idea](#) - - [Technology](#) - - [Dependencies](#) - - [How to run using Docker](#) - - [How to set up the database](#) - - [Configuration](#) - - [Build](#) - - [How to run](#) +The activity tracker response to HTTP or p2p requests and can fetch activity objects from the origin microservice which created an activity. ---------- -Idea -------------- +Service Documentation +------------------- +We use **[Swagger](http://swagger.io/specification/)** for documenting this microservice. You can use **[Swagger UI](http://swagger.io/swagger-ui/)** to inspect the API. +In the future we want to deploy our own Swagger UI instance which you can use to check and use the API. Until then please use the **[Swagger petstore instance](http://petstore.swagger.io/)**. +Open the Swagger UI petstore demo, enter the APi endpoint you want to inspect and press explore. Of course the microservice instance you want to inspect needs to run. At the moment you can not authorize yourself, but we are working on this feature. -LAS2peer-ActivityTracker is a microservice to provide activity information for LAS2peer services. The service is generically to work with different other microservices. +API documentation endpoint: -The activity tracker answers long-polling HTTP requests to push new activities to a client. Later we will support additional websocket connections. + - `baseURL/activities/swagger.json` ---------- - Technology ------------------- - -The activity tracker is built on Java technologies. As a service framework we use our in-house developed **[LAS2Peer](https://github.com/rwth-acis/LAS2peer)** project. For persisting our data we use MySQL database and JOOQ to access it. User input validation is done using Jodd Vtor library and for serializing our data into JSON format, we use GSON library. +The activity tracker is built on Java technologies. As a service framework we use our in-house developed **[las2peer](https://github.com/rwth-acis/LAS2peer)** project. For persisting our data we use MySQL database and jOOQ to access it. User input validation is done using Jodd Vtor library and for serializing our data into JSON format, we use GSON library. ---------- Dependencies ------------------- - In order to be able to run this service project the following components should be installed on your system: - - JDK (min v1.7) + Java Cryptography Extension (JCE) - - MySQL 5 - - (Apache Ant) + - JDK (min v1.8) + Java Cryptography Extension (JCE) + - MySQL 5.7 + - Apache Ant to build - -How to run using Docker -------------------- - -Docker will be provided at a later point. - - How to set up the database ------------------- - - 1. `git clone this repo` + 1. `git clone` this repo 2. create a new database called `activitytracker`, possibly with UTF-8 collation 3. Run the SQL commands in the file `\etc\activitytracker_create.sql` This will create the tables and relations between them. @@ -64,35 +48,33 @@ How to set up the database Configuration ------------------- - Of course there are way to configure this service to your own specific environment. Here are the list of configuration files and their short description: -\etc\de.rwth.dbis.acis.activity.service.ActivityService.properties -: *dbUserName*: A database user's name, which will be used to access the database -: *dbPassword*: The database user's password -: *dbUrl*: JDBC Connection string to access the database. Modify it if you have changed the name of your database +`\etc\de.rwth.dbis.acis.activity.service.ActivityService.properties`: + - `dbUserName`: A database user's name, which will be used to access the database + - `dbPassword`: The database user's password + - `dbUrl`: JDBC Connection string to access the database. Modify it if you have changed the name of your database + - `land`: Default language setting + - `country`: Default country setting + - `baseURL`: Base URL this service runs on -For other configuration settings, check the **[LAS2Peer](https://github.com/rwth-acis/LAS2peer)** project. +For other configuration settings, check the **[las2peer](https://github.com/rwth-acis/LAS2peer)** project. Build ------------------- +For build management we use Ant. To build the cloned code, please using a console/terminal navigate to the `home` directory, where the `build.xml` file is located and run the following command: -For build management we use Ant. To build the cloned code, please using a console/terminal navigate to the home directory, where the build.xml file is located and run the following commands: - - 1. `ant install-ivy` - 2. `ant clean_all` - 3. `ant get_deps` - 4. `ant generate_configs` - 5. `ant jar` + - `ant` How to run ------------------- - 1. First please make sure you have already [set up the database](#how-to-set-up-the-database) 2. Make sure your [config settings](#configuration) are properly set. 3. [Build](#build) 4. Open a console/terminal window and navigate to the `\bin` directory - 5. Run the `start_network.bat` or `start_network.sh` - + 5. Run the `start_network.bat` or `start_network.sh` script +How to run using Docker +------------------- +Docker will be provided at a later point. \ No newline at end of file From 74521bafcbf9da84f19f5ea2f43e800f81e66108 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 17 May 2017 18:07:56 +0200 Subject: [PATCH 27/29] Remove hashbang from demo frontend urls --- etc/activitytracker_demo_data.sql | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/etc/activitytracker_demo_data.sql b/etc/activitytracker_demo_data.sql index b82c046..863e07b 100644 --- a/etc/activitytracker_demo_data.sql +++ b/etc/activitytracker_demo_data.sql @@ -7,41 +7,41 @@ REPLACE INTO reqbaztrack.activity (id, creation_date, activity_action, origin, d VALUES (1, '2015-10-21 07:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/projects/1', 'PROJECT', - 'http://localhost:5000/#!/projects/1', NULL, NULL, 'http://localhost:8080/bazaar/users/2'), + 'http://localhost:5000/projects/1', NULL, NULL, 'http://localhost:8080/bazaar/users/2'), (2, '2015-10-21 07:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', - 'http://localhost:5000/#!/projects/1/categories/1', 'http://localhost:8080/bazaar/projects/1', + 'http://localhost:5000/projects/1/categories/1', 'http://localhost:8080/bazaar/projects/1', 'PROJECT', 'http://localhost:8080/bazaar/users/2'), (3, '2015-10-21 08:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', - 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', + 'http://localhost:5000/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), (4, '2015-10-21 09:00:00', 'UPDATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', - 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', + 'http://localhost:5000/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), (5, '2015-10-21 10:00:00', 'DELETE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', NULL, 'REQUIREMENT', NULL, 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), (6, '2015-10-21 10:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/projects/2', 'PROJECT', - 'http://localhost:5000/#!/projects/2', NULL, NULL, 'http://localhost:8080/bazaar/users/2'), + 'http://localhost:5000/projects/2', NULL, NULL, 'http://localhost:8080/bazaar/users/2'), (7, '2015-10-21 10:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/categories/2', 'CATEGORY', - 'http://localhost:5000/#!/projects/2/categories/2', 'http://localhost:8080/bazaar/projects/2', + 'http://localhost:5000/projects/2/categories/2', 'http://localhost:8080/bazaar/projects/2', 'PROJECT', 'http://localhost:8080/bazaar/users/2'), (8, '2015-10-21 11:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', - 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', + 'http://localhost:5000/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), (9, '2015-10-21 12:00:00', 'UPDATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', - 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', + 'http://localhost:5000/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), (10, '2015-10-21 13:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/comments/1', 'COMMENT', - 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', + 'http://localhost:5000/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'), (11, '2015-10-21 14:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/comments/2', 'COMMENT', - 'http://localhost:5000/#!/projects/1/categories/1/requirements/2', 'http://localhost:8080/bazaar/requirements/2', + 'http://localhost:5000/projects/1/categories/1/requirements/2', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'), (12, '2015-10-21 15:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/requirements/1', 'VOTE', - 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', + 'http://localhost:5000/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'), (13, '2015-10-21 15:00:00', 'DELETE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', NULL, 'VOTE', - 'http://localhost:5000/#!/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', + 'http://localhost:5000/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'); SET FOREIGN_KEY_CHECKS = 1; From 2d307ec130c6434427db424a44329abd73208ec6 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 May 2017 13:56:52 +0200 Subject: [PATCH 28/29] Add jodd dependency to service --- etc/ant_configuration/service.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/ant_configuration/service.properties b/etc/ant_configuration/service.properties index 6ec0084..8aa134f 100644 --- a/etc/ant_configuration/service.properties +++ b/etc/ant_configuration/service.properties @@ -3,4 +3,4 @@ service.name=de.rwth.dbis.acis.activitytracker.service service.path=de/rwth/dbis/acis/activitytracker/service service.class=ActivityTrackerService service.passphrase=Passphrase -service.dependencies=commons-codec;version="1.9",commons-dbcp2;version="2.0",commons-io;version="2.4",commons-logging;version="1.2",commons-pool2;version="2.2",gson;version="2.3",httpclient;version="4.5.1",httpcore;version="4.4.3",jooq;version="3.9.1",jooq-codegen;version="3.9.1",jooq-meta;version="3.9.1",mysql-connector-java;version="5.1.6" +service.dependencies=commons-codec;version="1.9",commons-dbcp2;version="2.0",commons-io;version="2.4",commons-logging;version="1.2",commons-pool2;version="2.2",gson;version="2.3",httpclient;version="4.5.1",httpcore;version="4.4.3",jodd-bean;version="3.8.5",jodd-core;version="3.8.5",jodd-vtor;version="3.8.5",jooq;version="3.9.1",jooq-codegen;version="3.9.1",jooq-meta;version="3.9.1",mysql-connector-java;version="5.1.6" From b85bfc569b4fb396c9c5d2a75bc1fe71d6123cdb Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 May 2017 13:58:52 +0200 Subject: [PATCH 29/29] Use origin=https://www.requirements-bazaar.org/betabazaar for demo data --- etc/activitytracker_demo_data.sql | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/etc/activitytracker_demo_data.sql b/etc/activitytracker_demo_data.sql index 863e07b..ebf647c 100644 --- a/etc/activitytracker_demo_data.sql +++ b/etc/activitytracker_demo_data.sql @@ -5,42 +5,42 @@ TRUNCATE TABLE reqbaztrack.activity; REPLACE INTO reqbaztrack.activity (id, creation_date, activity_action, origin, data_url, data_type, data_frontend_url, parent_data_url, parent_data_type, user_url) VALUES - (1, '2015-10-21 07:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', + (1, '2015-10-21 07:00:00', 'CREATE', 'https://www.requirements-bazaar.org/betabazaar', 'http://localhost:8080/bazaar/projects/1', 'PROJECT', 'http://localhost:5000/projects/1', NULL, NULL, 'http://localhost:8080/bazaar/users/2'), - (2, '2015-10-21 07:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', + (2, '2015-10-21 07:00:00', 'CREATE', 'https://www.requirements-bazaar.org/betabazaar', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:5000/projects/1/categories/1', 'http://localhost:8080/bazaar/projects/1', 'PROJECT', 'http://localhost:8080/bazaar/users/2'), - (3, '2015-10-21 08:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', + (3, '2015-10-21 08:00:00', 'CREATE', 'https://www.requirements-bazaar.org/betabazaar', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:5000/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), - (4, '2015-10-21 09:00:00', 'UPDATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', + (4, '2015-10-21 09:00:00', 'UPDATE', 'https://www.requirements-bazaar.org/betabazaar', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:5000/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), - (5, '2015-10-21 10:00:00', 'DELETE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', NULL, 'REQUIREMENT', + (5, '2015-10-21 10:00:00', 'DELETE', 'https://www.requirements-bazaar.org/betabazaar', NULL, 'REQUIREMENT', NULL, 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), - (6, '2015-10-21 10:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/projects/2', 'PROJECT', + (6, '2015-10-21 10:00:00', 'CREATE', 'https://www.requirements-bazaar.org/betabazaar', 'http://localhost:8080/bazaar/projects/2', 'PROJECT', 'http://localhost:5000/projects/2', NULL, NULL, 'http://localhost:8080/bazaar/users/2'), - (7, '2015-10-21 10:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/categories/2', 'CATEGORY', + (7, '2015-10-21 10:00:00', 'CREATE', 'https://www.requirements-bazaar.org/betabazaar', 'http://localhost:8080/bazaar/categories/2', 'CATEGORY', 'http://localhost:5000/projects/2/categories/2', 'http://localhost:8080/bazaar/projects/2', 'PROJECT', 'http://localhost:8080/bazaar/users/2'), - (8, '2015-10-21 11:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', + (8, '2015-10-21 11:00:00', 'CREATE', 'https://www.requirements-bazaar.org/betabazaar', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', 'http://localhost:5000/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), - (9, '2015-10-21 12:00:00', 'UPDATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', + (9, '2015-10-21 12:00:00', 'UPDATE', 'https://www.requirements-bazaar.org/betabazaar', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', 'http://localhost:5000/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/categories/1', 'CATEGORY', 'http://localhost:8080/bazaar/users/2'), - (10, '2015-10-21 13:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/comments/1', 'COMMENT', + (10, '2015-10-21 13:00:00', 'CREATE', 'https://www.requirements-bazaar.org/betabazaar', 'http://localhost:8080/bazaar/comments/1', 'COMMENT', 'http://localhost:5000/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'), - (11, '2015-10-21 14:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', 'http://localhost:8080/bazaar/comments/2', 'COMMENT', + (11, '2015-10-21 14:00:00', 'CREATE', 'https://www.requirements-bazaar.org/betabazaar', 'http://localhost:8080/bazaar/comments/2', 'COMMENT', 'http://localhost:5000/projects/1/categories/1/requirements/2', 'http://localhost:8080/bazaar/requirements/2', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'), - (12, '2015-10-21 15:00:00', 'CREATE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', + (12, '2015-10-21 15:00:00', 'CREATE', 'https://www.requirements-bazaar.org/betabazaar', 'http://localhost:8080/bazaar/requirements/1', 'VOTE', 'http://localhost:5000/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2'), - (13, '2015-10-21 15:00:00', 'DELETE', 'de.rwth.dbis.acis.bazaar.service.BazaarService', NULL, 'VOTE', + (13, '2015-10-21 15:00:00', 'DELETE', 'https://www.requirements-bazaar.org/betabazaar', NULL, 'VOTE', 'http://localhost:5000/projects/1/categories/1/requirements/1', 'http://localhost:8080/bazaar/requirements/1', 'REQUIREMENT', 'http://localhost:8080/bazaar/users/2');