Class Utils
- java.lang.Object
-
- org.exoplatform.wcm.ext.component.activity.listener.Utils
-
public class Utils extends Object
Created by The eXo Platform SAS Author : eXoPlatform exo@exoplatform.com Mar 18, 2011
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONTENT_SPACESThe Constant Activity Typestatic StringCURRENT_STATE_PROPthe publication:currentState property namestatic StringDEFAULT_AVATARstatic StringEXO_RESOURCES_URIstatic StringFILE_SPACESstatic StringICON_FILE_EXTENSIONstatic intMAX_SUMMARY_CHAR_COUNTstatic intMAX_SUMMARY_LINES_COUNTstatic StringSHARE_CONTENTstatic StringSHARE_FILE
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.exoplatform.social.core.activity.model.ExoSocialActivitycreateActivity(org.exoplatform.social.core.manager.IdentityManager identityManager, String activityOwnerId, javax.jcr.Node node, String activityMsgBundleKey, String activityType)Create ExoSocialActivitystatic org.exoplatform.social.core.activity.model.ExoSocialActivitycreateActivity(org.exoplatform.social.core.manager.IdentityManager identityManager, String activityOwnerId, javax.jcr.Node node, String activityMsgBundleKey, String activityType, boolean isSystemComment, String systemComment, String perm)static org.exoplatform.social.core.activity.model.ExoSocialActivitycreateShareActivity(javax.jcr.Node node, String activityMsgBundleKey, String activityType, String comments, String perm)static voiddeleteFileActivity(javax.jcr.Node node)static StringgenerateThumbnailImageURI(javax.jcr.Node file)Generate the Thumbnail Image URI.static StringgetActivityType()static StringgetBundleValue(String key)static StringgetContentLink(javax.jcr.Node node)Generate the viewer link to site explorer by nodestatic StringgetFirstSummaryLines(String source)static StringgetFirstSummaryLines(String source, int linesCount)static StringgetIllustrativeImage(javax.jcr.Node node)Gets the illustrative image.static StringgetMimeType(javax.jcr.Node node)Get the MimeTypestatic StringgetSummary(javax.jcr.Node node)static String[]getSystemCommentBundle(Map<String,String> activityParams)static String[]getSystemCommentTitle(Map<String,String> activityParams)static Map<String,String>populateActivityData(javax.jcr.Node node, String activityOwnerId, String activityMsgBundleKey)Populate activity data with the data from Nodestatic Map<String,String>populateActivityData(javax.jcr.Node node, String activityOwnerId, String activityMsgBundleKey, boolean isComment, String systemComment, String perm)static voidpostActivity(javax.jcr.Node node, String activityMsgBundleKey)see the postActivity(Node node, String activityMsgBundleKey, Boolean isSystemComment, String systemComment, String perm)static org.exoplatform.social.core.activity.model.ExoSocialActivitypostActivity(javax.jcr.Node node, String activityMsgBundleKey, boolean needUpdate, boolean isSystemComment, String systemComment, String perm)static voidpostFileActivity(javax.jcr.Node node, String activityMsgBundleKey)see the postFileActivity(Node node, String activityMsgBundleKey, Boolean isSystemComment, String systemComment, String perm)static org.exoplatform.social.core.activity.model.ExoSocialActivitypostFileActivity(javax.jcr.Node node, String activityMsgBundleKey, boolean needUpdate, boolean isComment, String systemComment, String perm)static StringprocessMentions(String comment)static voidsetActivityType(String activityType)static voidsetAvatarUrl(javax.jcr.Node commentNode)static voidupdateNotifyMessages(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, String activityMsgBundleKey, String systemComment)
-
-
-
Field Detail
-
CONTENT_SPACES
public static final String CONTENT_SPACES
The Constant Activity Type- See Also:
- Constant Field Values
-
FILE_SPACES
public static final String FILE_SPACES
- See Also:
- Constant Field Values
-
SHARE_FILE
public static final String SHARE_FILE
- See Also:
- Constant Field Values
-
SHARE_CONTENT
public static final String SHARE_CONTENT
- See Also:
- Constant Field Values
-
CURRENT_STATE_PROP
public static final String CURRENT_STATE_PROP
the publication:currentState property name- See Also:
- Constant Field Values
-
EXO_RESOURCES_URI
public static final String EXO_RESOURCES_URI
- See Also:
- Constant Field Values
-
ICON_FILE_EXTENSION
public static final String ICON_FILE_EXTENSION
- See Also:
- Constant Field Values
-
DEFAULT_AVATAR
public static final String DEFAULT_AVATAR
- See Also:
- Constant Field Values
-
MAX_SUMMARY_LINES_COUNT
public static int MAX_SUMMARY_LINES_COUNT
-
MAX_SUMMARY_CHAR_COUNT
public static int MAX_SUMMARY_CHAR_COUNT
-
-
Method Detail
-
getActivityType
public static String getActivityType()
-
setActivityType
public static void setActivityType(String activityType)
-
populateActivityData
public static Map<String,String> populateActivityData(javax.jcr.Node node, String activityOwnerId, String activityMsgBundleKey) throws Exception
Populate activity data with the data from Node- Parameters:
node- the nodeactivityOwnerId- the owner id of the activityactivityMsgBundleKey- the message bundle key of the activity- Returns:
- Map the mapped data
- Throws:
Exception
-
populateActivityData
public static Map<String,String> populateActivityData(javax.jcr.Node node, String activityOwnerId, String activityMsgBundleKey, boolean isComment, String systemComment, String perm) throws Exception
- Throws:
Exception
-
postActivity
public static void postActivity(javax.jcr.Node node, String activityMsgBundleKey) throws Exceptionsee the postActivity(Node node, String activityMsgBundleKey, Boolean isSystemComment, String systemComment, String perm)- Throws:
Exception
-
createShareActivity
public static org.exoplatform.social.core.activity.model.ExoSocialActivity createShareActivity(javax.jcr.Node node, String activityMsgBundleKey, String activityType, String comments, String perm) throws Exception- Throws:
Exception
-
postFileActivity
public static void postFileActivity(javax.jcr.Node node, String activityMsgBundleKey) throws Exceptionsee the postFileActivity(Node node, String activityMsgBundleKey, Boolean isSystemComment, String systemComment, String perm)- Throws:
Exception
-
postActivity
public static org.exoplatform.social.core.activity.model.ExoSocialActivity postActivity(javax.jcr.Node node, String activityMsgBundleKey, boolean needUpdate, boolean isSystemComment, String systemComment, String perm) throws Exception- Parameters:
node- : activity raised from this sourceactivityMsgBundleKey-needUpdate-isSystemComment-systemComment- the new value of System Posted activity, if (isSystemComment) systemComment can not be set to null, set to empty string instead of.perm- the permission accorded for sharing file/content- Throws:
Exception
-
postFileActivity
public static org.exoplatform.social.core.activity.model.ExoSocialActivity postFileActivity(javax.jcr.Node node, String activityMsgBundleKey, boolean needUpdate, boolean isComment, String systemComment, String perm) throws Exception- Parameters:
node- : activity raised from this sourceactivityMsgBundleKey-isComment-systemComment- the new value of System Posted activity, if (isSystemComment) systemComment can not be set to null, set to empty string instead of.- Throws:
Exception
-
updateNotifyMessages
public static void updateNotifyMessages(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, String activityMsgBundleKey, String systemComment) throws Exception- Throws:
Exception
-
getContentLink
public static String getContentLink(javax.jcr.Node node) throws Exception
Generate the viewer link to site explorer by node- Parameters:
node- the node- Returns:
- String the viewer link
- Throws:
javax.jcr.RepositoryExceptionException
-
createActivity
public static org.exoplatform.social.core.activity.model.ExoSocialActivity createActivity(org.exoplatform.social.core.manager.IdentityManager identityManager, String activityOwnerId, javax.jcr.Node node, String activityMsgBundleKey, String activityType) throws ExceptionCreate ExoSocialActivity- Parameters:
identityManager- the identity ManageractivityOwnerId- the remote user namenode- the nodeactivityMsgBundleKey- the message bundle keyactivityType- the activity type- Returns:
- the ExoSocialActivity
- Throws:
Exception- the activity storage exception
-
createActivity
public static org.exoplatform.social.core.activity.model.ExoSocialActivity createActivity(org.exoplatform.social.core.manager.IdentityManager identityManager, String activityOwnerId, javax.jcr.Node node, String activityMsgBundleKey, String activityType, boolean isSystemComment, String systemComment, String perm) throws Exception- Throws:
Exception
-
deleteFileActivity
public static void deleteFileActivity(javax.jcr.Node node) throws javax.jcr.RepositoryException- Throws:
javax.jcr.RepositoryException
-
getIllustrativeImage
public static String getIllustrativeImage(javax.jcr.Node node)
Gets the illustrative image.- Parameters:
node- the node- Returns:
- the illustrative image
-
generateThumbnailImageURI
public static String generateThumbnailImageURI(javax.jcr.Node file) throws Exception
Generate the Thumbnail Image URI.- Parameters:
file- the node- Returns:
- the Thumbnail uri with medium size
- Throws:
Exception- the exception
-
getMimeType
public static String getMimeType(javax.jcr.Node node)
Get the MimeType- Parameters:
node- the node- Returns:
- the MimeType
-
getSummary
public static String getSummary(javax.jcr.Node node)
-
getFirstSummaryLines
public static String getFirstSummaryLines(String source, int linesCount)
- Parameters:
source-linesCount-- Returns:
- first
linesCountwithout HTML tag
-
getSystemCommentTitle
public static String[] getSystemCommentTitle(Map<String,String> activityParams)
-
getSystemCommentBundle
public static String[] getSystemCommentBundle(Map<String,String> activityParams)
-
setAvatarUrl
public static void setAvatarUrl(javax.jcr.Node commentNode) throws javax.jcr.RepositoryException- Throws:
javax.jcr.RepositoryException
-
-