001// Generated by delombok at Sun Jun 16 13:52:34 CEST 2019
002package com.credibledoc.substitution.doc.module.substitution.launching;
003
004import com.credibledoc.enricher.line.LineProcessor;
005import com.credibledoc.enricher.line.LineProcessorService;
006import com.credibledoc.substitution.core.placeholder.Placeholder;
007import com.credibledoc.substitution.doc.module.substitution.report.UmlDiagramType;
008import com.credibledoc.substitution.reporting.reportdocument.ReportDocument;
009import com.credibledoc.substitution.reporting.reportdocument.ReportDocumentType;
010import com.credibledoc.substitution.reporting.reportdocument.creator.ReportDocumentCreator;
011import lombok.NonNull;
012import org.springframework.context.ApplicationContext;
013import org.springframework.stereotype.Service;
014import javax.inject.Inject;
015import java.util.ArrayList;
016import java.util.List;
017
018/**
019 * Creates document with UML part of a {@link Placeholder}.
020 * @author Kyrylo Semenko
021 */
022@Service
023public class LaunchingUmlReportService implements ReportDocumentCreator {
024    @java.lang.SuppressWarnings("all")
025    private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LaunchingUmlReportService.class);
026    @NonNull
027    private final ApplicationContext applicationContext;
028
029    /**
030     * Create a stateful object of {@link ReportDocument} type.
031     *
032     * @return The stateful object, which {@link ReportDocument#getCacheLines()} method
033     * will be used for generation of PlantUML activity diagram.
034     */
035    public ReportDocument prepareReportDocument() {
036        ReportDocument reportDocument = new ReportDocument();
037        reportDocument.setReportDocumentType(UmlDiagramType.class);
038        List<LineProcessor> lineProcessors = new ArrayList<>();
039        lineProcessors.add(new LineProcessor(applicationContext.getBean(LaunchingSearchCommand.class), applicationContext.getBean(LaunchingTransformer.class), reportDocument));
040        lineProcessors.add(new LineProcessor(applicationContext.getBean(ConfigurationLoadingSearchCommand.class), applicationContext.getBean(ConfigurationLoadingTransformer.class), reportDocument));
041        lineProcessors.add(new LineProcessor(applicationContext.getBean(ContentReplacedSearchCommand.class), applicationContext.getBean(ContentReplacedTransformer.class), reportDocument));
042        lineProcessors.add(new LineProcessor(applicationContext.getBean(FinishedSearchCommand.class), applicationContext.getBean(FinishedTransformer.class), reportDocument));
043        LineProcessorService.getInstance().getLineProcessors().addAll(lineProcessors);
044        log.info("Line processors prepared");
045        return reportDocument;
046    }
047
048    @Override
049    public Class<? extends ReportDocumentType> getReportDocumentType() {
050        return UmlDiagramType.class;
051    }
052
053    @Inject
054    @java.lang.SuppressWarnings("all")
055    public LaunchingUmlReportService(@NonNull final ApplicationContext applicationContext) {
056        if (applicationContext == null) {
057            throw new java.lang.NullPointerException("applicationContext");
058        }
059        this.applicationContext = applicationContext;
060    }
061}