File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
service/src/main/java/uk/nhs/adaptors/gp2gp/transformjsontoxmltool Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -65,17 +65,22 @@ public static void main(String[] args) {
6565 @ Override
6666 public void run (String ... args ) {
6767 try {
68- getFiles ().forEach (file -> {
69- String xmlResult = mapJsonToXml (file .getJsonFileInput ());
70- writeToFile (xmlResult , file .getJsonFileName ());
71- xmlSchemaValidator .validateOutputToXmlSchema (file .getJsonFileName (), xmlResult );
72- });
68+ getFiles ().forEach (this ::processAndValidateFile );
7369 } catch (NHSNumberNotFound | UnreadableJsonFileException | NoJsonFileFound | Hl7TranslatedResponseError e ) {
7470 LOGGER .error ("error: " + e .getMessage ());
7571 }
72+
7673 LOGGER .info ("end" );
7774 }
7875
76+ private void processAndValidateFile (InputFile file ) {
77+ String xmlResult = mapJsonToXml (file .getJsonFileInput ());
78+
79+ writeToFile (xmlResult , file .getJsonFileName ());
80+
81+ xmlSchemaValidator .validateOutputToXmlSchema (file .getJsonFileName (), xmlResult );
82+ }
83+
7984 private List <InputFile > getFiles () throws UnreadableJsonFileException , NoJsonFileFound {
8085 File [] files = new File (JSON_FILE_INPUT_PATH ).listFiles ();
8186 List <String > jsonStringInputs = new ArrayList <>();
You can’t perform that action at this time.
0 commit comments