branch feature/spgeed updated (7c8c7735 -> 437c8ca4)
This is an automated email from the git hooks/post-receive script. New change to branch feature/spgeed in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git from 7c8c7735 addin performance test (spgeed - topia) + spgeed dao request with where new 155dd8f5 test new 437c8ca4 test The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 437c8ca43d5ae72f3b490b449dfa50b2b65f6b78 Author: Killian <killian.herbreteau@epitech.eu> Date: Thu Sep 19 09:27:14 2019 +0200 test commit 155dd8f515e4ee7bb182703ac7e3c818ba10ca81 Author: Killian <killian.herbreteau@epitech.eu> Date: Thu Sep 19 09:26:46 2019 +0200 test Summary of changes: ....java => PollenChildFavoriteListSpgeedDao.java} | 32 +++- ...llSpgeedDao.java => PollenChoiceSpgeedDao.java} | 32 +++- ...lSpgeedDao.java => PollenCommentSpgeedDao.java} | 32 +++- ...java => PollenFavoriteListMemberSpgeedDao.java} | 32 +++- ...edDao.java => PollenFavoriteListSpgeedDao.java} | 32 +++- ...pgeedDao.java => PollenPrincipalSpgeedDao.java} | 32 +++- ...pgeedDao.java => PollenRessourceSpgeedDao.java} | 32 +++- ...edDao.java => PollenSessionTokenSpgeedDao.java} | 32 +++- ...ollSpgeedDao.java => PollenTokenSpgeedDao.java} | 32 +++- ...o.java => PollenUserEmailAddressSpgeedDao.java} | 32 +++- ...PollSpgeedDao.java => PollenVoteSpgeedDao.java} | 32 +++- ...ao.java => PollenVoterListMemberSpgeedDao.java} | 32 +++- ...pgeedDao.java => PollenVoterListSpgeedDao.java} | 32 +++- ...ollenPollSpgeedDao.java => SpgeedDaoUtils.java} | 35 +++- ...roperties => #pollen-rest-api-test.properties#} | 12 +- .../resources/.#pollen-rest-api-test.properties | 1 + .../services/service/security/SpgeedDao.java | 31 +++ .../chorem/pollen/services/SpgeedDaoUtilsTest.java | 211 +++++++++++++++++++++ 18 files changed, 602 insertions(+), 104 deletions(-) copy pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/{PollenPollSpgeedDao.java => PollenChildFavoriteListSpgeedDao.java} (53%) copy pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/{PollenPollSpgeedDao.java => PollenChoiceSpgeedDao.java} (53%) copy pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/{PollenPollSpgeedDao.java => PollenCommentSpgeedDao.java} (53%) copy pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/{PollenPollSpgeedDao.java => PollenFavoriteListMemberSpgeedDao.java} (53%) copy pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/{PollenPollSpgeedDao.java => PollenFavoriteListSpgeedDao.java} (53%) copy pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/{PollenPollSpgeedDao.java => PollenPrincipalSpgeedDao.java} (53%) copy pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/{PollenPollSpgeedDao.java => PollenRessourceSpgeedDao.java} (53%) copy pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/{PollenPollSpgeedDao.java => PollenSessionTokenSpgeedDao.java} (53%) copy pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/{PollenPollSpgeedDao.java => PollenTokenSpgeedDao.java} (53%) copy pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/{PollenPollSpgeedDao.java => PollenUserEmailAddressSpgeedDao.java} (53%) copy pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/{PollenPollSpgeedDao.java => PollenVoteSpgeedDao.java} (53%) copy pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/{PollenPollSpgeedDao.java => PollenVoterListMemberSpgeedDao.java} (53%) copy pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/{PollenPollSpgeedDao.java => PollenVoterListSpgeedDao.java} (53%) copy pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/{PollenPollSpgeedDao.java => SpgeedDaoUtils.java} (50%) copy pollen-rest-api/src/test/resources/{pollen-rest-api-test.properties => #pollen-rest-api-test.properties#} (76%) create mode 120000 pollen-rest-api/src/test/resources/.#pollen-rest-api-test.properties create mode 100644 pollen-services/src/main/java/org/chorem/pollen/services/service/security/SpgeedDao.java create mode 100644 pollen-services/src/test/java/org/chorem/pollen/services/SpgeedDaoUtilsTest.java -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/spgeed in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 155dd8f515e4ee7bb182703ac7e3c818ba10ca81 Author: Killian <killian.herbreteau@epitech.eu> Date: Thu Sep 19 09:26:46 2019 +0200 test --- command | 1 + .../Dao/PollenChildFavoriteListSpgeedDao.java | 52 +++++ .../persistence/Dao/PollenChoiceSpgeedDao.java | 52 +++++ .../persistence/Dao/PollenCommentSpgeedDao.java | 52 +++++ .../Dao/PollenFavoriteListMemberSpgeedDao.java | 52 +++++ .../Dao/PollenFavoriteListSpgeedDao.java | 52 +++++ .../persistence/Dao/PollenPrincipalSpgeedDao.java | 52 +++++ .../persistence/Dao/PollenRessourceSpgeedDao.java | 52 +++++ .../Dao/PollenSessionTokenSpgeedDao.java | 52 +++++ .../persistence/Dao/PollenTokenSpgeedDao.java | 52 +++++ .../Dao/PollenUserEmailAddressSpgeedDao.java | 52 +++++ .../persistence/Dao/PollenVoteSpgeedDao.java | 52 +++++ .../Dao/PollenVoterListMemberSpgeedDao.java | 52 +++++ .../persistence/Dao/PollenVoterListSpgeedDao.java | 52 +++++ .../pollen/persistence/Dao/SpgeedDaoUtils.java | 55 ++++++ .../resources/#pollen-rest-api-test.properties# | 31 +++ .../resources/.#pollen-rest-api-test.properties | 1 + .../services/service/security/SpgeedDao.java | 31 +++ .../chorem/pollen/services/SpgeedDaoUtilsTest.java | 211 +++++++++++++++++++++ 19 files changed, 1006 insertions(+) diff --git a/command b/command new file mode 100644 index 00000000..de6d042d --- /dev/null +++ b/command @@ -0,0 +1 @@ +with pollenpo as (select title, description, begindate, enddate, anonymousvoteallowed, continuousresults, notifymehoursbeforepollends, pollendremindersent, notificationlocale, votenotification, feedcontent, commentnotification, newchoicenotification, gtuvalidationdate, premium, notificationmaxvotersend, emailaddresssuffixes, (select json_agg(pr)->0 as pollenprincipal from pollenprincipal pr where pr.topiaId = pi.creator) from poll pi) select json_agg(po)->2 from pollenpo po; \ No newline at end of file diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenChildFavoriteListSpgeedDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenChildFavoriteListSpgeedDao.java new file mode 100644 index 00000000..79d434be --- /dev/null +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenChildFavoriteListSpgeedDao.java @@ -0,0 +1,52 @@ +package org.chorem.pollen.persistence.Dao; + +import org.chorem.pollen.persistence.PollenMapper; +import org.chorem.pollen.persistence.entity.Poll; +import org.nuiton.spgeed.annotations.Select; +import org.nuiton.spgeed.annotations.Update; + +import java.sql.Date; + +public interface PollenPollSpgeedDao { + + String command = "WITH " + + "email_agg AS (" + + " SELECT emailaddress, topiaid, pollenuser" + + " FROM pollenuseremailaddress" + + ")," + + "users_agg AS (" + + " SELECT userx.topiaid, json_agg(demail.*)->0 AS defaultemailaddress, json_agg(emails.*) AS emailaddresses" + + " FROM email_agg demail, email_agg emails, pollenuser userx" + + " WHERE demail.topiaid = userx.defaultemailaddress AND emails.pollenuser = userx.topiaid" + + " GROUP BY userx.topiaid" + + ")," + + "principals_agg AS (" + + " SELECT principals.topiaid, json_agg(userx.*)->0 AS pollenuser" + + " FROM users_agg userx, pollenprincipal principals" + + " WHERE userx.topiaid = principals.pollenuser" + + " GROUP BY principals.topiaid" + + "), " + + "polls_agg AS (" + + " SELECT p.topiaid, json_agg(a.*)->0 AS creator" + + " FROM principals_agg a, poll p" + + " WHERE a.topiaid = p.creator" + + " GROUP BY p.topiaid" + + ") " + + "SELECT * FROM polls_agg"; + @Select(sql = command, mapper = PollenMapper.class) + Poll[] getallpoll(); + + @Update(sql = "insert into poll (title, description, begindate, enddate, anonymousvoteallowed, " + + "continuousresults, notifymehoursbeforepollends, pollendremindersent, " + + "notificationlocale, votenotification, feedcontent, commentnotification, " + + "newchoicenotification, gtuvalidationdate, premium, notificationmaxvotersend, " + + "emailaddresssuffixes) values ($(title), $(description), $(begindate), $(enddate), $(anonymousvoteallowed), " + + "$(continuousresults), $(notifymehoursbeforepollends), $(pollendremindersent), " + + "$(notificationlocale), $(votenotification), $(feedcontent), $(commentnotification), " + + "$(newchoicenotification), $(gtuvalidationdate), $(premium), $(notificationmaxvotersend), " + + "$(emailaddresssuffixes)))", mapper = PollenMapper.class) + int new_poll(String title, String description, Date begindate, Date enddate, boolean anonymousvoteallowed, boolean continuousresults, + int notifymehoursbeforepollends, boolean pollendremindersent, String notificationlocale, boolean votenotification, + String feedcontent, boolean commentnotification, boolean newchoicenotification, Date gtuvalidationdate, boolean premium, + boolean notificationmaxvotersend, String emailaddresssuffixes); +} \ No newline at end of file diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenChoiceSpgeedDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenChoiceSpgeedDao.java new file mode 100644 index 00000000..79d434be --- /dev/null +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenChoiceSpgeedDao.java @@ -0,0 +1,52 @@ +package org.chorem.pollen.persistence.Dao; + +import org.chorem.pollen.persistence.PollenMapper; +import org.chorem.pollen.persistence.entity.Poll; +import org.nuiton.spgeed.annotations.Select; +import org.nuiton.spgeed.annotations.Update; + +import java.sql.Date; + +public interface PollenPollSpgeedDao { + + String command = "WITH " + + "email_agg AS (" + + " SELECT emailaddress, topiaid, pollenuser" + + " FROM pollenuseremailaddress" + + ")," + + "users_agg AS (" + + " SELECT userx.topiaid, json_agg(demail.*)->0 AS defaultemailaddress, json_agg(emails.*) AS emailaddresses" + + " FROM email_agg demail, email_agg emails, pollenuser userx" + + " WHERE demail.topiaid = userx.defaultemailaddress AND emails.pollenuser = userx.topiaid" + + " GROUP BY userx.topiaid" + + ")," + + "principals_agg AS (" + + " SELECT principals.topiaid, json_agg(userx.*)->0 AS pollenuser" + + " FROM users_agg userx, pollenprincipal principals" + + " WHERE userx.topiaid = principals.pollenuser" + + " GROUP BY principals.topiaid" + + "), " + + "polls_agg AS (" + + " SELECT p.topiaid, json_agg(a.*)->0 AS creator" + + " FROM principals_agg a, poll p" + + " WHERE a.topiaid = p.creator" + + " GROUP BY p.topiaid" + + ") " + + "SELECT * FROM polls_agg"; + @Select(sql = command, mapper = PollenMapper.class) + Poll[] getallpoll(); + + @Update(sql = "insert into poll (title, description, begindate, enddate, anonymousvoteallowed, " + + "continuousresults, notifymehoursbeforepollends, pollendremindersent, " + + "notificationlocale, votenotification, feedcontent, commentnotification, " + + "newchoicenotification, gtuvalidationdate, premium, notificationmaxvotersend, " + + "emailaddresssuffixes) values ($(title), $(description), $(begindate), $(enddate), $(anonymousvoteallowed), " + + "$(continuousresults), $(notifymehoursbeforepollends), $(pollendremindersent), " + + "$(notificationlocale), $(votenotification), $(feedcontent), $(commentnotification), " + + "$(newchoicenotification), $(gtuvalidationdate), $(premium), $(notificationmaxvotersend), " + + "$(emailaddresssuffixes)))", mapper = PollenMapper.class) + int new_poll(String title, String description, Date begindate, Date enddate, boolean anonymousvoteallowed, boolean continuousresults, + int notifymehoursbeforepollends, boolean pollendremindersent, String notificationlocale, boolean votenotification, + String feedcontent, boolean commentnotification, boolean newchoicenotification, Date gtuvalidationdate, boolean premium, + boolean notificationmaxvotersend, String emailaddresssuffixes); +} \ No newline at end of file diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenCommentSpgeedDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenCommentSpgeedDao.java new file mode 100644 index 00000000..79d434be --- /dev/null +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenCommentSpgeedDao.java @@ -0,0 +1,52 @@ +package org.chorem.pollen.persistence.Dao; + +import org.chorem.pollen.persistence.PollenMapper; +import org.chorem.pollen.persistence.entity.Poll; +import org.nuiton.spgeed.annotations.Select; +import org.nuiton.spgeed.annotations.Update; + +import java.sql.Date; + +public interface PollenPollSpgeedDao { + + String command = "WITH " + + "email_agg AS (" + + " SELECT emailaddress, topiaid, pollenuser" + + " FROM pollenuseremailaddress" + + ")," + + "users_agg AS (" + + " SELECT userx.topiaid, json_agg(demail.*)->0 AS defaultemailaddress, json_agg(emails.*) AS emailaddresses" + + " FROM email_agg demail, email_agg emails, pollenuser userx" + + " WHERE demail.topiaid = userx.defaultemailaddress AND emails.pollenuser = userx.topiaid" + + " GROUP BY userx.topiaid" + + ")," + + "principals_agg AS (" + + " SELECT principals.topiaid, json_agg(userx.*)->0 AS pollenuser" + + " FROM users_agg userx, pollenprincipal principals" + + " WHERE userx.topiaid = principals.pollenuser" + + " GROUP BY principals.topiaid" + + "), " + + "polls_agg AS (" + + " SELECT p.topiaid, json_agg(a.*)->0 AS creator" + + " FROM principals_agg a, poll p" + + " WHERE a.topiaid = p.creator" + + " GROUP BY p.topiaid" + + ") " + + "SELECT * FROM polls_agg"; + @Select(sql = command, mapper = PollenMapper.class) + Poll[] getallpoll(); + + @Update(sql = "insert into poll (title, description, begindate, enddate, anonymousvoteallowed, " + + "continuousresults, notifymehoursbeforepollends, pollendremindersent, " + + "notificationlocale, votenotification, feedcontent, commentnotification, " + + "newchoicenotification, gtuvalidationdate, premium, notificationmaxvotersend, " + + "emailaddresssuffixes) values ($(title), $(description), $(begindate), $(enddate), $(anonymousvoteallowed), " + + "$(continuousresults), $(notifymehoursbeforepollends), $(pollendremindersent), " + + "$(notificationlocale), $(votenotification), $(feedcontent), $(commentnotification), " + + "$(newchoicenotification), $(gtuvalidationdate), $(premium), $(notificationmaxvotersend), " + + "$(emailaddresssuffixes)))", mapper = PollenMapper.class) + int new_poll(String title, String description, Date begindate, Date enddate, boolean anonymousvoteallowed, boolean continuousresults, + int notifymehoursbeforepollends, boolean pollendremindersent, String notificationlocale, boolean votenotification, + String feedcontent, boolean commentnotification, boolean newchoicenotification, Date gtuvalidationdate, boolean premium, + boolean notificationmaxvotersend, String emailaddresssuffixes); +} \ No newline at end of file diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenFavoriteListMemberSpgeedDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenFavoriteListMemberSpgeedDao.java new file mode 100644 index 00000000..79d434be --- /dev/null +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenFavoriteListMemberSpgeedDao.java @@ -0,0 +1,52 @@ +package org.chorem.pollen.persistence.Dao; + +import org.chorem.pollen.persistence.PollenMapper; +import org.chorem.pollen.persistence.entity.Poll; +import org.nuiton.spgeed.annotations.Select; +import org.nuiton.spgeed.annotations.Update; + +import java.sql.Date; + +public interface PollenPollSpgeedDao { + + String command = "WITH " + + "email_agg AS (" + + " SELECT emailaddress, topiaid, pollenuser" + + " FROM pollenuseremailaddress" + + ")," + + "users_agg AS (" + + " SELECT userx.topiaid, json_agg(demail.*)->0 AS defaultemailaddress, json_agg(emails.*) AS emailaddresses" + + " FROM email_agg demail, email_agg emails, pollenuser userx" + + " WHERE demail.topiaid = userx.defaultemailaddress AND emails.pollenuser = userx.topiaid" + + " GROUP BY userx.topiaid" + + ")," + + "principals_agg AS (" + + " SELECT principals.topiaid, json_agg(userx.*)->0 AS pollenuser" + + " FROM users_agg userx, pollenprincipal principals" + + " WHERE userx.topiaid = principals.pollenuser" + + " GROUP BY principals.topiaid" + + "), " + + "polls_agg AS (" + + " SELECT p.topiaid, json_agg(a.*)->0 AS creator" + + " FROM principals_agg a, poll p" + + " WHERE a.topiaid = p.creator" + + " GROUP BY p.topiaid" + + ") " + + "SELECT * FROM polls_agg"; + @Select(sql = command, mapper = PollenMapper.class) + Poll[] getallpoll(); + + @Update(sql = "insert into poll (title, description, begindate, enddate, anonymousvoteallowed, " + + "continuousresults, notifymehoursbeforepollends, pollendremindersent, " + + "notificationlocale, votenotification, feedcontent, commentnotification, " + + "newchoicenotification, gtuvalidationdate, premium, notificationmaxvotersend, " + + "emailaddresssuffixes) values ($(title), $(description), $(begindate), $(enddate), $(anonymousvoteallowed), " + + "$(continuousresults), $(notifymehoursbeforepollends), $(pollendremindersent), " + + "$(notificationlocale), $(votenotification), $(feedcontent), $(commentnotification), " + + "$(newchoicenotification), $(gtuvalidationdate), $(premium), $(notificationmaxvotersend), " + + "$(emailaddresssuffixes)))", mapper = PollenMapper.class) + int new_poll(String title, String description, Date begindate, Date enddate, boolean anonymousvoteallowed, boolean continuousresults, + int notifymehoursbeforepollends, boolean pollendremindersent, String notificationlocale, boolean votenotification, + String feedcontent, boolean commentnotification, boolean newchoicenotification, Date gtuvalidationdate, boolean premium, + boolean notificationmaxvotersend, String emailaddresssuffixes); +} \ No newline at end of file diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenFavoriteListSpgeedDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenFavoriteListSpgeedDao.java new file mode 100644 index 00000000..79d434be --- /dev/null +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenFavoriteListSpgeedDao.java @@ -0,0 +1,52 @@ +package org.chorem.pollen.persistence.Dao; + +import org.chorem.pollen.persistence.PollenMapper; +import org.chorem.pollen.persistence.entity.Poll; +import org.nuiton.spgeed.annotations.Select; +import org.nuiton.spgeed.annotations.Update; + +import java.sql.Date; + +public interface PollenPollSpgeedDao { + + String command = "WITH " + + "email_agg AS (" + + " SELECT emailaddress, topiaid, pollenuser" + + " FROM pollenuseremailaddress" + + ")," + + "users_agg AS (" + + " SELECT userx.topiaid, json_agg(demail.*)->0 AS defaultemailaddress, json_agg(emails.*) AS emailaddresses" + + " FROM email_agg demail, email_agg emails, pollenuser userx" + + " WHERE demail.topiaid = userx.defaultemailaddress AND emails.pollenuser = userx.topiaid" + + " GROUP BY userx.topiaid" + + ")," + + "principals_agg AS (" + + " SELECT principals.topiaid, json_agg(userx.*)->0 AS pollenuser" + + " FROM users_agg userx, pollenprincipal principals" + + " WHERE userx.topiaid = principals.pollenuser" + + " GROUP BY principals.topiaid" + + "), " + + "polls_agg AS (" + + " SELECT p.topiaid, json_agg(a.*)->0 AS creator" + + " FROM principals_agg a, poll p" + + " WHERE a.topiaid = p.creator" + + " GROUP BY p.topiaid" + + ") " + + "SELECT * FROM polls_agg"; + @Select(sql = command, mapper = PollenMapper.class) + Poll[] getallpoll(); + + @Update(sql = "insert into poll (title, description, begindate, enddate, anonymousvoteallowed, " + + "continuousresults, notifymehoursbeforepollends, pollendremindersent, " + + "notificationlocale, votenotification, feedcontent, commentnotification, " + + "newchoicenotification, gtuvalidationdate, premium, notificationmaxvotersend, " + + "emailaddresssuffixes) values ($(title), $(description), $(begindate), $(enddate), $(anonymousvoteallowed), " + + "$(continuousresults), $(notifymehoursbeforepollends), $(pollendremindersent), " + + "$(notificationlocale), $(votenotification), $(feedcontent), $(commentnotification), " + + "$(newchoicenotification), $(gtuvalidationdate), $(premium), $(notificationmaxvotersend), " + + "$(emailaddresssuffixes)))", mapper = PollenMapper.class) + int new_poll(String title, String description, Date begindate, Date enddate, boolean anonymousvoteallowed, boolean continuousresults, + int notifymehoursbeforepollends, boolean pollendremindersent, String notificationlocale, boolean votenotification, + String feedcontent, boolean commentnotification, boolean newchoicenotification, Date gtuvalidationdate, boolean premium, + boolean notificationmaxvotersend, String emailaddresssuffixes); +} \ No newline at end of file diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenPrincipalSpgeedDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenPrincipalSpgeedDao.java new file mode 100644 index 00000000..79d434be --- /dev/null +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenPrincipalSpgeedDao.java @@ -0,0 +1,52 @@ +package org.chorem.pollen.persistence.Dao; + +import org.chorem.pollen.persistence.PollenMapper; +import org.chorem.pollen.persistence.entity.Poll; +import org.nuiton.spgeed.annotations.Select; +import org.nuiton.spgeed.annotations.Update; + +import java.sql.Date; + +public interface PollenPollSpgeedDao { + + String command = "WITH " + + "email_agg AS (" + + " SELECT emailaddress, topiaid, pollenuser" + + " FROM pollenuseremailaddress" + + ")," + + "users_agg AS (" + + " SELECT userx.topiaid, json_agg(demail.*)->0 AS defaultemailaddress, json_agg(emails.*) AS emailaddresses" + + " FROM email_agg demail, email_agg emails, pollenuser userx" + + " WHERE demail.topiaid = userx.defaultemailaddress AND emails.pollenuser = userx.topiaid" + + " GROUP BY userx.topiaid" + + ")," + + "principals_agg AS (" + + " SELECT principals.topiaid, json_agg(userx.*)->0 AS pollenuser" + + " FROM users_agg userx, pollenprincipal principals" + + " WHERE userx.topiaid = principals.pollenuser" + + " GROUP BY principals.topiaid" + + "), " + + "polls_agg AS (" + + " SELECT p.topiaid, json_agg(a.*)->0 AS creator" + + " FROM principals_agg a, poll p" + + " WHERE a.topiaid = p.creator" + + " GROUP BY p.topiaid" + + ") " + + "SELECT * FROM polls_agg"; + @Select(sql = command, mapper = PollenMapper.class) + Poll[] getallpoll(); + + @Update(sql = "insert into poll (title, description, begindate, enddate, anonymousvoteallowed, " + + "continuousresults, notifymehoursbeforepollends, pollendremindersent, " + + "notificationlocale, votenotification, feedcontent, commentnotification, " + + "newchoicenotification, gtuvalidationdate, premium, notificationmaxvotersend, " + + "emailaddresssuffixes) values ($(title), $(description), $(begindate), $(enddate), $(anonymousvoteallowed), " + + "$(continuousresults), $(notifymehoursbeforepollends), $(pollendremindersent), " + + "$(notificationlocale), $(votenotification), $(feedcontent), $(commentnotification), " + + "$(newchoicenotification), $(gtuvalidationdate), $(premium), $(notificationmaxvotersend), " + + "$(emailaddresssuffixes)))", mapper = PollenMapper.class) + int new_poll(String title, String description, Date begindate, Date enddate, boolean anonymousvoteallowed, boolean continuousresults, + int notifymehoursbeforepollends, boolean pollendremindersent, String notificationlocale, boolean votenotification, + String feedcontent, boolean commentnotification, boolean newchoicenotification, Date gtuvalidationdate, boolean premium, + boolean notificationmaxvotersend, String emailaddresssuffixes); +} \ No newline at end of file diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenRessourceSpgeedDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenRessourceSpgeedDao.java new file mode 100644 index 00000000..79d434be --- /dev/null +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenRessourceSpgeedDao.java @@ -0,0 +1,52 @@ +package org.chorem.pollen.persistence.Dao; + +import org.chorem.pollen.persistence.PollenMapper; +import org.chorem.pollen.persistence.entity.Poll; +import org.nuiton.spgeed.annotations.Select; +import org.nuiton.spgeed.annotations.Update; + +import java.sql.Date; + +public interface PollenPollSpgeedDao { + + String command = "WITH " + + "email_agg AS (" + + " SELECT emailaddress, topiaid, pollenuser" + + " FROM pollenuseremailaddress" + + ")," + + "users_agg AS (" + + " SELECT userx.topiaid, json_agg(demail.*)->0 AS defaultemailaddress, json_agg(emails.*) AS emailaddresses" + + " FROM email_agg demail, email_agg emails, pollenuser userx" + + " WHERE demail.topiaid = userx.defaultemailaddress AND emails.pollenuser = userx.topiaid" + + " GROUP BY userx.topiaid" + + ")," + + "principals_agg AS (" + + " SELECT principals.topiaid, json_agg(userx.*)->0 AS pollenuser" + + " FROM users_agg userx, pollenprincipal principals" + + " WHERE userx.topiaid = principals.pollenuser" + + " GROUP BY principals.topiaid" + + "), " + + "polls_agg AS (" + + " SELECT p.topiaid, json_agg(a.*)->0 AS creator" + + " FROM principals_agg a, poll p" + + " WHERE a.topiaid = p.creator" + + " GROUP BY p.topiaid" + + ") " + + "SELECT * FROM polls_agg"; + @Select(sql = command, mapper = PollenMapper.class) + Poll[] getallpoll(); + + @Update(sql = "insert into poll (title, description, begindate, enddate, anonymousvoteallowed, " + + "continuousresults, notifymehoursbeforepollends, pollendremindersent, " + + "notificationlocale, votenotification, feedcontent, commentnotification, " + + "newchoicenotification, gtuvalidationdate, premium, notificationmaxvotersend, " + + "emailaddresssuffixes) values ($(title), $(description), $(begindate), $(enddate), $(anonymousvoteallowed), " + + "$(continuousresults), $(notifymehoursbeforepollends), $(pollendremindersent), " + + "$(notificationlocale), $(votenotification), $(feedcontent), $(commentnotification), " + + "$(newchoicenotification), $(gtuvalidationdate), $(premium), $(notificationmaxvotersend), " + + "$(emailaddresssuffixes)))", mapper = PollenMapper.class) + int new_poll(String title, String description, Date begindate, Date enddate, boolean anonymousvoteallowed, boolean continuousresults, + int notifymehoursbeforepollends, boolean pollendremindersent, String notificationlocale, boolean votenotification, + String feedcontent, boolean commentnotification, boolean newchoicenotification, Date gtuvalidationdate, boolean premium, + boolean notificationmaxvotersend, String emailaddresssuffixes); +} \ No newline at end of file diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenSessionTokenSpgeedDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenSessionTokenSpgeedDao.java new file mode 100644 index 00000000..79d434be --- /dev/null +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenSessionTokenSpgeedDao.java @@ -0,0 +1,52 @@ +package org.chorem.pollen.persistence.Dao; + +import org.chorem.pollen.persistence.PollenMapper; +import org.chorem.pollen.persistence.entity.Poll; +import org.nuiton.spgeed.annotations.Select; +import org.nuiton.spgeed.annotations.Update; + +import java.sql.Date; + +public interface PollenPollSpgeedDao { + + String command = "WITH " + + "email_agg AS (" + + " SELECT emailaddress, topiaid, pollenuser" + + " FROM pollenuseremailaddress" + + ")," + + "users_agg AS (" + + " SELECT userx.topiaid, json_agg(demail.*)->0 AS defaultemailaddress, json_agg(emails.*) AS emailaddresses" + + " FROM email_agg demail, email_agg emails, pollenuser userx" + + " WHERE demail.topiaid = userx.defaultemailaddress AND emails.pollenuser = userx.topiaid" + + " GROUP BY userx.topiaid" + + ")," + + "principals_agg AS (" + + " SELECT principals.topiaid, json_agg(userx.*)->0 AS pollenuser" + + " FROM users_agg userx, pollenprincipal principals" + + " WHERE userx.topiaid = principals.pollenuser" + + " GROUP BY principals.topiaid" + + "), " + + "polls_agg AS (" + + " SELECT p.topiaid, json_agg(a.*)->0 AS creator" + + " FROM principals_agg a, poll p" + + " WHERE a.topiaid = p.creator" + + " GROUP BY p.topiaid" + + ") " + + "SELECT * FROM polls_agg"; + @Select(sql = command, mapper = PollenMapper.class) + Poll[] getallpoll(); + + @Update(sql = "insert into poll (title, description, begindate, enddate, anonymousvoteallowed, " + + "continuousresults, notifymehoursbeforepollends, pollendremindersent, " + + "notificationlocale, votenotification, feedcontent, commentnotification, " + + "newchoicenotification, gtuvalidationdate, premium, notificationmaxvotersend, " + + "emailaddresssuffixes) values ($(title), $(description), $(begindate), $(enddate), $(anonymousvoteallowed), " + + "$(continuousresults), $(notifymehoursbeforepollends), $(pollendremindersent), " + + "$(notificationlocale), $(votenotification), $(feedcontent), $(commentnotification), " + + "$(newchoicenotification), $(gtuvalidationdate), $(premium), $(notificationmaxvotersend), " + + "$(emailaddresssuffixes)))", mapper = PollenMapper.class) + int new_poll(String title, String description, Date begindate, Date enddate, boolean anonymousvoteallowed, boolean continuousresults, + int notifymehoursbeforepollends, boolean pollendremindersent, String notificationlocale, boolean votenotification, + String feedcontent, boolean commentnotification, boolean newchoicenotification, Date gtuvalidationdate, boolean premium, + boolean notificationmaxvotersend, String emailaddresssuffixes); +} \ No newline at end of file diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenTokenSpgeedDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenTokenSpgeedDao.java new file mode 100644 index 00000000..79d434be --- /dev/null +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenTokenSpgeedDao.java @@ -0,0 +1,52 @@ +package org.chorem.pollen.persistence.Dao; + +import org.chorem.pollen.persistence.PollenMapper; +import org.chorem.pollen.persistence.entity.Poll; +import org.nuiton.spgeed.annotations.Select; +import org.nuiton.spgeed.annotations.Update; + +import java.sql.Date; + +public interface PollenPollSpgeedDao { + + String command = "WITH " + + "email_agg AS (" + + " SELECT emailaddress, topiaid, pollenuser" + + " FROM pollenuseremailaddress" + + ")," + + "users_agg AS (" + + " SELECT userx.topiaid, json_agg(demail.*)->0 AS defaultemailaddress, json_agg(emails.*) AS emailaddresses" + + " FROM email_agg demail, email_agg emails, pollenuser userx" + + " WHERE demail.topiaid = userx.defaultemailaddress AND emails.pollenuser = userx.topiaid" + + " GROUP BY userx.topiaid" + + ")," + + "principals_agg AS (" + + " SELECT principals.topiaid, json_agg(userx.*)->0 AS pollenuser" + + " FROM users_agg userx, pollenprincipal principals" + + " WHERE userx.topiaid = principals.pollenuser" + + " GROUP BY principals.topiaid" + + "), " + + "polls_agg AS (" + + " SELECT p.topiaid, json_agg(a.*)->0 AS creator" + + " FROM principals_agg a, poll p" + + " WHERE a.topiaid = p.creator" + + " GROUP BY p.topiaid" + + ") " + + "SELECT * FROM polls_agg"; + @Select(sql = command, mapper = PollenMapper.class) + Poll[] getallpoll(); + + @Update(sql = "insert into poll (title, description, begindate, enddate, anonymousvoteallowed, " + + "continuousresults, notifymehoursbeforepollends, pollendremindersent, " + + "notificationlocale, votenotification, feedcontent, commentnotification, " + + "newchoicenotification, gtuvalidationdate, premium, notificationmaxvotersend, " + + "emailaddresssuffixes) values ($(title), $(description), $(begindate), $(enddate), $(anonymousvoteallowed), " + + "$(continuousresults), $(notifymehoursbeforepollends), $(pollendremindersent), " + + "$(notificationlocale), $(votenotification), $(feedcontent), $(commentnotification), " + + "$(newchoicenotification), $(gtuvalidationdate), $(premium), $(notificationmaxvotersend), " + + "$(emailaddresssuffixes)))", mapper = PollenMapper.class) + int new_poll(String title, String description, Date begindate, Date enddate, boolean anonymousvoteallowed, boolean continuousresults, + int notifymehoursbeforepollends, boolean pollendremindersent, String notificationlocale, boolean votenotification, + String feedcontent, boolean commentnotification, boolean newchoicenotification, Date gtuvalidationdate, boolean premium, + boolean notificationmaxvotersend, String emailaddresssuffixes); +} \ No newline at end of file diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenUserEmailAddressSpgeedDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenUserEmailAddressSpgeedDao.java new file mode 100644 index 00000000..79d434be --- /dev/null +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenUserEmailAddressSpgeedDao.java @@ -0,0 +1,52 @@ +package org.chorem.pollen.persistence.Dao; + +import org.chorem.pollen.persistence.PollenMapper; +import org.chorem.pollen.persistence.entity.Poll; +import org.nuiton.spgeed.annotations.Select; +import org.nuiton.spgeed.annotations.Update; + +import java.sql.Date; + +public interface PollenPollSpgeedDao { + + String command = "WITH " + + "email_agg AS (" + + " SELECT emailaddress, topiaid, pollenuser" + + " FROM pollenuseremailaddress" + + ")," + + "users_agg AS (" + + " SELECT userx.topiaid, json_agg(demail.*)->0 AS defaultemailaddress, json_agg(emails.*) AS emailaddresses" + + " FROM email_agg demail, email_agg emails, pollenuser userx" + + " WHERE demail.topiaid = userx.defaultemailaddress AND emails.pollenuser = userx.topiaid" + + " GROUP BY userx.topiaid" + + ")," + + "principals_agg AS (" + + " SELECT principals.topiaid, json_agg(userx.*)->0 AS pollenuser" + + " FROM users_agg userx, pollenprincipal principals" + + " WHERE userx.topiaid = principals.pollenuser" + + " GROUP BY principals.topiaid" + + "), " + + "polls_agg AS (" + + " SELECT p.topiaid, json_agg(a.*)->0 AS creator" + + " FROM principals_agg a, poll p" + + " WHERE a.topiaid = p.creator" + + " GROUP BY p.topiaid" + + ") " + + "SELECT * FROM polls_agg"; + @Select(sql = command, mapper = PollenMapper.class) + Poll[] getallpoll(); + + @Update(sql = "insert into poll (title, description, begindate, enddate, anonymousvoteallowed, " + + "continuousresults, notifymehoursbeforepollends, pollendremindersent, " + + "notificationlocale, votenotification, feedcontent, commentnotification, " + + "newchoicenotification, gtuvalidationdate, premium, notificationmaxvotersend, " + + "emailaddresssuffixes) values ($(title), $(description), $(begindate), $(enddate), $(anonymousvoteallowed), " + + "$(continuousresults), $(notifymehoursbeforepollends), $(pollendremindersent), " + + "$(notificationlocale), $(votenotification), $(feedcontent), $(commentnotification), " + + "$(newchoicenotification), $(gtuvalidationdate), $(premium), $(notificationmaxvotersend), " + + "$(emailaddresssuffixes)))", mapper = PollenMapper.class) + int new_poll(String title, String description, Date begindate, Date enddate, boolean anonymousvoteallowed, boolean continuousresults, + int notifymehoursbeforepollends, boolean pollendremindersent, String notificationlocale, boolean votenotification, + String feedcontent, boolean commentnotification, boolean newchoicenotification, Date gtuvalidationdate, boolean premium, + boolean notificationmaxvotersend, String emailaddresssuffixes); +} \ No newline at end of file diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenVoteSpgeedDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenVoteSpgeedDao.java new file mode 100644 index 00000000..79d434be --- /dev/null +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenVoteSpgeedDao.java @@ -0,0 +1,52 @@ +package org.chorem.pollen.persistence.Dao; + +import org.chorem.pollen.persistence.PollenMapper; +import org.chorem.pollen.persistence.entity.Poll; +import org.nuiton.spgeed.annotations.Select; +import org.nuiton.spgeed.annotations.Update; + +import java.sql.Date; + +public interface PollenPollSpgeedDao { + + String command = "WITH " + + "email_agg AS (" + + " SELECT emailaddress, topiaid, pollenuser" + + " FROM pollenuseremailaddress" + + ")," + + "users_agg AS (" + + " SELECT userx.topiaid, json_agg(demail.*)->0 AS defaultemailaddress, json_agg(emails.*) AS emailaddresses" + + " FROM email_agg demail, email_agg emails, pollenuser userx" + + " WHERE demail.topiaid = userx.defaultemailaddress AND emails.pollenuser = userx.topiaid" + + " GROUP BY userx.topiaid" + + ")," + + "principals_agg AS (" + + " SELECT principals.topiaid, json_agg(userx.*)->0 AS pollenuser" + + " FROM users_agg userx, pollenprincipal principals" + + " WHERE userx.topiaid = principals.pollenuser" + + " GROUP BY principals.topiaid" + + "), " + + "polls_agg AS (" + + " SELECT p.topiaid, json_agg(a.*)->0 AS creator" + + " FROM principals_agg a, poll p" + + " WHERE a.topiaid = p.creator" + + " GROUP BY p.topiaid" + + ") " + + "SELECT * FROM polls_agg"; + @Select(sql = command, mapper = PollenMapper.class) + Poll[] getallpoll(); + + @Update(sql = "insert into poll (title, description, begindate, enddate, anonymousvoteallowed, " + + "continuousresults, notifymehoursbeforepollends, pollendremindersent, " + + "notificationlocale, votenotification, feedcontent, commentnotification, " + + "newchoicenotification, gtuvalidationdate, premium, notificationmaxvotersend, " + + "emailaddresssuffixes) values ($(title), $(description), $(begindate), $(enddate), $(anonymousvoteallowed), " + + "$(continuousresults), $(notifymehoursbeforepollends), $(pollendremindersent), " + + "$(notificationlocale), $(votenotification), $(feedcontent), $(commentnotification), " + + "$(newchoicenotification), $(gtuvalidationdate), $(premium), $(notificationmaxvotersend), " + + "$(emailaddresssuffixes)))", mapper = PollenMapper.class) + int new_poll(String title, String description, Date begindate, Date enddate, boolean anonymousvoteallowed, boolean continuousresults, + int notifymehoursbeforepollends, boolean pollendremindersent, String notificationlocale, boolean votenotification, + String feedcontent, boolean commentnotification, boolean newchoicenotification, Date gtuvalidationdate, boolean premium, + boolean notificationmaxvotersend, String emailaddresssuffixes); +} \ No newline at end of file diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenVoterListMemberSpgeedDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenVoterListMemberSpgeedDao.java new file mode 100644 index 00000000..79d434be --- /dev/null +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenVoterListMemberSpgeedDao.java @@ -0,0 +1,52 @@ +package org.chorem.pollen.persistence.Dao; + +import org.chorem.pollen.persistence.PollenMapper; +import org.chorem.pollen.persistence.entity.Poll; +import org.nuiton.spgeed.annotations.Select; +import org.nuiton.spgeed.annotations.Update; + +import java.sql.Date; + +public interface PollenPollSpgeedDao { + + String command = "WITH " + + "email_agg AS (" + + " SELECT emailaddress, topiaid, pollenuser" + + " FROM pollenuseremailaddress" + + ")," + + "users_agg AS (" + + " SELECT userx.topiaid, json_agg(demail.*)->0 AS defaultemailaddress, json_agg(emails.*) AS emailaddresses" + + " FROM email_agg demail, email_agg emails, pollenuser userx" + + " WHERE demail.topiaid = userx.defaultemailaddress AND emails.pollenuser = userx.topiaid" + + " GROUP BY userx.topiaid" + + ")," + + "principals_agg AS (" + + " SELECT principals.topiaid, json_agg(userx.*)->0 AS pollenuser" + + " FROM users_agg userx, pollenprincipal principals" + + " WHERE userx.topiaid = principals.pollenuser" + + " GROUP BY principals.topiaid" + + "), " + + "polls_agg AS (" + + " SELECT p.topiaid, json_agg(a.*)->0 AS creator" + + " FROM principals_agg a, poll p" + + " WHERE a.topiaid = p.creator" + + " GROUP BY p.topiaid" + + ") " + + "SELECT * FROM polls_agg"; + @Select(sql = command, mapper = PollenMapper.class) + Poll[] getallpoll(); + + @Update(sql = "insert into poll (title, description, begindate, enddate, anonymousvoteallowed, " + + "continuousresults, notifymehoursbeforepollends, pollendremindersent, " + + "notificationlocale, votenotification, feedcontent, commentnotification, " + + "newchoicenotification, gtuvalidationdate, premium, notificationmaxvotersend, " + + "emailaddresssuffixes) values ($(title), $(description), $(begindate), $(enddate), $(anonymousvoteallowed), " + + "$(continuousresults), $(notifymehoursbeforepollends), $(pollendremindersent), " + + "$(notificationlocale), $(votenotification), $(feedcontent), $(commentnotification), " + + "$(newchoicenotification), $(gtuvalidationdate), $(premium), $(notificationmaxvotersend), " + + "$(emailaddresssuffixes)))", mapper = PollenMapper.class) + int new_poll(String title, String description, Date begindate, Date enddate, boolean anonymousvoteallowed, boolean continuousresults, + int notifymehoursbeforepollends, boolean pollendremindersent, String notificationlocale, boolean votenotification, + String feedcontent, boolean commentnotification, boolean newchoicenotification, Date gtuvalidationdate, boolean premium, + boolean notificationmaxvotersend, String emailaddresssuffixes); +} \ No newline at end of file diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenVoterListSpgeedDao.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenVoterListSpgeedDao.java new file mode 100644 index 00000000..79d434be --- /dev/null +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/PollenVoterListSpgeedDao.java @@ -0,0 +1,52 @@ +package org.chorem.pollen.persistence.Dao; + +import org.chorem.pollen.persistence.PollenMapper; +import org.chorem.pollen.persistence.entity.Poll; +import org.nuiton.spgeed.annotations.Select; +import org.nuiton.spgeed.annotations.Update; + +import java.sql.Date; + +public interface PollenPollSpgeedDao { + + String command = "WITH " + + "email_agg AS (" + + " SELECT emailaddress, topiaid, pollenuser" + + " FROM pollenuseremailaddress" + + ")," + + "users_agg AS (" + + " SELECT userx.topiaid, json_agg(demail.*)->0 AS defaultemailaddress, json_agg(emails.*) AS emailaddresses" + + " FROM email_agg demail, email_agg emails, pollenuser userx" + + " WHERE demail.topiaid = userx.defaultemailaddress AND emails.pollenuser = userx.topiaid" + + " GROUP BY userx.topiaid" + + ")," + + "principals_agg AS (" + + " SELECT principals.topiaid, json_agg(userx.*)->0 AS pollenuser" + + " FROM users_agg userx, pollenprincipal principals" + + " WHERE userx.topiaid = principals.pollenuser" + + " GROUP BY principals.topiaid" + + "), " + + "polls_agg AS (" + + " SELECT p.topiaid, json_agg(a.*)->0 AS creator" + + " FROM principals_agg a, poll p" + + " WHERE a.topiaid = p.creator" + + " GROUP BY p.topiaid" + + ") " + + "SELECT * FROM polls_agg"; + @Select(sql = command, mapper = PollenMapper.class) + Poll[] getallpoll(); + + @Update(sql = "insert into poll (title, description, begindate, enddate, anonymousvoteallowed, " + + "continuousresults, notifymehoursbeforepollends, pollendremindersent, " + + "notificationlocale, votenotification, feedcontent, commentnotification, " + + "newchoicenotification, gtuvalidationdate, premium, notificationmaxvotersend, " + + "emailaddresssuffixes) values ($(title), $(description), $(begindate), $(enddate), $(anonymousvoteallowed), " + + "$(continuousresults), $(notifymehoursbeforepollends), $(pollendremindersent), " + + "$(notificationlocale), $(votenotification), $(feedcontent), $(commentnotification), " + + "$(newchoicenotification), $(gtuvalidationdate), $(premium), $(notificationmaxvotersend), " + + "$(emailaddresssuffixes)))", mapper = PollenMapper.class) + int new_poll(String title, String description, Date begindate, Date enddate, boolean anonymousvoteallowed, boolean continuousresults, + int notifymehoursbeforepollends, boolean pollendremindersent, String notificationlocale, boolean votenotification, + String feedcontent, boolean commentnotification, boolean newchoicenotification, Date gtuvalidationdate, boolean premium, + boolean notificationmaxvotersend, String emailaddresssuffixes); +} \ No newline at end of file diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/SpgeedDaoUtils.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/SpgeedDaoUtils.java new file mode 100644 index 00000000..704333a0 --- /dev/null +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/Dao/SpgeedDaoUtils.java @@ -0,0 +1,55 @@ +package org.chorem.pollen.persistence.Dao; + +import org.chorem.pollen.persistence.PollenMapper; +import org.chorem.pollen.persistence.entity.Poll; +import org.nuiton.spgeed.annotations.Select; +import org.nuiton.spgeed.annotations.Update; + +import java.sql.Date; + +public interface PollenPollSpgeedDao { + + String command = "WITH " + + "email_agg AS (" + + " SELECT emailaddress, topiaid, pollenuser" + + " FROM pollenuseremailaddress" + + ")," + + "users_agg AS (" + + " SELECT userx.topiaid, json_agg(demail.*)->0 AS defaultemailaddress, json_agg(emails.*) AS emailaddresses" + + " FROM email_agg demail, email_agg emails, pollenuser userx" + + " WHERE demail.topiaid = userx.defaultemailaddress AND emails.pollenuser = userx.topiaid" + + " GROUP BY userx.topiaid" + + ")," + + "principals_agg AS (" + + " SELECT principals.topiaid, json_agg(userx.*)->0 AS pollenuser" + + " FROM users_agg userx, pollenprincipal principals" + + " WHERE userx.topiaid = principals.pollenuser" + + " GROUP BY principals.topiaid" + + "), " + + "polls_agg AS (" + + " SELECT p.topiaid, json_agg(a.*)->0 AS creator" + + " FROM principals_agg a, poll p" + + " WHERE a.topiaid = p.creator" + + " GROUP BY p.topiaid" + + ") " + + "SELECT * FROM polls_agg"; + + @Select(sql = command, mapper = PollenMapper.class) + Poll[] getallpoll(); + + @Update(sql = "insert into poll (title, description, begindate, enddate, anonymousvoteallowed, " + + "continuousresults, notifymehoursbeforepollends, pollendremindersent, " + + "notificationlocale, votenotification, feedcontent, commentnotification, " + + "newchoicenotification, gtuvalidationdate, premium, notificationmaxvotersend, " + + "emailaddresssuffixes) values ($(title), $(description), $(begindate), $(enddate), $(anonymousvoteallowed), " + + "$(continuousresults), $(notifymehoursbeforepollends), $(pollendremindersent), " + + "$(notificationlocale), $(votenotification), $(feedcontent), $(commentnotification), " + + "$(newchoicenotification), $(gtuvalidationdate), $(premium), $(notificationmaxvotersend), " + + "$(emailaddresssuffixes)))", mapper = PollenMapper.class) + int new_poll(String title, String description, Date begindate, Date enddate, boolean anonymousvoteallowed, boolean continuousresults, + int notifymehoursbeforepollends, boolean pollendremindersent, String notificationlocale, boolean votenotification, + String feedcontent, boolean commentnotification, boolean newchoicenotification, Date gtuvalidationdate, boolean premium, + boolean notificationmaxvotersend, String emailaddresssuffixes); + + String woForeignKey = Poll.PROPERTY_TITLE + "," + Poll.PROPERTY_END_DATE + "," + Poll.PROPERTY_NOTIFICATION_MAX_VOTER_SEND + "," + Poll.PROPERTY_TOPIA_ID + ", " + Poll.PROPERTY_POLL_TYPE; +} \ No newline at end of file diff --git a/pollen-rest-api/src/test/resources/#pollen-rest-api-test.properties# b/pollen-rest-api/src/test/resources/#pollen-rest-api-test.properties# new file mode 100644 index 00000000..1674773a --- /dev/null +++ b/pollen-rest-api/src/test/resources/#pollen-rest-api-test.properties# @@ -0,0 +1,31 @@ +### +# #%L +# Pollen :: Service +# %% +# Copyright (C) 2009 - 2017 Code Lutin, Tony Chemit +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# #L% +### + +hibernate.dialect=org.hibernate.dialect.postgreSQLDialect +hibernate.connection.url=jdbc:postgresql://localhost:5432/pollenprod?allowMultiQueries=true +hibernate.connection.username=pollen +hibernate.connection.password=pollen +hibernate.connection.driver_class=org.postgresql.Driver +#hibernate.hbm2ddl.auto=update +pollen.version=${project.version} +topia.persistence.topiaIdFactoryClassName=org.nuiton.topia.persistence.internal.ShortTopiaIdFactory +topia.service.migration=org.chorem.pollen.persistence.PollenFlywayServiceImpl +pollen.devMode=true diff --git a/pollen-rest-api/src/test/resources/.#pollen-rest-api-test.properties b/pollen-rest-api/src/test/resources/.#pollen-rest-api-test.properties new file mode 120000 index 00000000..db2ccc70 --- /dev/null +++ b/pollen-rest-api/src/test/resources/.#pollen-rest-api-test.properties @@ -0,0 +1 @@ +Killian_H@localhost.localdomain.4769:1566378066 \ No newline at end of file diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/security/SpgeedDao.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/security/SpgeedDao.java new file mode 100644 index 00000000..8d3dd98b --- /dev/null +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/security/SpgeedDao.java @@ -0,0 +1,31 @@ +package org.chorem.pollen.persistence.Dao; + +import org.chorem.pollen.persistence.PollenSpgeedApplicationContext; + +import javax.sql.DataSource; + +public class SpgeedDao { + + DataSource dataSource = null; + + public DataSource getdb() { + + if (dataSource == null) { + PollenSpgeedApplicationContext pollenSpgeedApplicationContext = new PollenSpgeedApplicationContext(); + + PollenServicesConfig pollenServicesConfig = new PollenServicesConfig("pollen-rest-api.properties"); + + String dburl = pollenServicesConfig.getDataSourceUrl(); + String dbpassword = pollenServicesConfig.getDataSourcePassword(); + String dbuser = pollenServicesConfig.getDataSourceUser(); + + pollenSpgeedApplicationContext.setDataSource(dburl, dbuser, dbpassword); + this.dataSource = pollenSpgeedApplicationContext.getDataSource(); + } + return (dataSource); + } + + public static SpgeedUserDao getUserDao() { + + } +} \ No newline at end of file diff --git a/pollen-services/src/test/java/org/chorem/pollen/services/SpgeedDaoUtilsTest.java b/pollen-services/src/test/java/org/chorem/pollen/services/SpgeedDaoUtilsTest.java new file mode 100644 index 00000000..29a3c39f --- /dev/null +++ b/pollen-services/src/test/java/org/chorem/pollen/services/SpgeedDaoUtilsTest.java @@ -0,0 +1,211 @@ +package org.chorem.pollen.services; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.chorem.pollen.persistence.PollenTopiaApplicationContext; +import org.chorem.pollen.persistence.PollenTopiaPersistenceContext; +import org.chorem.pollen.persistence.entity.*; +import org.chorem.pollen.services.service.security.SpgeedDummyService; +import org.chorem.pollen.services.test.FakePollenApplicationContext; +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; + +import java.util.List; + +/** + * @author ymartel (martel@codelutin.com) + */ +public class SpgeedTest { + + @Rule + public final FakePollenApplicationContext application = new FakePollenApplicationContext("pollen-rest-api.properties"); + + public static final String EMAIL_JSON = "{ " + + " \"topiaid\":\"PollenUserEmailAddress_M-wGbZ74QQCUr_hwl6JXmw\"," + + " \"topiaversion\":1," + + " \"topiacreatedate\":\"2019-07-19T10:00:30.962\"," + + " \"emailaddress\":\"admin@chorem.org\"," + + " \"pgppublickey\":null," + + " \"validated\":true," + + " \"pollenuser\":\"PollenUser_6qdaqbgBTyCBa8Dvz5SeHQ\"" + + "}"; + + public static final String USER_JSON = "{" + + " \"name\":\"admin\"," + + " \"administrator\":true," + + " \"language\":null," + + " \"password\":\"m7LAmO/AeLrjPI6kkzS0wTmU6fpbG/nxptfi/P7fg0BToZoIAV6xVre3tcttYxnLTDrXjtq7YOpggTFRz7mTjA==\"," + + " \"banned\":false," + + " \"gtuvalidationdate\":null," + + " \"premiumto\":null," + + " \"cancreatepoll\":false," + + " \"emailaddresses\":[" + + " {" + + " \"topiaid\":\"PollenUserEmailAddress_M-wGbZ74QQCUr_hwl6JXmw\"," + + " \"topiaversion\":1," + + " \"topiacreatedate\":\"2019-07-19T10:00:30.962\"," + + " \"emailaddress\":\"admin@chorem.org\"," + + " \"pgppublickey\":null," + + " \"validated\":true," + + " \"pollenuser\":\"PollenUser_6qdaqbgBTyCBa8Dvz5SeHQ\"" + + " }" + + " ]," + + " \"defaultemailaddress\":" + + " {" + + " \"topiaid\":\"PollenUserEmailAddress_M-wGbZ74QQCUr_hwl6JXmw\"," + + " \"topiaversion\":1," + + " \"topiacreatedate\":\"2019-07-19T10:00:30.962\"," + + " \"emailaddress\":\"admin@chorem.org\"," + + " \"pgppublickey\":null," + + " \"validated\":true," + + " \"pollenuser\":\"PollenUser_6qdaqbgBTyCBa8Dvz5SeHQ\"" + + " }" + + "}"; + + @Test + public void testEmailDeserialization() throws Exception { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); + PollenUserEmailAddress email = mapper.readValue(EMAIL_JSON, PollenUserEmailAddress.class); + + Assert.assertNotNull(email); + Assert.assertEquals("admin@chorem.org", email.getEmailAddress()); + } + + @Test + public void testUserDeserialization() throws Exception { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); + PollenUser pollenUser = mapper.readValue(USER_JSON, PollenUser.class); + + Assert.assertNotNull(pollenUser); + Assert.assertNotNull(pollenUser.getEmailAddresses()); + Assert.assertNotNull(pollenUser.getDefaultEmailAddress()); + Assert.assertEquals("admin@chorem.org", pollenUser.getDefaultEmailAddress().getEmailAddress()); + Assert.assertEquals("admin", pollenUser.getName()); + Assert.assertTrue(pollenUser.isAdministrator()); + } + + @Test + public void testUserDeserializationCallDB() { + SpgeedDummyService spgeedDummyService = new SpgeedDummyService(); + PollenUser[] pollenUser = spgeedDummyService.getallPollenUser(); + Assert.assertNotNull(pollenUser); + } + + @Test + public void testPoll() { + SpgeedDummyService spgeedDummyService = new SpgeedDummyService(); + Poll[] polls = spgeedDummyService.getallPoll(); + PollenUser[] user = spgeedDummyService.getallPollenUser(); + + System.out.println(spgeedDummyService.getPollenUsercount()); + Assert.assertNotNull(polls); + } + + public List<Poll> getTopiaPolls() { + List<Poll> topiaPoll = null; + + try (PollenTopiaApplicationContext topiaApplicationContext = application.getTopiaApplicationContext()) { + try (PollenTopiaPersistenceContext topiaPersistenceContext = topiaApplicationContext.newPersistenceContext()) { + for (int i = 0; i < 1; i++) { + PollTopiaDao pollDao = topiaPersistenceContext.getPollDao(); + topiaPoll = pollDao.findAll(); + for (int j = 0; j < topiaPoll.size(); j++) { + Assert.assertNotNull(topiaPoll.get(j)); + Assert.assertNotNull(topiaPoll.get(j).getCreator()); + Assert.assertNotNull(topiaPoll.get(j).getCreator().getPollenUser()); + Assert.assertNotNull(topiaPoll.get(j).getCreator().getPollenUser().getDefaultEmailAddress()); + Assert.assertNotNull(topiaPoll.get(j).getCreator().getPollenUser().getDefaultEmailAddress().getEmailAddress()); + topiaPoll.get(j).getTitle(); + topiaPoll.get(j).getEndDate(); + topiaPoll.get(j).getVoteVisibility(); + topiaPoll.get(j).getCommentVisibility(); + topiaPoll.get(j).getResultVisibility(); + topiaPoll.get(j).getBeginDate(); + topiaPoll.get(j).getPollType(); + topiaPoll.get(j).getNotifyMeHoursBeforePollEnds(); + topiaPoll.get(j).getFeedContent(); + topiaPoll.get(j).getNotificationLocale(); + topiaPoll.get(j).getDescription(); + topiaPoll.get(j).getEmailAddressSuffixes(); + topiaPoll.get(j).getGtuValidationDate(); + topiaPoll.get(j).getClass(); + topiaPoll.get(j).getTopiaVersion(); + topiaPoll.get(j).getTopiaId(); + topiaPoll.get(j).getTopiaCreateDate(); + } + } + } + } + return topiaPoll; + } + + public Poll[] getSpgeedPolls() { + SpgeedDummyService spgeedDummyService = new SpgeedDummyService(); + Poll[] spgeedPollArray = null; + + for (int i = 0; i < 1; i++) { + spgeedPollArray = spgeedDummyService.getallPoll(); + } + return spgeedPollArray; + } + + + @Test + public void testPollLink() { + SpgeedDummyService spgeedDummyService = new SpgeedDummyService(); + Poll[] PollArray = spgeedDummyService.getallPoll(); + /* Testing foreign key value */ + Assert.assertNotNull(PollArray); + Assert.assertNotNull(PollArray[0]); + Assert.assertNotNull(PollArray[0].getCreator().getPollenUser()); + Assert.assertNotNull(PollArray[0].getCreator().getPollenUser().getEmailAddresses()); + Assert.assertNotNull(PollArray[0].getCreator().getPollenUser().getDefaultEmailAddress()); + + /* Testing Poll filling */ + Assert.assertNotNull(PollArray[0].getTitle()); + Assert.assertNotNull(PollArray[0].getEndDate()); + Assert.assertNotNull(PollArray[0].getVoteVisibility()); + Assert.assertNotNull(PollArray[0].getCommentVisibility()); + Assert.assertNotNull(PollArray[0].getResultVisibility()); + Assert.assertNotNull(PollArray[0].getBeginDate()); + Assert.assertNotNull(PollArray[0].getNotifyMeHoursBeforePollEnds()); + Assert.assertNotNull(PollArray[0].getFeedContent()); + Assert.assertNotNull(PollArray[0].getNotificationLocale()); + Assert.assertNotNull(PollArray[0].getEmailAddressSuffixes()); + Assert.assertNotNull(PollArray[0].getGtuValidationDate()); + Assert.assertNotNull(PollArray[0].getTopiaId()); + Assert.assertNotNull(PollArray[0].getClass()); + Assert.assertNotNull(PollArray[0].getTopiaVersion()); + Assert.assertNotNull(PollArray[0].getTopiaCreateDate()); + Assert.assertNotNull(PollArray[0].getDescription()); + Assert.assertNotNull(PollArray[0].getCreator()); + } + @Test + public void testPerformance() { + Poll[] spgeedPollArray; + List<Poll> topiaPoll; + long beforSpgeed = System.currentTimeMillis(); + + spgeedPollArray = getSpgeedPolls(); + + long afterSpgeed = System.currentTimeMillis(); + + topiaPoll = getTopiaPolls(); + + long topiaExecutionTime = System.currentTimeMillis() - afterSpgeed; + Assert.assertNotNull(spgeedPollArray); + Assert.assertNotNull(topiaPoll); + Assert.assertEquals(topiaPoll.size(), spgeedPollArray.length); + long spgeedExecutionTime = afterSpgeed - beforSpgeed; + System.out.println(topiaExecutionTime + " "+spgeedExecutionTime); + Assert.assertTrue(topiaExecutionTime > spgeedExecutionTime); + } +} \ No newline at end of file -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/spgeed in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 437c8ca43d5ae72f3b490b449dfa50b2b65f6b78 Author: Killian <killian.herbreteau@epitech.eu> Date: Thu Sep 19 09:27:14 2019 +0200 test --- command | 1 - 1 file changed, 1 deletion(-) diff --git a/command b/command deleted file mode 100644 index de6d042d..00000000 --- a/command +++ /dev/null @@ -1 +0,0 @@ -with pollenpo as (select title, description, begindate, enddate, anonymousvoteallowed, continuousresults, notifymehoursbeforepollends, pollendremindersent, notificationlocale, votenotification, feedcontent, commentnotification, newchoicenotification, gtuvalidationdate, premium, notificationmaxvotersend, emailaddresssuffixes, (select json_agg(pr)->0 as pollenprincipal from pollenprincipal pr where pr.topiaId = pi.creator) from poll pi) select json_agg(po)->2 from pollenpo po; \ No newline at end of file -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm