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
POST /api/campaign
: Post CampaignPUT /api/campaign/{id}/collection-dates
: Put campaignCollectionDatesGET /api/campaign/{id}/interviewers
: Get interviewersGET /api/campaign/{id}/survey-units/abandoned
: Get numberSUAbandonedGET /api/campaign/{id}/survey-units/not-attributed
: Get numberSUNotAttributedPUT /api/campaign/{idCampaign}/organizational-unit/{idOu}/visibility
: Change visibility of a campaign for an Organizational UnitGET /api/campaigns
: Get Campaigns
GET /api/campaign/{id}/survey-units/interviewer/{idep}/closing-causes
: Get interviewerStateCount
GET /api/campaign/{id}/survey-units/contact-outcomes
: Get campaignStateCountGET /api/campaign/{id}/survey-units/interviewer/{idep}/contact-outcomes
: Get contact-outcome type for an interviewer on a specific campaignGET /api/campaign/{id}/survey-units/not-attributed/contact-outcomes
: Get Contact-outcomes count for non attributted SUsGET /api/campaigns/survey-units/contact-outcomes
: Get campaignStateCount
POST /api/create-dataset
: Create datasetDELETE /api/delete-dataset
: Delete dataset
POST /api/geographical-locations
: Create Context with Organizational Unit and users associated
GET /api/interviewer/{id}/campaigns
: Get interviewer campaignsGET /api/interviewers
: Get interviewersPOST /api/interviewers
: Post interviewers
POST /api/message
: Post a messageGET /api/message-history
: Get the message historyPUT /api/message/{id}/interviewer/{idep}/delete
: Mark a message as deletedPUT /api/message/{id}/interviewer/{idep}/read
: Mark a message as readGET /api/messages/{id}
: Get a messagePOST /api/verify-name
: Update Messages with campaigns or interviewers listed in request body
POST /api/organization-units
: Create Context with Organizational Unit and users associated
PUT /api/preferences
: Update preferences with campaigns listed in request body
GET /api/campaign/{id}/survey-units/interviewer/{idep}/state-count
: Get interviewerStateCountGET /api/campaign/{id}/survey-units/not-attributed/state-count
: Get state count for non attributted SUsGET /api/campaign/{id}/survey-units/state-count
: Get campaignStateCountGET /api/campaigns/survey-units/state-count
: Get campaignStateCountGET /api/interviewers/survey-units/state-count
: Get interviewersStateCount
GET /api/campaign/{id}/survey-units
: Update the Survey UnitGET /api/check-habilitation
: Check habilitationGET /api/survey-unit/{id}
: Get detail of specific survey unitPUT /api/survey-unit/{id}
: Update the Survey UnitPUT /api/survey-unit/{id}/close/{closingCause}
: Closes a survey unitPUT /api/survey-unit/{id}/closing-cause/{closingCause}
: Add Closing causePUT /api/survey-unit/{id}/comment
: Update the state of Survey Units listed in request bodyPUT /api/survey-unit/{id}/state/{state}
: Update the state of Survey Units listed in request bodyGET /api/survey-unit/{id}/states
: Get states of given survey unitPUT /api/survey-unit/{id}/viewed
: Update the state of Survey Units listed in request bodyGET /api/survey-units
: Get SurveyUnitsPOST /api/survey-units
: POST SurveyUnit assignations to interviewerGET /api/survey-units/closable
: Get closable survey unitsPOST /api/survey-units/interviewers
: Post SurveyUnits
GET /api/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 (benjamin.claudel@keyconsulting.fr)
- Samuel Corcaud (samuel.corcaud@keyconsulting.fr)
Please check LICENSE file