├── .dockerignore ├── .editorconfig ├── .gitattributes ├── .gitignore ├── .java-version ├── .jshintrc ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── CHANGELOG.md ├── Dockerfile ├── FAQ.md ├── Jenkinsfile.sh ├── LICENSE ├── README.md ├── USER_GUIDE.md ├── backup ├── Dockerfile ├── README.md └── backup.sh ├── codeship-services.yml ├── codeship-steps.yml ├── dev-howto.txt ├── dockercfg.encrypted ├── env.encrypted ├── initEventDb.sql ├── mvnw ├── mvnw.cmd ├── mysql ├── mysql-dev.sh ├── pom.xml ├── readme └── screenshot.png └── src ├── main ├── docker │ └── docker-compose.yml ├── java │ └── io │ │ └── cfp │ │ ├── Application.java │ │ ├── SecurityConfiguration.java │ │ ├── WebConfiguration.java │ │ ├── api │ │ ├── AdminsController.java │ │ ├── ApplicationController.java │ │ ├── CommentsController.java │ │ ├── ConfigController.java │ │ ├── EventsController.java │ │ ├── ExportController.java │ │ ├── FormatsController.java │ │ ├── ProposalsController.java │ │ ├── RatesController.java │ │ ├── ReviewersController.java │ │ ├── RoomsController.java │ │ ├── ScheduleController.java │ │ ├── SpeakersController.java │ │ ├── StatsController.java │ │ ├── TalksController.java │ │ ├── ThemesController.java │ │ └── UserController.java │ │ ├── config │ │ ├── CacheConfig.java │ │ ├── MailConfig.java │ │ ├── SwaggerConfig.java │ │ ├── exception │ │ │ └── GlobalControllerExceptionHandler.java │ │ ├── filter │ │ │ ├── AuthFilter.java │ │ │ └── CorsFilter.java │ │ └── mapping │ │ │ ├── Mapping.java │ │ │ └── MappingConfig.java │ │ ├── controller │ │ ├── CospeakerController.java │ │ ├── HomeController.java │ │ └── ScheduleController.java │ │ ├── domain │ │ ├── admin │ │ │ └── meter │ │ │ │ └── AdminMeter.java │ │ ├── common │ │ │ ├── Key.java │ │ │ └── UserAuthentication.java │ │ └── exception │ │ │ ├── BadRequestException.java │ │ │ ├── CospeakerNotFoundException.java │ │ │ ├── CustomException.java │ │ │ ├── EntityExistsException.java │ │ │ ├── ErrorResponse.java │ │ │ ├── ForbiddenException.java │ │ │ ├── NotFoundException.java │ │ │ └── NotVerifiedException.java │ │ ├── dto │ │ ├── AdminUserInfo.java │ │ ├── ApplicationSettings.java │ │ ├── CommentUser.java │ │ ├── EventSched.java │ │ ├── FormatDto.java │ │ ├── FullCalendar.java │ │ ├── RateAdmin.java │ │ ├── RestrictedMeter.java │ │ ├── RoomDto.java │ │ ├── TalkAdmin.java │ │ ├── TalkAdminCsv.java │ │ ├── TalkUser.java │ │ ├── TrackDto.java │ │ └── user │ │ │ ├── AdminUserDTO.java │ │ │ ├── CospeakerProfil.java │ │ │ ├── Schedule.java │ │ │ └── UserProfil.java │ │ ├── entity │ │ ├── CfpConfig.java │ │ ├── Comment.java │ │ ├── Event.java │ │ ├── Format.java │ │ ├── Rate.java │ │ ├── Role.java │ │ ├── Room.java │ │ ├── Talk.java │ │ ├── Track.java │ │ └── User.java │ │ ├── mapper │ │ ├── CoSpeakerMapper.java │ │ ├── CommentMapper.java │ │ ├── EventMapper.java │ │ ├── FormatMapper.java │ │ ├── ProposalMapper.java │ │ ├── RateMapper.java │ │ ├── RoleMapper.java │ │ ├── RoomMapper.java │ │ ├── ThemeMapper.java │ │ ├── TrackMapper.java │ │ └── UserMapper.java │ │ ├── model │ │ ├── Comment.java │ │ ├── Event.java │ │ ├── Format.java │ │ ├── FullCalendar.java │ │ ├── Proposal.java │ │ ├── Rate.java │ │ ├── Role.java │ │ ├── Room.java │ │ ├── Stat.java │ │ ├── Theme.java │ │ ├── User.java │ │ └── queries │ │ │ ├── CommentQuery.java │ │ │ ├── EventQuery.java │ │ │ ├── ProposalQuery.java │ │ │ ├── RateQuery.java │ │ │ ├── RoleQuery.java │ │ │ └── UserQuery.java │ │ ├── multitenant │ │ ├── TenantFilter.java │ │ ├── TenantId.java │ │ └── TenantIdHandlerMethodArgumentResolver.java │ │ ├── repository │ │ └── TalkRepo.java │ │ └── service │ │ ├── GravatarUtils.java │ │ ├── PdfCardService.java │ │ ├── TalkAdminService.java │ │ ├── TalkUserService.java │ │ ├── admin │ │ └── config │ │ │ └── ApplicationConfigService.java │ │ ├── auth │ │ ├── AuthUtils.java │ │ └── MD5Utils.java │ │ ├── email │ │ └── EmailingService.java │ │ └── user │ │ └── SecurityUserService.java ├── resources │ ├── META-INF │ │ └── spring-devtools.properties │ ├── changelog │ │ ├── changelog-1.0.xml │ │ └── changelog-master.xml │ ├── config │ │ ├── application-prod.properties │ │ └── application.properties │ ├── io │ │ └── cfp │ │ │ └── mapper │ │ │ ├── CoSpeakerMapper.xml │ │ │ ├── CommentMapper.xml │ │ │ ├── EventMapper.xml │ │ │ ├── FormatMapper.xml │ │ │ ├── ProposalMapper.xml │ │ │ ├── RateMapper.xml │ │ │ ├── RoleMapper.xml │ │ │ ├── RoomMapper.xml │ │ │ ├── ThemeMapper.xml │ │ │ └── UserMapper.xml │ ├── logback.xml │ ├── mails │ │ ├── en │ │ │ ├── backToEdit.html │ │ │ ├── confirmed.html │ │ │ ├── confirmedPresence.html │ │ │ ├── newMessage.html │ │ │ ├── newMessageAdmin.html │ │ │ ├── notSelectionned.html │ │ │ ├── pending.html │ │ │ ├── selectionned.html │ │ │ ├── subjects.yml │ │ │ └── test.html │ │ └── fr │ │ │ ├── backToEdit.html │ │ │ ├── confirmed.html │ │ │ ├── confirmedPresence.html │ │ │ ├── newMessage.html │ │ │ ├── newMessageAdmin.html │ │ │ ├── notSelectionned.html │ │ │ ├── pending.html │ │ │ ├── selectionned.html │ │ │ ├── subjects.yml │ │ │ └── test.html │ └── static │ │ └── swagger-ui.html └── webapp │ └── WEB-INF │ └── jsp │ └── 403.jsp └── test ├── groovy └── io │ └── cfp │ └── config │ └── filter │ └── CorsFilterSpec.groovy ├── java └── io │ └── cfp │ ├── ApplicationJUnit.java │ ├── JpaTestConfig.java │ ├── api │ ├── ApiTestApplication.java │ ├── ApplicationControllerTest.java │ ├── CommentsControllerTest.java │ ├── ConfigControllerTest.java │ ├── ExportControllerTest.java │ ├── ProposalsControllerTest.java │ └── ScheduleControllerTest.java │ ├── controller │ ├── ControllerTestApplication.java │ ├── admin │ │ └── ScheduleControllerTest.java │ └── config │ │ └── security │ │ └── SecurityConfig.java │ ├── mapper │ ├── CommentMapperTest.java │ ├── EventMapperTest.java │ ├── MapperTestApplication.java │ ├── ProposalMapperTest.java │ ├── RateMapperTest.java │ ├── RoleMapperTest.java │ ├── ThemeMapperTest.java │ └── UserMapperTest.java │ ├── model │ └── ProposalTest.java │ ├── multitenant │ └── TenantFilterTest.java │ ├── service │ ├── TalkAdminServiceTest.java │ ├── admin │ │ └── config │ │ │ └── ApplicationConfigServiceTest.java │ └── email │ │ └── EmailingServiceTest.java │ └── utils │ └── Utils.java └── resources ├── changelog └── changelog-test.xml ├── config └── application.properties ├── datasets └── datasets.xml └── json ├── auth └── new_user.json ├── comments ├── new_comment.json ├── new_internal_comment.json ├── update_comment.json └── update_internal_comment.json ├── config ├── close_cfp.json └── open_cfp.json └── proposals ├── invalid_proposal.json ├── new_proposal.json └── other_proposal.json /.dockerignore: -------------------------------------------------------------------------------- 1 | target/ 2 | dist/ 3 | !target/call-for-paper.jar 4 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | charset = utf-8 9 | end_of_line = lf 10 | indent_style = space 11 | indent_size = 4 12 | insert_final_newline = true 13 | trim_trailing_whitespace = true 14 | 15 | [src/**.java] 16 | max_line_length = 120 17 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | target 4 | dist 5 | target-grunt 6 | 7 | **/node_modules 8 | **/npm-debug.log 9 | **/bower_components 10 | src/main/webapp/WEB-INF/static/ 11 | 12 | ### Eclipse ### 13 | *.pydevproject 14 | .metadata 15 | .gradle 16 | bin/ 17 | tmp/ 18 | *.tmp 19 | *.bak 20 | *.swp 21 | *~.nib 22 | local.properties 23 | .settings/ 24 | .loadpath 25 | .classpath 26 | 27 | # External tool builders 28 | .externalToolBuilders/ 29 | 30 | # Locally stored "Eclipse launch configurations" 31 | *.launch 32 | 33 | # CDT-specific 34 | .cproject 35 | 36 | # PDT-specific 37 | .buildpath 38 | 39 | # sbteclipse plugin 40 | .target 41 | 42 | # TeXlipse plugin 43 | .texlipse 44 | 45 | 46 | ### Java ### 47 | *.class 48 | 49 | # Mobile Tools for Java (J2ME) 50 | .mtj.tmp/ 51 | 52 | # Package Files # 53 | *.war 54 | *.ear 55 | 56 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 57 | hs_err_pid* 58 | target/ 59 | .svn/ 60 | *.project 61 | /bin/ 62 | /bin/ 63 | 64 | 65 | env 66 | dockercfg 67 | codeship.aes -------------------------------------------------------------------------------- /.java-version: -------------------------------------------------------------------------------- 1 | 1.8 2 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "browser": true, 4 | "esnext": true, 5 | "bitwise": true, 6 | "camelcase": true, 7 | "curly": true, 8 | "eqeqeq": true, 9 | "immed": true, 10 | "indent": 2, 11 | "latedef": true, 12 | "newcap": true, 13 | "noarg": true, 14 | "quotmark": "single", 15 | "regexp": true, 16 | "undef": true, 17 | "unused": true, 18 | "strict": true, 19 | "trailing": true, 20 | "smarttabs": true, 21 | "globals": { 22 | "angular": false, 23 | "$": false, 24 | "_": false 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfpio/callForPapers/3db755934d44a6b16885c9c7fdfd7eb6c2dc5133/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM maven:3.6.3-jdk-8 as build 2 | 3 | WORKDIR /work 4 | ADD pom.xml /work/ 5 | RUN mvn dependency:go-offline 6 | 7 | ADD / /work 8 | 9 | RUN mvn -q -Prelease package 10 | 11 | 12 | ### --- 13 | 14 | FROM openjdk:13-jdk 15 | COPY --from=build /work/target/call-for-paper.jar /app.jar 16 | LABEL maintainer="team@breizhcamp.org" 17 | EXPOSE 8080 18 | CMD [ "java", "-jar", "app.jar" ] 19 | -------------------------------------------------------------------------------- /FAQ.md: -------------------------------------------------------------------------------- 1 | # FAQ 2 | 3 | Not seeing the answer you're looking at ? Please [open a PR](https://github.com/cfpio/callForPapers/pulls) with a new question ! 4 | 5 | ## Is it a new UI or legacy one? I saw repo https://github.com/cfpio/front-proposals with a new UI. 6 | 7 | We still run legacy UI, still need to complete the new UI development then switch the service. 8 | 9 | ## Is it possible to set English as a default language? 10 | 11 | Language is selected based on browser's preference. Please notice the whole UI might not have been translated to English (yet) 12 | 13 | ## Is it possible to export data after CFP will be closed? So we can import into our schedule 14 | 15 | We offer various export APIs to JSON, CSV, Sched.com 16 | 17 | ## There are some bugs in the admin panel, what is the best way to fix them? 18 | 19 | We welcome pull request to fix the service https://github.com/cfpio/callForPapers/ 20 | 21 | ## Is the UI customization (custom css) possible? 22 | 23 | No. A simple way would be to have a configurable plain text attribute for custom CSS. We welcome pull-requests :P 24 | 25 | ## Is it possible to create custom fields for speaker profile and submission? 26 | 27 | No. Let us know which information you'd like to request, maybe those would make sense for general usage. 28 | 29 | ## What are the "roles" on cfp.io and what can they do? 30 | 31 | 1. The owner: can configure the cfp (There can be only one https://www.youtube.com/watch?v=c5Frf3FFPZc) 32 | 2. The admins: can review the talks, vote, ask questions to submitters 33 | 3. The authenticated: can submit talks 34 | -------------------------------------------------------------------------------- /Jenkinsfile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -x -e 4 | 5 | # 6 | # Build production docker image 7 | # 8 | docker build -t cfpio/callforpapers:1.0.${BUILD_NUMBER} -t cfpio/callforpapers:latest --label "org.label-schema.vcs-ref-commit=$GIT_COMMIT" . 9 | 10 | # 11 | # Push to Dockerhub 12 | # 13 | docker push cfpio/callforpapers:1.0.${BUILD_NUMBER} 14 | docker push cfpio/callforpapers:latest 15 | 16 | # 17 | # Clean up built images 18 | # 19 | docker rmi cfpio/callforpapers 20 | docker rmi cfpio/callforpapers:1.0.${BUILD_NUMBER} 21 | 22 | docker run cfpio/clever /root/restart.sh $CC_TOKEN $CC_SECRET $CC_APPLICATION 23 | -------------------------------------------------------------------------------- /backup/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mysql 2 | MAINTAINER team@breizhcamp.org 3 | 4 | ADD backup.sh /backup.sh 5 | 6 | CMD ["sh", "backup.sh"] 7 | -------------------------------------------------------------------------------- /backup/README.md: -------------------------------------------------------------------------------- 1 | # Conteneur de backup de la base SQL 2 | 3 | Effectue un backup local (pour le moment) de la base de données MySQL du conteneur "linké". 4 | Le but à terme est de pousser le backup sur GCloud Storage. 5 | 6 | ## Build 7 | 8 | $ docker build -t mysql_backup . 9 | 10 | ## Utilisation 11 | 12 | Pour lancer un backup (remplacer CONTENEUR_MYSQL, LE_MOT_DE_PASSE, REPERTOIRE_LOCAL) : 13 | 14 | $ docker run -ti --link CONTENEUR_MYSQL:db -e MYSQL_ROOT_PASSWORD="LE_MOT_DE_PASSE" -v REPERTOIRE_LOCAL:/backups mysql_backup 15 | 16 | -------------------------------------------------------------------------------- /backup/backup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | readonly HERE="$(readlink -f $(dirname "$0"))" 4 | 5 | mkdir -p "$HERE/backups" 6 | BACKUP_FILE="$HERE/backups/database-$(date +"%Y%m%d-%H%M%S").mysqldump.gz" 7 | 8 | /bin/sh -c 'exec mysqldump -h db -uroot -p"$MYSQL_ROOT_PASSWORD" --all-databases' | gzip > "$BACKUP_FILE" 9 | -------------------------------------------------------------------------------- /codeship-services.yml: -------------------------------------------------------------------------------- 1 | cfp: 2 | build: 3 | image: cfpio/callforpapers 4 | dockerfile: Dockerfile 5 | clever: 6 | image: cfpio/clever 7 | -------------------------------------------------------------------------------- /codeship-steps.yml: -------------------------------------------------------------------------------- 1 | - name: dockerhub_push 2 | service: cfp 3 | type: push 4 | image_name: cfpio/callforpapers 5 | registry: https://index.docker.io/v1/ 6 | encrypted_dockercfg_path: dockercfg.encrypted 7 | 8 | - name: deploy 9 | service: clever 10 | encrypted_env_file: env.encrypted 11 | command: /root/restart.sh $CC_TOKEN $CC_SECRET $CC_APPLICATION 12 | -------------------------------------------------------------------------------- /dev-howto.txt: -------------------------------------------------------------------------------- 1 | Procédure pour lancer l'appli CFP complète en dev avec compte local (front + back + auth) 2 | 3 | 4 | Clone des 3 repos : 5 | 6 | git clone git@github.com:lhuet/callForPapers.git 7 | git clone git@github.com:lhuet/front-legacy.git 8 | git clone git@github.com:lhuet/auth.git 9 | 10 | 11 | Lancer la base de données à partir du repo callForPaper (pré-requis : avoir docker) 12 | ./mysql-dev.sh 13 | => MySQK 5.7 dispo sur 127.0.0.1:3306 (user/pwd => cfpdev/galettesaucisse) 14 | 15 | Lancer l'application backend (ds le repo callForPapers) 16 | mvn spring-boot:run 17 | => lancement sur localhost:8080 18 | 19 | Lancer l'application auth (ds le repo auth) 20 | mvn spring-boot:run 21 | => lancement sur localhost:46001 22 | 23 | Lancer Gulp pour le front (Dans le repo front-legacy) 24 | npm install 25 | bower install 26 | Modifier front-legacy/app/scripts/bootstrapper.js avec les URLs locales : 27 | var config = { 28 | apiBaseUrl: 'http://localhost:3000/v0', 29 | authServer: 'http://localhost:46001' 30 | } 31 | 32 | gulp serve 33 | => localhost:3000 34 | 35 | 36 | Création d'un compte local 37 | -> Créer un compte sur l'appli auth avec son mail (en local, pas de mail envoyé) 38 | -> Récupérer le token ds la base : SELECT * FROM cfpdev.humanity; 39 | -> UTiliser l'URL : http://localhost:46001/local/register?email=&token= 40 | -> finir l'enregistrement de l'utilisateur 41 | 42 | => Youpi, on est loggué et prêt à développer ! 43 | -------------------------------------------------------------------------------- /dockercfg.encrypted: -------------------------------------------------------------------------------- 1 | z42XLZM8nFpdUM8S8z7mFJC1rw66RixwU4tGF+oxSa38mgTHZlSgFjNN84XWj9O/rVenwJAUX0IFjIQMfKr5DZUglPbvcytv2C/Y1cHiTOiA4deTM+oGFP7xspQJAoBursQY5RIjDiXDLua+A2Ewgm+THIygA9qF -------------------------------------------------------------------------------- /env.encrypted: -------------------------------------------------------------------------------- 1 | p1YyApGlkiJwoY8EH/PtHGbr3zCHJFR6PqW2hDIgZGzK1gEnLmUGWEQPgsrNFSCIQDgQ/4s+gs+8cKgP93l9tbNxK8PQdQbzvb54bqpYe9tQaYILyeOgF9V6yUZg044G5iOXoGb9PNjH8N0mVT3elYOJWmFsx2UOpPoPmOjmk2jNiRd2TuHTU5xLcl6QjOjZrx9k9nEjyrYAAUqAsg== -------------------------------------------------------------------------------- /initEventDb.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO `cfpdev`.`events` (`id`) VALUES ('default'); 2 | 3 | INSERT INTO `cfpdev`.`config` (`key`, `value`, `event_id`) VALUES ('eventName', 'Breizhcamp 2017', 'default'); 4 | INSERT INTO `cfpdev`.`config` (`key`, `value`, `event_id`) VALUES ('community', 'Breizhcamp', 'default'); 5 | INSERT INTO `cfpdev`.`config` (`key`, `value`, `event_id`) VALUES ('date', '23/03/2017', 'default'); 6 | INSERT INTO `cfpdev`.`config` (`key`, `value`, `event_id`) VALUES ('releaseDate', '13/01/2017', 'default'); 7 | INSERT INTO `cfpdev`.`config` (`key`, `value`, `event_id`) VALUES ('decisionDate', '25/01/2017', 'default'); 8 | INSERT INTO `cfpdev`.`config` (`key`, `value`, `event_id`) VALUES ('open', 'true', 'default'); 9 | 10 | 11 | -- pwd = toto 12 | INSERT INTO `cfpdev`.`users` (`email`, `lastname`, `firstname`, `password`, `verified`) VALUES ('breizhcamp@cfp.io', 'camp', 'breizh', '$2a$10$pKrWwOBhBVOCZqIzq2xqDe/AQA/tpfTbAxQzcI5vQMPKxIce6.e76', 1); 13 | 14 | 15 | -------------------------------------------------------------------------------- /mysql: -------------------------------------------------------------------------------- 1 | docker exec -it mysql-cfp-dev mysql --user cfpdev --password=galettesaucisse cfpdev 2 | -------------------------------------------------------------------------------- /mysql-dev.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker kill mysql-cfp-dev 4 | docker rm -v mysql-cfp-dev 5 | 6 | docker run --name mysql-cfp-dev -d -p 3306:3306 \ 7 | -e MYSQL_ROOT_PASSWORD=cfpbreizhroot \ 8 | -e MYSQL_DATABASE=cfpdev \ 9 | -e MYSQL_USER=cfpdev \ 10 | -e MYSQL_PASSWORD=galettesaucisse \ 11 | mysql:5.7 \ 12 | --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci 13 | 14 | -------------------------------------------------------------------------------- /readme/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfpio/callForPapers/3db755934d44a6b16885c9c7fdfd7eb6c2dc5133/readme/screenshot.png -------------------------------------------------------------------------------- /src/main/docker/docker-compose.yml: -------------------------------------------------------------------------------- 1 | app: 2 | build: . 3 | links: 4 | - database 5 | 6 | database: 7 | image: mysql:5.7 8 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp; 22 | 23 | import org.springframework.boot.SpringApplication; 24 | import org.springframework.boot.autoconfigure.SpringBootApplication; 25 | import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration; 26 | import org.springframework.boot.builder.SpringApplicationBuilder; 27 | import org.springframework.boot.web.servlet.ServletComponentScan; 28 | import org.springframework.boot.web.support.SpringBootServletInitializer; 29 | import org.springframework.cache.annotation.EnableCaching; 30 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; 31 | 32 | @SpringBootApplication(exclude = FreeMarkerAutoConfiguration.class) 33 | @EnableCaching 34 | @ServletComponentScan(basePackages = "io.cfp.config.filter") 35 | @EnableJpaRepositories(basePackages = "io.cfp.repository") 36 | public class Application extends SpringBootServletInitializer { 37 | 38 | @Override 39 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 40 | return application.sources(Application.class); 41 | } 42 | 43 | public static void main(String[] args) throws Exception { 44 | SpringApplication.run(Application.class, args); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/SecurityConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2016, CloudBees, Inc. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | package io.cfp; 27 | 28 | import org.springframework.beans.factory.annotation.Autowired; 29 | import org.springframework.context.annotation.Configuration; 30 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 31 | import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; 32 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 33 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 34 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 35 | import org.springframework.security.config.http.SessionCreationPolicy; 36 | import org.springframework.security.core.userdetails.UserDetailsService; 37 | 38 | /** 39 | * @author Nicolas De Loof 40 | */ 41 | @Configuration 42 | @EnableGlobalMethodSecurity(securedEnabled = true) 43 | @EnableWebSecurity 44 | public class SecurityConfiguration extends WebSecurityConfigurerAdapter { 45 | 46 | @Autowired 47 | private UserDetailsService userService; 48 | 49 | @Autowired 50 | @Override 51 | protected void configure(AuthenticationManagerBuilder auth) throws Exception { 52 | auth.userDetailsService(userService); 53 | } 54 | 55 | @Override 56 | protected void configure(HttpSecurity http) throws Exception { 57 | http 58 | .authorizeRequests() 59 | .anyRequest().permitAll() 60 | .and() 61 | .sessionManagement() 62 | .sessionCreationPolicy(SessionCreationPolicy.STATELESS) 63 | .and() 64 | .csrf().disable(); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/api/ConfigController.java: -------------------------------------------------------------------------------- 1 | package io.cfp.api; 2 | 3 | import io.cfp.entity.Role; 4 | import io.cfp.multitenant.TenantId; 5 | import io.cfp.service.admin.config.ApplicationConfigService; 6 | import org.slf4j.Logger; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.http.MediaType; 9 | import org.springframework.security.access.annotation.Secured; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RequestMethod; 13 | import org.springframework.web.bind.annotation.RestController; 14 | 15 | import javax.validation.Valid; 16 | 17 | import static org.slf4j.LoggerFactory.getLogger; 18 | 19 | @RestController 20 | @RequestMapping(value = { "/v1/config", "/api/config" }, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) 21 | public class ConfigController { 22 | 23 | private static final Logger LOGGER = getLogger(ConfigController.class); 24 | 25 | @Autowired 26 | private ApplicationConfigService applicationConfigService; 27 | 28 | /** 29 | * Disable or enable submission of new talks 30 | * @param key enable submission if true, else disable 31 | * @return key 32 | */ 33 | @RequestMapping(value="/enableSubmissions", method= RequestMethod.POST) 34 | @Secured(Role.ADMIN) 35 | public io.cfp.domain.common.Key postEnableSubmissions(@Valid @RequestBody io.cfp.domain.common.Key key, 36 | @TenantId String eventId) { 37 | 38 | if (key.getKey().equals("true")) { 39 | LOGGER.info("Open submissions of {}", eventId); 40 | applicationConfigService.openCfp(eventId); 41 | } 42 | if (key.getKey().equals("false")) { 43 | LOGGER.info("Close submissions of {}", eventId); 44 | applicationConfigService.closeCfp(eventId); 45 | } 46 | 47 | return key; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/api/FormatsController.java: -------------------------------------------------------------------------------- 1 | package io.cfp.api; 2 | 3 | import io.cfp.entity.Role; 4 | import io.cfp.mapper.FormatMapper; 5 | import io.cfp.mapper.ThemeMapper; 6 | import io.cfp.model.Format; 7 | import io.cfp.model.Theme; 8 | import io.cfp.multitenant.TenantId; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.security.access.annotation.Secured; 11 | import org.springframework.transaction.annotation.Transactional; 12 | import org.springframework.web.bind.annotation.PathVariable; 13 | import org.springframework.web.bind.annotation.RequestBody; 14 | import org.springframework.web.bind.annotation.RequestMapping; 15 | import org.springframework.web.bind.annotation.RestController; 16 | 17 | import java.util.Collection; 18 | 19 | import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE; 20 | import static org.springframework.web.bind.annotation.RequestMethod.*; 21 | 22 | /** 23 | * @author Nicolas De Loof 24 | */ 25 | @RestController 26 | @RequestMapping(value = { "/v1/formats", "/api/formats" }, produces = APPLICATION_JSON_UTF8_VALUE) 27 | public class FormatsController { 28 | 29 | 30 | @Autowired 31 | private FormatMapper formats; 32 | 33 | @RequestMapping(method = GET) 34 | public Collection all(@TenantId String eventId) { 35 | return formats.findByEvent(eventId); 36 | } 37 | 38 | @RequestMapping(method = POST) 39 | @Transactional 40 | @Secured(Role.OWNER) 41 | public Format create(@RequestBody Format format, @TenantId String eventId) { 42 | formats.insert(format.setEvent(eventId)); 43 | return format; 44 | } 45 | 46 | @RequestMapping(value = "/{id}", method = PUT) 47 | @Transactional 48 | @Secured(Role.OWNER) 49 | public void update(@PathVariable int id, @RequestBody Format format, @TenantId String eventId) { 50 | formats.updateForEvent(format.setId(id), eventId); 51 | } 52 | 53 | @RequestMapping(value = "/{id}", method = DELETE) 54 | @Transactional 55 | @Secured(Role.OWNER) 56 | public void delete(@PathVariable int id, @TenantId String eventId) { 57 | formats.deleteForEvent(id, eventId); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/api/RatesController.java: -------------------------------------------------------------------------------- 1 | package io.cfp.api; 2 | 3 | import io.cfp.entity.Role; 4 | import io.cfp.mapper.RateMapper; 5 | import io.cfp.model.Rate; 6 | import io.cfp.model.Stat; 7 | import io.cfp.model.queries.RateQuery; 8 | import io.cfp.multitenant.TenantId; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.security.access.annotation.Secured; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.List; 14 | import java.util.Map; 15 | import java.util.stream.Collectors; 16 | 17 | import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE; 18 | 19 | @RestController 20 | @RequestMapping(value = { "/v1/rates", "/api/rates" }, produces = APPLICATION_JSON_UTF8_VALUE) 21 | public class RatesController { 22 | 23 | 24 | @Autowired 25 | private RateMapper rates; 26 | 27 | /** 28 | * Get all ratings 29 | */ 30 | @GetMapping 31 | @Secured(Role.ADMIN) 32 | public List getRates(@TenantId String eventId) { 33 | RateQuery rateQuery = new RateQuery().setEventId(eventId); 34 | return rates.findAll(rateQuery); 35 | } 36 | 37 | /** 38 | * Delete all ratings 39 | */ 40 | @DeleteMapping 41 | @Secured(Role.ADMIN) 42 | public void deleteRates(@TenantId String eventId) { 43 | rates.deleteAllForEvent(eventId); 44 | } 45 | 46 | /** 47 | * Delete specific rating 48 | */ 49 | @DeleteMapping("/{rateId}") 50 | @Secured(Role.ADMIN) 51 | public void deleteRate(@PathVariable int rateId, @TenantId String eventId) { 52 | rates.deleteForEvent(rateId, eventId); 53 | } 54 | 55 | 56 | /** 57 | * Get Rates stats 58 | */ 59 | @GetMapping(value = "/stats") 60 | @Secured(Role.ADMIN) 61 | public Map getRateStats(@TenantId String eventId) { 62 | return rates.getRateByEmailUsers(eventId) 63 | .stream() 64 | .collect(Collectors.toMap(Stat::getName, Stat::getCount)); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/api/RoomsController.java: -------------------------------------------------------------------------------- 1 | package io.cfp.api; 2 | 3 | import io.cfp.dto.RoomDto; 4 | import io.cfp.entity.Role; 5 | import io.cfp.mapper.RoomMapper; 6 | import io.cfp.model.Room; 7 | import io.cfp.multitenant.TenantId; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.security.access.annotation.Secured; 10 | import org.springframework.transaction.annotation.Transactional; 11 | import org.springframework.web.bind.annotation.PathVariable; 12 | import org.springframework.web.bind.annotation.RequestBody; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | import java.util.Collection; 17 | 18 | import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE; 19 | import static org.springframework.web.bind.annotation.RequestMethod.*; 20 | 21 | /** 22 | * @author Nicolas De Loof 23 | */ 24 | @RestController 25 | @RequestMapping(value = { "/v1/rooms", "/api/rooms" }, produces = APPLICATION_JSON_UTF8_VALUE) 26 | public class RoomsController { 27 | 28 | 29 | @Autowired 30 | private RoomMapper rooms; 31 | 32 | @RequestMapping(method = GET) 33 | public Collection all(@TenantId String eventId) { 34 | return rooms.findByEvent(eventId); 35 | } 36 | 37 | @RequestMapping(method = POST) 38 | @Transactional 39 | @Secured(Role.OWNER) 40 | public Room create(@RequestBody Room room, @TenantId String eventId) { 41 | rooms.insert(room.setEvent(eventId)); 42 | return room; 43 | } 44 | 45 | @RequestMapping(value = "/{id}", method = PUT) 46 | @Transactional 47 | @Secured(Role.OWNER) 48 | public void update(@PathVariable int id, @RequestBody Room room, @TenantId String eventId) { 49 | rooms.updateForEvent(room.setId(id), eventId); 50 | } 51 | 52 | @RequestMapping(value = "/{id}", method = DELETE) 53 | @Transactional 54 | @Secured(Role.OWNER) 55 | public void delete(@PathVariable int id, @TenantId String eventId) { 56 | rooms.deleteForEvent(id, eventId); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/api/SpeakersController.java: -------------------------------------------------------------------------------- 1 | package io.cfp.api; 2 | 3 | 4 | import io.cfp.mapper.ProposalMapper; 5 | import io.cfp.mapper.UserMapper; 6 | import io.cfp.model.Proposal; 7 | import io.cfp.model.User; 8 | import io.cfp.model.queries.ProposalQuery; 9 | import io.cfp.model.queries.UserQuery; 10 | import io.cfp.multitenant.TenantId; 11 | import org.slf4j.Logger; 12 | import org.slf4j.LoggerFactory; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.security.access.annotation.Secured; 15 | import org.springframework.security.core.annotation.AuthenticationPrincipal; 16 | import org.springframework.web.bind.annotation.GetMapping; 17 | import org.springframework.web.bind.annotation.RequestMapping; 18 | import org.springframework.web.bind.annotation.RequestParam; 19 | import org.springframework.web.bind.annotation.RestController; 20 | 21 | import java.lang.reflect.Array; 22 | import java.util.*; 23 | import java.util.stream.Collectors; 24 | 25 | import static io.cfp.entity.Role.ADMIN; 26 | import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE; 27 | 28 | @RestController 29 | @RequestMapping(value = {"/api/speakers", "/v1/speakers"}, produces = APPLICATION_JSON_UTF8_VALUE) 30 | public class SpeakersController { 31 | 32 | private static final Logger LOGGER = LoggerFactory.getLogger(SpeakersController.class); 33 | 34 | @Autowired 35 | private UserMapper users; 36 | 37 | @GetMapping 38 | public List search(@AuthenticationPrincipal User user, 39 | @TenantId String event, 40 | @RequestParam(name = "states", required = false) String states, 41 | @RequestParam(name = "sort", required = false, defaultValue = "lastname,firstname") String sort, 42 | @RequestParam(name = "order", required = false, defaultValue = "asc") String order) { 43 | List stateList = new ArrayList<>(); 44 | if (user != null && user.hasRole(ADMIN)) { 45 | if (states != null) { 46 | stateList = Arrays.stream(states.split(",")) 47 | .map(Proposal.State::valueOf) 48 | .collect(Collectors.toList()); 49 | } 50 | } else { 51 | LOGGER.info("User is not admin, can only get public informations of PRESENT speakers"); 52 | stateList.add(Proposal.State.PRESENT); 53 | } 54 | 55 | List sortList = new ArrayList<>(); 56 | if (sort != null) { 57 | sortList = Arrays.stream(sort.split(",")) 58 | .filter(s -> User.AUTHORIZED_SORTS.contains(s.toLowerCase())) 59 | .collect(Collectors.toList()); 60 | } 61 | 62 | UserQuery query = new UserQuery() 63 | .setEventId(event) 64 | .setStates(stateList) 65 | .setSort(sortList) 66 | .setOrder(order.equalsIgnoreCase("desc") ? "desc" : "asc"); 67 | 68 | LOGGER.info("Search Speakers {}", query); 69 | List u = users.findAll(query); 70 | LOGGER.debug("Found {} Speakers", u.size()); 71 | 72 | if (user == null || !user.hasRole(ADMIN)) { 73 | List cleanedUsers = new ArrayList<>(); 74 | for (User us : u) { 75 | cleanedUsers.add(us.cleanPrivatesInformations()); 76 | } 77 | u = cleanedUsers; 78 | } 79 | 80 | return u; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/api/StatsController.java: -------------------------------------------------------------------------------- 1 | package io.cfp.api; 2 | 3 | import io.cfp.domain.admin.meter.AdminMeter; 4 | import io.cfp.dto.RestrictedMeter; 5 | import io.cfp.mapper.ProposalMapper; 6 | import io.cfp.model.Role; 7 | import io.cfp.model.User; 8 | import io.cfp.model.queries.ProposalQuery; 9 | import io.cfp.multitenant.TenantId; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.security.access.annotation.Secured; 12 | import org.springframework.security.core.annotation.AuthenticationPrincipal; 13 | import org.springframework.transaction.annotation.Transactional; 14 | import org.springframework.web.bind.annotation.GetMapping; 15 | import org.springframework.web.bind.annotation.RequestMapping; 16 | import org.springframework.web.bind.annotation.ResponseBody; 17 | import org.springframework.web.bind.annotation.RestController; 18 | 19 | import java.io.Serializable; 20 | 21 | import static io.cfp.model.Proposal.State.*; 22 | import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE; 23 | 24 | @RestController 25 | @RequestMapping(value = { "/v1/stats", "/api/stats" }, produces = APPLICATION_JSON_UTF8_VALUE) 26 | public class StatsController { 27 | 28 | @Autowired 29 | private ProposalMapper proposals; 30 | 31 | /** 32 | * Get meter stats (talks count, draft count, ...) 33 | */ 34 | @GetMapping(value="/me") 35 | @ResponseBody 36 | @Secured(Role.AUTHENTICATED) 37 | @Transactional(readOnly = true) 38 | public Serializable me(@AuthenticationPrincipal User user, 39 | @TenantId String event) { 40 | RestrictedMeter meter = new RestrictedMeter(); 41 | 42 | ProposalQuery mine = new ProposalQuery().setEventId(event).setUserId(user.getId()).addStates(CONFIRMED, ACCEPTED, REFUSED, BACKUP); 43 | meter.setTalks(proposals.count(mine)); 44 | return meter; 45 | } 46 | 47 | @GetMapping(value="/event") 48 | @Secured(Role.REVIEWER) 49 | @Transactional(readOnly = true) 50 | public Serializable event(@TenantId String event) { 51 | AdminMeter meter = new AdminMeter(); 52 | meter.setSpeakers(proposals.countSubmissionsByEventId(event)); 53 | 54 | ProposalQuery totalQuery = new ProposalQuery().setEventId(event).addStates(CONFIRMED, ACCEPTED, REFUSED, BACKUP); 55 | meter.setTalks(proposals.count(totalQuery)); 56 | 57 | ProposalQuery draftQuery = new ProposalQuery().setEventId(event).addStates(DRAFT); 58 | meter.setDrafts(proposals.count(draftQuery)); 59 | 60 | ProposalQuery submittedQuery = new ProposalQuery().setEventId(event).addStates(CONFIRMED); 61 | meter.setSubmitted(proposals.count(submittedQuery)); 62 | 63 | ProposalQuery acceptedQuery = new ProposalQuery().setEventId(event).addStates(ACCEPTED); 64 | meter.setAccepted(proposals.count(acceptedQuery)); 65 | 66 | ProposalQuery rejectedQuery = new ProposalQuery().setEventId(event).addStates(REFUSED); 67 | meter.setRejected(proposals.count(rejectedQuery)); 68 | 69 | ProposalQuery backupQuery = new ProposalQuery().setEventId(event).addStates(BACKUP); 70 | meter.setBackup(proposals.count(backupQuery)); 71 | 72 | return meter; 73 | 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/api/TalksController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.api; 22 | 23 | import io.cfp.mapper.ProposalMapper; 24 | import io.cfp.model.Proposal; 25 | import io.cfp.model.queries.ProposalQuery; 26 | import io.cfp.multitenant.TenantId; 27 | import org.slf4j.Logger; 28 | import org.slf4j.LoggerFactory; 29 | import org.springframework.beans.factory.annotation.Autowired; 30 | import org.springframework.web.bind.annotation.GetMapping; 31 | import org.springframework.web.bind.annotation.RequestMapping; 32 | import org.springframework.web.bind.annotation.RequestParam; 33 | import org.springframework.web.bind.annotation.RestController; 34 | 35 | import java.util.List; 36 | 37 | import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE; 38 | 39 | @RestController 40 | @RequestMapping(value = { "/v1" }, produces = APPLICATION_JSON_UTF8_VALUE) 41 | public class TalksController { 42 | 43 | private static final Logger LOGGER = LoggerFactory.getLogger(TalksController.class); 44 | 45 | @Autowired 46 | private ProposalMapper proposals; 47 | 48 | 49 | /** 50 | * API pour exposer publiquement les proposals acceptés, aucune écriture disponible. 51 | * @param userId critère pour filtrer les proposals acceptés d'un utilisateur 52 | * @return Liste de proposition 53 | */ 54 | @GetMapping("/talks") 55 | public List search(@TenantId String event, @RequestParam(name = "userId", required = false) Integer userId) { 56 | ProposalQuery query = new ProposalQuery() 57 | .setEventId(event) 58 | .addStates(Proposal.State.ACCEPTED) 59 | .setUserId(userId); 60 | 61 | LOGGER.info("Search accepted Proposals : {}", query); 62 | List proposals = this.proposals.findAll(query); 63 | LOGGER.debug("Found {} Proposals", proposals.size()); 64 | return proposals; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/api/ThemesController.java: -------------------------------------------------------------------------------- 1 | package io.cfp.api; 2 | 3 | import io.cfp.entity.Role; 4 | import io.cfp.mapper.ThemeMapper; 5 | import io.cfp.model.Stat; 6 | import io.cfp.model.Theme; 7 | import io.cfp.multitenant.TenantId; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.security.access.annotation.Secured; 10 | import org.springframework.transaction.annotation.Transactional; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.Collection; 14 | import java.util.Map; 15 | import java.util.stream.Collectors; 16 | 17 | import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE; 18 | import static org.springframework.web.bind.annotation.RequestMethod.*; 19 | 20 | /** 21 | * @author Nicolas De Loof 22 | */ 23 | @RestController 24 | @RequestMapping(value = { "/v1/themes", "/api/themes" }, produces = APPLICATION_JSON_UTF8_VALUE) 25 | public class ThemesController { 26 | 27 | 28 | @Autowired 29 | private ThemeMapper themes; 30 | 31 | @RequestMapping(method = GET) 32 | public Collection all(@TenantId String eventId) { 33 | return themes.findByEvent(eventId); 34 | } 35 | 36 | @RequestMapping(method = POST) 37 | @Transactional 38 | @Secured(Role.OWNER) 39 | public Theme create(@RequestBody Theme theme, @TenantId String eventId) { 40 | themes.insert(theme.setEvent(eventId)); 41 | return theme; 42 | } 43 | 44 | @RequestMapping(value = "/{id}", method = PUT) 45 | @Transactional 46 | @Secured(Role.OWNER) 47 | public void update(@PathVariable int id, @RequestBody Theme theme, @TenantId String eventId) { 48 | themes.updateForEvent(theme.setId(id), eventId); 49 | } 50 | 51 | @RequestMapping(value = "/{id}", method = DELETE) 52 | @Transactional 53 | @Secured(Role.OWNER) 54 | public void delete(@PathVariable int id, @TenantId String eventId) { 55 | themes.deleteForEvent(id, eventId); 56 | } 57 | 58 | @GetMapping(value = "/stats") 59 | @Secured(Role.ADMIN) 60 | public Map getStats(@TenantId String eventId, 61 | @RequestParam(required = false) String state) { 62 | return themes.countProposalsByThemeAndState(eventId, state) 63 | .stream() 64 | .collect(Collectors.toMap(Stat::getName, Stat::getCount)); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/config/CacheConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.config; 22 | 23 | import com.google.common.cache.Cache; 24 | import com.google.common.cache.CacheBuilder; 25 | import org.springframework.cache.CacheManager; 26 | import org.springframework.cache.guava.GuavaCache; 27 | import org.springframework.cache.support.SimpleCacheManager; 28 | import org.springframework.context.annotation.Bean; 29 | import org.springframework.context.annotation.Configuration; 30 | 31 | import java.util.Arrays; 32 | import java.util.concurrent.TimeUnit; 33 | 34 | /** 35 | * Created by Nicolas on 12/12/2015. 36 | */ 37 | @Configuration 38 | public class CacheConfig { 39 | 40 | @Bean 41 | public CacheManager cacheManager() { 42 | // configure and return an implementation of Spring's CacheManager SPI 43 | SimpleCacheManager cacheManager = new SimpleCacheManager(); 44 | 45 | Cache applicationSettings = CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(); 46 | 47 | Cache isCfpOpen = CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(); 48 | 49 | cacheManager.setCaches(Arrays.asList(new GuavaCache("applicationSettings", applicationSettings), new GuavaCache("isCfpOpen", isCfpOpen))); 50 | 51 | return cacheManager; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/config/MailConfig.java: -------------------------------------------------------------------------------- 1 | package io.cfp.config; 2 | 3 | import freemarker.template.TemplateExceptionHandler; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * Configuration for sending mail 9 | */ 10 | @Configuration 11 | public class MailConfig { 12 | 13 | @Bean(name = "mailTemplate") 14 | public freemarker.template.Configuration freemarkerConfig() { 15 | freemarker.template.Configuration config = new freemarker.template.Configuration(freemarker.template.Configuration.VERSION_2_3_21); 16 | config.setClassForTemplateLoading(MailConfig.class, "/mails/"); 17 | config.setDefaultEncoding("UTF-8"); 18 | config.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); 19 | 20 | return config; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/config/SwaggerConfig.java: -------------------------------------------------------------------------------- 1 | package io.cfp.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import springfox.documentation.builders.ApiInfoBuilder; 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.service.ApiInfo; 8 | import springfox.documentation.spi.DocumentationType; 9 | import springfox.documentation.spring.web.plugins.Docket; 10 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 11 | 12 | /** 13 | * Created by lhuet on 08/05/16. 14 | */ 15 | @Configuration 16 | @EnableSwagger2 17 | public class SwaggerConfig { 18 | 19 | @Bean 20 | public Docket api() { 21 | return new Docket(DocumentationType.SWAGGER_2) 22 | .apiInfo(apiInfo()) 23 | .select() 24 | .paths(PathSelectors.regex("/api.*")) 25 | .build(); 26 | } 27 | 28 | private ApiInfo apiInfo() { 29 | return new ApiInfoBuilder() 30 | .title("cfp.io Apis") 31 | .description("REST API") 32 | .license("MIT") 33 | .build(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/config/filter/CorsFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.config.filter; 22 | 23 | import org.springframework.http.HttpHeaders; 24 | import org.springframework.web.cors.CorsUtils; 25 | import org.springframework.web.filter.OncePerRequestFilter; 26 | 27 | import javax.servlet.FilterChain; 28 | import javax.servlet.ServletException; 29 | import javax.servlet.http.HttpServletRequest; 30 | import javax.servlet.http.HttpServletResponse; 31 | import java.io.IOException; 32 | 33 | /** 34 | * @author Nicolas De Loof 35 | */ 36 | public class CorsFilter extends OncePerRequestFilter { 37 | @Override 38 | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { 39 | 40 | if (CorsUtils.isCorsRequest(request)) { 41 | String origin = request.getHeader(HttpHeaders.ORIGIN); 42 | if (origin != null) 43 | response.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, origin); 44 | response.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "DELETE,GET,HEAD,PATCH,POST,PUT"); 45 | response.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, request.getHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS)); // todo filter ? 46 | response.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true"); 47 | response.addHeader(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "1"); 48 | } 49 | filterChain.doFilter(request, response); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/config/mapping/Mapping.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.config.mapping; 22 | 23 | import ma.glasnost.orika.MapperFactory; 24 | 25 | /** 26 | * Interface to implement in order to define DTO mapping 27 | */ 28 | public interface Mapping 29 | { 30 | /** 31 | * Method called to define DTO mapping 32 | * 33 | * @param mapperFactory Orika Factory 34 | */ 35 | void mapClasses(MapperFactory mapperFactory); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/config/mapping/MappingConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.config.mapping; 22 | 23 | import ma.glasnost.orika.CustomConverter; 24 | import ma.glasnost.orika.MapperFacade; 25 | import ma.glasnost.orika.MapperFactory; 26 | import ma.glasnost.orika.converter.ConverterFactory; 27 | import ma.glasnost.orika.impl.DefaultMapperFactory; 28 | import org.springframework.beans.factory.annotation.Autowired; 29 | import org.springframework.context.annotation.Bean; 30 | import org.springframework.context.annotation.Configuration; 31 | 32 | import java.util.List; 33 | 34 | /** 35 | * Configuration class for Orika mapper 36 | */ 37 | @Configuration 38 | public class MappingConfig { 39 | 40 | @Autowired(required = false) 41 | private List> converters; 42 | 43 | @Autowired(required = false) 44 | private List mappings; 45 | 46 | @Bean 47 | public MapperFactory mapperFactory() { 48 | DefaultMapperFactory mapperFactory = new DefaultMapperFactory.Builder().build(); 49 | 50 | //register here custom converter and mapper 51 | ConverterFactory converterFactory = mapperFactory.getConverterFactory(); 52 | if (converters != null && !converters.isEmpty()) { 53 | for (CustomConverter converter : converters) { 54 | converterFactory.registerConverter(converter); 55 | } 56 | } 57 | 58 | if (mappings != null && !mappings.isEmpty()) { 59 | for (Mapping mapping : mappings) { 60 | mapping.mapClasses(mapperFactory); 61 | } 62 | } 63 | 64 | return mapperFactory; 65 | } 66 | 67 | @Bean 68 | public MapperFacade mapperFacade(MapperFactory mapperFactory) { 69 | return mapperFactory.getMapperFacade(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/controller/HomeController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.controller; 22 | 23 | import org.springframework.stereotype.Controller; 24 | import org.springframework.web.bind.annotation.RequestMapping; 25 | 26 | /** 27 | * Created by tmaugin on 15/04/2015. 28 | */ 29 | 30 | @Controller 31 | public class HomeController { 32 | 33 | /** 34 | * Redirect to index.html 35 | * @return 36 | */ 37 | @RequestMapping("/") 38 | public String index() { 39 | return "forward:/index.html"; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/domain/common/Key.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.domain.common; 22 | 23 | /** 24 | * Created by tmaugin on 09/07/2015. 25 | * SII 26 | */ 27 | public class Key { 28 | private String key; 29 | 30 | public String getKey() { 31 | return key; 32 | } 33 | 34 | public void setKey(String key) { 35 | this.key = key; 36 | } 37 | 38 | public Key(String key) { 39 | this.key = key; 40 | } 41 | 42 | public Key() { 43 | this.key = null; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/domain/common/UserAuthentication.java: -------------------------------------------------------------------------------- 1 | package io.cfp.domain.common; 2 | 3 | import io.cfp.entity.Role; 4 | import io.cfp.model.User; 5 | import org.springframework.security.core.Authentication; 6 | import org.springframework.security.core.GrantedAuthority; 7 | import org.springframework.security.core.authority.SimpleGrantedAuthority; 8 | 9 | import java.util.Collection; 10 | import java.util.List; 11 | import java.util.stream.Collectors; 12 | 13 | public class UserAuthentication implements Authentication { 14 | 15 | private final User user; 16 | private final List authorities; 17 | private boolean authenticated = true; 18 | 19 | public UserAuthentication(User user) { 20 | this.user = user; 21 | authorities = 22 | user.getRoles().stream() 23 | .map(SimpleGrantedAuthority::new) 24 | .collect(Collectors.toList()); 25 | 26 | authorities.add(new SimpleGrantedAuthority(Role.AUTHENTICATED)); 27 | } 28 | 29 | @Override 30 | public String getName() { 31 | return user.getEmail(); 32 | } 33 | 34 | @Override 35 | public Collection getAuthorities() { 36 | return authorities; 37 | } 38 | 39 | @Override 40 | public Object getCredentials() { 41 | return "****"; 42 | } 43 | 44 | @Override 45 | public User getDetails() { 46 | return user; 47 | } 48 | 49 | @Override 50 | public Object getPrincipal() { 51 | return user; 52 | } 53 | 54 | @Override 55 | public boolean isAuthenticated() { 56 | return authenticated; 57 | } 58 | 59 | @Override 60 | public void setAuthenticated(boolean authenticated) { 61 | this.authenticated = authenticated; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/domain/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.domain.exception; 22 | 23 | /** 24 | * Created by tmaugin on 24/07/2015. 25 | */ 26 | public class BadRequestException extends CustomException { 27 | public BadRequestException() { 28 | super(); 29 | } 30 | 31 | //Constructor that accepts a message 32 | public BadRequestException(String message) 33 | { 34 | super(message); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/domain/exception/CospeakerNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.domain.exception; 22 | 23 | 24 | import io.cfp.dto.user.CospeakerProfil; 25 | 26 | public class CospeakerNotFoundException extends NotFoundException 27 | { 28 | private CospeakerProfil cospeaker; 29 | 30 | public CospeakerNotFoundException() 31 | { 32 | super(); 33 | } 34 | 35 | public CospeakerNotFoundException(CospeakerProfil cospeaker) 36 | { 37 | super(); 38 | this.cospeaker = cospeaker; 39 | } 40 | 41 | public CospeakerNotFoundException(String message, CospeakerProfil cospeaker) 42 | { 43 | super(message); 44 | this.cospeaker = cospeaker; 45 | } 46 | 47 | 48 | 49 | 50 | public void setCospeaker(CospeakerProfil cospeaker) 51 | { 52 | this.cospeaker = cospeaker; 53 | } 54 | public CospeakerProfil getCospeaker() 55 | { 56 | return cospeaker; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/domain/exception/CustomException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.domain.exception; 22 | 23 | /** 24 | * Created by tmaugin on 13/05/2015. 25 | */ 26 | public class CustomException extends RuntimeException 27 | { 28 | public CustomException() {} 29 | 30 | //Constructor that accepts a message 31 | public CustomException(String message) 32 | { 33 | super(message); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/domain/exception/EntityExistsException.java: -------------------------------------------------------------------------------- 1 | package io.cfp.domain.exception; 2 | 3 | /** 4 | * @author Nicolas De Loof 5 | */ 6 | public class EntityExistsException extends Exception { 7 | 8 | public EntityExistsException() { 9 | } 10 | 11 | public EntityExistsException(String message) { 12 | super(message); 13 | } 14 | 15 | public EntityExistsException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public EntityExistsException(Throwable cause) { 20 | super(cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/domain/exception/ErrorResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.domain.exception; 22 | 23 | import com.fasterxml.jackson.annotation.JsonInclude; 24 | 25 | import java.util.Date; 26 | 27 | /** 28 | * Created by tmaugin on 09/04/2015. 29 | */ 30 | @JsonInclude(JsonInclude.Include.NON_NULL) 31 | public class ErrorResponse { 32 | private Date timestamp; 33 | private Integer status; 34 | private String error; 35 | private String exception; 36 | private String message; 37 | 38 | public ErrorResponse(Exception e) 39 | { 40 | this.exception = e.getClass().toString(); 41 | this.message = e.toString(); 42 | this.timestamp = new Date(); 43 | } 44 | 45 | public Integer getStatus() { 46 | return status; 47 | } 48 | 49 | public void setStatus(Integer status) { 50 | this.status = status; 51 | } 52 | 53 | public String getError() { 54 | return error; 55 | } 56 | 57 | public void setError(String error) { 58 | this.error = error; 59 | } 60 | 61 | public String getException() { 62 | return exception; 63 | } 64 | 65 | public void setException(String exception) { 66 | this.exception = exception; 67 | } 68 | 69 | public String getMessage() { 70 | return message; 71 | } 72 | 73 | public void setMessage(String message) { 74 | this.message = message; 75 | } 76 | 77 | public Date getTimestamp() { 78 | return timestamp; 79 | } 80 | 81 | public void setTimestamp(Date timestamp) { 82 | this.timestamp = timestamp; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/domain/exception/ForbiddenException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.domain.exception; 22 | 23 | /** 24 | * Created by tmaugin on 22/05/2015. 25 | */ 26 | public class ForbiddenException extends CustomException { 27 | public ForbiddenException() { 28 | super(); 29 | } 30 | 31 | //Constructor that accepts a message 32 | public ForbiddenException(String message) 33 | { 34 | super(message); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/domain/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.domain.exception; 22 | 23 | /** 24 | * Created by tmaugin on 22/05/2015. 25 | */ 26 | public class NotFoundException extends CustomException { 27 | public NotFoundException() { 28 | super(); 29 | } 30 | 31 | //Constructor that accepts a message 32 | public NotFoundException(String message) 33 | { 34 | super(message); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/domain/exception/NotVerifiedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.domain.exception; 22 | 23 | /** 24 | * Created by tmaugin on 20/05/2015. 25 | */ 26 | public class NotVerifiedException extends CustomException { 27 | public NotVerifiedException() { 28 | super(); 29 | } 30 | 31 | //Constructor that accepts a message 32 | public NotVerifiedException(String message) 33 | { 34 | super(message); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/dto/AdminUserInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.dto; 22 | 23 | import com.fasterxml.jackson.annotation.JsonInclude; 24 | import lombok.Data; 25 | import lombok.NoArgsConstructor; 26 | import org.apache.commons.lang3.StringUtils; 27 | 28 | /** 29 | * Created by tmaugin on 05/05/2015. 30 | */ 31 | @Data 32 | @NoArgsConstructor 33 | @JsonInclude(JsonInclude.Include.NON_NULL) 34 | public class AdminUserInfo { 35 | 36 | private boolean connected; 37 | private boolean reviewer; 38 | private boolean admin; 39 | private boolean owner; 40 | 41 | private String uri; 42 | private String email; 43 | 44 | public AdminUserInfo(String email, String logout) { 45 | this.uri = logout; 46 | this.email = email; 47 | this.connected = StringUtils.isNotEmpty(email); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/dto/CommentUser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.dto; 22 | 23 | import io.cfp.dto.user.UserProfil; 24 | 25 | import java.util.Date; 26 | 27 | /** 28 | * Comment DTO sent to the speaker 29 | */ 30 | public class CommentUser { 31 | 32 | private int id; 33 | private String comment; 34 | private UserProfil user; 35 | private Date added; 36 | 37 | public int getId() { 38 | return id; 39 | } 40 | 41 | public void setId(int id) { 42 | this.id = id; 43 | } 44 | 45 | public String getComment() { 46 | return comment; 47 | } 48 | 49 | public void setComment(String comment) { 50 | this.comment = comment; 51 | } 52 | 53 | public Date getAdded() { 54 | return added; 55 | } 56 | 57 | public void setAdded(Date added) { 58 | this.added = added; 59 | } 60 | 61 | public UserProfil getUser() { 62 | return user; 63 | } 64 | 65 | public void setUser(UserProfil user) { 66 | this.user = user; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/dto/EventSched.java: -------------------------------------------------------------------------------- 1 | package io.cfp.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Builder; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | import java.time.LocalDateTime; 11 | 12 | /** 13 | * DTO used to export proposal into Sched format 14 | */ 15 | @Data @Builder(toBuilder = true) @NoArgsConstructor @AllArgsConstructor 16 | @JsonInclude(JsonInclude.Include.NON_NULL) 17 | public class EventSched { 18 | 19 | private String id; 20 | /** Title of the proposal */ 21 | private String name; 22 | 23 | /** Complete summary */ 24 | private String description; 25 | 26 | /** Speakers and co-speakers delimiter , */ 27 | private String speakers; 28 | 29 | private String language; 30 | 31 | @JsonProperty("event_start") 32 | private LocalDateTime eventStart; 33 | 34 | @JsonProperty("event_end") 35 | private LocalDateTime eventEnd; 36 | 37 | /** Track name */ 38 | @JsonProperty("event_type") 39 | private String eventType; 40 | 41 | /** Type (conference, lab...) */ 42 | private String format; 43 | 44 | /** Room name */ 45 | private String venue; 46 | /** Room id */ 47 | private Integer venueId; 48 | 49 | /** Not used */ 50 | private String active = "Y"; 51 | @JsonProperty("event_key") 52 | private String eventKey = "tobedefined"; 53 | private String goers = "tobedefined"; 54 | private String seats = "tobedefined"; 55 | @JsonProperty("invite_only") 56 | private String inviteOnly = "N"; 57 | 58 | 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/dto/FormatDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.dto; 22 | 23 | import io.cfp.entity.Format; 24 | 25 | public class FormatDto { 26 | 27 | private int id; 28 | private String name; 29 | private int duration; 30 | private String description; 31 | private String icon; 32 | private boolean referenced; 33 | 34 | public FormatDto() { 35 | } 36 | 37 | public FormatDto(Format format, boolean referenced) { 38 | this.id = format.getId(); 39 | this.name = format.getName(); 40 | this.duration = format.getDuration(); 41 | this.description = format.getDescription(); 42 | this.icon = format.getIcon(); 43 | this.referenced = referenced; 44 | } 45 | 46 | public String getDescription() { 47 | return description; 48 | } 49 | 50 | public void setDescription(String description) { 51 | this.description = description; 52 | } 53 | 54 | public int getDuration() { 55 | return duration; 56 | } 57 | 58 | public void setDuration(int duration) { 59 | this.duration = duration; 60 | } 61 | 62 | public int getId() { 63 | return id; 64 | } 65 | 66 | public void setId(int id) { 67 | this.id = id; 68 | } 69 | 70 | public String getName() { 71 | return name; 72 | } 73 | 74 | public void setName(String name) { 75 | this.name = name; 76 | } 77 | 78 | public String getIcon() { 79 | return icon; 80 | } 81 | 82 | public void setIcon(String icon) { 83 | this.icon = icon; 84 | } 85 | 86 | public boolean isReferenced() { 87 | return referenced; 88 | } 89 | 90 | public void setReferenced(boolean referenced) { 91 | this.referenced = referenced; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/dto/FullCalendar.java: -------------------------------------------------------------------------------- 1 | package io.cfp.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import io.cfp.entity.Talk; 5 | import io.cfp.model.Room; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.time.format.DateTimeFormatter; 10 | import java.time.temporal.ChronoUnit; 11 | import java.util.List; 12 | import java.util.stream.Collectors; 13 | 14 | /** 15 | * @author Nicolas De Loof 16 | */ 17 | @Data @NoArgsConstructor 18 | public class FullCalendar { 19 | 20 | private List resources; 21 | 22 | private List events; 23 | 24 | public FullCalendar(List talks, List rooms) { 25 | 26 | resources = rooms.stream() 27 | .map(Resource::new) 28 | .collect(Collectors.toList()); 29 | 30 | events = talks.stream() 31 | .filter(t -> t.getDate() != null && t.getRoom() != null) 32 | .map(Event::new) 33 | .collect(Collectors.toList()); 34 | } 35 | 36 | @Data @NoArgsConstructor 37 | @JsonInclude(JsonInclude.Include.NON_NULL) 38 | public static class Resource { 39 | private String id; 40 | private String title; 41 | 42 | public Resource(Room r) { 43 | this.id = String.valueOf(r.getId()); 44 | this.title = r.getName(); 45 | } 46 | } 47 | 48 | @Data @NoArgsConstructor 49 | @JsonInclude(JsonInclude.Include.NON_NULL) 50 | public static class Event { 51 | private String id; 52 | private String resourceId; 53 | private String start; 54 | private int duration; 55 | private String end; 56 | private String color; 57 | private String format; 58 | private String icon; 59 | private String title; 60 | private String slides; 61 | private String videos; 62 | 63 | public Event(Talk talk) { 64 | this.id = String.valueOf(talk.getId()); 65 | this.title = talk.getName(); 66 | if (talk.getRoom() != null) { 67 | this.resourceId = String.valueOf(talk.getRoom().getId()); 68 | } 69 | if (talk.getDate() != null) { 70 | this.start = DateTimeFormatter.ISO_INSTANT.format(talk.getDate().toInstant()); 71 | this.end = DateTimeFormatter.ISO_INSTANT.format(talk.getDate().toInstant().plus(talk.getDuree(), ChronoUnit.MINUTES)); 72 | } 73 | this.color = talk.getTrack().getColor(); 74 | this.format = talk.getFormat().getName(); 75 | this.icon = talk.getFormat().getIcon(); 76 | this.duration = talk.getDuree(); 77 | this.slides = talk.getSlides(); 78 | this.videos = talk.getVideo(); 79 | } 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/dto/RateAdmin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.dto; 22 | 23 | import io.cfp.dto.user.AdminUserDTO; 24 | import io.cfp.entity.Rate; 25 | 26 | import java.util.Date; 27 | 28 | /** 29 | * Rate DTO for admin view 30 | */ 31 | public class RateAdmin { 32 | 33 | private int id; 34 | private int rate; 35 | private Date added; 36 | private boolean love; 37 | private boolean hate; 38 | 39 | private int talkId; 40 | private AdminUserDTO user; 41 | 42 | public RateAdmin() { 43 | } 44 | 45 | public RateAdmin(Rate e) { 46 | this.id = e.getId(); 47 | this.rate = e.getRate(); 48 | this.added = e.getAdded(); 49 | this.love = e.isLove(); 50 | this.hate = e.isHate(); 51 | this.talkId = e.getTalk().getId(); 52 | this.user = new AdminUserDTO(e.getAdminUser()); 53 | } 54 | 55 | 56 | public int getId() { 57 | return id; 58 | } 59 | 60 | public void setId(int id) { 61 | this.id = id; 62 | } 63 | 64 | public int getRate() { 65 | return rate; 66 | } 67 | 68 | public void setRate(int rate) { 69 | this.rate = rate; 70 | } 71 | 72 | public Date getAdded() { 73 | return added; 74 | } 75 | 76 | public void setAdded(Date added) { 77 | this.added = added; 78 | } 79 | 80 | public boolean isLove() { 81 | return love; 82 | } 83 | 84 | public void setLove(boolean love) { 85 | this.love = love; 86 | } 87 | 88 | public boolean isHate() { 89 | return hate; 90 | } 91 | 92 | public void setHate(boolean hate) { 93 | this.hate = hate; 94 | } 95 | 96 | public int getTalkId() { 97 | return talkId; 98 | } 99 | 100 | public void setTalkId(int talkId) { 101 | this.talkId = talkId; 102 | } 103 | 104 | public AdminUserDTO getUser() { 105 | return user; 106 | } 107 | 108 | public void setUser(AdminUserDTO user) { 109 | this.user = user; 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/dto/RestrictedMeter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.dto; 22 | 23 | import com.fasterxml.jackson.annotation.JsonIgnore; 24 | 25 | import java.io.Serializable; 26 | 27 | /** 28 | * Created by Thomas on 24/08/2015. 29 | */ 30 | public class RestrictedMeter implements Serializable { 31 | private Counts meter; 32 | 33 | public Counts getMeter() { 34 | return meter; 35 | } 36 | 37 | public RestrictedMeter() { 38 | this.meter = new Counts(); 39 | } 40 | 41 | @JsonIgnore 42 | public Integer getTalks() { 43 | return this.meter.talks; 44 | } 45 | 46 | public void setTalks(Integer talks) { 47 | this.meter.talks = talks; 48 | } 49 | 50 | private class Counts implements Serializable { 51 | private Integer talks; 52 | 53 | public Integer getTalks() { 54 | return talks; 55 | } 56 | 57 | public Counts() { 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/dto/RoomDto.java: -------------------------------------------------------------------------------- 1 | package io.cfp.dto; 2 | 3 | import io.cfp.entity.Room; 4 | 5 | /** 6 | * @author Nicolas De Loof 7 | */ 8 | public class RoomDto { 9 | 10 | private int id; 11 | private String name; 12 | 13 | public RoomDto() { 14 | } 15 | 16 | public RoomDto(Room room) { 17 | this.id = room.getId(); 18 | this.name = room.getName(); 19 | } 20 | 21 | public int getId() { 22 | return id; 23 | } 24 | 25 | public void setId(int id) { 26 | this.id = id; 27 | } 28 | 29 | public String getName() { 30 | return name; 31 | } 32 | 33 | public void setName(String name) { 34 | this.name = name; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/dto/TalkAdmin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.dto; 22 | 23 | import io.cfp.entity.Talk; 24 | import io.cfp.model.Proposal; 25 | 26 | import java.math.BigDecimal; 27 | import java.math.RoundingMode; 28 | import java.util.List; 29 | 30 | /** 31 | * Talk DTO for admin view 32 | */ 33 | public class TalkAdmin extends TalkUser { 34 | 35 | private int userId; 36 | 37 | private boolean reviewed; 38 | 39 | private BigDecimal mean; 40 | private List voteUsersEmail; 41 | 42 | public TalkAdmin() { 43 | } 44 | 45 | public TalkAdmin(Talk t) { 46 | super(t); 47 | } 48 | 49 | public TalkAdmin(Proposal p) { 50 | super(p); 51 | } 52 | 53 | public void setMean(Double mean) { 54 | if (mean == null) return; 55 | 56 | if (mean == 0) { 57 | this.mean = BigDecimal.ZERO; 58 | } else { 59 | this.mean = new BigDecimal(mean).setScale(2, RoundingMode.HALF_EVEN); 60 | } 61 | } 62 | 63 | public int getUserId() { 64 | return userId; 65 | } 66 | 67 | public void setUserId(int userId) { 68 | this.userId = userId; 69 | } 70 | 71 | public boolean isReviewed() { 72 | return reviewed; 73 | } 74 | 75 | public void setReviewed(boolean reviewed) { 76 | this.reviewed = reviewed; 77 | } 78 | 79 | public BigDecimal getMean() { 80 | return mean; 81 | } 82 | 83 | 84 | public List getVoteUsersEmail() { 85 | return voteUsersEmail; 86 | } 87 | 88 | public void setVoteUsersEmail(List voteUsersEmail) { 89 | this.voteUsersEmail = voteUsersEmail; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/dto/TalkAdminCsv.java: -------------------------------------------------------------------------------- 1 | package io.cfp.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import com.fasterxml.jackson.annotation.JsonUnwrapped; 5 | import io.cfp.dto.user.CospeakerProfil; 6 | import io.cfp.dto.user.UserProfil; 7 | 8 | import java.util.Set; 9 | 10 | /** 11 | * Allow CSV export to unwrap speaker 12 | */ 13 | public interface TalkAdminCsv { 14 | 15 | @JsonUnwrapped 16 | UserProfil getSpeaker(); 17 | 18 | @JsonIgnore 19 | Set getCospeakers(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/dto/TrackDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.dto; 22 | 23 | import io.cfp.entity.Track; 24 | 25 | public class TrackDto { 26 | private int id; 27 | private String libelle; 28 | private String description; 29 | private boolean referenced; 30 | private String color; 31 | 32 | public TrackDto() { 33 | } 34 | 35 | public TrackDto(Track track, boolean referenced) { 36 | this.id = track.getId(); 37 | this.libelle = track.getLibelle(); 38 | this.description = track.getDescription(); 39 | this.color = track.getColor(); 40 | this.referenced = referenced; 41 | } 42 | 43 | public int getId() { 44 | return id; 45 | } 46 | 47 | public void setId(int id) { 48 | this.id = id; 49 | } 50 | 51 | public String getLibelle() { 52 | return libelle; 53 | } 54 | 55 | public void setLibelle(String libelle) { 56 | this.libelle = libelle; 57 | } 58 | 59 | public String getDescription() { 60 | return description; 61 | } 62 | 63 | public void setDescription(String description) { 64 | this.description = description; 65 | } 66 | 67 | public boolean isReferenced() { 68 | return referenced; 69 | } 70 | 71 | public void setReferenced(boolean referenced) { 72 | this.referenced = referenced; 73 | } 74 | 75 | public String getColor() { 76 | return color; 77 | } 78 | 79 | public void setColor(String color) { 80 | this.color = color; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/dto/user/AdminUserDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.dto.user; 22 | 23 | import io.cfp.entity.User; 24 | 25 | public class AdminUserDTO { 26 | 27 | private String name; 28 | private String email; 29 | 30 | public AdminUserDTO() { 31 | } 32 | 33 | public AdminUserDTO(User u) { 34 | this.name = u.getFirstname() + " " +u.getLastname(); 35 | this.email = u.getEmail(); 36 | } 37 | 38 | public String getName() { 39 | return name; 40 | } 41 | 42 | public void setName(String name) { 43 | this.name = name; 44 | } 45 | 46 | public String getEmail() { 47 | return email; 48 | } 49 | 50 | public void setEmail(String email) { 51 | this.email = email; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/dto/user/CospeakerProfil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.dto.user; 22 | 23 | public class CospeakerProfil { 24 | private int id; 25 | private String email; 26 | private String lastname; 27 | private String firstname; 28 | 29 | public CospeakerProfil() { 30 | } 31 | 32 | public CospeakerProfil(String email) { 33 | this.email = email; 34 | } 35 | 36 | public int getId() { 37 | return id; 38 | } 39 | 40 | public void setId(int id) { 41 | this.id = id; 42 | } 43 | 44 | public String getEmail() { 45 | return email; 46 | } 47 | 48 | public void setEmail(String email) { 49 | this.email = email; 50 | } 51 | 52 | public String getLastname() { 53 | return lastname; 54 | } 55 | 56 | public void setLastname(String lastname) { 57 | this.lastname = lastname; 58 | } 59 | 60 | public String getFirstname() { 61 | return firstname; 62 | } 63 | 64 | public void setFirstname(String firstname) { 65 | this.firstname = firstname; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/entity/CfpConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.entity; 22 | 23 | import javax.persistence.Entity; 24 | import javax.persistence.GeneratedValue; 25 | import javax.persistence.GenerationType; 26 | import javax.persistence.Id; 27 | import javax.persistence.ManyToOne; 28 | import javax.persistence.Table; 29 | import javax.persistence.UniqueConstraint; 30 | import javax.validation.constraints.NotNull; 31 | 32 | /** 33 | * Created by lhuet on 21/11/15. 34 | */ 35 | @Entity 36 | @Table(name = "config", uniqueConstraints = @UniqueConstraint(columnNames = {"key"}) ) 37 | public class CfpConfig { 38 | private int id; 39 | private String key; 40 | private String value; 41 | private Event event; 42 | 43 | @Id 44 | @GeneratedValue(strategy = GenerationType.IDENTITY) 45 | public int getId() { 46 | return id; 47 | } 48 | 49 | @ManyToOne 50 | public Event getEvent() { 51 | return event; 52 | } 53 | 54 | public void setEvent(Event event) { 55 | this.event = event; 56 | } 57 | 58 | public void setId(int id) { 59 | this.id = id; 60 | } 61 | 62 | @NotNull 63 | public String getKey() { 64 | return key; 65 | } 66 | 67 | public void setKey(String key) { 68 | this.key = key; 69 | } 70 | 71 | public String getValue() { 72 | return value; 73 | } 74 | 75 | public void setValue(String value) { 76 | this.value = value; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/entity/Comment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.entity; 22 | 23 | import org.hibernate.annotations.Type; 24 | 25 | import javax.persistence.Entity; 26 | import javax.persistence.GeneratedValue; 27 | import javax.persistence.GenerationType; 28 | import javax.persistence.Id; 29 | import javax.persistence.JoinColumn; 30 | import javax.persistence.ManyToOne; 31 | import javax.persistence.Table; 32 | import javax.validation.constraints.NotNull; 33 | import java.util.Date; 34 | 35 | /** 36 | * Comment on a talk 37 | */ 38 | @Entity 39 | @Table(name = "comments") 40 | public class Comment { 41 | 42 | private int id; 43 | private String comment; 44 | private Date added; 45 | private boolean internal; 46 | 47 | private Talk talk; 48 | private User user; 49 | private Event event; 50 | 51 | @Id 52 | @GeneratedValue(strategy = GenerationType.IDENTITY) 53 | public int getId() { 54 | return id; 55 | } 56 | 57 | @ManyToOne 58 | public Event getEvent() { 59 | return event; 60 | } 61 | 62 | public void setEvent(Event event) { 63 | this.event = event; 64 | } 65 | 66 | @NotNull 67 | @Type(type="text") 68 | public String getComment() { 69 | return comment; 70 | } 71 | 72 | @NotNull 73 | public Date getAdded() { 74 | return added; 75 | } 76 | 77 | public boolean isInternal() { 78 | return internal; 79 | } 80 | 81 | @ManyToOne 82 | @JoinColumn(name = "proposal") 83 | public Talk getTalk() { 84 | return talk; 85 | } 86 | 87 | @ManyToOne 88 | @JoinColumn(name = "user") 89 | public User getUser() { 90 | return user; 91 | } 92 | 93 | 94 | public void setId(int id) { 95 | this.id = id; 96 | } 97 | 98 | public void setComment(String comment) { 99 | this.comment = comment; 100 | } 101 | 102 | public void setAdded(Date added) { 103 | this.added = added; 104 | } 105 | 106 | public void setInternal(boolean internal) { 107 | this.internal = internal; 108 | } 109 | 110 | public void setTalk(Talk talk) { 111 | this.talk = talk; 112 | } 113 | 114 | public void setUser(User user) { 115 | this.user = user; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/entity/Event.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.entity; 22 | 23 | import lombok.AllArgsConstructor; 24 | import lombok.Builder; 25 | import lombok.Data; 26 | import lombok.NoArgsConstructor; 27 | import org.hibernate.annotations.Type; 28 | import org.slf4j.Logger; 29 | import org.slf4j.LoggerFactory; 30 | 31 | import javax.persistence.Column; 32 | import javax.persistence.Entity; 33 | import javax.persistence.Id; 34 | import javax.persistence.Table; 35 | import java.util.Date; 36 | 37 | /** 38 | * @author Nicolas De Loof 39 | */ 40 | @Entity 41 | @Table(name = "events") 42 | @Data @Builder(toBuilder = true) @NoArgsConstructor @AllArgsConstructor 43 | public class Event { 44 | private static final Logger logger = LoggerFactory.getLogger(Event.class); 45 | 46 | private static ThreadLocal current = new ThreadLocal(); 47 | 48 | @Deprecated 49 | public static String current() { 50 | String s = current.get(); 51 | if (s == null) { 52 | logger.warn("current event is not set. Falling back to 'demo'"); 53 | s = "demo"; 54 | } 55 | return s ; 56 | } 57 | 58 | @Id 59 | private String id; 60 | 61 | private String name; 62 | 63 | @Column(name = "short_description") 64 | private String shortDescription; 65 | 66 | private boolean published; 67 | 68 | private String url; 69 | 70 | private String logoUrl; 71 | 72 | private String videosUrl; 73 | 74 | private String contactMail; 75 | 76 | @Type(type="date") 77 | private Date date; 78 | 79 | private int duration; 80 | 81 | @Type(type="date") 82 | private Date releaseDate; 83 | 84 | @Type(type="date") 85 | private Date decisionDate; 86 | 87 | private boolean open = true; 88 | 89 | public static void setCurrent(String tenant) { 90 | current.set(tenant); 91 | } 92 | 93 | public static void unsetCurrent() { 94 | current.remove(); 95 | } 96 | 97 | 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/entity/Role.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2016, CloudBees, Inc. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | package io.cfp.entity; 27 | 28 | import javax.persistence.*; 29 | import javax.validation.constraints.NotNull; 30 | 31 | /** 32 | * @author Nicolas De Loof 33 | */ 34 | @Entity 35 | @Table(name = "roles") 36 | public class Role { 37 | 38 | private int id; 39 | private String name; 40 | private User user; 41 | private Event event; 42 | 43 | @Id 44 | @GeneratedValue(strategy = GenerationType.IDENTITY) 45 | public int getId() { 46 | return id; 47 | } 48 | 49 | @NotNull 50 | public String getName() { 51 | return name; 52 | } 53 | 54 | @ManyToOne 55 | public User getUser() { 56 | return user; 57 | } 58 | 59 | @ManyToOne 60 | public Event getEvent() { 61 | return event; 62 | } 63 | 64 | public void setId(int id) { 65 | this.id = id; 66 | } 67 | 68 | public void setName(String name) { 69 | this.name = name; 70 | } 71 | 72 | public void setEvent(Event event) { 73 | this.event = event; 74 | } 75 | 76 | public void setUser(User user) { 77 | this.user = user; 78 | } 79 | 80 | public static final String MAINTAINER = "ROLE_MAINTAINER"; 81 | public static final String OWNER = "ROLE_OWNER"; 82 | public static final String ADMIN = "ROLE_ADMIN"; 83 | public static final String REVIEWER = "ROLE_REVIEWER"; 84 | public static final String AUTHENTICATED = "ROLE_AUTHENTICATED"; 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/entity/Room.java: -------------------------------------------------------------------------------- 1 | package io.cfp.entity; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.GeneratedValue; 5 | import javax.persistence.GenerationType; 6 | import javax.persistence.Id; 7 | import javax.persistence.ManyToOne; 8 | import javax.persistence.Table; 9 | import javax.validation.constraints.NotNull; 10 | 11 | /** 12 | * @author Nicolas De Loof 13 | */ 14 | @Entity 15 | @Table(name = "rooms") 16 | public class Room { 17 | 18 | private int id; 19 | private String name; 20 | private Event event; 21 | 22 | 23 | @Id 24 | @GeneratedValue(strategy = GenerationType.IDENTITY) 25 | public int getId() { 26 | return id; 27 | } 28 | 29 | @ManyToOne 30 | public Event getEvent() { 31 | return event; 32 | } 33 | 34 | @NotNull(message = "Room name is required") 35 | public String getName() { 36 | return name; 37 | } 38 | 39 | public void setId(int id) { 40 | this.id = id; 41 | } 42 | 43 | public void setEvent(Event event) { 44 | this.event = event; 45 | } 46 | 47 | public void setName(String name) { 48 | this.name = name; 49 | } 50 | 51 | public Room withName(String name) { 52 | this.name = name; 53 | return this; 54 | } 55 | 56 | public Room withEvent(Event event) { 57 | this.event = event; 58 | return this; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/entity/Track.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.entity; 22 | 23 | import javax.persistence.Entity; 24 | import javax.persistence.GeneratedValue; 25 | import javax.persistence.GenerationType; 26 | import javax.persistence.Id; 27 | import javax.persistence.ManyToOne; 28 | import javax.persistence.Table; 29 | import javax.validation.constraints.NotNull; 30 | 31 | import org.hibernate.annotations.Type; 32 | 33 | /** 34 | * Created by SGUERNIO on 29/11/2015. 35 | */ 36 | @Entity 37 | @Table(name = "tracks") 38 | public class Track { 39 | 40 | private int id; 41 | private String libelle; 42 | private String description; 43 | private String color; 44 | private Event event; 45 | 46 | @Id 47 | @GeneratedValue(strategy = GenerationType.IDENTITY) 48 | public int getId() { 49 | return id; 50 | } 51 | 52 | @ManyToOne 53 | public Event getEvent() { 54 | return event; 55 | } 56 | 57 | public void setEvent(Event event) { 58 | this.event = event; 59 | } 60 | 61 | public void setId(int id) { 62 | this.id = id; 63 | } 64 | 65 | @NotNull 66 | public String getLibelle() { 67 | return libelle; 68 | } 69 | 70 | public void setLibelle(String libelle) { 71 | this.libelle = libelle; 72 | } 73 | 74 | @Type(type="text") 75 | public String getDescription() { 76 | return description; 77 | } 78 | 79 | public void setDescription(String description) { 80 | this.description = description; 81 | } 82 | 83 | public String getColor() { 84 | return color; 85 | } 86 | 87 | public void setColor(String color) { 88 | this.color = color; 89 | } 90 | 91 | public Track id(int id) { 92 | this.id = id; 93 | return this; 94 | } 95 | 96 | public Track libelle(String libelle) { 97 | this.libelle = libelle; 98 | return this; 99 | } 100 | 101 | public Track description(String description) { 102 | this.description = description; 103 | return this; 104 | } 105 | 106 | public Track color(String color) { 107 | this.color = color; 108 | return this; 109 | } 110 | 111 | public Track event(Event event) { 112 | this.event = event; 113 | return this; 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/mapper/CoSpeakerMapper.java: -------------------------------------------------------------------------------- 1 | package io.cfp.mapper; 2 | 3 | import org.apache.ibatis.annotations.Mapper; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | /** 7 | * @author Nicolas De Loof 8 | */ 9 | @Mapper 10 | public interface CoSpeakerMapper { 11 | 12 | void insert(@Param("proposal") int proposal, @Param("user") int user); 13 | 14 | void delete(@Param("proposal") int id); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/mapper/CommentMapper.java: -------------------------------------------------------------------------------- 1 | package io.cfp.mapper; 2 | 3 | import io.cfp.model.Comment; 4 | import io.cfp.model.Proposal; 5 | import io.cfp.model.queries.CommentQuery; 6 | import org.apache.ibatis.annotations.Mapper; 7 | import org.apache.ibatis.annotations.Param; 8 | 9 | import java.util.Collection; 10 | 11 | 12 | @Mapper 13 | public interface CommentMapper { 14 | 15 | Collection findAll(CommentQuery query); 16 | 17 | Comment findById(@Param("id") int id, @Param("eventId") String eventId); 18 | 19 | int insert(Comment comment); 20 | 21 | int update(Comment comment); 22 | 23 | int delete(Comment comment); 24 | 25 | void updateEventId(@Param("id") int id, @Param("eventId") String eventId); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/mapper/EventMapper.java: -------------------------------------------------------------------------------- 1 | package io.cfp.mapper; 2 | 3 | import io.cfp.model.Event; 4 | import io.cfp.model.queries.EventQuery; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @author Nicolas De Loof 12 | */ 13 | @Mapper 14 | public interface EventMapper { 15 | 16 | List findOpen(); 17 | 18 | List findPassed(); 19 | 20 | List findByUser(int user); 21 | 22 | List findAll(EventQuery eventQuery); 23 | 24 | boolean exists(String id); 25 | 26 | int insert(Event event); 27 | 28 | Event findOne(String eventId); 29 | 30 | void update(@Param("it") Event event); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/mapper/FormatMapper.java: -------------------------------------------------------------------------------- 1 | package io.cfp.mapper; 2 | 3 | import io.cfp.model.Format; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | 10 | /** 11 | * @author Nicolas De Loof 12 | */ 13 | @Mapper 14 | public interface FormatMapper { 15 | 16 | List findByEvent(String eventId); 17 | 18 | Format findById(int id); 19 | 20 | void insert(Format format); 21 | 22 | void updateForEvent(@Param("it") Format format, @Param("eventId") String eventId); 23 | 24 | void updateEventId(@Param("id") int id, @Param("eventId") String eventId); 25 | 26 | void deleteForEvent(@Param("id") int id, @Param("eventId") String eventId); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/mapper/ProposalMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.mapper; 22 | 23 | import io.cfp.model.Proposal; 24 | import io.cfp.model.queries.ProposalQuery; 25 | import org.apache.ibatis.annotations.Mapper; 26 | import org.apache.ibatis.annotations.Param; 27 | 28 | import java.util.List; 29 | 30 | @Mapper 31 | public interface ProposalMapper { 32 | 33 | List findAll(ProposalQuery proposalQuery); 34 | Proposal findById(@Param("id") int id, @Param("eventId") String eventId); 35 | int insert(Proposal proposal); 36 | int updateForEvent(@Param("it") Proposal proposal, @Param("eventId") String eventId, @Param("userId") Integer userId); 37 | int deleteForEvent(@Param("id") int id, @Param("eventId") String eventId); 38 | int updateState(Proposal proposal); 39 | 40 | int updateAllStateWhere(@Param("eventId") String event, @Param("newState") Proposal.State refused, @Param("oldState") Proposal.State confirmed); 41 | 42 | int count(ProposalQuery proposalQuery); 43 | int countSubmissionsByEventId(@Param("eventId") String eventId); 44 | 45 | int deleteAllByEventId(String event); 46 | 47 | void updateEventId(@Param("id") int id, @Param("eventId") String eventId); 48 | 49 | int updateSchedule(Proposal proposal); 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/mapper/RateMapper.java: -------------------------------------------------------------------------------- 1 | package io.cfp.mapper; 2 | 3 | import io.cfp.model.Rate; 4 | import io.cfp.model.Stat; 5 | import io.cfp.model.queries.RateQuery; 6 | import org.apache.ibatis.annotations.Mapper; 7 | import org.apache.ibatis.annotations.Param; 8 | 9 | import java.util.List; 10 | 11 | 12 | @Mapper 13 | public interface RateMapper { 14 | 15 | 16 | List findAll(RateQuery rateQuery); 17 | List findAllWithTalk(@Param("eventId") String eventId); 18 | 19 | 20 | Rate findMyRate(@Param("proposalId") int proposalId, @Param("user") int userId, @Param("eventId") String eventId); 21 | int insert(Rate rate); 22 | int update(Rate rate); 23 | int deleteForEvent(@Param("id") int id, @Param("eventId") String eventId); 24 | int deleteAllForEvent(@Param("eventId") String eventId); 25 | 26 | 27 | List getRateByEmailUsers(String eventId); 28 | 29 | void updateEventId(@Param("id") int id, @Param("eventId") String eventId); 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package io.cfp.mapper; 2 | 3 | import io.cfp.model.Role; 4 | import io.cfp.model.queries.RoleQuery; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @author Nicolas De Loof 12 | */ 13 | @Mapper 14 | public interface RoleMapper { 15 | 16 | int insert(Role role); 17 | int delete(Role role); 18 | List findAll(RoleQuery roleQuery); 19 | 20 | void updateEventId(@Param("id") int id, @Param("eventId") String eventId); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/mapper/RoomMapper.java: -------------------------------------------------------------------------------- 1 | package io.cfp.mapper; 2 | 3 | import io.cfp.model.Room; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author Nicolas De Loof 11 | */ 12 | @Mapper 13 | public interface RoomMapper { 14 | 15 | List findByEvent(String eventId); 16 | 17 | Room findById(int id); 18 | 19 | void insert(Room room); 20 | 21 | void updateForEvent(@Param("it") Room room, @Param("eventId") String eventId); 22 | 23 | void updateEventId(@Param("id") int id, @Param("eventId") String eventId); 24 | 25 | void deleteForEvent(@Param("id") int id, @Param("eventId") String eventId); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/mapper/ThemeMapper.java: -------------------------------------------------------------------------------- 1 | package io.cfp.mapper; 2 | 3 | import io.cfp.model.Stat; 4 | import io.cfp.model.Theme; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | 11 | /** 12 | * @author Nicolas De Loof 13 | */ 14 | @Mapper 15 | public interface ThemeMapper { 16 | 17 | List findByEvent(String eventId); 18 | 19 | void insert(Theme theme); 20 | 21 | int updateForEvent(@Param("it") Theme theme, @Param("eventId") String eventId); 22 | 23 | void updateEventId(@Param("id") int id, @Param("eventId") String eventId); 24 | 25 | int deleteForEvent(@Param("id") int id, @Param("eventId") String eventId); 26 | 27 | List countProposalsByThemeAndState(@Param("eventId") String eventId, @Param("state") String state); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/mapper/TrackMapper.java: -------------------------------------------------------------------------------- 1 | package io.cfp.mapper; 2 | 3 | public interface TrackMapper { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package io.cfp.mapper; 2 | 3 | import io.cfp.model.User; 4 | import io.cfp.model.queries.UserQuery; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | @Mapper 11 | public interface UserMapper { 12 | 13 | List findAll(UserQuery userQuery); 14 | User findById(User user); 15 | int update(User user); 16 | int delete(User user); 17 | 18 | boolean exists(String email); 19 | 20 | int insert(User user); 21 | 22 | User findByEmail(@Param("email") String email); 23 | List findEmailByRole(@Param("role") String role, @Param("eventId") String eventId); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/model/Comment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.model; 22 | 23 | import com.fasterxml.jackson.annotation.JsonInclude; 24 | import lombok.Data; 25 | import lombok.NoArgsConstructor; 26 | import lombok.experimental.Accessors; 27 | 28 | import javax.validation.constraints.NotNull; 29 | import java.util.Date; 30 | 31 | @Data 32 | @NoArgsConstructor 33 | @Accessors(chain = true) 34 | @JsonInclude(JsonInclude.Include.NON_NULL) 35 | public class Comment { 36 | 37 | private int id; 38 | @NotNull 39 | private String comment; 40 | @NotNull 41 | private Date added; 42 | private boolean internal; 43 | 44 | private User user; 45 | private String eventId; 46 | private int proposalId; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/model/Event.java: -------------------------------------------------------------------------------- 1 | package io.cfp.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.experimental.Accessors; 7 | 8 | import java.util.Date; 9 | 10 | /** 11 | * @author Nicolas De Loof 12 | */ 13 | @Data @NoArgsConstructor @AllArgsConstructor @Accessors(chain = true) 14 | public class Event { 15 | 16 | private String id; 17 | 18 | private String name; 19 | 20 | private String shortDescription; 21 | 22 | private boolean published; 23 | 24 | private String url; 25 | 26 | private String logoUrl; 27 | 28 | private String videosUrl; 29 | 30 | private String contactMail; 31 | 32 | private Date date; 33 | 34 | private int duration; 35 | 36 | private Date releaseDate; 37 | 38 | private Date decisionDate; 39 | 40 | private boolean open = true; 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/model/Format.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.model; 22 | 23 | import com.fasterxml.jackson.annotation.JsonInclude; 24 | import lombok.Data; 25 | import lombok.NoArgsConstructor; 26 | import lombok.experimental.Accessors; 27 | 28 | @Data 29 | @NoArgsConstructor 30 | @Accessors(chain = true) 31 | @JsonInclude(JsonInclude.Include.NON_NULL) 32 | public class Format { 33 | 34 | private int id; 35 | private String name; 36 | private int duration; 37 | private String description; 38 | private String icon; 39 | private String event; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/model/FullCalendar.java: -------------------------------------------------------------------------------- 1 | package io.cfp.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.time.format.DateTimeFormatter; 8 | import java.time.temporal.ChronoUnit; 9 | import java.util.List; 10 | import java.util.stream.Collectors; 11 | 12 | @Data @NoArgsConstructor 13 | public class FullCalendar { 14 | 15 | private List resources; 16 | 17 | private List events; 18 | 19 | 20 | public FullCalendar(List talks, List rooms, List formats, List themes) { 21 | 22 | resources = rooms.stream() 23 | .map(Resource::new) 24 | .collect(Collectors.toList()); 25 | 26 | events = talks.stream() 27 | .filter(t -> t.getSchedule() != null && t.getRoomId() != null) 28 | .map(p -> { 29 | 30 | Format format = formats.stream() 31 | .filter(f -> f.getId() == p.getFormat()) 32 | .findFirst() 33 | .orElse(new Format()); 34 | 35 | Theme theme = themes.stream() 36 | .filter(th -> th.getId() == p.getTrackId()) 37 | .findFirst() 38 | .orElse(new Theme()); 39 | 40 | Event event = new Event(p, format, theme); 41 | return event; 42 | }) 43 | .collect(Collectors.toList()); 44 | } 45 | 46 | @Data @NoArgsConstructor 47 | @JsonInclude(JsonInclude.Include.NON_NULL) 48 | public static class Resource { 49 | private String id; 50 | private String title; 51 | 52 | public Resource(Room r) { 53 | this.id = String.valueOf(r.getId()); 54 | this.title = r.getName(); 55 | } 56 | } 57 | 58 | @Data @NoArgsConstructor 59 | @JsonInclude(JsonInclude.Include.NON_NULL) 60 | public static class Event { 61 | private String id; 62 | private String resourceId; 63 | private String start; 64 | private int duration; 65 | private String end; 66 | private String color; 67 | private String format; 68 | private String icon; 69 | private String title; 70 | private String slides; 71 | private String videos; 72 | 73 | public Event(Proposal proposal, Format format, Theme theme) { 74 | this.id = String.valueOf(proposal.getId()); 75 | this.title = proposal.getName(); 76 | this.resourceId = String.valueOf(proposal.getRoomId()); 77 | if (proposal.getSchedule() != null) { 78 | this.start = DateTimeFormatter.ISO_INSTANT.format(proposal.getSchedule().toInstant()); 79 | this.end = DateTimeFormatter.ISO_INSTANT.format(proposal.getSchedule().toInstant().plus(format.getDuration(), ChronoUnit.MINUTES)); 80 | } 81 | this.color = theme.getColor(); 82 | this.format = format.getName(); 83 | this.icon = format.getIcon(); 84 | this.duration = format.getDuration(); 85 | this.slides = proposal.getSlides(); 86 | this.videos = proposal.getVideo(); 87 | } 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/model/Proposal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.model; 22 | 23 | import com.fasterxml.jackson.annotation.JsonIgnore; 24 | import com.fasterxml.jackson.annotation.JsonInclude; 25 | import lombok.Data; 26 | import lombok.NoArgsConstructor; 27 | import lombok.experimental.Accessors; 28 | 29 | import javax.validation.constraints.NotNull; 30 | import java.util.*; 31 | import java.util.stream.Collectors; 32 | 33 | import static org.apache.commons.collections4.CollectionUtils.isNotEmpty; 34 | 35 | @Data 36 | @NoArgsConstructor 37 | @Accessors(chain = true) 38 | @JsonInclude(JsonInclude.Include.NON_NULL) 39 | public class Proposal { 40 | 41 | public static final List AUTHORIZED_SORTS = Arrays.asList("state", "name", "language", "tracklabel", "difficulty", "added"); 42 | 43 | public enum State { DRAFT, CONFIRMED, PRESENT, ACCEPTED, REFUSED, BACKUP } 44 | 45 | private int id; 46 | private State state; 47 | @NotNull(message = "Session name field is required") 48 | private String name; 49 | private String language; 50 | private String eventId; 51 | private Integer trackId; 52 | private String trackLabel; 53 | private String description; 54 | private String references; 55 | private Integer difficulty; 56 | private Date added; 57 | private Integer format; 58 | private String formatName; 59 | private User speaker; 60 | 61 | private Date schedule; 62 | private String scheduleHour; 63 | private Integer roomId; 64 | 65 | private Set cospeakers = new HashSet<>(); 66 | 67 | private String video; 68 | private String slides; 69 | 70 | private List voteUsersEmail; 71 | private String mean; 72 | 73 | 74 | public String buildSpeakersList() { 75 | String res = this.getSpeaker().getFullName(); 76 | if (isNotEmpty(this.getCospeakers())) { 77 | for (User user : this.getCospeakers()) { 78 | res += ", " + user.getFullName(); 79 | } 80 | } 81 | return res; 82 | } 83 | 84 | @JsonIgnore 85 | public Set getSpeakersIds() { 86 | Set speakersIds = new HashSet<>(); 87 | speakersIds.add(this.getSpeaker().getId()); 88 | speakersIds.addAll(this.getCospeakers().stream().map(User::getId).collect(Collectors.toSet())); 89 | return speakersIds; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/model/Rate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.model; 22 | 23 | import lombok.Data; 24 | import lombok.NoArgsConstructor; 25 | import lombok.experimental.Accessors; 26 | 27 | import javax.validation.constraints.Max; 28 | import javax.validation.constraints.Min; 29 | import javax.validation.constraints.NotNull; 30 | import java.util.Date; 31 | 32 | @Data 33 | @NoArgsConstructor 34 | @Accessors(chain = true) 35 | public class Rate { 36 | 37 | private int id; 38 | @Max(5) 39 | @Min(0) 40 | @NotNull 41 | private int rate; 42 | private Date added; 43 | private boolean love; 44 | private boolean hate; 45 | 46 | private Proposal talk; 47 | private User user; 48 | private String eventId; 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/model/Role.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.model; 22 | 23 | import lombok.AllArgsConstructor; 24 | import lombok.Data; 25 | import lombok.NoArgsConstructor; 26 | import lombok.experimental.Accessors; 27 | 28 | @Data 29 | @NoArgsConstructor 30 | @AllArgsConstructor 31 | @Accessors(chain = true) 32 | public class Role { 33 | 34 | public static final String MAINTAINER = "ROLE_MAINTAINER"; 35 | public static final String OWNER = "ROLE_OWNER"; 36 | public static final String ADMIN = "ROLE_ADMIN"; 37 | public static final String REVIEWER = "ROLE_REVIEWER"; 38 | public static final String AUTHENTICATED = "ROLE_AUTHENTICATED"; 39 | 40 | private int id; 41 | private String name; 42 | private int user; 43 | private String event; 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/model/Room.java: -------------------------------------------------------------------------------- 1 | package io.cfp.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import io.cfp.entity.Event; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | 9 | import javax.persistence.ManyToOne; 10 | import javax.validation.constraints.NotNull; 11 | 12 | @Data 13 | @NoArgsConstructor 14 | @Accessors(chain = true) 15 | @JsonInclude(JsonInclude.Include.NON_NULL) 16 | public class Room { 17 | 18 | private int id; 19 | private String name; 20 | private String event; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/model/Stat.java: -------------------------------------------------------------------------------- 1 | package io.cfp.model; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | import lombok.experimental.Accessors; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @Accessors(chain = true) 10 | public class Stat { 11 | private String name; 12 | private Long count; 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/model/Theme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.model; 22 | 23 | import com.fasterxml.jackson.annotation.JsonInclude; 24 | import io.cfp.entity.Event; 25 | import lombok.Data; 26 | import lombok.NoArgsConstructor; 27 | import lombok.experimental.Accessors; 28 | import org.hibernate.annotations.Type; 29 | 30 | import javax.persistence.Entity; 31 | import javax.persistence.GeneratedValue; 32 | import javax.persistence.GenerationType; 33 | import javax.persistence.Id; 34 | import javax.persistence.ManyToOne; 35 | import javax.persistence.Table; 36 | import javax.validation.constraints.NotNull; 37 | 38 | @Data 39 | @NoArgsConstructor 40 | @Accessors(chain = true) 41 | @JsonInclude(JsonInclude.Include.NON_NULL) 42 | public class Theme { 43 | 44 | private int id; 45 | private String libelle; 46 | private String description; 47 | private String color; 48 | private String event; 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/model/queries/CommentQuery.java: -------------------------------------------------------------------------------- 1 | package io.cfp.model.queries; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | @Data @Accessors(chain = true) 7 | public class CommentQuery { 8 | 9 | private String eventId; 10 | private int proposalId; 11 | private Boolean internal; 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/model/queries/EventQuery.java: -------------------------------------------------------------------------------- 1 | package io.cfp.model.queries; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | @Data @Accessors(chain = true) 7 | public class EventQuery { 8 | 9 | private int user; 10 | private boolean open; 11 | private boolean passed; 12 | private String name; 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/model/queries/ProposalQuery.java: -------------------------------------------------------------------------------- 1 | package io.cfp.model.queries; 2 | 3 | import io.cfp.model.Proposal; 4 | import lombok.Data; 5 | import lombok.experimental.Accessors; 6 | 7 | import java.util.ArrayList; 8 | import java.util.Arrays; 9 | import java.util.List; 10 | 11 | @Data 12 | @Accessors(chain = true) 13 | public class ProposalQuery { 14 | 15 | private String eventId; 16 | private Integer userId; 17 | private List states = new ArrayList<>(); 18 | private String track; 19 | private String room; 20 | private String format; 21 | private List sort = new ArrayList<>(); 22 | private String order; 23 | 24 | public ProposalQuery addStates(Proposal.State... states) { 25 | this.states.addAll(Arrays.asList(states)); 26 | return this; 27 | } 28 | 29 | public ProposalQuery addSort(String... sort) { 30 | this.sort.addAll(Arrays.asList(sort)); 31 | return this; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/model/queries/RateQuery.java: -------------------------------------------------------------------------------- 1 | package io.cfp.model.queries; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | @Data @Accessors(chain = true) 7 | public class RateQuery { 8 | 9 | private String eventId; 10 | private int proposalId; 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/model/queries/RoleQuery.java: -------------------------------------------------------------------------------- 1 | package io.cfp.model.queries; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | @Data 7 | @Accessors(chain = true) 8 | public class RoleQuery { 9 | 10 | private int userId; 11 | private String eventId; 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/model/queries/UserQuery.java: -------------------------------------------------------------------------------- 1 | package io.cfp.model.queries; 2 | 3 | import io.cfp.model.Proposal; 4 | import lombok.Data; 5 | import lombok.experimental.Accessors; 6 | 7 | import java.util.ArrayList; 8 | import java.util.Arrays; 9 | import java.util.List; 10 | 11 | @Data @Accessors(chain = true) 12 | public class UserQuery { 13 | 14 | private String email; 15 | private List states = new ArrayList<>(); 16 | private String eventId; 17 | private List sort = new ArrayList<>(); 18 | private String order; 19 | 20 | public UserQuery addState(Proposal.State... states) { 21 | this.states.addAll(Arrays.asList(states)); 22 | return this; 23 | } 24 | 25 | public UserQuery addSort(String... sort) { 26 | this.sort.addAll(Arrays.asList(sort)); 27 | return this; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/multitenant/TenantId.java: -------------------------------------------------------------------------------- 1 | package io.cfp.multitenant; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * @author Nicolas De Loof 11 | */ 12 | @Target({ ElementType.PARAMETER, ElementType.ANNOTATION_TYPE }) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Documented 15 | public @interface TenantId { 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/multitenant/TenantIdHandlerMethodArgumentResolver.java: -------------------------------------------------------------------------------- 1 | package io.cfp.multitenant; 2 | 3 | import org.springframework.core.MethodParameter; 4 | import org.springframework.web.bind.support.WebDataBinderFactory; 5 | import org.springframework.web.context.request.NativeWebRequest; 6 | import org.springframework.web.context.request.RequestAttributes; 7 | import org.springframework.web.method.support.HandlerMethodArgumentResolver; 8 | import org.springframework.web.method.support.ModelAndViewContainer; 9 | 10 | import java.lang.annotation.Annotation; 11 | 12 | /** 13 | * @author Nicolas De Loof 14 | */ 15 | public class TenantIdHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver { 16 | 17 | @Override 18 | public boolean supportsParameter(MethodParameter parameter) { 19 | Annotation annotation = parameter.getParameterAnnotation(TenantId.class); 20 | return (annotation != null); 21 | } 22 | 23 | @Override 24 | public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer model, NativeWebRequest request, WebDataBinderFactory factory) throws Exception { 25 | return request.getAttribute("tenantId", RequestAttributes.SCOPE_REQUEST); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/repository/TalkRepo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.repository; 22 | 23 | import io.cfp.entity.Talk; 24 | import org.springframework.data.jpa.repository.JpaRepository; 25 | import org.springframework.data.jpa.repository.Query; 26 | import org.springframework.data.repository.query.Param; 27 | 28 | import java.util.Collection; 29 | import java.util.List; 30 | 31 | public interface TalkRepo extends JpaRepository { 32 | 33 | Talk findByIdAndEventId(int integer, String eventId); 34 | 35 | List findByEventIdAndUserIdAndStateIn(String eventId, int userId, Collection states); 36 | 37 | int countByEventIdAndUserId(String eventId, int userId); 38 | 39 | @Query("SELECT t FROM Talk t JOIN FETCH t.cospeakers c WHERE t.event.id = :eventId AND c.id = :userId AND t.id = :talkId") 40 | Talk findByIdAndEventIdAndCospeakers(@Param("talkId") int talkId, @Param("eventId") String eventId, @Param("userId") int userId); 41 | 42 | @Query("SELECT t FROM Talk t JOIN FETCH t.cospeakers c WHERE t.event.id = :eventId AND c.id = :userId AND t.state IN (:states)") 43 | List findByEventIdAndCospeakerIdAndStateIn(@Param("eventId") String eventId, @Param("userId") int userId, @Param("states") Collection states); 44 | 45 | @Query("SELECT DISTINCT t FROM Talk t " + 46 | "JOIN FETCH t.user " + 47 | "JOIN FETCH t.format " + 48 | "JOIN FETCH t.track " + 49 | "LEFT JOIN FETCH t.cospeakers " + 50 | "WHERE t.event.id = :eventId " + 51 | "AND t.state IN (:states) " + 52 | "order by t.id") 53 | List findByEventIdAndStatesFetch(@Param("eventId") String eventId, @Param("states") Collection states); 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/service/GravatarUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.service; 22 | 23 | 24 | import io.cfp.service.auth.MD5Utils; 25 | 26 | public final class GravatarUtils { 27 | 28 | public static String getImageURL(String email) { 29 | String hash = MD5Utils.md5Hex(email); 30 | 31 | return "https://www.gravatar.com/avatar/".concat(hash).concat("?s=250"); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/service/admin/config/ApplicationConfigService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.service.admin.config; 22 | 23 | import io.cfp.mapper.EventMapper; 24 | import org.springframework.beans.factory.annotation.Autowired; 25 | import org.springframework.beans.factory.annotation.Value; 26 | import org.springframework.stereotype.Service; 27 | import org.springframework.transaction.annotation.Transactional; 28 | 29 | /** 30 | * Created by lhuet on 21/11/15. 31 | */ 32 | @Service 33 | public class ApplicationConfigService { 34 | 35 | @Value("${authServer}") 36 | private String authServer; 37 | 38 | @Autowired 39 | private EventMapper eventMapper; 40 | 41 | @Transactional 42 | public void openCfp(String eventId) { 43 | io.cfp.model.Event event = eventMapper.findOne(eventId); 44 | event.setOpen(true); 45 | eventMapper.update(event); 46 | } 47 | 48 | @Transactional 49 | public void closeCfp(String eventId) { 50 | io.cfp.model.Event event = eventMapper.findOne(eventId); 51 | event.setOpen(false); 52 | eventMapper.update(event); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/service/auth/MD5Utils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.service.auth; 22 | 23 | import java.io.UnsupportedEncodingException; 24 | import java.security.MessageDigest; 25 | import java.security.NoSuchAlgorithmException; 26 | 27 | public class MD5Utils { 28 | public static String hex(byte[] array) { 29 | StringBuffer sb = new StringBuffer(); 30 | for (int i = 0; i < array.length; ++i) { 31 | sb.append(Integer.toHexString((array[i] 32 | & 0xFF) | 0x100).substring(1,3)); 33 | } 34 | return sb.toString(); 35 | } 36 | public static String md5Hex (String message) { 37 | try { 38 | MessageDigest md = 39 | MessageDigest.getInstance("MD5"); 40 | return hex (md.digest(message.getBytes("CP1252"))); 41 | } catch (NoSuchAlgorithmException e) { 42 | } catch (UnsupportedEncodingException e) { 43 | } 44 | return null; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/io/cfp/service/user/SecurityUserService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.service.user; 22 | 23 | import io.cfp.entity.Event; 24 | import io.cfp.mapper.RoleMapper; 25 | import io.cfp.mapper.UserMapper; 26 | import io.cfp.model.Role; 27 | import io.cfp.model.User; 28 | import io.cfp.model.queries.RoleQuery; 29 | import org.slf4j.Logger; 30 | import org.slf4j.LoggerFactory; 31 | import org.springframework.beans.factory.annotation.Autowired; 32 | import org.springframework.security.core.GrantedAuthority; 33 | import org.springframework.security.core.authority.SimpleGrantedAuthority; 34 | import org.springframework.security.core.userdetails.UserDetails; 35 | import org.springframework.security.core.userdetails.UserDetailsService; 36 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 37 | import org.springframework.stereotype.Service; 38 | import org.springframework.transaction.annotation.Transactional; 39 | 40 | import java.util.List; 41 | import java.util.Optional; 42 | import java.util.stream.Collectors; 43 | 44 | @Service 45 | @Transactional(readOnly = true) 46 | public class SecurityUserService implements UserDetailsService { 47 | 48 | private static final Logger LOGGER = LoggerFactory.getLogger(SecurityUserService.class); 49 | 50 | @Autowired 51 | private UserMapper userMapper; 52 | 53 | @Autowired 54 | private RoleMapper roleMapper; 55 | 56 | @Override 57 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 58 | LOGGER.debug("Authenticating {}", username); 59 | String lowercaseLogin = username.toLowerCase(); 60 | Optional userFromDatabase = Optional.ofNullable(userMapper.findByEmail(lowercaseLogin)); 61 | return userFromDatabase.map(user -> { 62 | List roles = roleMapper.findAll(new RoleQuery().setEventId(Event.current()).setUserId(user.getId())); 63 | List grantedAuthorities = roles.stream() 64 | .map(role -> new SimpleGrantedAuthority(role.getName())) 65 | .collect(Collectors.toList()); 66 | return new org.springframework.security.core.userdetails.User(lowercaseLogin, "****", grantedAuthorities); 67 | }).orElseThrow(() -> new UsernameNotFoundException("User " + lowercaseLogin + " was not found in the " + "database")); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/spring-devtools.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016 BreizhCamp 3 | # [http://breizhcamp.org] 4 | # 5 | # This file is part of CFP.io. 6 | # 7 | # CFP.io is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Affero General Public License as 9 | # published by the Free Software Foundation, either version 3 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Affero General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Affero General Public License 18 | # along with this program. If not, see . 19 | # 20 | 21 | restart.include.orika=/orika-core-[\\w-.]+\\.jar 22 | -------------------------------------------------------------------------------- /src/main/resources/changelog/changelog-master.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/main/resources/config/application-prod.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016 BreizhCamp 3 | # [http://breizhcamp.org] 4 | # 5 | # This file is part of CFP.io. 6 | # 7 | # CFP.io is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Affero General Public License as 9 | # published by the Free Software Foundation, either version 3 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Affero General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Affero General Public License 18 | # along with this program. If not, see . 19 | # 20 | 21 | server.port=8080 22 | 23 | cfp.app.hostname=https://{{event}}.cfp.io 24 | authServer=https://auth.cfp.io 25 | 26 | # outbound email 27 | spring.mail.host=smtp.sendgrid.net 28 | spring.mail.port=2525 29 | 30 | # disable mostly everything by default 31 | endpoints.enabled=false 32 | endpoints.health.enabled=true 33 | 34 | #spring.jpa.hibernate.format_sql=true 35 | 36 | #logging.level.org.hibernate.SQL=DEBUG 37 | #logging.level.org.hibernate.type=trace 38 | -------------------------------------------------------------------------------- /src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016 BreizhCamp 3 | # [http://breizhcamp.org] 4 | # 5 | # This file is part of CFP.io. 6 | # 7 | # CFP.io is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Affero General Public License as 9 | # published by the Free Software Foundation, either version 3 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Affero General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Affero General Public License 18 | # along with this program. If not, see . 19 | # 20 | 21 | # dev values for 127.0.0.1 host 22 | authServer=http://localhost:46001 23 | token.signing-key=1f5es1f8es8fe1s8f6e81s8fes1f6es1f86esf1 24 | 25 | spring.jpa.hibernate.ddl-auto=validate 26 | spring.jpa.properties.hibernate.globally_quoted_identifiers=true 27 | liquibase.changeLog=classpath:/changelog/changelog-master.xml 28 | spring.http.encoding.charset=UTF-8 29 | 30 | #serve our favicon 31 | spring.mvc.favicon.enabled=false 32 | 33 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver 34 | spring.datasource.url=jdbc:mysql://localhost:3306/cfpdev 35 | spring.datasource.username=cfpdev 36 | spring.datasource.password=galettesaucisse 37 | 38 | spring.datasource.hikari.connection-init-sql=set names utf8mb4 39 | 40 | spring.mail.host=localhost 41 | 42 | #Mail port server can be override for dev with : spring.mail.port 43 | #You can use fakeSMTP to simulate mail server : https://nilhcem.github.io/FakeSMTP/ 44 | 45 | # debug 46 | server.tomcat.accessLogEnabled=true 47 | 48 | # garbage to remove later? 49 | 50 | cfp.database.loaded=true 51 | cfp.app.hostname=http://localhost 52 | 53 | cfp.google.login= 54 | cfp.google.password= 55 | 56 | cfp.email.emailsender=contact@cfp.io 57 | cfp.email.send=true 58 | cfp.email.sendgrid.apikey=TO_BE_DEFINED 59 | 60 | # enable everything in dev mode 61 | endpoints.enabled=true 62 | 63 | # No need for livereload as front is not managed by this app. 64 | spring.devtools.livereload.enabled=false 65 | 66 | mybatis.type-aliases-package=io.cfp.model 67 | mybatis.configuration.auto-mapping-behavior=partial 68 | mybatis.configuration.map-underscore-to-camel-case=true 69 | 70 | 71 | server.compression.enabled=true 72 | server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,application/javascript,text/css 73 | -------------------------------------------------------------------------------- /src/main/resources/io/cfp/mapper/CoSpeakerMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | insert into cospeakers (proposal_id, user_id) 7 | values (#{proposal}, #{user}) 8 | 9 | 10 | 11 | delete from cospeakers where proposal_id = #{proposal} 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/resources/io/cfp/mapper/CommentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | insert into comments (comment, added, internal, proposal, user, event_id) 8 | values (#{comment}, #{added}, #{internal}, #{proposalId}, #{user.id}, #{eventId}) 9 | 10 | 11 | 32 | 33 | 44 | 45 | 46 | UPDATE comments SET 47 | comment = #{comment}, 48 | added = #{added} 49 | WHERE id = #{id} 50 | AND event_id = #{eventId} 51 | AND proposal = #{proposalId} 52 | AND `user` = #{user.id} 53 | 54 | 55 | 56 | UPDATE comments SET 57 | event_id = #{eventId} 58 | WHERE id = #{id} 59 | 60 | 61 | 62 | DELETE FROM comments WHERE id = #{id} 63 | AND event_id = #{eventId} 64 | AND proposal = #{proposalId} 65 | AND `user` = #{user.id} 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/main/resources/io/cfp/mapper/EventMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 12 | 13 | 16 | 17 | 18 | 21 | 22 | 39 | 40 | 43 | 44 | 45 | insert into events (id, name, short_description, date, release_date, decision_date, open) 46 | values (#{id}, #{name}, #{shortDescription}, #{date}, #{releaseDate}, #{decisionDate}, #{open}) 47 | 48 | 49 | 50 | UPDATE events 51 | SET name=#{it.name}, 52 | short_description=#{it.shortDescription}, 53 | date=#{it.date}, 54 | duration=#{it.duration}, 55 | release_date=#{it.releaseDate}, 56 | decision_date=#{it.decisionDate}, 57 | open=#{it.open}, 58 | published=#{it.published}, 59 | url=#{it.url}, 60 | logo_url=#{it.logoUrl}, 61 | videos_url=#{it.videosUrl}, 62 | contact_mail=#{it.contactMail} 63 | WHERE id = #{it.id} 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /src/main/resources/io/cfp/mapper/FormatMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | insert into formats (name, description, icon, duration, event_id) 8 | values (#{name}, #{description}, #{icon}, #{duration}, #{event}) 9 | 10 | 11 | 14 | 15 | 18 | 19 | 20 | UPDATE formats SET 21 | name = #{it.name}, 22 | description = #{it.description}, 23 | icon = #{it.icon}, 24 | duration = #{it.duration} 25 | WHERE id = #{it.id} and event_id = #{eventId} 26 | 27 | 28 | 29 | UPDATE formats SET 30 | event_id = #{eventId} 31 | WHERE id = #{id} 32 | 33 | 34 | 35 | DELETE FROM formats WHERE id = #{id} and event_id = #{eventId} 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/main/resources/io/cfp/mapper/RateMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 23 | 24 | 38 | 39 | 54 | 55 | 56 | insert into rates (rate, added, love, hate, proposal, admin, event_id) 57 | values (#{rate}, #{added}, #{love}, #{hate}, #{talk.id}, #{user.id}, #{eventId}) 58 | 59 | 60 | 61 | UPDATE rates SET 62 | rate = #{rate}, 63 | added = #{added}, 64 | love = #{love}, 65 | hate = #{hate} 66 | WHERE id = #{id} and event_id = #{eventId} and admin = #{user.id} 67 | 68 | 69 | 70 | UPDATE rates SET 71 | event_id = #{eventId} 72 | WHERE id = #{id} 73 | 74 | 75 | 76 | DELETE FROM rates WHERE id = #{id} and event_id = #{eventId} 77 | 78 | 79 | 80 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /src/main/resources/io/cfp/mapper/RoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | insert into roles (name, user_id, event_id) 7 | values (#{name}, #{user}, #{event}) 8 | 9 | 10 | 11 | DELETE FROM roles WHERE id = #{id} and event_id = #{event} 12 | 13 | 14 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/main/resources/io/cfp/mapper/RoomMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | insert into rooms (name, event_id) 8 | values (#{name}, #{event}) 9 | 10 | 11 | 14 | 15 | 18 | 19 | 20 | UPDATE rooms SET 21 | name = #{it.name} 22 | WHERE id = #{it.id} and event_id = #{eventId} 23 | 24 | 25 | 26 | UPDATE rooms SET 27 | event_id = #{eventId} 28 | WHERE id = #{id} 29 | 30 | 31 | 32 | DELETE FROM rooms WHERE id = #{id} and event_id = #{eventId} 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/main/resources/io/cfp/mapper/ThemeMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | insert into tracks (libelle, description, color, event_id) 8 | values (#{libelle}, #{description}, #{color}, #{event}) 9 | 10 | 11 | 14 | 15 | 27 | 28 | 29 | UPDATE tracks SET 30 | libelle = #{it.libelle}, 31 | description = #{it.description}, 32 | color = #{it.color} 33 | WHERE id = #{it.id} and event_id = #{eventId} 34 | 35 | 36 | 37 | UPDATE tracks SET 38 | event_id = #{eventId} 39 | WHERE id = #{id} 40 | 41 | 42 | 43 | DELETE FROM tracks WHERE id = #{id} and event_id = #{eventId} 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 20 | 21 | 22 | 23 | true 24 | 25 | 26 | 27 | 28 | %d{ISO8601} [%thread] [%X{event.id}] [%X{user}] %-5level %logger{36} - %msg%n 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/main/resources/mails/en/subjects.yml: -------------------------------------------------------------------------------- 1 | backToEdit: "Your session is available to edit" 2 | confirmed: "Confirmation of your session" 3 | confirmedPresence: "you have confirmed you will be with us" 4 | newMessage: "New comment about talk {0}" 5 | newMessageAdmin: "Speaker {0} posted a new comment on talk {1}" 6 | notSelectionned: "Your proposal has been refused" 7 | pending: "Confirmation of your session" 8 | selectionned: "Your proposal has been accepted" 9 | test: "Test" 10 | -------------------------------------------------------------------------------- /src/main/resources/mails/en/test.html: -------------------------------------------------------------------------------- 1 | ${var1} 20 | 21 | ${var2} 22 | -------------------------------------------------------------------------------- /src/main/resources/mails/fr/subjects.yml: -------------------------------------------------------------------------------- 1 | backToEdit: "Votre proposition est à nouveau disponible pour modification" 2 | confirmed: "Confirmation de votre session" 3 | confirmedPresence: "Vous avez confirmé votre présence" 4 | newMessage: "Nouveau commentaire sur le talk {0}" 5 | newMessageAdmin: "Speaker {0} a posté un commentaire pour le talk {1}" 6 | notSelectionned: "Votre proposition a été refusée" 7 | pending: "Confirmation de votre session" 8 | selectionned: "Votre proposition a été acceptée" 9 | test: "Test" 10 | -------------------------------------------------------------------------------- /src/main/resources/mails/fr/test.html: -------------------------------------------------------------------------------- 1 | ${var1} 20 | 21 | ${var2} 22 | -------------------------------------------------------------------------------- /src/main/resources/static/swagger-ui.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Swagger UI 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 45 | 46 |
 
47 |
48 | 49 | 50 | -------------------------------------------------------------------------------- /src/test/groovy/io/cfp/config/filter/CorsFilterSpec.groovy: -------------------------------------------------------------------------------- 1 | package io.cfp.config.filter 2 | 3 | import org.springframework.http.HttpHeaders 4 | import spock.lang.Specification 5 | 6 | import javax.servlet.FilterChain 7 | import javax.servlet.http.HttpServletRequest 8 | import javax.servlet.http.HttpServletResponse 9 | 10 | /** 11 | * Created by jl on 11/06/16. 12 | */ 13 | class CorsFilterSpec extends Specification { 14 | 15 | CorsFilter filter = new CorsFilter() 16 | 17 | def 'port number in Origin header should not be considered'() { 18 | 19 | given: 20 | def request = Mock(HttpServletRequest) { 21 | getHeader(HttpHeaders.ORIGIN) >> origin 22 | } 23 | def response = Mock(HttpServletResponse) 24 | def filterChain = Mock(FilterChain) 25 | 26 | when: 27 | filter.doFilterInternal(request, response, filterChain) 28 | 29 | then: 30 | 1 * response.addHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, origin) 31 | 1 * filterChain.doFilter(request, response) 32 | 33 | where: 34 | origin << ['http://localhost', 'http://localhost:3000', 'https://foo.cfp.io:3000', 'http://foo.cfp.io'] 35 | 36 | } 37 | 38 | // TODO implement other tests 39 | } 40 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/ApplicationJUnit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp; 22 | 23 | import org.springframework.boot.SpringApplication; 24 | import org.springframework.boot.autoconfigure.SpringBootApplication; 25 | import org.springframework.boot.builder.SpringApplicationBuilder; 26 | import org.springframework.boot.web.servlet.ServletComponentScan; 27 | import org.springframework.boot.web.support.SpringBootServletInitializer; 28 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; 29 | 30 | @SpringBootApplication 31 | @ServletComponentScan(basePackages = "io.cfp.config.filter") 32 | @EnableJpaRepositories(basePackages = "io.cfp.repository") 33 | public class ApplicationJUnit extends SpringBootServletInitializer { 34 | 35 | @Override 36 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 37 | return application.sources(Application.class); 38 | } 39 | 40 | public static void main(String[] args) throws Exception { 41 | SpringApplication.run(Application.class, args); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/JpaTestConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Copyright (c) 2016, CloudBees, Inc. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | package io.cfp; 27 | 28 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 29 | import org.springframework.boot.autoconfigure.domain.EntityScan; 30 | import org.springframework.context.annotation.Configuration; 31 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; 32 | import org.springframework.transaction.annotation.EnableTransactionManagement; 33 | 34 | @Configuration 35 | @EnableAutoConfiguration 36 | @EntityScan(basePackages = {"io.cfp.entity"}) 37 | @EnableJpaRepositories(basePackages = {"io.cfp.repository"}) 38 | @EnableTransactionManagement 39 | public class JpaTestConfig { 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/api/ApiTestApplication.java: -------------------------------------------------------------------------------- 1 | package io.cfp.api; 2 | 3 | import io.cfp.SecurityConfiguration; 4 | import io.cfp.WebConfiguration; 5 | import io.cfp.config.exception.GlobalControllerExceptionHandler; 6 | import io.cfp.config.filter.AuthFilter; 7 | import io.cfp.mapper.RoleMapper; 8 | import io.cfp.service.auth.AuthUtils; 9 | import io.cfp.service.user.SecurityUserService; 10 | import org.springframework.boot.autoconfigure.SpringBootApplication; 11 | import org.springframework.context.annotation.Bean; 12 | import org.springframework.context.annotation.Import; 13 | import org.springframework.web.servlet.config.annotation.EnableWebMvc; 14 | 15 | import static org.mockito.Mockito.mock; 16 | 17 | @SpringBootApplication 18 | @EnableWebMvc 19 | @Import({SecurityConfiguration.class, WebConfiguration.class }) 20 | class ApiTestApplication { 21 | 22 | @Bean 23 | public SecurityUserService securityUserService() { 24 | return new SecurityUserService(); 25 | } 26 | 27 | @Bean 28 | public RoleMapper roleMapper() { 29 | return mock(RoleMapper.class); 30 | } 31 | 32 | @Bean 33 | public AuthFilter authFilter() { 34 | AuthFilter authFilter = new AuthFilter(); 35 | authFilter.setAuthUtils(authUtils()); 36 | authFilter.setRoleMapper(roleMapper()); 37 | return authFilter; 38 | } 39 | 40 | @Bean 41 | public AuthUtils authUtils() { 42 | return new AuthUtils(); 43 | } 44 | 45 | @Bean 46 | public GlobalControllerExceptionHandler exceptionHandler() { 47 | return new GlobalControllerExceptionHandler(); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/api/ApplicationControllerTest.java: -------------------------------------------------------------------------------- 1 | package io.cfp.api; 2 | 3 | import io.cfp.mapper.EventMapper; 4 | import io.cfp.mapper.UserMapper; 5 | import io.cfp.model.Event; 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; 10 | import org.springframework.boot.test.mock.mockito.MockBean; 11 | import org.springframework.http.MediaType; 12 | import org.springframework.test.context.junit4.SpringRunner; 13 | import org.springframework.test.web.servlet.MockMvc; 14 | import org.springframework.test.web.servlet.result.MockMvcResultHandlers; 15 | 16 | import java.util.Date; 17 | 18 | import static org.mockito.Matchers.anyString; 19 | import static org.mockito.Mockito.when; 20 | import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; 21 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; 22 | 23 | @RunWith(SpringRunner.class) 24 | @WebMvcTest(ApplicationController.class) 25 | public class ApplicationControllerTest { 26 | 27 | @MockBean 28 | private EventMapper eventMapper; 29 | 30 | @MockBean 31 | private UserMapper userMapper; 32 | 33 | @Autowired 34 | private MockMvc mockMvc; 35 | 36 | @Test 37 | public void should_return_event_settings() throws Exception { 38 | 39 | Event event = new Event(); 40 | event.setName("EVENT_ID"); 41 | event.setDate(new Date()); 42 | event.setReleaseDate(new Date()); 43 | event.setDecisionDate(new Date()); 44 | 45 | 46 | when(eventMapper.findOne(anyString())).thenReturn(event); 47 | 48 | mockMvc.perform(get("/api/application") 49 | .accept(MediaType.APPLICATION_JSON_UTF8) 50 | .contentType(MediaType.APPLICATION_JSON_UTF8) 51 | ) 52 | .andDo(MockMvcResultHandlers.print()) 53 | .andExpect(status().isOk()) 54 | .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) 55 | .andExpect(jsonPath("$.eventName").value("EVENT_ID")) 56 | ; 57 | 58 | } 59 | 60 | @Test 61 | public void should_return_not_found_id_no_event() throws Exception { 62 | 63 | when(eventMapper.findOne(anyString())).thenReturn(null); 64 | 65 | mockMvc.perform(get("/api/application") 66 | .accept(MediaType.APPLICATION_JSON_UTF8) 67 | .contentType(MediaType.APPLICATION_JSON_UTF8)) 68 | .andDo(MockMvcResultHandlers.print()) 69 | .andExpect(status().isNotFound()) 70 | .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)); 71 | 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/api/ConfigControllerTest.java: -------------------------------------------------------------------------------- 1 | package io.cfp.api; 2 | 3 | import io.cfp.mapper.UserMapper; 4 | import io.cfp.model.Role; 5 | import io.cfp.model.User; 6 | import io.cfp.service.admin.config.ApplicationConfigService; 7 | import io.cfp.utils.Utils; 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; 12 | import org.springframework.boot.test.mock.mockito.MockBean; 13 | import org.springframework.http.MediaType; 14 | import org.springframework.test.context.junit4.SpringRunner; 15 | import org.springframework.test.web.servlet.MockMvc; 16 | 17 | import static org.mockito.Matchers.anyString; 18 | import static org.mockito.Mockito.verify; 19 | import static org.mockito.Mockito.when; 20 | import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; 21 | import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; 22 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; 23 | 24 | @RunWith(SpringRunner.class) 25 | @WebMvcTest(ConfigController.class) 26 | public class ConfigControllerTest { 27 | 28 | @MockBean 29 | private ApplicationConfigService applicationConfigService; 30 | 31 | @MockBean 32 | private UserMapper userMapper; 33 | 34 | @Autowired 35 | private MockMvc mockMvc; 36 | 37 | @Test 38 | public void should_open_cfp() throws Exception { 39 | 40 | User user = new User(); 41 | user.setId(20); 42 | user.setEmail("EMAIL"); 43 | user.addRole(Role.ADMIN); 44 | String token = Utils.createTokenForUser(user); 45 | 46 | when(userMapper.findByEmail("EMAIL")).thenReturn(user); 47 | 48 | String openCFP = Utils.getContent("/json/config/open_cfp.json"); 49 | 50 | mockMvc.perform(post("/api/config/enableSubmissions") 51 | .accept(MediaType.APPLICATION_JSON_UTF8) 52 | .contentType(MediaType.APPLICATION_JSON_UTF8) 53 | .header("Authorization", "Bearer " + token) 54 | .content(openCFP) 55 | ) 56 | .andDo(print()) 57 | .andExpect(status().isOk()) 58 | .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) 59 | .andExpect(jsonPath("$.key").value("true")) 60 | ; 61 | 62 | verify(applicationConfigService).openCfp(anyString()); 63 | } 64 | 65 | @Test 66 | public void should_close_cfp() throws Exception { 67 | 68 | User user = new User(); 69 | user.setId(20); 70 | user.setEmail("EMAIL"); 71 | user.addRole(Role.ADMIN); 72 | String token = Utils.createTokenForUser(user); 73 | 74 | when(userMapper.findByEmail("EMAIL")).thenReturn(user); 75 | 76 | String closeCFP = Utils.getContent("/json/config/close_cfp.json"); 77 | 78 | mockMvc.perform(post("/api/config/enableSubmissions") 79 | .accept(MediaType.APPLICATION_JSON_UTF8) 80 | .contentType(MediaType.APPLICATION_JSON_UTF8) 81 | .header("Authorization", "Bearer " + token) 82 | .content(closeCFP) 83 | ) 84 | .andDo(print()) 85 | .andExpect(status().isOk()) 86 | .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) 87 | .andExpect(jsonPath("$.key").value("false")) 88 | ; 89 | 90 | verify(applicationConfigService).closeCfp(anyString()); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/controller/ControllerTestApplication.java: -------------------------------------------------------------------------------- 1 | package io.cfp.controller; 2 | 3 | import io.cfp.SecurityConfiguration; 4 | import io.cfp.WebConfiguration; 5 | import io.cfp.config.exception.GlobalControllerExceptionHandler; 6 | import io.cfp.config.filter.AuthFilter; 7 | import io.cfp.mapper.RoleMapper; 8 | import io.cfp.service.auth.AuthUtils; 9 | import io.cfp.service.user.SecurityUserService; 10 | import org.springframework.boot.autoconfigure.SpringBootApplication; 11 | import org.springframework.context.annotation.Bean; 12 | import org.springframework.context.annotation.Import; 13 | import org.springframework.web.servlet.config.annotation.EnableWebMvc; 14 | 15 | import static org.mockito.Mockito.mock; 16 | 17 | @SpringBootApplication 18 | @EnableWebMvc 19 | @Import({SecurityConfiguration.class, WebConfiguration.class }) 20 | class ControllerTestApplication { 21 | 22 | @Bean 23 | public SecurityUserService securityUserService() { 24 | return new SecurityUserService(); 25 | } 26 | 27 | @Bean 28 | public RoleMapper roleMapper() { 29 | return mock(RoleMapper.class); 30 | } 31 | 32 | @Bean 33 | public AuthFilter authFilter() { 34 | AuthFilter authFilter = new AuthFilter(); 35 | authFilter.setAuthUtils(authUtils()); 36 | authFilter.setRoleMapper(roleMapper()); 37 | return authFilter; 38 | } 39 | 40 | @Bean 41 | public AuthUtils authUtils() { 42 | return new AuthUtils(); 43 | } 44 | 45 | @Bean 46 | public GlobalControllerExceptionHandler exceptionHandler() { 47 | return new GlobalControllerExceptionHandler(); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/controller/config/security/SecurityConfig.java: -------------------------------------------------------------------------------- 1 | package io.cfp.controller.config.security; 2 | 3 | import io.cfp.SecurityConfiguration; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.Import; 6 | import org.springframework.web.servlet.config.annotation.EnableWebMvc; 7 | 8 | @Configuration 9 | @EnableWebMvc 10 | @Import(SecurityConfiguration.class) 11 | public class SecurityConfig { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/mapper/EventMapperTest.java: -------------------------------------------------------------------------------- 1 | package io.cfp.mapper; 2 | 3 | import io.cfp.model.Event; 4 | import io.cfp.model.queries.EventQuery; 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.mybatis.spring.boot.test.autoconfigure.MybatisTest; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.test.context.junit4.SpringRunner; 10 | 11 | import java.util.List; 12 | 13 | import static org.assertj.core.api.Assertions.assertThat; 14 | 15 | @RunWith(SpringRunner.class) 16 | @MybatisTest 17 | public class EventMapperTest { 18 | 19 | @Autowired 20 | private EventMapper eventMapper; 21 | 22 | @Test 23 | public void should_find_all_open_Event() { 24 | List openEvents = eventMapper.findOpen(); 25 | assertThat(openEvents).isNotEmpty(); 26 | } 27 | 28 | @Test 29 | public void should_find_all_open_Event_by_query() { 30 | EventQuery eventQuery = new EventQuery().setOpen(true); 31 | List openEvents = eventMapper.findAll(eventQuery); 32 | assertThat(openEvents).isNotEmpty(); 33 | } 34 | 35 | @Test 36 | public void should_find_all_passed_Event() { 37 | List openEvents = eventMapper.findOpen(); 38 | assertThat(openEvents).isNotEmpty(); 39 | } 40 | 41 | @Test 42 | public void should_find_all_passed_Event_by_query() { 43 | EventQuery eventQuery = new EventQuery().setPassed(true); 44 | List openEvents = eventMapper.findAll(eventQuery); 45 | assertThat(openEvents).isNotEmpty(); 46 | } 47 | 48 | @Test 49 | public void should_find_all_Events_by_user() { 50 | List eventsOfUser = eventMapper.findByUser(10); 51 | assertThat(eventsOfUser).isNotEmpty(); 52 | } 53 | 54 | @Test 55 | public void should_find_all_Events_by_user_by_query() { 56 | EventQuery eventQuery = new EventQuery().setUser(10); 57 | List eventsOfUser = eventMapper.findAll(eventQuery); 58 | assertThat(eventsOfUser).isNotEmpty(); 59 | } 60 | 61 | @Test 62 | public void should_create_an_Event() { 63 | Event event = new Event(); 64 | event.setId("EVENT_TEST"); 65 | int createdLines = eventMapper.insert(event); 66 | 67 | assertThat(createdLines).isEqualTo(1); 68 | } 69 | 70 | 71 | @Test 72 | public void should_return_an_existing_Event() { 73 | assertThat(eventMapper.exists("EVENT_ID")).isTrue(); 74 | } 75 | 76 | 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/mapper/MapperTestApplication.java: -------------------------------------------------------------------------------- 1 | package io.cfp.mapper; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | 5 | @SpringBootApplication 6 | class MapperTestApplication { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/mapper/RateMapperTest.java: -------------------------------------------------------------------------------- 1 | package io.cfp.mapper; 2 | 3 | import io.cfp.model.Rate; 4 | import io.cfp.model.Stat; 5 | import io.cfp.model.User; 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | import org.mybatis.spring.boot.test.autoconfigure.MybatisTest; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.test.context.junit4.SpringRunner; 11 | 12 | import java.util.Date; 13 | import java.util.List; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | @RunWith(SpringRunner.class) 18 | @MybatisTest 19 | public class RateMapperTest { 20 | 21 | private static final int RATE_ID = 71; 22 | private static final String EVENT_ID = "EVENT_ID"; 23 | private static final int USER_ID = 10; 24 | 25 | @Autowired 26 | private RateMapper rateMapper; 27 | 28 | @Test 29 | public void should_get_rates_group_by_email() { 30 | List ratesByEmail = rateMapper.getRateByEmailUsers(EVENT_ID); 31 | assertThat(ratesByEmail).isNotEmpty(); 32 | } 33 | 34 | @Test 35 | public void should_delete_a_rate() { 36 | int deletedLines = rateMapper.deleteForEvent(RATE_ID, EVENT_ID); 37 | 38 | assertThat(deletedLines).isEqualTo(1); 39 | } 40 | 41 | @Test 42 | public void should_update_the_rate() { 43 | Rate rate = new Rate(); 44 | rate.setId(RATE_ID); 45 | rate.setUser(new User().setId(USER_ID)); 46 | rate.setEventId(EVENT_ID); 47 | rate.setAdded(new Date()); 48 | 49 | int updatedLines = rateMapper.update(rate); 50 | 51 | assertThat(updatedLines).isEqualTo(1); 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/mapper/RoleMapperTest.java: -------------------------------------------------------------------------------- 1 | package io.cfp.mapper; 2 | 3 | import io.cfp.model.Role; 4 | import io.cfp.model.queries.RoleQuery; 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.mybatis.spring.boot.test.autoconfigure.MybatisTest; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.test.context.junit4.SpringRunner; 10 | 11 | import java.util.List; 12 | 13 | import static org.assertj.core.api.Assertions.assertThat; 14 | 15 | @RunWith(SpringRunner.class) 16 | @MybatisTest 17 | public class RoleMapperTest { 18 | 19 | private static final int USER_ID = 10; 20 | private static final int ROLE_ID_TO_DELETE = 11; 21 | 22 | @Autowired 23 | private RoleMapper roleMapper; 24 | 25 | @Test 26 | public void should_find_all_roles() { 27 | List allRoles = roleMapper.findAll(new RoleQuery()); 28 | assertThat(allRoles).isNotEmpty(); 29 | } 30 | 31 | @Test 32 | public void should_find_all_roles_with_event() { 33 | RoleQuery roleQuery = new RoleQuery(); 34 | roleQuery.setEventId("EVENT_ID"); 35 | List allRolesWithEvent = roleMapper.findAll(roleQuery); 36 | assertThat(allRolesWithEvent).isNotEmpty(); 37 | } 38 | 39 | @Test 40 | public void should_find_all_roles_with_user() { 41 | RoleQuery roleQuery = new RoleQuery(); 42 | roleQuery.setUserId(USER_ID); 43 | List allRolesWithUser = roleMapper.findAll(roleQuery); 44 | assertThat(allRolesWithUser).isNotEmpty(); 45 | } 46 | 47 | @Test 48 | public void should_create_a_role() { 49 | Role role = new Role(); 50 | role.setName("CREATED_ROLE"); 51 | int createdLines = roleMapper.insert(role); 52 | 53 | assertThat(createdLines).isEqualTo(1); 54 | assertThat(role.getId()).isGreaterThan(0); 55 | } 56 | 57 | @Test 58 | public void should_delete_a_role() { 59 | Role role = new Role(); 60 | role.setId(ROLE_ID_TO_DELETE); 61 | role.setEvent("EVENT_ID"); 62 | 63 | int deletedLines = roleMapper.delete(role); 64 | 65 | assertThat(deletedLines).isEqualTo(1); 66 | } 67 | 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/mapper/ThemeMapperTest.java: -------------------------------------------------------------------------------- 1 | package io.cfp.mapper; 2 | 3 | import io.cfp.model.Stat; 4 | import io.cfp.model.Theme; 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.mybatis.spring.boot.test.autoconfigure.MybatisTest; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.test.context.junit4.SpringRunner; 10 | 11 | import java.util.List; 12 | 13 | import static org.assertj.core.api.Assertions.assertThat; 14 | 15 | @RunWith(SpringRunner.class) 16 | @MybatisTest 17 | public class ThemeMapperTest { 18 | 19 | private static final int THEME_ID = 40; 20 | private static final int THEME_ID_TO_DELETE = 41; 21 | private static final String EVENT_ID = "EVENT_ID"; 22 | private static final String ALL_STATE = "*"; 23 | 24 | @Autowired 25 | private ThemeMapper themeMapper; 26 | 27 | @Test 28 | public void should_delete_a_theme() { 29 | int deletedLines = themeMapper.deleteForEvent(THEME_ID_TO_DELETE, EVENT_ID); 30 | 31 | assertThat(deletedLines).isEqualTo(1); 32 | } 33 | 34 | @Test 35 | public void should_update_the_theme() { 36 | Theme theme = new Theme(); 37 | theme.setId(THEME_ID); 38 | theme.setEvent(EVENT_ID); 39 | theme.setLibelle("UPDATED_LIBELLE"); 40 | 41 | int updatedLines = themeMapper.updateForEvent(theme, EVENT_ID); 42 | 43 | assertThat(updatedLines).isEqualTo(1); 44 | } 45 | 46 | @Test 47 | public void should_count_the_proposals_by_theme_of_an_event() { 48 | List stats = themeMapper.countProposalsByThemeAndState(EVENT_ID, null); 49 | 50 | assertThat(stats).hasSize(1); 51 | } 52 | 53 | @Test 54 | public void should_count_the_ACCEPTED_proposals_by_theme_of_an_event_() { 55 | List stats = themeMapper.countProposalsByThemeAndState(EVENT_ID, "ACCEPTED"); 56 | 57 | assertThat(stats).hasSize(1); 58 | } 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/model/ProposalTest.java: -------------------------------------------------------------------------------- 1 | package io.cfp.model; 2 | 3 | 4 | import org.junit.Test; 5 | 6 | import static org.assertj.core.api.Assertions.assertThat; 7 | 8 | public class ProposalTest { 9 | 10 | @Test 11 | public void should_return_a_list_of_speaker_and_cospeakers() { 12 | User speaker = new User(); 13 | speaker.setId(1); 14 | speaker.setEmail("EMAIL_SPEAKER"); 15 | speaker.addRole(Role.AUTHENTICATED); 16 | 17 | User cospeaker = new User(); 18 | cospeaker.setId(2); 19 | cospeaker.setEmail("EMAIL_COSPEAKER"); 20 | cospeaker.addRole(Role.AUTHENTICATED); 21 | 22 | Proposal proposal = new Proposal(); 23 | proposal.setSpeaker(speaker); 24 | proposal.getCospeakers().add(cospeaker); 25 | 26 | assertThat(proposal.getSpeakersIds()).hasSize(2).contains(1,2); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/multitenant/TenantFilterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 BreizhCamp 3 | * [http://breizhcamp.org] 4 | * 5 | * This file is part of CFP.io. 6 | * 7 | * CFP.io is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Affero General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | package io.cfp.multitenant; 22 | 23 | import io.cfp.multitenant.TenantFilter; 24 | import org.junit.Test; 25 | import org.springframework.http.HttpHeaders; 26 | import org.springframework.mock.web.MockHttpServletRequest; 27 | 28 | import static org.junit.Assert.*; 29 | 30 | /** 31 | * @author Nicolas De Loof 32 | */ 33 | public class TenantFilterTest { 34 | 35 | private MockHttpServletRequest request = new MockHttpServletRequest(); 36 | 37 | private TenantFilter filter = new TenantFilter(); 38 | 39 | @Test 40 | public void should_retrieve_tenant_from_Origin() { 41 | request.setPathInfo("/some/api"); 42 | request.addHeader(HttpHeaders.ORIGIN, "https://test.cfp.io" ); 43 | assertEquals("test", filter.extractTenant(request)); 44 | } 45 | 46 | @Test 47 | public void should_retrieve_tenant_from_Referer() { 48 | request.setPathInfo("/some/api"); 49 | request.addHeader(HttpHeaders.REFERER, "https://test.cfp.io/" ); 50 | assertEquals("test", filter.extractTenant(request)); 51 | } 52 | 53 | @Test 54 | public void should_retrieve_tenant_from_XTenant_header() { 55 | request.setPathInfo("/some/api"); 56 | request.addHeader(TenantFilter.TENANT_HEADER, "test" ); 57 | assertEquals("test", filter.extractTenant(request)); 58 | } 59 | 60 | @Test 61 | public void should_retrieve_tenant_from_Host() { 62 | request.setServerName("test.cfp.io"); 63 | assertEquals("test", filter.extractTenant(request)); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/service/TalkAdminServiceTest.java: -------------------------------------------------------------------------------- 1 | package io.cfp.service; 2 | 3 | import io.cfp.dto.TalkAdmin; 4 | import io.cfp.entity.Format; 5 | import io.cfp.entity.Track; 6 | import io.cfp.mapper.ProposalMapper; 7 | import io.cfp.mapper.RateMapper; 8 | import io.cfp.model.Proposal; 9 | import io.cfp.model.queries.ProposalQuery; 10 | import io.cfp.model.queries.RateQuery; 11 | import org.junit.Test; 12 | import org.junit.runner.RunWith; 13 | import org.mockito.InjectMocks; 14 | import org.mockito.Mock; 15 | import org.mockito.runners.MockitoJUnitRunner; 16 | 17 | import java.util.ArrayList; 18 | import java.util.HashSet; 19 | import java.util.List; 20 | 21 | import static org.assertj.core.api.Assertions.assertThat; 22 | import static org.mockito.Matchers.any; 23 | import static org.mockito.Mockito.when; 24 | 25 | @RunWith(MockitoJUnitRunner.class) 26 | public class TalkAdminServiceTest { 27 | 28 | public static final int USER_ID = 10; 29 | @InjectMocks 30 | private TalkAdminService talkAdminService; 31 | 32 | 33 | @Mock 34 | private ProposalMapper proposalMapper; 35 | 36 | @Mock 37 | private RateMapper rateMapper; 38 | 39 | @Test 40 | public void should_return_all_talkAdmins() { 41 | 42 | io.cfp.model.User adminUser = new io.cfp.model.User(); 43 | adminUser.setId(USER_ID); 44 | 45 | Proposal talk = new Proposal(); 46 | talk.setId(20); 47 | Format format = new Format(); 48 | format.setId(30); 49 | talk.setFormat(30); 50 | Track track = new Track(); 51 | track.setId(40); 52 | talk.setTrackId(40); 53 | talk.setSpeaker(adminUser); 54 | talk.setCospeakers(new HashSet<>()); 55 | talk.setState(Proposal.State.ACCEPTED); 56 | 57 | List talksAdminList = new ArrayList<>(); 58 | talksAdminList.add(talk); 59 | when(proposalMapper.findAll(any(ProposalQuery.class))).thenReturn(talksAdminList); 60 | 61 | List rates = new ArrayList<>(); 62 | 63 | io.cfp.model.Rate rate = new io.cfp.model.Rate(); 64 | 65 | rate.setUser(adminUser); 66 | rate.setTalk(talk); 67 | 68 | rates.add(rate); 69 | when(rateMapper.findAll(any(RateQuery.class))).thenReturn(rates); 70 | 71 | List returnedTalkAdminList = talkAdminService.findAll("EVENT_ID", USER_ID); 72 | assertThat(returnedTalkAdminList).isNotEmpty(); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/service/admin/config/ApplicationConfigServiceTest.java: -------------------------------------------------------------------------------- 1 | package io.cfp.service.admin.config; 2 | 3 | 4 | import io.cfp.mapper.EventMapper; 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.mockito.InjectMocks; 8 | import org.mockito.Mock; 9 | import org.mockito.runners.MockitoJUnitRunner; 10 | 11 | import java.util.Date; 12 | 13 | import static org.assertj.core.api.Assertions.assertThat; 14 | import static org.mockito.Matchers.eq; 15 | import static org.mockito.Mockito.verify; 16 | import static org.mockito.Mockito.when; 17 | 18 | @RunWith(MockitoJUnitRunner.class) 19 | public class ApplicationConfigServiceTest { 20 | 21 | @InjectMocks 22 | private ApplicationConfigService applicationConfigService; 23 | 24 | @Mock 25 | private EventMapper eventMapper; 26 | 27 | @Test 28 | public void should_close_CFP() { 29 | 30 | io.cfp.model.Event event = new io.cfp.model.Event(); 31 | event.setOpen(true); 32 | event.setDate(new Date()); 33 | event.setReleaseDate(new Date()); 34 | event.setDecisionDate(new Date()); 35 | 36 | when(eventMapper.findOne("EVENT_ID")).thenReturn(event); 37 | 38 | applicationConfigService.closeCfp("EVENT_ID"); 39 | 40 | verify(eventMapper).update(eq(event)); 41 | 42 | assertThat(event.isOpen()).isFalse(); 43 | } 44 | 45 | @Test 46 | public void should_open_CFP() { 47 | 48 | io.cfp.model.Event event = new io.cfp.model.Event(); 49 | event.setOpen(true); 50 | event.setDate(new Date()); 51 | event.setReleaseDate(new Date()); 52 | event.setDecisionDate(new Date()); 53 | 54 | when(eventMapper.findOne("EVENT_ID")).thenReturn(event); 55 | 56 | applicationConfigService.openCfp("EVENT_ID"); 57 | 58 | verify(eventMapper).update(eq(event)); 59 | 60 | assertThat(event.isOpen()).isTrue(); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/test/java/io/cfp/utils/Utils.java: -------------------------------------------------------------------------------- 1 | package io.cfp.utils; 2 | 3 | import io.cfp.model.User; 4 | import io.jsonwebtoken.Jwts; 5 | import io.jsonwebtoken.SignatureAlgorithm; 6 | import org.joda.time.DateTime; 7 | 8 | import java.io.IOException; 9 | import java.net.URISyntaxException; 10 | import java.nio.file.Files; 11 | import java.nio.file.Paths; 12 | 13 | public class Utils { 14 | public static String getContent(String path) throws URISyntaxException, IOException { 15 | return new String(Files.readAllBytes(Paths.get(Utils.class.getResource(path).toURI()))); 16 | } 17 | 18 | public static String createTokenForUser(User user) { 19 | return Jwts.builder() 20 | .setSubject(user.getEmail()) 21 | .setExpiration(DateTime.now().plusSeconds(3600).toDate()) 22 | .signWith(SignatureAlgorithm.HS512, "secret") 23 | .compact(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/resources/changelog/changelog-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/test/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016 BreizhCamp 3 | # [http://breizhcamp.org] 4 | # 5 | # This file is part of CFP.io. 6 | # 7 | # CFP.io is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Affero General Public License as 9 | # published by the Free Software Foundation, either version 3 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Affero General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Affero General Public License 18 | # along with this program. If not, see . 19 | # 20 | 21 | # dev values for 127.0.0.1 host 22 | cfp.auth.secrettoken=7d9e847482440f00821b05023259f92f87205d23 23 | cfp.auth.captchapublic=6LdxgxATAAAAAFUCo5RuwxxCGF20b-UWaawAM0nM 24 | cfp.auth.captchasecret=6LdxgxATAAAAAB9s-u4m0EN9oKWnMZGsDIR7WbuG 25 | cfp.google.clientid=980998530813-um48to1pf2be7tn9d9ar29d7si41a5kd.apps.googleusercontent.com 26 | cfp.google.clientsecret=g4uJRnvOF_nIESvYcdq1gksd 27 | cfp.github.clientid=5fb632a6027ffe32338b 28 | cfp.github.clientsecret=f6f6ec707257776b1eda31ecd97ed12a3535e013 29 | 30 | # garbage to remove later? 31 | 32 | cfp.database.loaded=true 33 | cfp.app.hostname=http://localhost 34 | 35 | cfp.google.login= 36 | cfp.google.password= 37 | 38 | cfp.email.emailsender=cfp@breizhcamp.org 39 | cfp.email.send=true 40 | 41 | token.signing-key=secret 42 | 43 | spring.mail.host=localhost 44 | authServer=localhost 45 | 46 | spring.datasource.url=jdbc:h2:mem:cfp;DB_CLOSE_DELAY=-1 47 | spring.datasource.username= 48 | spring.datasource.password= 49 | liquibase.changeLog=classpath:/changelog/changelog-test.xml 50 | 51 | 52 | spring.jpa.generate-ddl=false 53 | spring.jpa.hibernate.ddl-auto=none 54 | spring.jpa.hibernate.naming-strategy=org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy 55 | spring.jpa.database-platform=org.hibernate.dialect.H2Dialect 56 | spring.jpa.database=H2 57 | spring.jpa.show-sql=false 58 | spring.jpa.properties.hibernate.globally_quoted_identifiers=false 59 | spring.jpa.properties.hibernate.cache.use_second_level_cache=false 60 | spring.jpa.properties.hibernate.cache.use_query_cache=false 61 | spring.jpa.properties.hibernate.generate_statistics=false 62 | spring.jpa.properties.hibernate.hbm2ddl.auto=none 63 | 64 | endpoints.autoconfig.enabled=true 65 | endpoints.beans.enabled=true 66 | endpoints.configprops.enabled=true 67 | endpoints.dump.enabled=true 68 | endpoints.env.enabled=true 69 | endpoints.health.enabled=true 70 | endpoints.info.enabled=true 71 | endpoints.liquibase.enabled=true 72 | endpoints.metrics.enabled=true 73 | endpoints.mappings.enabled=true 74 | endpoints.shutdown.enabled=true 75 | endpoints.trace.enabled=true 76 | 77 | logging.level.org.springframework= INFO 78 | logging.level.org.hibernate= INFO 79 | logging.level.io.cfp.mapper= DEBUG 80 | logging.level.ROOT= INFO 81 | 82 | mybatis.configuration.auto-mapping-behavior=partial 83 | mybatis.configuration.map-underscore-to-camel-case=true 84 | -------------------------------------------------------------------------------- /src/test/resources/json/auth/new_user.json: -------------------------------------------------------------------------------- 1 | { 2 | "email": "EMAIL@DOMAIN.COM", 3 | "password": "PASSWORD", 4 | "captcha": "CAPTCHA" 5 | } 6 | -------------------------------------------------------------------------------- /src/test/resources/json/comments/new_comment.json: -------------------------------------------------------------------------------- 1 | { 2 | "comment": "COMMENT", 3 | "internal": false 4 | } 5 | -------------------------------------------------------------------------------- /src/test/resources/json/comments/new_internal_comment.json: -------------------------------------------------------------------------------- 1 | { 2 | "comment": "COMMENT", 3 | "internal": true 4 | } 5 | -------------------------------------------------------------------------------- /src/test/resources/json/comments/update_comment.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 10, 3 | "comment": "COMMENT", 4 | "internal": false 5 | } 6 | -------------------------------------------------------------------------------- /src/test/resources/json/comments/update_internal_comment.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 10, 3 | "comment": "COMMENT", 4 | "internal": true 5 | } 6 | -------------------------------------------------------------------------------- /src/test/resources/json/config/close_cfp.json: -------------------------------------------------------------------------------- 1 | { 2 | "key": false 3 | } 4 | -------------------------------------------------------------------------------- /src/test/resources/json/config/open_cfp.json: -------------------------------------------------------------------------------- 1 | { 2 | "key": true 3 | } 4 | -------------------------------------------------------------------------------- /src/test/resources/json/proposals/invalid_proposal.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 25, 3 | "name": "NAME", 4 | "language": "LANGUAGE", 5 | "speaker": { 6 | "id": 666 7 | }, 8 | "eventId": "EVENT_ID", 9 | "trackId": 13, 10 | "trackLabel": "TRACK_LABEL", 11 | "description": "DESCRIPTION", 12 | "references": "REFERENCES", 13 | "difficulty": 1, 14 | "added": 1493831052251, 15 | "formatId": 11, 16 | "schedule": 1493831052251, 17 | "roomId": 12, 18 | "video": "VIDEO", 19 | "slides": "SLIDES" 20 | } 21 | -------------------------------------------------------------------------------- /src/test/resources/json/proposals/new_proposal.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": "ACCEPTED", 3 | "name": "NAME", 4 | "language": "LANGUAGE", 5 | "eventId": "EVENT_ID", 6 | "trackId": 13, 7 | "trackLabel": "TRACK_LABEL", 8 | "description": "DESCRIPTION", 9 | "references": "REFERENCES", 10 | "difficulty": 1, 11 | "added": 1493831052251, 12 | "formatId": 11, 13 | "speaker": { 14 | "id": 20, 15 | "email": "EMAIL", 16 | "lastname": "LASTNAME", 17 | "firstname": "FIRSTNAME", 18 | "company": "COMPANY", 19 | "phone": "PHONE", 20 | "bio": "BIO", 21 | "twitter": "TWITTER", 22 | "googleplus": "GOOGLEPLUS", 23 | "github": "GITHUB", 24 | "language": "LANGUAGE", 25 | "gender": "MALE", 26 | "tshirtSize": "M", 27 | "social": "SOCIAL", 28 | "imageProfilURL": "IMAGE_PROFIL_URL", 29 | "shortName": "F. LASTNAME" 30 | }, 31 | "schedule": 1493831052251, 32 | "roomId": 12, 33 | "video": "VIDEO", 34 | "slides": "SLIDES" 35 | } 36 | -------------------------------------------------------------------------------- /src/test/resources/json/proposals/other_proposal.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 25, 3 | "state": "ACCEPTED", 4 | "name": "NAME", 5 | "language": "LANGUAGE", 6 | "eventId": "EVENT_ID", 7 | "trackId": 13, 8 | "trackLabel": "TRACK_LABEL", 9 | "description": "DESCRIPTION", 10 | "references": "REFERENCES", 11 | "difficulty": 1, 12 | "added": 1493831052251, 13 | "formatId": 11, 14 | "speaker": { 15 | "id": 20, 16 | "email": "EMAIL", 17 | "lastname": "LASTNAME", 18 | "firstname": "FIRSTNAME", 19 | "company": "COMPANY", 20 | "phone": "PHONE", 21 | "bio": "BIO", 22 | "twitter": "TWITTER", 23 | "googleplus": "GOOGLEPLUS", 24 | "github": "GITHUB", 25 | "language": "LANGUAGE", 26 | "gender": "MALE", 27 | "tshirtSize": "M", 28 | "social": "SOCIAL", 29 | "imageProfilURL": "IMAGE_PROFIL_URL", 30 | "shortName": "F. LASTNAME" 31 | }, 32 | "schedule": 1493831052251, 33 | "roomId": 12, 34 | "video": "VIDEO", 35 | "slides": "SLIDES" 36 | } 37 | --------------------------------------------------------------------------------