Skip to content

Commit

Permalink
Next (#114)
Browse files Browse the repository at this point in the history
* build: update dependencies (#113)

* ci: bump softprops/action-gh-release from 1 to 2 (#97)

* build: bump actions/setup-java from 3 to 4 (#98)

* build: bump org.apache.logging.log4j:log4j-slf4j2-impl from 2.22.1 to 2.23.1 (#99)

* ci: bump mukunku/tag-exists-action from 1.2.0 to 1.6.0 (#100)

* ci: bump actions/github-script from 6 to 7 (#103)

* ci: bump actions/checkout from 3 to 4 (#104)

* build: bump org.apache.maven.plugins:maven-source-plugin from 3.2.1 to 3.3.1 (#108)

* build: bump org.apache.maven.plugins:maven-gpg-plugin from 3.1.0 to 3.2.4 (#111)

---------

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: Allow Control/@scope="line" (#107)

* Allow Control/@scope="line"

* bump: 1.3.4

* chore: snapshot version

---------

Co-authored-by: nsenave <[email protected]>

* feat: enrich uncollected cells (#112)

* Fix/json serializer (#119)

* fix: serialize to string without root attribute

* test: add test for new use case

* bump: version to 1.3.6-SNAPSHOT

* chore: remove blanck

* Fix/serialize synonyms (#120)

* Fix serialize synonyms issues

* build: remove useless maven repo (exist-db)

* bump: version to 1.3.7-SNAPSHOT

* bump to 1.3.7

---------

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: François Bulot <[email protected]>
Co-authored-by: Laurent Caouissin <[email protected]>
  • Loading branch information
4 people authored May 22, 2024
1 parent b8d7917 commit 8a4f15f
Show file tree
Hide file tree
Showing 11 changed files with 361 additions and 53 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
release-version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get version
id: version
Expand All @@ -21,7 +21,7 @@ jobs:
- name: Print version
run: echo ${{ steps.version.outputs.version }}

- uses: mukunku/tag-exists-action@v1.2.0
- uses: mukunku/tag-exists-action@v1.6.0
name: Check tag existence
id: check-tag-exists
with:
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
needs: check-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
Expand All @@ -70,7 +70,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
writeToFile: false

- uses: softprops/action-gh-release@v1
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.check-version.outputs.release-version }}
target_commitish: ${{ github.head_ref || github.ref }}
Expand All @@ -83,9 +83,9 @@ jobs:
needs: create-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/create-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
tag-version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get version
id: version
Expand All @@ -22,7 +22,7 @@ jobs:
- name: Print version
run: echo ${{ steps.version.outputs.version }}

- uses: mukunku/tag-exists-action@v1.2.0
- uses: mukunku/tag-exists-action@v1.6.0
name: Check tag existence
id: check-tag-exists
with:
Expand All @@ -45,10 +45,10 @@ jobs:
needs: check-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
Expand All @@ -61,7 +61,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Create tag
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
Expand All @@ -75,9 +75,9 @@ jobs:
needs: create-tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
Expand All @@ -97,7 +97,7 @@ jobs:
needs: [ deploy-maven-repo, check-version ]
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
- uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
Expand All @@ -111,7 +111,7 @@ jobs:
needs: deploy-comment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions-ecosystem/action-remove-labels@v1
with:
labels: deploy-snapshot
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'deploy-snapshot') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
Expand Down
16 changes: 4 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>fr.insee.pogues</groupId>
<artifactId>pogues-model</artifactId>
<packaging>jar</packaging>
<version>1.3.3</version>
<version>1.3.7</version>
<name>Pogues Model</name>
<description>Classes and converters for the Pogues model</description>
<url>https://inseefr.github.io/Pogues-Model/</url>
Expand Down Expand Up @@ -106,7 +106,7 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
<version>2.22.1</version>
<version>2.23.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -219,7 +219,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand Down Expand Up @@ -256,7 +256,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<version>3.2.4</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -277,12 +277,4 @@
</build>
</profile>
</profiles>

<repositories>
<repository>
<id>exist</id>
<url>https://raw.github.com/eXist-db/mvn-repo/master/</url>
</repository>
</repositories>

</project>
9 changes: 9 additions & 0 deletions src/main/java/fr/insee/pogues/PostProcessingException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package fr.insee.pogues;

public class PostProcessingException extends RuntimeException {

public PostProcessingException(String message, Exception e) {
super(message, e);
}

}
20 changes: 13 additions & 7 deletions src/main/java/fr/insee/pogues/conversion/JSONSerializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ public class JSONSerializer {

public JSONSerializer() { }

public JSONSerializer(boolean withoutJsonRoot){
this.withoutJsonRoot = withoutJsonRoot;
}

private boolean withoutJsonRoot;

private static final Logger logger = LoggerFactory.getLogger(JSONSerializer.class);

public String serialize(Questionnaire questionnaire) throws JAXBException, UnsupportedEncodingException {
Expand All @@ -34,15 +40,15 @@ public String serialize(Questionnaire questionnaire) throws JAXBException, Unsup
marshaller.setProperty(MarshallerProperties.MEDIA_TYPE, "application/json");

// Set it to true if you need to include the JSON root element in the JSON output
marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT, true);
marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT, !withoutJsonRoot);
// Set it to true if you need the JSON output to formatted
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
// Marshal the questionnaire object to JSON and put the output in a string

ByteArrayOutputStream baos = new ByteArrayOutputStream();
marshaller.marshal(questionnaire, baos);

return baos.toString("UTF-8");
String questionnaireString = baos.toString("UTF-8");
return new JSONSynonymsPostProcessor().transform(questionnaireString);

}

Expand All @@ -57,7 +63,7 @@ public String serialize(SequenceType sequence) throws JAXBException, Unsupported
marshaller.setProperty(MarshallerProperties.MEDIA_TYPE, "application/json");

// Set it to true if you need to include the JSON root element in the JSON output
marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT, true);
marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT, !withoutJsonRoot);
// Set it to true if you need the JSON output to formatted
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
// Marshal the sequence object to JSON and put the output in a string
Expand All @@ -79,7 +85,7 @@ public String serialize(CodeList codeList) throws JAXBException, UnsupportedEnco
marshaller.setProperty(MarshallerProperties.MEDIA_TYPE, "application/json");

// Set it to true if you need to include the JSON root element in the JSON output
marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT, true);
marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT, !withoutJsonRoot);
// Set it to true if you need the JSON output to formatted
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
// Marshal the code list object to JSON and put the output in a string
Expand All @@ -101,7 +107,7 @@ public String serialize(QuestionType question) throws JAXBException, Unsupported
marshaller.setProperty(MarshallerProperties.MEDIA_TYPE, "application/json");

// Set it to true if you need to include the JSON root element in the JSON output
marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT, true);
marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT, !withoutJsonRoot);
// Set it to true if you need the JSON output to formatted
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
// Marshal the code list object to JSON and put the output in a string
Expand All @@ -123,7 +129,7 @@ public String serialize(ResponseType response) throws JAXBException, Unsupported
marshaller.setProperty(MarshallerProperties.MEDIA_TYPE, "application/json");

// Set it to true if you need to include the JSON root element in the JSON output
marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT, true);
marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT, !withoutJsonRoot);
// Set it to true if you need the JSON output to formatted
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
// Marshal the code list object to JSON and put the output in a string
Expand Down
Loading

0 comments on commit 8a4f15f

Please sign in to comment.