Search in sources :

Example 1 with IPostProcess

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);
        }
    }
}
Also used : ComponentEnvironment(org.entando.entando.aps.system.init.model.ComponentEnvironment) IPostProcess(org.entando.entando.aps.system.init.model.IPostProcess) ComponentInstallationReport(org.entando.entando.aps.system.init.model.ComponentInstallationReport) FatalBeanException(org.springframework.beans.FatalBeanException) SystemInstallationReport(org.entando.entando.aps.system.init.model.SystemInstallationReport) Component(org.entando.entando.aps.system.init.model.Component)

Aggregations

Component (org.entando.entando.aps.system.init.model.Component)1 ComponentEnvironment (org.entando.entando.aps.system.init.model.ComponentEnvironment)1 ComponentInstallationReport (org.entando.entando.aps.system.init.model.ComponentInstallationReport)1 IPostProcess (org.entando.entando.aps.system.init.model.IPostProcess)1 SystemInstallationReport (org.entando.entando.aps.system.init.model.SystemInstallationReport)1 FatalBeanException (org.springframework.beans.FatalBeanException)1