Fixing "Draft" execution step executing dematerialization and

de-indexing actions [#24877]
This commit is contained in:
Francesco Mangiacrapa 2023-03-29 14:38:10 +02:00
parent 292fe88107
commit 7fb96e75fe
2 changed files with 54 additions and 28 deletions

View File

@ -3,6 +3,7 @@
## [v1.2.0-SNAPSHOT]
- Integrated the field 'geov_link' (Geoportal GisViewer link) in the centroid layer [#24859]
- Fixed Draft execution step executing dematerialization and de-indexing actions [#24877]
## [v1.1.1] - 2023-03-06

View File

@ -177,37 +177,62 @@ public class Default3PhaseManager extends SimpleLifeCycleManager implements Life
return callParameters;
}
protected StepExecutionReport executeSubmit(StepExecutionReport theReport) throws Exception {
// Materialize
protected StepExecutionReport executeSubmit(StepExecutionReport theReport) throws Exception {
log.info(STEPS.SUBMIT + " running...");
for(MaterializationPlugin mat : getMaterializers(theReport.getTheRequest()))
theReport = materializeDocument(theReport,mat,getMaterializationParameters(theReport.getTheRequest()));
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)){
// Index
for(IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest()))
theReport = index(theReport,indexer,getInternalIndexParams(theReport.getTheRequest()));
// setPhase
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
theReport.getToSetLifecycleInformation().setPhase(Phases.PENDING_APPROVAL);
}
return theReport;
}
// Materialize
for (MaterializationPlugin mat : getMaterializers(theReport.getTheRequest()))
theReport = materializeDocument(theReport, mat, getMaterializationParameters(theReport.getTheRequest()));
if (theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)) {
// Index
for (IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest()))
theReport = index(theReport, indexer, getInternalIndexParams(theReport.getTheRequest()));
// setPhase
if (theReport.getToSetLifecycleInformation().getLastOperationStatus()
.equals(LifecycleInformation.Status.OK))
theReport.getToSetLifecycleInformation().setPhase(Phases.PENDING_APPROVAL);
}
return theReport;
}
protected StepExecutionReport executeApprove(StepExecutionReport theReport) throws Exception {
// Index
for(IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest()))
theReport = index(theReport,indexer,getPublicIndexParams(theReport.getTheRequest()));
// setPhase
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
theReport.getToSetLifecycleInformation().setPhase(Phases.PUBLISHED);
return theReport;
}
protected StepExecutionReport executeApprove(StepExecutionReport theReport) throws Exception {
log.info(STEPS.APPROVE + " running...");
protected StepExecutionReport executeReject(StepExecutionReport theReport) throws Exception {
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
theReport.getToSetLifecycleInformation().setPhase(LifecycleInformation.CommonPhases.DRAFT_PHASE);
return theReport;
}
// Index
for (IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest()))
theReport = index(theReport, indexer, getPublicIndexParams(theReport.getTheRequest()));
// setPhase
if (theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
theReport.getToSetLifecycleInformation().setPhase(Phases.PUBLISHED);
return theReport;
}
protected StepExecutionReport executeReject(StepExecutionReport theReport) throws Exception {
log.info(STEPS.REJECT + " running...");
// DeMaterialize
JSONPathWrapper wrapper = new JSONPathWrapper(
theReport.getTheRequest().getDocument().getTheDocument().toJson());
for (String s : wrapper.getMatchingPaths("$..[?(@." + RegisteredFileSet.PAYLOADS + ")]")) {
log.info("Requesting dematerialization for {} ", s);
for (MaterializationPlugin mat : getMaterializers(theReport.getTheRequest()))
theReport = deMaterialize(theReport, mat, new Document("fileSetPath", s));
if (!theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
break;
}
// DeIndexing
if (theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)) {
for (IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest())) {
log.info("Requesting deindexing for {} ", indexer.getDescriptor());
theReport = deIndex(theReport, indexer, getInternalIndexParams(theReport.getTheRequest()));
}
}
if (theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
theReport.getToSetLifecycleInformation().setPhase(LifecycleInformation.CommonPhases.DRAFT_PHASE);
return theReport;
}
}