Back-office services for Pearl Jam
REST API for communication between Pearl Jam DB and Pearl Jam UI.
For building and running the application you need:
- JDK 11
- Maven 3
- Docker for tests
Use the maven clean and maven install
mvn clean install
Use the Spring Boot Maven plugin like so:
mvn spring-boot:run
To access to swagger-ui, use this url : http://localhost:8080/api/swagger-ui.html
- To start the server on port 8180 execute in the bin folder of your keycloak :
standalone.bat -Djboss.socket.binding.port-offset=100 (on Windows)
standalone.sh -Djboss.socket.binding.port-offset=100 (on Unix-based systems)
- Go to the console administration and create role investigator and a user with this role.
Use the [Spring Boot Maven plugin] (https://docs.spring.io/spring-boot/docs/current/reference/html/build-tool-plugins-maven-plugin.html) like so:
mvn clean package
The war will be generate in /target
repository
To deploy the war file in Tomcat, you need to :
Download Apache Tomcat and unpackage it into a tomcat folder
Copy your WAR file from target/ to the tomcat/webapps/ folder
Before to startup the tomcat server, some configurations are needed :
Create pearljambo.properties near war file and complete the following properties:
#Profile configuration
spring.profiles.active=prod
#Logs configuration
fr.insee.pearljam.logging.path=${catalina.base}/webapps/log4j2.xml
fr.insee.pearljam.logging.level=DEBUG
#Application configuration
fr.insee.pearljam.application.mode=keycloak
fr.insee.pearljam.application.crosOrigin=*
#Database configuration
fr.insee.pearljam.persistence.database.host = pearljam-db
fr.insee.pearljam.persistence.database.port = 5432
fr.insee.pearljam.persistence.database.schema = pearljam
fr.insee.pearljam.persistence.database.user = pearljam
fr.insee.pearljam.persistence.database.password = pearljam
fr.insee.pearljam.persistence.database.driver = org.postgresql.Driver
fr.insee.pearljam.defaultSchema=public
#Datacollection Api
fr.insee.pearljam.datacollection.service.url.scheme=http
fr.insee.pearljam.datacollection.service.url.host=localhost
fr.insee.pearljam.datacollection.service.url.port=8081
#Keycloak configuration
keycloak.realm=insee-realm
keycloak.resource=pearljam-web
keycloak.auth-server-url=http://localhost:8180/auth
keycloak.public-client=true
keycloak.bearer-only=true
keycloak.principal-attribute:preferred_username
#Keycloak roles
fr.insee.pearljam.interviewer.role=investigator
fr.insee.pearljam.user.local.role=manager_local
fr.insee.pearljam.user.national.role=manager_national
Create log4j2.xml near war file and define your external config for logs.
From a terminal navigate to tomcat/bin folder and execute
catalina.bat run (on Windows)
catalina.sh run (on Unix-based systems)
To access to swagger-ui, use this url : http://localhost:8080/pearljam-1.1.0/swagger-ui.html
To access to keycloak, use this url : http://localhost:8180
Before committing code please ensure,
1 - README.md is updated
2 - A successful build is run and all tests are sucessful
3 - All newly implemented APIs are documented
4 - All newly added properties are documented
Campaign :
-
GET /campaign/{id}/interviewers
: Get interviewers -
GET /campaign/{id}/survey-units/abandoned
: Get numberSUAbandoned -
GET /campaign/{id}/survey-units/contact-outcomes
: Get campaignStateCount -
GET /campaign/{id}/survey-units/interviewer/{idep}/state-count
: Get interviewerStateCount -
GET /campaign/{id}/survey-units/not-attributed
: Get numberSUNotAttributed -
GET /campaign/{id}/survey-units/not-attributed/contact-outcomes
: Get Contact-outcomes count for non attributted SUs -
GET /campaign/{id}/survey-units/not-attributed/state-count
: Get state count for non attributted SUs -
GET /campaign/{id}/survey-units/state-count
: Get campaignStateCount -
GET /campaigns
: Get Campaigns -
GET /campaigns/survey-units/contact-outcomes
: Get campaignStateCount -
GET /campaigns/survey-units/state-count
: Get campaignStateCount -
GET /interviewers/survey-units/state-count
: Get interviewersStateCount -
PUT /campaign/{id}/collection-dates
: Put campaignCollectionDates -
PUT /campaign/{idCampaign}/organizational-unit/{idOu}/visibility
: Change visibility of a campaign for an Organizational Unit -
POST /campaign
: Post Campaign
Dataset :
-
POST /create-dataset
: Create dataset -
DELETE /delete-dataset
: Delete dataset
GeographicalLocation :
POST /geographical-locations
: Create Context with Organizational Unit and users associated
Interviewer :
-
GET /campaign/{id}/survey-units/interviewer/{idep}/contact-outcomes
: Get contact-outcome type for an interviewer on a specific campaign -
GET /interviewer/{id}/campaigns
: Get interviewer campaigns -
GET /interviewers
: Get interviewers -
POST /interviewers
: Post interviewers
Message :
-
GET /message-history
: Get the message history -
GET /messages/{id}
: Get a message -
PUT /message/{id}/interviewer/{idep}/delete
: Mark a message as deleted -
PUT /message/{id}/interviewer/{idep}/read
: Mark a message as read -
POST /message
: Post a message -
POST /verify-name
: Update Messages with campaigns or interviewers listed in request body
OrganizationUnit :
POST /organization-units
: Create Context with Organizational Unit and users associated
Preference :
PUT /preferences
: Update preferences with campaigns listed in request body
SurveyUnit :
-
GET /campaign/{id}/survey-units
: Update the Survey Unit -
GET /check-habilitation
: Check habilitation -
GET /survey-unit/{id}
: Get detail of specific survey unit -
GET /survey-unit/{id}/states
: Get states of given survey unit -
GET /survey-units
: Get SurveyUnits -
GET /survey-units/closable
: Get closable survey units -
PUT /survey-unit/{id}
: Update the Survey Unit -
PUT /survey-unit/{id}/close/{closingCause}
: Closes a survey unit -
PUT /survey-unit/{id}/closing-cause/{closingCause}
: Add Closing cause -
PUT /survey-unit/{id}/comment
: Update the state of Survey Units listed in request body -
PUT /survey-unit/{id}/state/{state}
: Update the state of Survey Units listed in request body -
PUT /survey-unit/{id}/viewed
: Update the state of Survey Units listed in request body -
POST /survey-units
: POST SurveyUnits -
POST /survey-units/interviewers
: POST SurveyUnit assignations to interviewer
User :
GET /user
: Get User
- spring-boot-jpa
- spring-boot-security
- spring-boot-web
- spring-boot-tomcat
- spring-boot-test
- rest-assured
- liquibase
- postgresql
- junit
- springfox-swagger2
- hibernate
- keycloak
- Benjamin Claudel ([email protected])
- Samuel Corcaud ([email protected])
Please check LICENSE file