Package com.jalios.jcms.jportal
Class JPortalUtils
- java.lang.Object
-
- com.jalios.jcms.jportal.JPortalUtils
-
public final class JPortalUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static int
GRID_SIZE
static java.lang.String
JPORTAL_EDITOR_URL
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
assignRandomIdsIfMissing(java.util.List<JBlockMapping> jBlocks)
static java.lang.String
assignRandomIdsToStructure(java.lang.String structure)
static void
computeBlockSizes(java.util.List<JBlockMapping> blocks)
Recalculates the size of a list of blocks and its child blocksstatic boolean
displayBlock(JBlockMapping jBlock, boolean isPublicationDisplayed, Member loggedMember)
static boolean
displayPublicationHeadersInSelectionBlock(JBlockMapping jBlock)
Check if the headers/footers of a selected Publication should be displayed in a selection blockstatic java.lang.String
generateRandomBlockID()
Generate a random block IDstatic JBlockMapping
getJBlockByPortletId(AbstractJPortal jportal, java.lang.String portletId)
static JBlockMapping
getJBlockByPortletId(java.util.List<JBlockMapping> jblocks, java.lang.String portletId)
static java.lang.String
getJBlockCssClass(JBlockMapping jBlock)
static java.lang.String
getJBlockCustomClass(JBlockMapping jblock)
Compute jblock custom classstatic DataAttribute
getJBlockDataAttributes(JBlockMapping jblock)
Compute jblock data attributesstatic java.lang.String
getJBlockDisplayConditionCssClass(JBlockMapping jblock)
static java.lang.String
getJPortalCss(AbstractJPortal jPortal, boolean isDraftStructure)
static java.lang.String
getJPortalEditionUrl(AbstractJPortal jPortal)
static java.lang.String
getJPortalEditionUrl(AbstractJPortal jPortal, PortletCollection collaborativeSpace)
static java.lang.String
getJPortalJS(AbstractJPortal jPortal, boolean isDraftStructure)
static java.lang.String
getJPortalMappingCss(JPortalMapping jPortalMapping)
static java.lang.String
getJPortalMappingJs(JPortalMapping jPortalMapping)
static java.lang.String
getJPortalStructureCss(JPortalStructure structure)
static java.lang.String
getJPortalStructureJS(JPortalStructure structure)
static java.lang.String
getPortletTitle(JPortletMapping portletMapping, java.lang.String lang)
Get the title of a portlet in the user langstatic java.lang.String
getPrettyPrintJPortalStructure(JPortalStructure structure)
static java.lang.String
getSkinUsage(AbstractJPortal jPortal)
Returns the matching skin usage depending on JPortal usage (Portal vs CollaborativeSpace)static boolean
hasPortlet(JBlockMapping jblock)
static boolean
isBlockSelection(JBlockMapping jBlock)
Is the block a selection blockstatic boolean
isCollaborativeSpaceJPortal(AbstractJPortal jPortal)
Check if a jportal belongs to a CollaborativeSpacestatic boolean
isEmpty(JBlockMapping jBlock)
Returns true if givenJBlockMapping
is empty, and if all of its children are emptystatic java.lang.String
jPortalActionToJSon(JPortalActionResult action)
static java.lang.String
jPortalMappingToJson(JPortalMapping jPortal)
static JPortalMapping
jsonToJPortalMapping(java.lang.String json)
static ControllerStatus
updateJPortletUIMapping(AbstractJPortal jportal, PortalElement portalElement, java.util.Map<java.lang.String,java.lang.String> cssMap, Member member)
-
-
-
Field Detail
-
JPORTAL_EDITOR_URL
public static final java.lang.String JPORTAL_EDITOR_URL
- See Also:
- Constant Field Values
-
GRID_SIZE
public static final int GRID_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
jPortalMappingToJson
public static java.lang.String jPortalMappingToJson(JPortalMapping jPortal)
- Parameters:
jPortal
- theJPortalMapping
- 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
-
jPortalActionToJSon
public static java.lang.String jPortalActionToJSon(JPortalActionResult action)
- Parameters:
action
- theJPortalActionResult
- Returns:
- the
JPortalActionResult
as json
-
getJBlockCustomClass
public static java.lang.String getJBlockCustomClass(JBlockMapping jblock)
Compute jblock custom class- Parameters:
jblock
- theJBlockMapping
- 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
- theJBlockMapping
- Returns:
- all custom data of the jblock
-
isEmpty
public static boolean isEmpty(JBlockMapping jBlock)
Returns true if givenJBlockMapping
is empty, and if all of its children are empty- Parameters:
jBlock
- theJBlockMapping
theJBlockMapping
- Returns:
- true if given
JBlockMapping
is empty
-
updateJPortletUIMapping
public static ControllerStatus updateJPortletUIMapping(AbstractJPortal jportal, PortalElement portalElement, java.util.Map<java.lang.String,java.lang.String> cssMap, Member member)
-
getJBlockByPortletId
public static JBlockMapping getJBlockByPortletId(AbstractJPortal jportal, java.lang.String portletId)
-
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
- theJBlockMapping
- 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
- theAbstractJPortal
- Returns:
- the jportal edition url
-
getJPortalEditionUrl
public static java.lang.String getJPortalEditionUrl(AbstractJPortal jPortal, PortletCollection collaborativeSpace)
- Parameters:
jPortal
- theAbstractJPortal
collaborativeSpace
- thePortletCollection
- Returns:
- the jportal edition url
- Since:
- jcms-10.0.7
-
getPrettyPrintJPortalStructure
public static java.lang.String getPrettyPrintJPortalStructure(JPortalStructure structure)
- Parameters:
structure
- theJPortalStructure
- Returns:
- the JPortalStructure json pretty printed
-
isCollaborativeSpaceJPortal
public static boolean isCollaborativeSpaceJPortal(AbstractJPortal jPortal)
Check if a jportal belongs to a CollaborativeSpace- Parameters:
jPortal
- theAbstractJPortal
- 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
- theAbstractJPortal
p- 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 ofJBlockMapping
-
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
- theJPortletMapping
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)
-
-