use of org.entando.entando.aps.system.init.model.IPostProcess in project entando-core by entando.
the class InitializerManager method executePostInitProcesses.
public void executePostInitProcesses() throws BeansException {
SystemInstallationReport report = null;
try {
report = this.extractReport();
List<Component> components = this.getComponentManager().getCurrentComponents();
for (int i = 0; i < components.size(); i++) {
Component component = components.get(i);
ComponentInstallationReport componentReport = report.getComponentReport(component.getCode(), false);
SystemInstallationReport.Status postProcessStatus = componentReport.getPostProcessStatus();
if (!postProcessStatus.equals(SystemInstallationReport.Status.INIT)) {
continue;
}
String compEnvKey = (AbstractInitializerManager.Environment.test.equals(this.getEnvironment())) ? AbstractInitializerManager.Environment.test.toString() : AbstractInitializerManager.Environment.production.toString();
ComponentEnvironment componentEnvironment = (null != component.getEnvironments()) ? component.getEnvironments().get(compEnvKey) : null;
List<IPostProcess> postProcesses = (null != componentEnvironment) ? componentEnvironment.getPostProcesses() : null;
if (null == postProcesses || postProcesses.isEmpty()) {
postProcessStatus = SystemInstallationReport.Status.NOT_AVAILABLE;
} else if (!this.isCheckOnStartup()) {
postProcessStatus = SystemInstallationReport.Status.SKIPPED;
} else if (!componentReport.isPostProcessExecutionRequired()) {
// Porting or restore
postProcessStatus = SystemInstallationReport.Status.NOT_AVAILABLE;
} else {
postProcessStatus = this.executePostProcesses(postProcesses);
}
componentReport.setPostProcessStatus(postProcessStatus);
report.setUpdated();
}
} catch (Throwable t) {
logger.error("Error while executing post processes", t);
throw new FatalBeanException("Error while executing post processes", t);
} finally {
if (null != report && report.isUpdated()) {
this.saveReport(report);
}
}
}
Aggregations