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