Class JPortalUtils


  • public final class JPortalUtils
    extends java.lang.Object
    • Method Detail

      • jPortalMappingToJson

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

        public static JPortalMapping jsonToJPortalMapping​(java.lang.String json)
        Parameters:
        json - the json String representing the JPortalMapping
        Returns:
        a JPortalMapping from the given json String
      • getJBlockCustomClass

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

        public static java.lang.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
      • getJBlockByPortletId

        public static JBlockMapping getJBlockByPortletId​(java.util.List<JBlockMapping> jblocks,
                                                         java.lang.String portletId)
      • getJBlockDisplayConditionCssClass

        public static java.lang.String getJBlockDisplayConditionCssClass​(JBlockMapping jblock)
      • hasPortlet

        public static boolean hasPortlet​(JBlockMapping jblock)
      • getJPortalCss

        public static java.lang.String getJPortalCss​(AbstractJPortal jPortal,
                                                     boolean isDraftStructure)
      • getJPortalJS

        public static java.lang.String getJPortalJS​(AbstractJPortal jPortal,
                                                    boolean isDraftStructure)
      • getJPortalMappingJs

        public static java.lang.String getJPortalMappingJs​(JPortalMapping jPortalMapping)
      • getJPortalStructureCss

        public static java.lang.String getJPortalStructureCss​(JPortalStructure structure)
      • getJPortalStructureJS

        public static java.lang.String getJPortalStructureJS​(JPortalStructure structure)
      • getJPortalMappingCss

        public static java.lang.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 java.lang.String getJPortalEditionUrl​(AbstractJPortal jPortal)
        Parameters:
        jPortal - the AbstractJPortal
        Returns:
        the jportal edition url
      • getPrettyPrintJPortalStructure

        public static java.lang.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
      • getSkinUsage

        public static java.lang.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​(java.util.List<JBlockMapping> blocks)
        Recalculates the size of a list of blocks and its child blocks
        Parameters:
        blocks - a list of JBlockMapping
      • getPortletTitle

        public static java.lang.String getPortletTitle​(JPortletMapping portletMapping,
                                                       java.lang.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 java.lang.String generateRandomBlockID()
        Generate a random block ID
        Returns:
        random block id
      • assignRandomIdsToStructure

        public static java.lang.String assignRandomIdsToStructure​(java.lang.String structure)
      • assignRandomIdsIfMissing

        public static void assignRandomIdsIfMissing​(java.util.List<JBlockMapping> jBlocks)