Commit 65d6c4c3 authored by granier's avatar granier
Browse files

En cours

parent 489d4895
......@@ -184,7 +184,17 @@ public class FormatValidatorPlugin extends ActionHandler {
jsonFormatIdentifier, fileToValidate,
version, validatorResultList);
final Format format = objectCheckResult.getFormat();
String declaredPuid = jsonFormatIdentifier.get(SedaConstants.TAG_FORMAT_ID).asText();
String declaredPuid;
if (jsonFormatIdentifier.get(SedaConstants.TAG_FORMAT_ID) != null) {
declaredPuid = jsonFormatIdentifier.get(SedaConstants.TAG_FORMAT_ID).asText();
} else {
final ObjectNode object = JsonHandler.createObjectNode();
object.put(SedaConstants.EV_DET_TECH_DATA, "E0028 : Le format du fichier " + fileToValidate + " n'est pas déclaré dans le bordereau");
itemStatus.increment(StatusCode.KO);
itemStatus.setEvDetailData(JsonHandler.unprettyPrint(object));
LOGGER.warn("E0028 : Le format du fichier: {} n'est pas déclaré dans le bordereau", fileToValidate);
return new ItemStatus(FORMAT_VALIDATOR_PLUGIN).setItemsStatus(itemStatus.getItemId(), itemStatus);
}
/*
if (!format.getPronomIds().contains(declaredPuid)) {
......@@ -227,6 +237,13 @@ public class FormatValidatorPlugin extends ActionHandler {
itemStatus.setEvDetailData(JsonHandler.unprettyPrint(object));
LOGGER.warn("Impossible d'identifier le format : {}, {}", fileToValidate, e.getMessage());
return new ItemStatus(FORMAT_VALIDATOR_PLUGIN).setItemsStatus(itemStatus.getItemId(), itemStatus);
} catch (FileFormatRejectedException e) {
final ObjectNode object = JsonHandler.createObjectNode();
object.put(SedaConstants.EV_DET_TECH_DATA, e.getMessage());
itemStatus.increment(StatusCode.KO);
itemStatus.setEvDetailData(JsonHandler.unprettyPrint(object));
LOGGER.warn(e.getMessage());
return new ItemStatus(FORMAT_VALIDATOR_PLUGIN).setItemsStatus(itemStatus.getItemId(), itemStatus);
} catch (Exception e) {
LOGGER.warn("erreur lors de la validation du format" + e.getMessage());
}
......@@ -378,7 +395,7 @@ public class FormatValidatorPlugin extends ActionHandler {
private ObjectCheckFormatResult executeOneObjectFromOG(HandlerIO handlerIO,
String objectId,
JsonNode manifestFormatIdentification,
File file, JsonNode version, List<ValidatorResult> validatorResultList) throws FormatErrorException, UnknownFormatException {
File file, JsonNode version, List<ValidatorResult> validatorResultList) throws FormatErrorException, UnknownFormatException, FileFormatRejectedException {
final ObjectCheckFormatResult objectCheckFormatResult = new ObjectCheckFormatResult(objectId);
objectCheckFormatResult.setStatus(StatusCode.OK);
ValidatorResult vr = new ValidatorResult();
......@@ -456,6 +473,7 @@ public class FormatValidatorPlugin extends ActionHandler {
LOGGER.error(e);
objectCheckFormatResult.setStatus(StatusCode.KO);
objectCheckFormatResult.setSubStatus(FILE_FORMAT_REJECTED);
return objectCheckFormatResult;
}
return null;
......
fr.cines.validator.FacileUri=https://facile.cines.fr/xml
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment