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] ## [v1.2.0-SNAPSHOT]
- Integrated the field 'geov_link' (Geoportal GisViewer link) in the centroid layer [#24859] - 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 ## [v1.1.1] - 2023-03-06

View File

@ -177,37 +177,62 @@ public class Default3PhaseManager extends SimpleLifeCycleManager implements Life
return callParameters; return callParameters;
} }
protected StepExecutionReport executeSubmit(StepExecutionReport theReport) throws Exception { protected StepExecutionReport executeSubmit(StepExecutionReport theReport) throws Exception {
// Materialize log.info(STEPS.SUBMIT + " running...");
for(MaterializationPlugin mat : getMaterializers(theReport.getTheRequest())) // Materialize
theReport = materializeDocument(theReport,mat,getMaterializationParameters(theReport.getTheRequest())); for (MaterializationPlugin mat : getMaterializers(theReport.getTheRequest()))
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)){ theReport = materializeDocument(theReport, mat, getMaterializationParameters(theReport.getTheRequest()));
// Index if (theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)) {
for(IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest())) // Index
theReport = index(theReport,indexer,getInternalIndexParams(theReport.getTheRequest())); for (IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest()))
// setPhase theReport = index(theReport, indexer, getInternalIndexParams(theReport.getTheRequest()));
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)) // setPhase
theReport.getToSetLifecycleInformation().setPhase(Phases.PENDING_APPROVAL); if (theReport.getToSetLifecycleInformation().getLastOperationStatus()
} .equals(LifecycleInformation.Status.OK))
return theReport; theReport.getToSetLifecycleInformation().setPhase(Phases.PENDING_APPROVAL);
} }
return theReport;
}
protected StepExecutionReport executeApprove(StepExecutionReport theReport) throws Exception { protected StepExecutionReport executeApprove(StepExecutionReport theReport) throws Exception {
// Index log.info(STEPS.APPROVE + " running...");
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 { // Index
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)) for (IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest()))
theReport.getToSetLifecycleInformation().setPhase(LifecycleInformation.CommonPhases.DRAFT_PHASE); theReport = index(theReport, indexer, getPublicIndexParams(theReport.getTheRequest()));
return theReport; // 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;
}
} }