Package org.exoplatform.forum.common
Class CommonUtils
java.lang.Object
org.exoplatform.forum.common.CommonUtils
- Version:
- $Revision$
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final StringcenterTrunc(String str, int middlePosition, int maxLength) Truncates large Strings showing the string around the specific middle position with the specific length.static Stringstatic org.exoplatform.services.jcr.ext.common.SessionProviderstatic StringgenerateCheckSum(byte[] b) Generates checksum for files, and get a file ending in .sha1 This task can also be used to perform checksum verifications.static <T> TgetComponent(Class<T> type) static StringgetExcerpt(String str, String textQuery, int maxLength) Get excerpt of given string with start position is the first position of textQuery.static org.exoplatform.container.ExoContainergetExoContainer(org.quartz.JobExecutionContext context) static CalendarGet current time GMT/Zulu or UTC,(zone time is 0+GMT)static StringgetImageUrl(String imagePath) static StringgetRSSLink(String appType, String portalName, String objectId) static StringGet the URI of full URLstatic StringgetUserRSSLink(String apptype, String userId) static FilegetXMLFile(ByteArrayOutputStream bos, String appName, String objectType, Date createDate, String fileName) static booleanhasSpecialCharacter(String input) To check the input content has special characters or not.static booleanCheck string is null or emptystatic booleancheck string array is whether empty or notstatic StringmakeNotificationSender(String from) This function will change email address in 'from' field by address of mail service which is configured as system property :gatein.email.smtp.fromormail.from.static StringNormalize Unified search inputstatic Stringstatic StringprocessSearchCondition(String searchCondition) Process the search condition correspond to each contextstatic Stringstatic StringFilter all invalid character (anything except word, number, space and search wildcard) from search conditional.static String
-
Field Details
-
COMMA
- See Also:
-
SLASH
- See Also:
-
EMPTY_STR
- See Also:
-
COLON
- See Also:
-
SEMICOLON
- See Also:
-
SPACE
- See Also:
-
ASTERISK_STR
- See Also:
-
PERCENT_STR
- See Also:
-
AMP_NUMBER
- See Also:
-
LESS_THAN
- See Also:
-
GREATER_THAN
- See Also:
-
QUOT
- See Also:
-
AMP_SPACE
- See Also:
-
AMP_HEX
- See Also:
-
AMP
- See Also:
-
FROM_KEY
- See Also:
-
-
Constructor Details
-
CommonUtils
public CommonUtils()
-
-
Method Details
-
generateCheckSum
Generates checksum for files, and get a file ending in .sha1 This task can also be used to perform checksum verifications.- Parameters:
b-- Returns:
- Throws:
Exception
-
getXMLFile
public static File getXMLFile(ByteArrayOutputStream bos, String appName, String objectType, Date createDate, String fileName) throws Exception - Throws:
Exception
-
getImageUrl
- Throws:
Exception
-
convertCodeHTML
-
makeNotificationSender
This function will change email address in 'from' field by address of mail service which is configured as system property :gatein.email.smtp.fromormail.from.
That ensures that 'emailAddress' part of 'from' field in a message object is always the same identity with authentication of smtp configuration.
It's because of 2 reasons:- we don't want notification message to show email address of user as sender. Instead, we use mail service of kernel.
- Almost authenticated smtp systems do not allow to separate email address in
fromfield of message from smtp authentication (for now, GMX, MS exchange deny, Gmail efforts to modify the such value)
- Parameters:
from-- Returns:
- null if can not find suitable sender.
-
getURI
Get the URI of full URL- Parameters:
url- The URL input- Returns:
-
processBBCode
- Parameters:
s-- Returns:
-
getExoContainer
public static org.exoplatform.container.ExoContainer getExoContainer(org.quartz.JobExecutionContext context) -
getRSSLink
-
getUserRSSLink
-
isEmpty
Check string is null or empty- Parameters:
s-- Returns:
- boolean
-
isEmpty
check string array is whether empty or not- Parameters:
array-- Returns:
- false if at least one element of array is not empty, true in the opposite case.
-
removeSpecialCharacterForSearch
Filter all invalid character (anything except word, number, space and search wildcard) from search conditional.- Parameters:
input- the input string- Returns:
- String after remove all special characters
- Since:
- 4.0.x
-
removeSpecialCharacterForUnifiedSearch
-
processUnifiedSearchSearchCondition
-
normalizeUnifiedSearchInput
Normalize Unified search input- Parameters:
input- The key search- Returns:
-
hasSpecialCharacter
To check the input content has special characters or not.- Parameters:
input-- Returns:
-
processSearchCondition
Process the search condition correspond to each context- Parameters:
searchCondition- the search condition
-
getExcerpt
Get excerpt of given string with start position is the first position of textQuery.- Parameters:
str- the give stringtextQuery- the text that we truncate at the first appearmaxLength- max of string length- Returns:
- the excerpt string
-
centerTrunc
Truncates large Strings showing the string around the specific middle position with the specific length.- Parameters:
str- the string to truncatemiddlePosition- the middle position we will show string aroundmaxLength- the max length of string to show- Returns:
- the truncated string
-
getGreenwichMeanTime
Get current time GMT/Zulu or UTC,(zone time is 0+GMT)- Returns:
- Calendar
-
getComponent
-
createSystemProvider
public static org.exoplatform.services.jcr.ext.common.SessionProvider createSystemProvider()
-