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