Class MCRWCMSDefaultSectionProvider

java.lang.Object
org.mycore.wcms2.navigation.MCRWCMSDefaultSectionProvider
All Implemented Interfaces:
MCRWCMSJSONProvider<Element,com.google.gson.JsonArray>, MCRWCMSSectionProvider

public class MCRWCMSDefaultSectionProvider extends Object implements MCRWCMSSectionProvider
The default implementation to convert MyCoRe Webpage sections from and to json.
Author:
Matthias Eichner
  • Constructor Details

    • MCRWCMSDefaultSectionProvider

      public MCRWCMSDefaultSectionProvider()
  • Method Details

    • toJSON

      public com.google.gson.JsonArray toJSON(Element rootElement)
      Description copied from interface: MCRWCMSSectionProvider
      Converts a MyCoRe Webpage to a json array. The array contains all the section elements of the webpage including their content.

      [
      {title: "title of section", lang: "de", data: "<xml>content of section</xml>"},
      {title: "title of section 2", lang: "en", data: "<xml>content of section 2</xml>"}
      ]

      Specified by:
      toJSON in interface MCRWCMSJSONProvider<Element,com.google.gson.JsonArray>
      Specified by:
      toJSON in interface MCRWCMSSectionProvider
    • getContent

      protected String getContent(Element e) throws IOException
      Returns the content of an element as string. The element itself is ignored.
      Parameters:
      e - the element to get the content from
      Returns:
      the content as string
      Throws:
      IOException
    • fromJSON

      public Element fromJSON(com.google.gson.JsonArray jsonSectionArray)
      Specified by:
      fromJSON in interface MCRWCMSJSONProvider<Element,com.google.gson.JsonArray>
      Specified by:
      fromJSON in interface MCRWCMSSectionProvider