001// Generated by delombok at Sat May 11 08:17:52 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 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 * 033 034 * @return The stateful object, which {@link ReportDocument#getCacheLines()} method 035 036 * will be used for generation of PlantUML activity diagram. 037 */ 038 public ReportDocument prepareReportDocument() { 039 ReportDocument reportDocument = new ReportDocument(); 040 reportDocument.setReportDocumentType(ReportDocumentType.DOCUMENT_PART_UML); 041 List<LineProcessor> lineProcessors = new ArrayList<>(); 042 lineProcessors.add(new LineProcessor(applicationContext.getBean(LaunchingSearchCommand.class), applicationContext.getBean(LaunchingTransformer.class), reportDocument)); 043 lineProcessors.add(new LineProcessor(applicationContext.getBean(ConfigurationLoadingSearchCommand.class), applicationContext.getBean(ConfigurationLoadingTransformer.class), reportDocument)); 044 lineProcessors.add(new LineProcessor(applicationContext.getBean(ContentReplacedSearchCommand.class), applicationContext.getBean(ContentReplacedTransformer.class), reportDocument)); 045 lineProcessors.add(new LineProcessor(applicationContext.getBean(FinishedSearchCommand.class), applicationContext.getBean(FinishedTransformer.class), reportDocument)); 046 LineProcessorService.getInstance().getLineProcessors().addAll(lineProcessors); 047 log.info("Line processors prepared"); 048 return reportDocument; 049 } 050 051 @Override 052 public ReportDocumentType getReportDocumentType() { 053 return ReportDocumentType.DOCUMENT_PART_UML; 054 } 055 056 @Inject 057 @java.lang.SuppressWarnings("all") 058 public LaunchingUmlReportService(@NonNull final ApplicationContext applicationContext) { 059 if (applicationContext == null) { 060 throw new java.lang.NullPointerException("applicationContext"); 061 } 062 this.applicationContext = applicationContext; 063 } 064}