public class Utils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
TURN_ON_QUICK_EDIT
The Quick edit attribute for HTTPSession
|
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addLockToken(javax.jcr.Node node)
Allows you to add a lock token to the given node
|
static String |
buildQuery(String sqlQuery,
HashMap<String,String> params)
Replace the parameter with the relevant value from
paramsto
build the SQL query |
static boolean |
canEditCurrentPortal(String remoteUser)
Can edit current portal.
|
static boolean |
checkQuery(String workspace,
String strQuery,
String SQLLanguage) |
static String |
cleanString(String str)
Clean string.
|
static void |
closePopupWindow(org.exoplatform.webui.core.UIContainer container,
String popupWindowId)
Close popup window.
|
static void |
createPopupMessage(org.exoplatform.webui.core.UIContainer container,
String message,
Object[] args,
int type)
Creates the popup message.
|
static void |
createPopupWindow(org.exoplatform.webui.core.UIContainer container,
org.exoplatform.webui.core.UIComponent component,
String popupWindowId,
boolean isMiddle,
int width) |
static void |
createPopupWindow(org.exoplatform.webui.core.UIContainer container,
org.exoplatform.webui.core.UIComponent component,
String popupWindowId,
int width)
Creates the popup window.
|
static void |
createPopupWindow(org.exoplatform.webui.core.UIContainer container,
org.exoplatform.webui.core.UIComponent component,
String popupWindowId,
int width,
boolean isShowMask)
Creates the popup window.
|
static void |
createPopupWindow(org.exoplatform.webui.core.UIContainer container,
org.exoplatform.webui.core.UIComponent component,
String popupWindowId,
int width,
int top,
int left)
Creates the popup window.
|
static String |
getActivityEditLink(javax.jcr.Node node) |
static String |
getActivityEditLink(String itemPath) |
static javax.portlet.PortletPreferences |
getAllPortletPreferences()
Get all portlet preferences
|
static String |
getCurrentMode()
Gets the current mode of the site
|
static String |
getDownloadLink(javax.jcr.Node node)
Get download link of a node which stored binary data
|
static String |
getEditLink(javax.jcr.Node node,
boolean isEditable,
boolean isNew) |
static String |
getEditLink(String itemPath,
boolean isEditable,
boolean isNew)
Creates a restfull compliant link to the editor for editing a content,
adding a content or managing contents.
|
static javax.jcr.Node |
getFileLangNode(javax.jcr.Node currentNode)
Get node nt:file if node support multi-language
|
static org.exoplatform.webui.core.UIPopupContainer |
getPopupContainer(org.exoplatform.webui.core.UIContainer container)
Gets the popup container.
|
static String |
getPortletPreference(String preferenceName)
Get one portlet preference by name
|
static String |
getProfileLink(String userId) |
static HashSet<String> |
getQueryParams(String sqlQuery)
get the parameter list from SQL query, the parameter have the ${PARAM} format.
|
static javax.jcr.Node |
getRealNode(javax.jcr.Node node)
Get the real node from frozen node, symlink node return True if the node is
viewable, otherwise will return False
|
static javax.jcr.Node |
getRealNode(String strRepository,
String strWorkspace,
String strIdentifier,
boolean isWCMBase)
GetRealNode
|
static javax.jcr.Node |
getRealNode(String strRepository,
String strWorkspace,
String strIdentifier,
boolean isWCMBase,
String cacheVisibility)
GetRealNode
|
static String |
getRealNodePath(javax.jcr.Node node) |
static String |
getRealPortletId(org.exoplatform.webui.application.portlet.PortletRequestContext portletRequestContext) |
static org.exoplatform.portal.mop.user.UserNavigation |
getSelectedNavigation() |
static javax.jcr.Node |
getViewableNodeByComposer(String repository,
String workspace,
String nodeIdentifier)
Gets the viewable node by WCMComposer (depends on site mode)
|
static javax.jcr.Node |
getViewableNodeByComposer(String repository,
String workspace,
String nodeIdentifier,
String version)
Gets the viewable node by WCMComposer (depends on site mode)
|
static javax.jcr.Node |
getViewableNodeByComposer(String repository,
String workspace,
String nodeIdentifier,
String version,
String cacheVisibility)
Gets the viewable node by WCMComposer (depends on site mode)
|
static String |
getWebdavURL(javax.jcr.Node node) |
static String |
getWebdavURL(javax.jcr.Node node,
boolean withTimeParam) |
static String |
getWebdavURL(javax.jcr.Node node,
boolean withTimeParam,
boolean isGetRealNodePath) |
static boolean |
hasEditPermissionOnNavigation() |
static boolean |
hasEditPermissionOnPage() |
static boolean |
hasEditPermissionOnPortal() |
static boolean |
hasParam(String sqlQuery)
Check if the input SQL query contains any parameter or not.
|
static boolean |
isAdministratorUser() |
static boolean |
isEditPortletInCreatePageWizard()
Checks if is edits the portlet in create page wizard.
|
static boolean |
isEmptyContent(String inputValue) |
static boolean |
isLiveMode()
Check if the current mode is live mode or not
|
static boolean |
isPortalEditMode() |
static boolean |
isPortletViewMode(org.exoplatform.webui.application.portlet.PortletRequestContext pContext)
Check if the portlet current mode is view mode or not
|
static boolean |
isQuickEditMode(org.exoplatform.webui.core.UIContainer container,
String popupWindowId)
Checks if is quick editmode.
|
static boolean |
isShowDelete(javax.jcr.Node content)
Check if the user can delete the current node
|
static boolean |
isShowDraft(javax.jcr.Node content)
Check if the content is draft and current mode of the site is edit mode
|
static boolean |
isShowQuickEdit()
Check if the current mode of the site is edit mode
|
static boolean |
isShowQuickEdit(javax.jcr.Node content)
Check if the content is editable and current mode of the site is edit mode
|
static boolean |
isViewable(javax.jcr.Node node)
Check if the node is viewable for the current user or not viewable.
|
static void |
removeReferences(javax.jcr.Node destNode)
Remove refences of node
|
static String |
toLowerCase(String st,
int n)
sets to lower case n first elements of string
|
static void |
updatePopupWindow(org.exoplatform.webui.core.UIContainer container,
org.exoplatform.webui.core.UIComponent component,
String popupWindowId)
Update popup window.
|
static void |
updatePortal(org.exoplatform.webui.application.portlet.PortletRequestContext context)
Refresh whole portal by AJAX.
|
public static final String TURN_ON_QUICK_EDIT
public static boolean isEditPortletInCreatePageWizard()
public static boolean isQuickEditMode(org.exoplatform.webui.core.UIContainer container,
String popupWindowId)
container - the current containerpopupWindowId - the popup window idpublic static boolean isPortletViewMode(org.exoplatform.webui.application.portlet.PortletRequestContext pContext)
pContext - The request context of a portletpublic static boolean isPortalEditMode()
public static String getRealPortletId(org.exoplatform.webui.application.portlet.PortletRequestContext portletRequestContext)
public static boolean canEditCurrentPortal(String remoteUser) throws Exception
remoteUser - the remote userException - the exceptionpublic static String cleanString(String str)
str - the strpublic static void updatePortal(org.exoplatform.webui.application.portlet.PortletRequestContext context)
context - the portlet request contextpublic static javax.jcr.Node getViewableNodeByComposer(String repository, String workspace, String nodeIdentifier)
repository - the repository's nameworkspace - the workspace's namenodeIdentifier - the node's path or node's UUIDnull if
nodeIdentifier is invalidgetViewableNodeByComposer()public static javax.jcr.Node getViewableNodeByComposer(String repository, String workspace, String nodeIdentifier, String version)
repository - the repository's nameworkspace - the workspace's namenodeIdentifier - the node's path or node's UUIDversion - the base version (e.g. WCMComposer.BASE_VERSION
)null if
nodeIdentifier is invalidgetViewableNodeByComposer(),
WCMComposerpublic static javax.jcr.Node getViewableNodeByComposer(String repository, String workspace, String nodeIdentifier, String version, String cacheVisibility)
repository - the repository's nameworkspace - the workspace's namenodeIdentifier - the node's path or node's UUIDversion - the base version (e.g. WCMComposer.BASE_VERSION
)cacheVisibility - the visibility of cachenull if
nodeIdentifier is invalidgetViewableNodeByComposer(),
WCMComposerpublic static String getCurrentMode()
WCMComposer.MODE_EDIT)WCMComposerpublic static boolean isLiveMode()
public static boolean isShowDraft(javax.jcr.Node content)
content - the content node.public static boolean isShowQuickEdit()
public static boolean isShowDelete(javax.jcr.Node content)
throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionAccessControlExceptionpublic static boolean isShowQuickEdit(javax.jcr.Node content)
content - the content nodepublic static String getEditLink(javax.jcr.Node node, boolean isEditable, boolean isNew)
public static String getActivityEditLink(javax.jcr.Node node)
public static String getEditLink(String itemPath, boolean isEditable, boolean isNew)
itemPath - isEditable - isNew - public static void createPopupWindow(org.exoplatform.webui.core.UIContainer container,
org.exoplatform.webui.core.UIComponent component,
String popupWindowId,
int width)
throws Exception
UIPopupContainer
. UIPopupWindow created by this method is belong to this
container.container - the current containercomponent - the component which will be display as a popuppopupWindowId - the popup's IDwidth - the width of the popupException - the exceptionpublic static void createPopupWindow(org.exoplatform.webui.core.UIContainer container,
org.exoplatform.webui.core.UIComponent component,
String popupWindowId,
int width,
boolean isShowMask)
throws Exception
UIPopupContainer
. UIPopupWindow created by this method is belong to this
container.container - the current containercomponent - the component which will be display as a popuppopupWindowId - the popup's IDwidth - the width of the popupisShowMask - Set as true to create mask layerException - the exceptionpublic static void createPopupWindow(org.exoplatform.webui.core.UIContainer container,
org.exoplatform.webui.core.UIComponent component,
String popupWindowId,
int width,
int top,
int left)
throws Exception
UIPopupContainer
. UIPopupWindow created by this method is belong to this
container.container - the current containercomponent - the component which will be display as a popuppopupWindowId - the popup's IDwidth - the width of the popuptop - the top of the popupleft - the left of the popupException - the exceptionpublic static void createPopupWindow(org.exoplatform.webui.core.UIContainer container,
org.exoplatform.webui.core.UIComponent component,
String popupWindowId,
boolean isMiddle,
int width)
throws Exception
Exceptionpublic static void closePopupWindow(org.exoplatform.webui.core.UIContainer container,
String popupWindowId)
container - the current containerpopupWindowId - the popup's IDpublic static void updatePopupWindow(org.exoplatform.webui.core.UIContainer container,
org.exoplatform.webui.core.UIComponent component,
String popupWindowId)
container - the containercomponent - the component which will be replace for the old one in the
same popuppopupWindowId - the popup's IDpublic static org.exoplatform.webui.core.UIPopupContainer getPopupContainer(org.exoplatform.webui.core.UIContainer container)
container - the current containerpublic static void createPopupMessage(org.exoplatform.webui.core.UIContainer container,
String message,
Object[] args,
int type)
container - the current containermessage - the message keyargs - the arguments to show in the messagetype - the message's type (e.g. ApplicationMessage.INFO)ApplicationMessagepublic static String getPortletPreference(String preferenceName)
preferenceName - the name of preferencepublic static javax.portlet.PortletPreferences getAllPortletPreferences()
public static boolean isViewable(javax.jcr.Node node)
node: - The node to checkpublic static javax.jcr.Node getRealNode(javax.jcr.Node node)
throws Exception
node: - The node to checkExceptionpublic static String getRealNodePath(javax.jcr.Node node) throws Exception
Exceptionpublic static String getWebdavURL(javax.jcr.Node node) throws Exception
Exceptionpublic static String getWebdavURL(javax.jcr.Node node, boolean withTimeParam) throws Exception
Exceptionpublic static String getWebdavURL(javax.jcr.Node node, boolean withTimeParam, boolean isGetRealNodePath) throws Exception
Exceptionpublic static javax.jcr.Node getRealNode(String strRepository, String strWorkspace, String strIdentifier, boolean isWCMBase) throws javax.jcr.RepositoryException
strRepository - strWorkspace - strIdentifier - javax.jcr.RepositoryExceptionpublic static javax.jcr.Node getRealNode(String strRepository, String strWorkspace, String strIdentifier, boolean isWCMBase, String cacheVisibility) throws javax.jcr.RepositoryException
strRepository - strWorkspace - strIdentifier - cacheVisibility - the visibility of cachejavax.jcr.RepositoryExceptionpublic static boolean hasEditPermissionOnPage()
throws Exception
Exceptionpublic static boolean hasEditPermissionOnNavigation()
throws Exception
Exceptionpublic static boolean hasEditPermissionOnPortal()
throws Exception
Exceptionpublic static org.exoplatform.portal.mop.user.UserNavigation getSelectedNavigation()
throws Exception
Exceptionpublic static boolean isEmptyContent(String inputValue)
public static boolean checkQuery(String workspace, String strQuery, String SQLLanguage)
workspace - strQuery - SQLLanguage - public static HashSet<String> getQueryParams(String sqlQuery)
sqlQuery - the given input SQL querypublic static String buildQuery(String sqlQuery, HashMap<String,String> params)
paramsto
build the SQL querysqlQuery - the input query that contain parameterparams - list of all parameter(key, value) pass to the querypublic static boolean hasParam(String sqlQuery)
sqlQuery - false if input SQL query does not contain any
parameter true if input SQL query one or more parameterpublic static String getDownloadLink(javax.jcr.Node node) throws Exception
node - NodeExceptionpublic static javax.jcr.Node getFileLangNode(javax.jcr.Node currentNode)
throws Exception
currentNode - Current NodeExceptionpublic static void addLockToken(javax.jcr.Node node)
throws Exception
Exceptionpublic static String toLowerCase(String st, int n)
st - n - public static boolean isAdministratorUser()
Copyright © 2003–2019 eXo Platform SAS. All rights reserved.