Back-office services for Queen
REST API for communication between Queen DB and Queen UI.
For building and running the application you need:
- JDK 11
- Maven 3
Use the maven clean and maven install
mvn clean installUse the Spring Boot Maven plugin like so:
mvn spring-boot:runTo access to swagger-ui, use this url : http://localhost:8080/api/swagger-ui.html
To access to h2 console, use this url : http://localhost:8080/api/h2-console
- 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.
Queen-Back-Office manage 2 Database configurations : 1 - PostgreSQL database with JPA connectors 2 - MongoDb database It is possible to switch between both configurations via the following property:
fr.insee.queen.application.persistenceTypeIt can take the 2 following values : MONGODB or JPA
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 packageThe 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 queenbo.properties or colemcobo.properties near war file and complete the following properties:
#Profile configuration
spring.profiles.active=prod
#Logs configuration
fr.insee.queen.logging.path=${catalina.base}/webapps/log4j2.xml
fr.insee.queen.logging.level=DEBUG
#Application configuration
fr.insee.queen.application.mode=noauth or basic or keycloak
fr.insee.queen.application.crosOrigin=*
fr.insee.queen.application.persistenceType = MONGODB or JPA
#Database configuration
fr.insee.queen.persistence.database.host = queen-db
fr.insee.queen.persistence.database.port = 5432
fr.insee.queen.persistence.database.schema = queen
fr.insee.queen.persistence.database.user = queen
fr.insee.queen.persistence.database.password = queen
fr.insee.queen.persistence.database.driver = org.postgresql.Driver
fr.insee.queen.defaultSchema=public
#Keycloak configuration
keycloak.realm=insee-realm
keycloak.resource=queen-web
keycloak.auth-server-url=http://localhost:8180/auth
keycloak.public-client=true
keycloak.bearer-only=true
keycloak.principal-attribute:preferred_username
#Roles
fr.insee.queen.interviewer.role=investigator
fr.insee.queen.reviewer.role=reviewer
fr.insee.queen.admin.role=admin
#Pilotage Api
fr.insee.queen.pilotage.service.url.scheme=http
fr.insee.queen.pilotage.service.url.host=localhost
fr.insee.queen.pilotage.service.url.port=8081
#If true, checkHabilitation and getSuFromPilotage are not used to secure the endpoints
fr.insee.queen.pilotage.integration.override=false
#Other claim to read roles from in token
fr.insee.queen.token.claim.role=inseegroupedefaut
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/queen-1.1.1/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 /campaigns: get the campaign listPOST /campaigns: post a new campaignPOST /campaign/context: integrates the context of a campaignDELETE /campaign/{id}: delete a campaign
-
Questionnaire
GET /questionnaire/{id}: get the questionnaire by his idGET /campaign/{id}/questionnaires: get the list of model jsonGET /campaign/{idCampaign}/questionnaire-id: id of the questionnaire associated to the campaignPOST /questionnaire-models: post a new questionnaire
-
SurveyUnit
GET /survey-unit/{id}: get survey-unit by idGET /survey-unit/{id}/deposit-prof: get the deposit-proof of survey-unit by idGET /campaign/{id}/survey-units: get the list of survey-unit of campaign idPUT /survey-unit/{id}: update a survey-unitPOST /campaign/{id}/survey-unit: post a survey-unit for a campaignDELETE /survey-unit/{id}: delete a survey-unit by id
-
Data
GET /survey-unit/{id}/data: get the data of reporting unit idPUT /survey-unit/{id}/data: update the data of reporting unit id
-
Comment
GET /survey-unit/{id}/comment: get the comment of reporting unit idPUT /survey-unit/{id}/comment: update the comment of reporting unit id
-
Nomenclatures
GET /campaign/{id}/required-nomenclatures: get the nomenclature of a campaignGET /questionnaire/{id}/required-nomenclatures: get the nomenclature of a questionnaireGET /nomenclature/{id}: get the nomenclature jsonPOST /nomenclature: post a new nomenclature
-
Personalization
GET /survey-unit/{id}/personalization: get the personalization of a survey-unitPUT /survey-unit/{id}/personalization: put the personalization for a survey-unit
-
Metadata
GET /campaign/{id}/metadata: get the metadata by campaign IdGET /questionnaire/{id}/metadata: get the metadata by questionnaire id
-
Paradata
POST /paradata: post the metadata of a campaign
-
StateData
GET /survey-unit/{id}/state-data: get the state-data of a survey-unitPUT /survey-unit/{id}/state-data: put the state-data for a survey-unitPOST /survey-units/state-data: Get state-data for all survey-units defined in request body
-
DataSet
POST /create-dataset: Create dataset
- spring-boot-jpa
- spring-boot-security
- spring-boot-web
- spring-boot-tomcat
- spring-boot-test
- liquibase
- h2 database
- postgresql
- junit
- springfox-swagger2
- hibernate
- hibernate-types-52 (for jsonb type)
- keycloak
- Benjamin Claudel ([email protected])
- Samuel Corcaud ([email protected])
- Paul Guillemet ([email protected])
Please check LICENSE file