Skip to content

Commit

Permalink
Fix file on error moved in done + add multiple inputed syntaxes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexisszmundy committed Jul 31, 2024
1 parent a50d666 commit bff804e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.HttpStatusCode;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.DeleteMapping;
Expand Down Expand Up @@ -355,13 +357,18 @@ private void treatCampaignWithMode(String campaignName, Mode mode, List<GenesisE
}else{
//Read file
log.info("Try to read Xml file : {}", fileName);
ResponseEntity<Object> response;
if (filepath.toFile().length() / 1024 / 1024 <= Constants.MAX_FILE_SIZE_UNTIL_SEQUENTIAL) {
treatXmlFileWithMemory(filepath, mode, variablesMap);
response = treatXmlFileWithMemory(filepath, mode, variablesMap);
} else {
treatXmlFileSequentially(filepath, mode, variablesMap);
response = treatXmlFileSequentially(filepath, mode, variablesMap);
}
log.debug("File {} saved", fileName);
fileUtils.moveDataFile(campaignName, mode.getFolder(), filepath);
if(response.getStatusCode() == HttpStatus.OK){
fileUtils.moveDataFile(campaignName, mode.getFolder(), filepath);
}else{
log.error("Error on file {}", fileName);
}
}
}
}
Expand All @@ -377,6 +384,7 @@ private ResponseEntity<Object> treatXmlFileWithMemory(Path filepath, Mode modeSp
try {
campaign = parser.parseDataFile(filepath);
} catch (GenesisException e) {
log.error(e.toString());
return ResponseEntity.status(e.getStatus()).body(e.getMessage());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private static void setValues(LunaticXmlCollectedData varData, Node value, List<
case "EDITED":
varData.setEdited(valueTypes);
break;
case "INPUTED":
case "INPUTED", "INPUTTED", "IMPUTED":
varData.setInputed(valueTypes);
break;
case "FORCED":
Expand Down

0 comments on commit bff804e

Please sign in to comment.