@Test public void testRichTextElementResolver() { RichTextElementConverter converter = new RichTextElementConverter( Link::getUrlSlug, () -> "/404", content -> "<p>replaced</p>", null, null); RichTextElement original = new RichTextElement(); original.setValue("<p>Each AeroPress comes with a <a href=\"\" data-item-id=\"65832c4e-8e9c-445f-a001-b9528d13dac8\">pack of filters</a> included in the <a href=\"\" data-item-id=\"not-found\">box</a>.</p>"); RichTextElement converted = converter.convert(original); Assert.assertEquals("<p>replaced</p>", converted.getValue()); }
public RichTextElement convert(RichTextElement orig) { if (orig.getValue() == null) { return orig; } orig.setValue(resolveLinks(orig)); orig.setValue(resolveLinkedItems(orig)); if (richTextElementResolver != null) { orig.setValue(richTextElementResolver.resolve(orig.getValue())); } return orig; }
RichTextElementConverter { public RichTextElement convert(RichTextElement orig) { if (orig.getValue() == null) { return orig; } orig.setValue(resolveLinks(orig)); orig.setValue(resolveLinkedItems(orig)); if (richTextElementResolver != null) { orig.setValue(richTextElementResolver.resolve(orig.getValue())); } return orig; } }
RichTextElementConverter { public RichTextElement convert(RichTextElement orig) { if (orig.getValue() == null) { return orig; } orig.setValue(resolveLinks(orig)); orig.setValue(resolveLinkedItems(orig)); if (richTextElementResolver != null) { orig.setValue(richTextElementResolver.resolve(orig.getValue())); } return orig; } RichTextElementConverter(
            ContentLinkUrlResolver contentLinkUrlResolver,
            BrokenLinkUrlResolver brokenLinkUrlResolver,
            RichTextElementResolver richTextElementResolver,
            TemplateEngineConfig templateEngineConfig,
            StronglyTypedContentItemConverter stronglyTypedContentItemConverter); }
RichTextElementConverter { public RichTextElement convert(RichTextElement orig) { if (orig.getValue() == null) { return orig; } orig.setValue(resolveLinks(orig)); orig.setValue(resolveLinkedItems(orig)); if (richTextElementResolver != null) { orig.setValue(richTextElementResolver.resolve(orig.getValue())); } return orig; } RichTextElementConverter(
            ContentLinkUrlResolver contentLinkUrlResolver,
            BrokenLinkUrlResolver brokenLinkUrlResolver,
            RichTextElementResolver richTextElementResolver,
            TemplateEngineConfig templateEngineConfig,
            StronglyTypedContentItemConverter stronglyTypedContentItemConverter); void process(List<ContentItem> orig); void process(ContentItem orig); RichTextElement convert(RichTextElement orig); }
RichTextElementConverter { public RichTextElement convert(RichTextElement orig) { if (orig.getValue() == null) { return orig; } orig.setValue(resolveLinks(orig)); orig.setValue(resolveLinkedItems(orig)); if (richTextElementResolver != null) { orig.setValue(richTextElementResolver.resolve(orig.getValue())); } return orig; } RichTextElementConverter(
            ContentLinkUrlResolver contentLinkUrlResolver,
            BrokenLinkUrlResolver brokenLinkUrlResolver,
            RichTextElementResolver richTextElementResolver,
            TemplateEngineConfig templateEngineConfig,
            StronglyTypedContentItemConverter stronglyTypedContentItemConverter); void process(List<ContentItem> orig); void process(ContentItem orig); RichTextElement convert(RichTextElement orig);  }