Class JPortalUtils

java.lang.Object
com.jalios.jcms.jportal.JPortalUtils

public final class JPortalUtils extends Object
  • Field Details

  • Method Details

    • jPortalMappingToJson

      public static String jPortalMappingToJson(JPortalMapping jPortal)
      Parameters:
      jPortal - the JPortalMapping
      Returns:
      a json String from the given JPortalMapping
    • jsonToJPortalMapping

      public static JPortalMapping jsonToJPortalMapping(String json)
      Parameters:
      json - the json String representing the JPortalMapping
      Returns:
      a JPortalMapping from the given json String
    • jPortalActionToJSon

      public static String jPortalActionToJSon(JPortalActionResult action)
      Parameters:
      action - the JPortalActionResult
      Returns:
      the JPortalActionResult as json
    • getJBlockCustomClass

      public static String getJBlockCustomClass(JBlockMapping jblock)
      Compute jblock custom class
      Parameters:
      jblock - the JBlockMapping
      Returns:
      all custom class of the jblock
    • getJBlockCssClass

      public static String getJBlockCssClass(JBlockMapping jBlock)
    • getJBlockDataAttributes

      public static DataAttribute getJBlockDataAttributes(JBlockMapping jblock)
      Compute jblock data attributes
      Parameters:
      jblock - the JBlockMapping
      Returns:
      all custom data of the jblock
    • isEmpty

      public static boolean isEmpty(JBlockMapping jBlock)
      Returns true if given JBlockMapping is empty, and if all of its children are empty
      Parameters:
      jBlock - the JBlockMapping the JBlockMapping
      Returns:
      true if given JBlockMapping is empty
    • updateJPortletUIMapping

      public static ControllerStatus updateJPortletUIMapping(AbstractJPortal jportal, PortalElement portalElement, Map<String,String> cssMap, Member member)
    • getJBlockByPortletId

      public static JBlockMapping getJBlockByPortletId(AbstractJPortal jportal, String portletId)
    • getJBlockByPortletId

      public static JBlockMapping getJBlockByPortletId(List<JBlockMapping> jblocks, String portletId)
    • getJBlockDisplayConditionCssClass

      public static String getJBlockDisplayConditionCssClass(JBlockMapping jblock)
    • hasPortlet

      public static boolean hasPortlet(JBlockMapping jblock)
    • getJPortalCss

      public static String getJPortalCss(AbstractJPortal jPortal, boolean isDraftStructure)
    • getJPortalJS

      public static String getJPortalJS(AbstractJPortal jPortal, boolean isDraftStructure)
    • getJPortalMappingJs

      public static String getJPortalMappingJs(JPortalMapping jPortalMapping)
    • getJPortalStructureCss

      public static String getJPortalStructureCss(JPortalStructure structure)
    • getJPortalStructureJS

      public static String getJPortalStructureJS(JPortalStructure structure)
    • getJPortalMappingCss

      public static String getJPortalMappingCss(JPortalMapping jPortalMapping)
    • displayBlock

      public static boolean displayBlock(JBlockMapping jBlock, boolean isPublicationDisplayed, Member loggedMember)
    • isBlockSelection

      public static boolean isBlockSelection(JBlockMapping jBlock)
      Is the block a selection block
      Parameters:
      jBlock - the JBlockMapping
      Returns:
      true if the selection option on the block is checked (old portlet selection from Portal)
    • displayPublicationHeadersInSelectionBlock

      public static boolean displayPublicationHeadersInSelectionBlock(JBlockMapping jBlock)
      Check if the headers/footers of a selected Publication should be displayed in a selection block
      Parameters:
      jBlock - JBlockMapping
      Returns:
      Boolean
    • getJPortalEditionUrl

      public static String getJPortalEditionUrl(AbstractJPortal jPortal)
      Parameters:
      jPortal - the AbstractJPortal
      Returns:
      the jportal edition url
    • getJPortalEditionUrl

      public static String getJPortalEditionUrl(AbstractJPortal jPortal, PortletCollection collaborativeSpace)
      Parameters:
      jPortal - the AbstractJPortal
      collaborativeSpace - the PortletCollection
      Returns:
      the jportal edition url
      Since:
      jcms-10.0.7
    • getPrettyPrintJPortalStructure

      public static String getPrettyPrintJPortalStructure(JPortalStructure structure)
      Parameters:
      structure - the JPortalStructure
      Returns:
      the JPortalStructure json pretty printed
    • isCollaborativeSpaceJPortal

      public static boolean isCollaborativeSpaceJPortal(AbstractJPortal jPortal)
      Check if a jportal belongs to a CollaborativeSpace
      Parameters:
      jPortal - the AbstractJPortal
      Returns:
      true if the jportal belongs to a collaborative space
      Since:
      jcms-10.0.7
    • isCollaborativeSpacePagePortal

      public static boolean isCollaborativeSpacePagePortal(AbstractJPortal jPortal)
      Check if a jportal is a CollaborativeSpace pagePortal (not the dashboard portal)
      Parameters:
      jPortal - the AbstractJPortal
      Returns:
      true if the jportal belongs to a collaborative space and is not the dashboard portal
      Since:
      jcms-10.0.9 / JCMS-11419
    • getSkinUsage

      public static String getSkinUsage(AbstractJPortal jPortal)
      Returns the matching skin usage depending on JPortal usage (Portal vs CollaborativeSpace)
      Parameters:
      jPortal - the AbstractJPortalp
      Returns:
      the matching skin usage depending on JPortal usage (Portal vs CollaborativeSpace)
      Since:
      jcms-10.0.7
    • computeBlockSizes

      public static void computeBlockSizes(List<JBlockMapping> blocks)
      Recalculates the size of a list of blocks and its child blocks
      Parameters:
      blocks - a list of JBlockMapping
    • getPortletTitle

      public static String getPortletTitle(JPortletMapping portletMapping, String lang)
      Get the title of a portlet in the user lang
      Parameters:
      portletMapping - the JPortletMapping
      lang - the user lang
      Returns:
      the title
    • generateRandomBlockID

      public static String generateRandomBlockID()
      Generate a random block ID
      Returns:
      random block id
    • assignRandomIdsToStructure

      public static String assignRandomIdsToStructure(String structure)
    • assignRandomIdsIfMissing

      public static void assignRandomIdsIfMissing(List<JBlockMapping> jBlocks)
    • addFirstBlockAsSelectionIfNone

      public static void addFirstBlockAsSelectionIfNone(JPortalMapping mapping)
      Iterates over a list of JPortalMapping blocks and ensures that at least one block is selection. If no block is currently selection, the first block will be added as selection.
      Parameters:
      mapping - JPortalMapping
    • hasSelectionInBlocks

      public static boolean hasSelectionInBlocks(List<JBlockMapping> blocks)