public final class Util extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
buildAbsoluteAvatarURL(org.exoplatform.social.core.identity.model.Identity resultIdentity)
Build absolute AvatarURL from in IndentityRestOut if avatar == null or "" use default avatar base on Identity's type
|
static void |
buildAbsoluteAvatarURL(IdentityRestOut resultIdentity)
Build absolute AvatarURL from in IndentityRestOut if avatar == null or "" use default avatar base on Identity's type
|
static String |
convertTimestampToTimeString(long timestamp)
Converts a timestamp string to time string by the pattern: EEE MMM d HH:mm:ss Z yyyy.
|
static org.exoplatform.social.core.manager.ActivityManager |
getActivityManager()
Deprecated.
Use
getActivityManager(String) instead.
Will be removed by 1.3.x |
static org.exoplatform.social.core.manager.ActivityManager |
getActivityManager(String portalContainerName)
Gets
ActivityManager with specified portal container name. |
static org.exoplatform.social.core.identity.model.Identity |
getAuthenticatedUserIdentity(String portalContainerName)
Gets UserIdentity of authenticated user.
|
static String |
getBaseRestUrl()
Get base url of rest service
|
static String |
getBaseUrl()
Gets base url (host + post) from a context uriInfo.
|
static String |
getCommentsActivityRestUrl(String activityId,
String restPath)
Get the rest url in order to load all comments of an activity
|
static javax.servlet.http.HttpServletRequest |
getCurrentServletRequest()
Gets current http servlet request provided by Rest Service Framework.
|
static String |
getDecodeQueryURL(String url)
Decode query parameters of string URL
Example:
- Input:
http://google.com?%3Cscript%3E
- Output: http://google.com?<script> |
static org.exoplatform.social.core.manager.IdentityManager |
getIdentityManager()
Deprecated.
Use
getIdentityManager(String) instead.
Will be removed by 1.3.x |
static org.exoplatform.social.core.manager.IdentityManager |
getIdentityManager(String portalContainerName)
Gets
IdentityManager with specified portal container name. |
static javax.ws.rs.core.MediaType |
getMediaType(String format)
Deprecated.
User
getMediaType(String, String[]) instead.
Will be removed by 1.3.x |
static javax.ws.rs.core.MediaType |
getMediaType(String expectedFormat,
String[] supportedFormats)
Gets the media type from an expected format string (usually the input) and an array of supported format strings.
|
static String |
getMembersSpaceRestUrl(String id,
boolean returnManager,
String restPath)
Get the rest url to load all members or managers of a space
|
static String |
getMimeTypeOfURL(String urlString)
Try to guess the mime type of url using the Content-Type from header, the extension of filename or some bytes of content.
|
static org.exoplatform.social.core.identity.model.Identity |
getOwnerIdentityIdFromActivity(org.exoplatform.social.core.activity.model.ExoSocialActivity activity)
Deprecated.
Use
getOwnerIdentityIdFromActivity(String, ExoSocialActivity) instead.
Will be removed by 1.3.x |
static org.exoplatform.social.core.identity.model.Identity |
getOwnerIdentityIdFromActivity(String portalContainerName,
org.exoplatform.social.core.activity.model.ExoSocialActivity activity)
Gets a owner identity Id from a provided activity.
|
static org.exoplatform.container.PortalContainer |
getPortalContainerByName(String portalContainerName)
Gets a portal container by its name.
|
static org.exoplatform.social.core.manager.RelationshipManager |
getRelationshipManager()
Deprecated.
Use
getRelationshipManager(String) instead.
Will be removed by 1.3.x |
static org.exoplatform.social.core.manager.RelationshipManager |
getRelationshipManager(String portalContainerName)
Gets
RelationshipManager with specified portal container name. |
static String |
getResourceBundleLabel(Locale locale,
String label) |
static javax.ws.rs.core.Response |
getResponse(Object entity,
javax.ws.rs.core.UriInfo uriInfo,
javax.ws.rs.core.MediaType mediaType,
javax.ws.rs.core.Response.Status status)
Gets the response object constructed from the provided params.
|
static String |
getRestUrl(String type,
String id,
String restPath)
Get base url of rest service
|
static org.exoplatform.social.core.space.spi.SpaceService |
getSpaceService()
Deprecated.
Use
getSpaceService(String) instead.
Will be removed by 1.3.x |
static org.exoplatform.social.core.space.spi.SpaceService |
getSpaceService(String portalContainerName)
Gets
SpaceService with specified portal container name. |
static org.exoplatform.social.core.identity.model.Identity |
getUserIdentity(String userName,
boolean loadProfile)
Deprecated.
Use
getUserIdentity(String, String, boolean) instead.
Will be removed by 1.3.x |
static org.exoplatform.social.core.identity.model.Identity |
getUserIdentity(String portalContainerName,
String userName,
boolean loadProfile)
Gets identity from the remote id (user name)
|
static String |
getViewerId()
Get current user id
|
static org.exoplatform.social.core.identity.model.Identity |
getViewerIdentity(String viewerId)
Deprecated.
Use
getViewerIdentity(String, String) instead.
Will be removed by 1.3.x |
static org.exoplatform.social.core.identity.model.Identity |
getViewerIdentity(String portalContainerName,
String viewerId)
Gets identity of viewer user (logged-in user).
|
static boolean |
hasMentioned(org.exoplatform.social.core.activity.model.ExoSocialActivity existingActivity,
String identityId)
Checks if user is mentioned or not.
|
static boolean |
isAnonymous()
Check if the current user is authenticated
|
static boolean |
isExternal(String userId)
Check if the user is external
|
static boolean |
isLikedByIdentity(String identityID,
org.exoplatform.social.core.activity.model.ExoSocialActivity activity)
Check if identityId contained in liked Identity, if yes return true else return false.
|
static boolean |
isValidURL(String link)
Checks a url is in a valid form or not.
|
public static boolean isValidURL(String link)
link - public static javax.ws.rs.core.Response getResponse(Object entity, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.Response.Status status)
entity - the identityuriInfo - the uri request infomediaType - the media type to be returnedstatus - the status code@Deprecated public static javax.ws.rs.core.MediaType getMediaType(String format) throws javax.ws.rs.WebApplicationException
getMediaType(String, String[]) instead.
Will be removed by 1.3.xformat - javax.ws.rs.WebApplicationExceptionpublic static javax.ws.rs.core.MediaType getMediaType(String expectedFormat, String[] supportedFormats)
expectedFormat - the expected input formatsupportedFormats - the supported format arraypublic static String getViewerId()
@Deprecated public static org.exoplatform.social.core.identity.model.Identity getViewerIdentity(String viewerId)
getViewerIdentity(String, String) instead.
Will be removed by 1.3.xpublic static org.exoplatform.social.core.identity.model.Identity getViewerIdentity(String portalContainerName, String viewerId)
@Deprecated public static org.exoplatform.social.core.identity.model.Identity getUserIdentity(String userName, boolean loadProfile)
getUserIdentity(String, String, boolean) instead.
Will be removed by 1.3.xuserName - loadProfile - public static org.exoplatform.social.core.identity.model.Identity getUserIdentity(String portalContainerName, String userName, boolean loadProfile)
portalContainerName - userName - loadProfile - @Deprecated public static final org.exoplatform.social.core.manager.IdentityManager getIdentityManager()
getIdentityManager(String) instead.
Will be removed by 1.3.xpublic static final org.exoplatform.social.core.manager.IdentityManager getIdentityManager(String portalContainerName)
IdentityManager with specified portal container name.portalContainerName - the specified portal container name@Deprecated public static final org.exoplatform.social.core.space.spi.SpaceService getSpaceService()
getSpaceService(String) instead.
Will be removed by 1.3.xSpaceService with default portal container.public static final org.exoplatform.social.core.space.spi.SpaceService getSpaceService(String portalContainerName)
SpaceService with specified portal container name.portalContainerName - the specified portal container name@Deprecated public static final org.exoplatform.social.core.manager.ActivityManager getActivityManager()
getActivityManager(String) instead.
Will be removed by 1.3.xActivityManager with default portal container.public static final org.exoplatform.social.core.manager.ActivityManager getActivityManager(String portalContainerName)
ActivityManager with specified portal container name.portalContainerName - the specified portal container@Deprecated public static final org.exoplatform.social.core.manager.RelationshipManager getRelationshipManager()
getRelationshipManager(String) instead.
Will be removed by 1.3.xRelationshipManager with default portal container.public static final org.exoplatform.social.core.manager.RelationshipManager getRelationshipManager(String portalContainerName)
RelationshipManager with specified portal container name.portalContainerName - the specified portal container namepublic static final org.exoplatform.container.PortalContainer getPortalContainerByName(String portalContainerName)
portalContainerName - the specified portal container namepublic static final String convertTimestampToTimeString(long timestamp)
timestamp - the timestamp to convert@Deprecated public static org.exoplatform.social.core.identity.model.Identity getOwnerIdentityIdFromActivity(org.exoplatform.social.core.activity.model.ExoSocialActivity activity)
getOwnerIdentityIdFromActivity(String, ExoSocialActivity) instead.
Will be removed by 1.3.xactivity - the activity to gets its owner identitypublic static org.exoplatform.social.core.identity.model.Identity getOwnerIdentityIdFromActivity(String portalContainerName, org.exoplatform.social.core.activity.model.ExoSocialActivity activity)
portalContainerName - the portal container nameactivity - the activity to gets its owner identitypublic static final String getBaseUrl()
public static javax.servlet.http.HttpServletRequest getCurrentServletRequest()
public static void buildAbsoluteAvatarURL(IdentityRestOut resultIdentity)
resultIdentity - public static String buildAbsoluteAvatarURL(org.exoplatform.social.core.identity.model.Identity resultIdentity)
resultIdentity - public static org.exoplatform.social.core.identity.model.Identity getAuthenticatedUserIdentity(String portalContainerName)
portalContainerName - current portal container namepublic static boolean isLikedByIdentity(String identityID, org.exoplatform.social.core.activity.model.ExoSocialActivity activity)
identityID - activity - public static String getMimeTypeOfURL(String urlString)
urlString - public static String getDecodeQueryURL(String url)
http://google.com?%3Cscript%3E
- Output: http://google.com?<script>url - The string URL to decodepublic static boolean hasMentioned(org.exoplatform.social.core.activity.model.ExoSocialActivity existingActivity,
String identityId)
existingActivity - Activity to check.identityId - Identity Id to check mentioned or not.public static String getRestUrl(String type, String id, String restPath)
type - the type of rest serviceid - the id of objectpublic static String getBaseRestUrl()
public static String getMembersSpaceRestUrl(String id, boolean returnManager, String restPath)
id - the id of spacereturnManager - return managers or memberspublic static String getCommentsActivityRestUrl(String activityId, String restPath)
activityId - activity's idpublic static boolean isAnonymous()
public static boolean isExternal(String userId)
Copyright © 2003–2021 eXo Platform SAS. All rights reserved.