-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new ENO transformation PoguesJSONToLunaticJSON (#314)
* feat: add new transformation PoguesJSONToLunaticJSON * bump: version to 4.8.2-SNAPSHOT
- Loading branch information
1 parent
f7f91a1
commit a9b9d66
Showing
6 changed files
with
66 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/java/fr/insee/pogues/transforms/visualize/eno/PoguesJSONToLunaticJSON.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package fr.insee.pogues.transforms.visualize.eno; | ||
|
||
import fr.insee.pogues.transforms.visualize.ModelTransformer; | ||
|
||
public interface PoguesJSONToLunaticJSON extends ModelTransformer { | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/fr/insee/pogues/transforms/visualize/eno/PoguesJSONToLunaticJSONImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package fr.insee.pogues.transforms.visualize.eno; | ||
|
||
import fr.insee.pogues.api.remote.eno.transforms.EnoClient; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.InputStream; | ||
import java.util.Map; | ||
|
||
import static fr.insee.pogues.utils.IOStreamsUtils.inputStream2String; | ||
import static fr.insee.pogues.utils.IOStreamsUtils.string2BOAS; | ||
|
||
@Service | ||
public class PoguesJSONToLunaticJSONImpl implements PoguesJSONToLunaticJSON { | ||
|
||
@Autowired | ||
private EnoClient enoClient; | ||
|
||
@Override | ||
public ByteArrayOutputStream transform(InputStream inputStream, Map<String, Object> params, String surveyName) throws Exception { | ||
String inputAsString = inputStream2String(inputStream); | ||
String outputAsString = transform(inputAsString, params); | ||
return string2BOAS(outputAsString); | ||
} | ||
|
||
private String transform(String inputAsString, Map<String, Object> params) throws Exception { | ||
return enoClient.getJSONPoguesToLunaticJson(inputAsString, params); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters