diff --git a/.gitlab/issue_templates/Bug.md b/.gitlab/issue_templates/Bug.md new file mode 100644 index 0000000000..9c420204ae --- /dev/null +++ b/.gitlab/issue_templates/Bug.md @@ -0,0 +1,6 @@ +## Source +[TULEAP - XXXX]() + +## Description + +## Solution(s) diff --git a/sources/common/common-public/src/main/resources/vitam-logbook-messages_fr.properties b/sources/common/common-public/src/main/resources/vitam-logbook-messages_fr.properties index 4239e9955d..9340d8d6b1 100644 --- a/sources/common/common-public/src/main/resources/vitam-logbook-messages_fr.properties +++ b/sources/common/common-public/src/main/resources/vitam-logbook-messages_fr.properties @@ -2970,6 +2970,9 @@ STP_TRANSFER_REPLY_DELETE_UNIT.KO=Échec du processus de purge des unités archi STP_TRANSFER_REPLY_DELETE_UNIT.FATAL=Erreur technique lors du processus de purge des unités archivistiques STP_TRANSFER_REPLY_DELETE_UNIT.WARNING=Avertissement lors du processus de purge des unités archivistiques +LFC.UNIT_DELETION_ABORT=Échec du processus de purge de l''unité archivistique +LFC.UNIT_DELETION_ABORT.OK=Échec du processus de purge de l''unité archivistique + TRANSFER_REPLY_DELETE_UNIT=Purge des unités archivistiques TRANSFER_REPLY_DELETE_UNIT.STARTED=Début de la purge des unités archivistiques TRANSFER_REPLY_DELETE_UNIT.STARTED.OK=Succès du début de la purge des unités archivistiques diff --git a/sources/integration-test/src/test/java/fr/gouv/vitam/purge/EndToEndEliminationAndTransferReplyIT.java b/sources/integration-test/src/test/java/fr/gouv/vitam/purge/EndToEndEliminationAndTransferReplyIT.java index 69f6b0850b..e8d86409a7 100755 --- a/sources/integration-test/src/test/java/fr/gouv/vitam/purge/EndToEndEliminationAndTransferReplyIT.java +++ b/sources/integration-test/src/test/java/fr/gouv/vitam/purge/EndToEndEliminationAndTransferReplyIT.java @@ -724,7 +724,7 @@ private void checkTransferResult(String ingestOperationGuid, RequestResponseOK(expectedNonDeletableUnitIds)); for (JsonNode unitLifeCycle : unitLifeCycles) { assertThat(unitLifeCycle.get("events").get(unitLifeCycle.get("events").size() - 1) - .get("outDetail").asText()).isEqualTo("LFC.UNIT_TRANSFERT_ABORT.OK"); + .get("outDetail").asText()).isEqualTo("LFC.UNIT_DELETION_ABORT.OK"); } // Check SIP transfer is deleted after atr reception diff --git a/sources/worker/worker-core/src/main/java/fr/gouv/vitam/worker/core/plugin/purge/PurgeUnitPlugin.java b/sources/worker/worker-core/src/main/java/fr/gouv/vitam/worker/core/plugin/purge/PurgeUnitPlugin.java index faa6eb78f7..79f7f67abf 100644 --- a/sources/worker/worker-core/src/main/java/fr/gouv/vitam/worker/core/plugin/purge/PurgeUnitPlugin.java +++ b/sources/worker/worker-core/src/main/java/fr/gouv/vitam/worker/core/plugin/purge/PurgeUnitPlugin.java @@ -78,6 +78,7 @@ import static fr.gouv.vitam.common.model.StatusCode.OK; import static fr.gouv.vitam.common.model.StatusCode.WARNING; +import static fr.gouv.vitam.worker.core.plugin.transfer.reply.TransferReplyDeleteUnitPlugin.TRANSFER_REPLY_DELETE_UNIT; import static fr.gouv.vitam.worker.core.utils.PluginHelper.buildItemStatus; import static java.util.Collections.singletonList; @@ -89,7 +90,7 @@ public class PurgeUnitPlugin extends ActionHandler { private static final VitamLogger LOGGER = VitamLoggerFactory.getInstance(PurgeUnitPlugin.class); - private static final String UNIT_TRANSFER_ABORT = "UNIT_TRANSFERT_ABORT"; + private static final String UNIT_DELETION_ABORT = "UNIT_DELETION_ABORT"; private final String actionId; private final PurgeDeleteService purgeDeleteService; @@ -136,10 +137,7 @@ public ItemStatus execute(WorkerParameters param, HandlerIO handler) public List executeList(WorkerParameters param, HandlerIO handler) { try { - List itemStatuses = processUnits(param.getContainerName(), param); - - return itemStatuses; - + return processUnits(param.getContainerName(), param); } catch (ProcessingStatusException e) { LOGGER.error("Unit purge failed with status " + e.getStatusCode(), e); return singletonList( @@ -180,16 +178,17 @@ private List processUnits(String processId, WorkerParameters param) purgeUnitStatus = PurgeUnitStatus.DELETED; itemStatuses.add(buildItemStatus(actionId, StatusCode.OK, null)); } else { - LOGGER.info("Unit " + unitId + " cannot be deleted because it has child units attached to it."); + String msg = "Unit " + unitId + " cannot be deleted because it has child units attached to it."; + LOGGER.info(msg); purgeUnitStatus = PurgeUnitStatus.NON_DESTROYABLE_HAS_CHILD_UNITS; - try { - writeLfcForUnpurgedUnit(lfcClientFactory.getClient(), param, unitId); - itemStatuses.add(buildItemStatus(actionId, WARNING, null)); - } catch (InvalidGuidOperationException | LogbookClientServerException | LogbookClientBadRequestException | LogbookClientNotFoundException e) { - LOGGER.error(e); - itemStatuses.add(buildItemStatus(UNIT_TRANSFER_ABORT, WARNING, - PluginHelper.EventDetails.of(String.format("Error '%s' while updating UNIT LFC.", e.getMessage())) - )); + itemStatuses.add(buildItemStatus(actionId, WARNING, PluginHelper.EventDetails.of(msg))); + if(TRANSFER_REPLY_DELETE_UNIT.equals(actionId)) { + try { + writeLfcForUnpurgedUnit(lfcClientFactory.getClient(), param, unitId); + } catch (InvalidGuidOperationException | LogbookClientServerException | + LogbookClientBadRequestException | LogbookClientNotFoundException e) { + LOGGER.error(e); + } } } @@ -282,12 +281,12 @@ private void writeLfcForUnpurgedUnit(LogbookLifeCyclesClient lfcClient, WorkerPa LogbookLifeCycleParameters logbookLfcParam = LogbookParametersFactory.newLogbookLifeCycleUnitParameters( GUIDFactory.newEventGUID(ParameterHelper.getTenantParameter()), - VitamLogbookMessages.getEventTypeLfc(UNIT_TRANSFER_ABORT), + VitamLogbookMessages.getEventTypeLfc(UNIT_DELETION_ABORT), GUIDReader.getGUID(param.getContainerName()), param.getLogbookTypeProcess(), OK, - VitamLogbookMessages.getOutcomeDetailLfc(UNIT_TRANSFER_ABORT, OK), - VitamLogbookMessages.getCodeLfc(UNIT_TRANSFER_ABORT, OK), + VitamLogbookMessages.getOutcomeDetailLfc(UNIT_DELETION_ABORT, OK), + VitamLogbookMessages.getCodeLfc(UNIT_DELETION_ABORT, OK), GUIDReader.getGUID(unitId)); lfcClient.update(logbookLfcParam, LifeCycleStatusCode.LIFE_CYCLE_COMMITTED); } diff --git a/sources/worker/worker-core/src/main/java/fr/gouv/vitam/worker/core/plugin/transfer/reply/TransferReplyDeleteUnitPlugin.java b/sources/worker/worker-core/src/main/java/fr/gouv/vitam/worker/core/plugin/transfer/reply/TransferReplyDeleteUnitPlugin.java index 18ca7c112c..49d02301ff 100644 --- a/sources/worker/worker-core/src/main/java/fr/gouv/vitam/worker/core/plugin/transfer/reply/TransferReplyDeleteUnitPlugin.java +++ b/sources/worker/worker-core/src/main/java/fr/gouv/vitam/worker/core/plugin/transfer/reply/TransferReplyDeleteUnitPlugin.java @@ -35,7 +35,7 @@ public class TransferReplyDeleteUnitPlugin extends PurgeUnitPlugin { - private static final String TRANSFER_REPLY_DELETE_UNIT = "TRANSFER_REPLY_DELETE_UNIT"; + public static final String TRANSFER_REPLY_DELETE_UNIT = "TRANSFER_REPLY_DELETE_UNIT"; /** * Default constructor