Class WysiwygController


  • public class WysiwygController
    extends Object
    Central service to manage Wysiwyg.
    • Method Detail

      • getManager

        protected static WysiwygManager getManager()
        Gets the manager.
        Returns:
      • getImages

        public static List<SimpleDocument> getImages​(String id,
                                                     String componentId)
        Turn over all the images attached according to the parameters id, componentId.
        Parameters:
        id - the id of the object to which this wysiwyg is attached.
        componentId - the id of component.
        Returns:
        List
      • getWebsiteRepository

        public static String getWebsiteRepository()
      • getWebsiteImages

        public static String[][] getWebsiteImages​(String path,
                                                  String componentId)
                                           throws WysiwygException
        Get images of the website.
        Parameters:
        path - type String: for example of the directory
        componentId -
        Returns:
        imagesList a table of string[N] with in logical index [N][0] = path name [N][1] = logical name of the file.
        Throws:
        WysiwygException
      • getWebsitePages

        public static String[][] getWebsitePages​(String path,
                                                 String componentId)
                                          throws WysiwygException
        Method declaration Get html pages of the website
        Parameters:
        path - type String: for example of the directory
        componentId -
        Returns:
        imagesList a table of string[N][2] with in logical index [N][0] = path name [N][1] = logical name of the file.
        Throws:
        WysiwygException
      • getWysiwygFileName

        public static String getWysiwygFileName​(String objectId,
                                                String currentLanguage)
      • getImagesFileName

        public static String getImagesFileName​(String objectId)
        Method declaration built the name of the images to be attached.
        Parameters:
        objectId - : for example the id of the publication.
        Returns:
        fileName String : name of the file
      • deleteFileAndAttachment

        public static void deleteFileAndAttachment​(String componentId,
                                                   String id)
      • deleteFile

        public static void deleteFile​(String componentId,
                                      String objectId,
                                      String language)
      • createFileAndAttachment

        public static void createFileAndAttachment​(String textHtml,
                                                   ResourceReference resource,
                                                   String context,
                                                   String userId,
                                                   String contentLanguage)
        Creation of the file and its attachment.
        Parameters:
        textHtml - a String containing the text published by the wysiwyg.
        resource - a reference to the resource to which is attached the wysiwyg.
        context - the context images/wysiwyg....
        userId - the user creating the wysiwyg.
        contentLanguage - the language of the content of the wysiwyg.
      • createFileAndAttachment

        public static void createFileAndAttachment​(String textHtml,
                                                   ResourceReference resource,
                                                   String userId,
                                                   String contentLanguage)
        Method declaration creation of the file and its attachment.
        Parameters:
        textHtml - a String containing the text published by the wysiwyg
        resource - a reference to the resource to which is attached the wysiwyg.
        userId - the author of the content.
        contentLanguage - the language of the content.
      • createUnindexedFileAndAttachment

        public static void createUnindexedFileAndAttachment​(String textHtml,
                                                            ResourceReference resource,
                                                            String userId,
                                                            String contentLanguage)
        Method declaration creation of the file and its attachment.
        Parameters:
        textHtml - a String containing the text published by the wysiwyg
        resource - a reference to the resource to which is attached the wysiwyg.
        userId - the author of the content.
        contentLanguage - the language of the content.
      • addToIndex

        public static void addToIndex​(FullIndexEntry indexEntry,
                                      ResourceReference pk,
                                      String language)
        Add all elements attached to object identified by the given index into the given index
        Parameters:
        indexEntry - the index of the related resource.
        pk - the primary key of the container of the wysiwyg.
        language - the language.
      • updateFileAndAttachment

        public static void updateFileAndAttachment​(String textHtml,
                                                   String componentId,
                                                   String objectId,
                                                   String userId,
                                                   String language)
        Method declaration remove and recreates the file attached
        Parameters:
        textHtml - String : contains the text published by the wysiwyg
        componentId - String : the id of component.
        objectId - String : for example the id of the publication.
        userId -
        language - the language of the content.
      • updateFileAndAttachment

        public static void updateFileAndAttachment​(String textHtml,
                                                   String componentId,
                                                   String objectId,
                                                   String userId,
                                                   String language,
                                                   boolean indexIt)
      • deleteWysiwygAttachments

        public static void deleteWysiwygAttachments​(String componentId,
                                                    String objectId)
        Method declaration remove the file attached.
        Parameters:
        componentId - String : the id of component.
        objectId - String : for example the id of the publication.
      • deleteWysiwygAttachmentsOnly

        public static void deleteWysiwygAttachmentsOnly​(String componentId,
                                                        String objectId)
                                                 throws WysiwygException
        La méthode deleteWysiwygAttachments efface tous les attachments de la publication donc pour éviter une éventuelle régression, je crée une nouvelle méthode
        Parameters:
        componentId -
        objectId -
        Throws:
        WysiwygException
      • get

        public static WysiwygContent get​(LocalizedContribution contribution)
        Gets representation of a wysiwyg content.
        Parameters:
        contribution - the localized contribution for which the WYSIWYG content has to be get.
        Returns:
        WysiwygContent instance.
      • get

        public static WysiwygContent get​(String componentId,
                                         String objectId,
                                         String language)
        Gets representation of a wysiwyg content.
        Parameters:
        componentId - String : the id of component.
        objectId - String : for example the id of the publication.
        language - the language of the content.
        Returns:
        WysiwygContent instance.
      • load

        public static String load​(String componentId,
                                  String objectId,
                                  String language)
        Loads wysiwyg content rendered for edition context.
        Parameters:
        componentId - String : the id of component.
        objectId - String : for example the id of the publication.
        language - the language of the content.
        Returns:
        text : the contents of the file attached.
      • loadForReadOnly

        public static String loadForReadOnly​(String componentId,
                                             String objectId,
                                             String language)
        Loads wysiwyg content that will only be read and never be updated.
        Indeed, this method will call standard WYSIWYG transformations that are necessary only in readOnly mode. The resizing of image attachments for example.
        Parameters:
        componentId - String : the id of component.
        objectId - String : for example the id of the publication.
        language - the language of the content.
        Returns:
        text : the contents of the file attached.
      • getEmbeddedAttachmentIds

        public static List<String> getEmbeddedAttachmentIds​(String content)
        Get all Silverpeas Files linked by wysiwyg content
        Parameters:
        content -
        Returns:
      • loadFileWebsite

        public static String loadFileWebsite​(String path,
                                             String fileName)
                                      throws WysiwygException
        Method declaration return the contents of the file.
        Parameters:
        fileName - String : name of the file
        path - String : the path of the file
        Returns:
        text : the contents of the file attached.
        Throws:
        WysiwygException
      • haveGotWysiwygToDisplay

        public static boolean haveGotWysiwygToDisplay​(String componentId,
                                                      String objectId,
                                                      String language)
      • haveGotWysiwyg

        public static boolean haveGotWysiwyg​(String componentId,
                                             String objectId,
                                             String language)
      • updateWebsite

        public static void updateWebsite​(String cheminFichier,
                                         String nomFichier,
                                         String contenuFichier)
                                  throws WysiwygException
        updateWebsite : creation or update of a file of a website Param = cheminFichier = c:\\j2sdk\\public_html\\WAUploads\\webSite10\\nomSite\\rep1\\rep2 nomFichier = index.html contenuFichier = code du fichier : "...."</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>cheminFichier</code> - </dd> <dd><code>contenuFichier</code> - </dd> <dd><code>nomFichier</code> - </dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="../WysiwygException.html" title="class in org.silverpeas.core.contribution.content.wysiwyg">WysiwygException</a></code></dd> </dl> </li> </ul> <a id="copy(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copy</h4> <pre class="methodSignature">public static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a><<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>,​<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>> copy​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> oldComponentId, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> oldObjectId, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> componentId, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> objectId, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> userId)</pre> <div class="block">Method declaration</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>oldComponentId</code> - </dd> <dd><code>oldObjectId</code> - </dd> <dd><code>componentId</code> - </dd> <dd><code>objectId</code> - </dd> <dd><code>userId</code> - </dd> </dl> </li> </ul> <a id="copyDocumentsBetweenTwoResourcesWithSourceContent(org.silverpeas.core.ResourceReference,org.silverpeas.core.ResourceReference,java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>copyDocumentsBetweenTwoResourcesWithSourceContent</h4> <pre class="methodSignature">public static <a href="../../../../util/Pair.html" title="class in org.silverpeas.core.util">Pair</a><<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>,​<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a><<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>,​<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>>> copyDocumentsBetweenTwoResourcesWithSourceContent​(<a href="../../../../ResourceReference.html" title="class in org.silverpeas.core">ResourceReference</a> sourceRef, <a href="../../../../ResourceReference.html" title="class in org.silverpeas.core">ResourceReference</a> targetRef, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> sourceContent)</pre> <div class="block">Copies WYSIWYG resources from a source to a target and updating given content with the news resource references.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>sourceRef</code> - the reference of the source.</dd> <dd><code>targetRef</code> - the reference of the target.</dd> <dd><code>sourceContent</code> - the content to update</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>a pair containing on left the updated content and on right a map containing the correspondance between old images and the new ones.</dd> </dl> </li> </ul> <a id="move(java.lang.String,java.lang.String,java.lang.String,java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>move</h4> <pre class="methodSignature">public static void move​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> fromComponentId, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> fromObjectId, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> componentId, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> objectId)</pre> </li> </ul> <a id="wysiwygPlaceHaveChanged(java.lang.String,java.lang.String,java.lang.String,java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>wysiwygPlaceHaveChanged</h4> <pre class="methodSignature">public static void wysiwygPlaceHaveChanged​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> oldComponentId, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> oldObjectId, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> newComponentId, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> newObjectId)</pre> </li> </ul> <a id="getWysiwygPath(java.lang.String,java.lang.String,java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getWysiwygPath</h4> <pre class="methodSignature">public static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> getWysiwygPath​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> componentId, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> objectId, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> language)</pre> </li> </ul> <a id="getWysiwygPath(java.lang.String,java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getWysiwygPath</h4> <pre class="methodSignature">public static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> getWysiwygPath​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> componentId, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> objectId)</pre> </li> </ul> <a id="getGalleries()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getGalleries</h4> <pre class="methodSignature">public static <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true" title="class or interface in java.util" class="externalLink">List</a><<a href="../../../../admin/component/model/ComponentInstLight.html" title="class in org.silverpeas.core.admin.component.model">ComponentInstLight</a>> getGalleries()</pre> </li> </ul> <a id="indexEmbeddedLinkedFiles(org.silverpeas.core.index.indexing.model.FullIndexEntry,java.util.List)"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>indexEmbeddedLinkedFiles</h4> <pre class="methodSignature">public static void indexEmbeddedLinkedFiles​(<a href="../../../../index/indexing/model/FullIndexEntry.html" title="class in org.silverpeas.core.index.indexing.model">FullIndexEntry</a> indexEntry, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html?is-external=true" title="class or interface in java.util" class="externalLink">List</a><<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>> embeddedAttachmentIds)</pre> <div class="block">Index given embedded linked files</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>indexEntry</code> - index entry to update</dd> <dd><code>embeddedAttachmentIds</code> - embedded linked files ids</dd> </dl> </li> </ul> </li> </ul> </section> </li> </ul> </div> </div> </main> <!-- ========= END OF CLASS DATA ========= --> <footer role="contentinfo"> <nav role="navigation"> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a id="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a id="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../index.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/WysiwygController.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../../allclasses.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li><a href="#field.summary">Field</a> | </li> <li>Constr | </li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li><a href="#field.detail">Field</a> | </li> <li>Constr | </li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a id="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </nav> <p class="legalCopy"><small>Copyright © 2022 <a href="https://www.silverpeas.org">Silverpeas</a>. All rights reserved.</small></p> </footer> </body> </html>