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.combiner.log.buffered.LogBufferedReader; 005import com.credibledoc.substitution.core.placeholder.Placeholder; 006import com.credibledoc.substitution.core.placeholder.PlaceholderService; 007import com.credibledoc.enricher.printable.Printable; 008import com.credibledoc.substitution.reporting.markdown.MarkdownService; 009import com.credibledoc.enricher.transformer.Transformer; 010import org.springframework.stereotype.Service; 011import javax.inject.Inject; 012import java.util.List; 013 014@Service 015public class ContentReplacedTransformer implements Transformer { 016 private static final String LINE_SEPARATOR = System.lineSeparator(); 017 018 @Override 019 public String transform(Printable printable, List<String> multiLine, LogBufferedReader logBufferedReader) { 020 String plantUml = ":" + MarkdownService.CONTENT_REPLACED + ";" + LINE_SEPARATOR + "note right" + LINE_SEPARATOR + parsePlaceholderDescription(multiLine) + LINE_SEPARATOR + "end note" + LINE_SEPARATOR; 021 printable.getCacheLines().add(plantUml); 022 return null; 023 } 024 025 private String parsePlaceholderDescription(List<String> multiLine) { 026 String line = multiLine.get(0); 027 int beginIndex = line.indexOf(MarkdownService.CONTENT_REPLACED); 028 String json = line.substring(beginIndex + MarkdownService.CONTENT_REPLACED.length()); 029 Placeholder placeholder = PlaceholderService.getInstance().readPlaceholderFromJson(json); 030 return placeholder.getDescription(); 031 } 032 033 @Inject 034 @java.lang.SuppressWarnings("all") 035 public ContentReplacedTransformer() { 036 } 037}