Class WysiwygContentTransformer


  • public class WysiwygContentTransformer
    extends Object
    This class provides method to transform wysiwyg content source into other wysiwyg formats.
    Author:
    Yohann Chastagnier
    • Method Detail

      • on

        public static WysiwygContentTransformer on​(String wysiwygContent)
        An instance of WYSIWYG transformer on the given content.
        Parameters:
        wysiwygContent - the wysiwyg content.
        Returns:
        an instance of the transformer.
      • modifyImageUrlAccordingToHtmlSizeDirective

        public WysiwygContentTransformer modifyImageUrlAccordingToHtmlSizeDirective()
        Transforms all URL of images to take into account theirs display size.
        Returns:
        the instance of the current WysiwygContentTransformer.
      • transform

        public String transform()
        Default method in order to apply all the transformation directives and recover immediately the result as string.
        Returns:
        the transformed wysiwyg content.
      • transform

        public <R> R transform​(WysiwygContentTransformerProcess<R> process)
                        throws org.silverpeas.kernel.SilverpeasException
        Applies all the transformation directives and finally processing the given treatment.
        Type Parameters:
        R - the result type of the process.
        Parameters:
        process - the process to execute after all the directives.
        Returns:
        the result of the process execution.
        Throws:
        org.silverpeas.kernel.SilverpeasException - on technical error.
      • toMailContent

        public MailContentProcess.MailResult toMailContent()
                                                    throws org.silverpeas.kernel.SilverpeasException
        Transforms all referenced content links in order to be handled in mail sending. A content can be for example an attachment.
        The directive set by method modifyImageUrlAccordingToHtmlSizeDirectiveWithImageMinWidthIfAny() is applied.
        Returns:
        the wysiwyg content transformed to be sent by mail.
        Throws:
        org.silverpeas.kernel.SilverpeasException - on technical error.