Package org.exoplatform.commons.utils
Class CommonsUtils
- java.lang.Object
-
- org.exoplatform.commons.utils.CommonsUtils
-
public class CommonsUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONFIGURED_DOMAIN_URL_KEYstatic StringCONFIGURED_TENANT_MASTER_HOST_KEY
-
Constructor Summary
Constructors Constructor Description CommonsUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidendRequest(Object service)static org.exoplatform.services.security.ConversationRegistrygetConversationRegistry()static org.exoplatform.services.security.ConversationStategetConversationState(String userId)Get the last added ConversationState of a given user.static StringgetCurrentDomain()Get the current domain name by configurationstatic StringgetCurrentPortalOwner()Get current portal ownerstatic org.exoplatform.portal.mop.SiteKeygetCurrentSite()GetSiteKeyof current sitestatic Collection<String>getGroupsOfUser(String userId)Gets groups of user from ConversationRegistry, if not found, get it from OrgnizationServicestatic org.exoplatform.services.organization.OrganizationServicegetOrganizationService()static StringgetRestContextName()static <T> TgetService(Class<T> clazz)Gets the service.static <T> TgetService(Class<T> clazz, String containerName)Gets the service.static org.exoplatform.services.organization.UsergetUser(String userId)Get the lastUserinstance added in ConversationState of a given userstatic booleanisFeatureActive(String featureName)static booleanisFeatureActive(String featureName, String username)static booleanisUserEnabled(String userId)Gets the user state enabled/disabled from ConversationRegistry, if not found, get it from OrgnizationServicestatic voidstartRequest(Object service)
-
-
-
Field Detail
-
CONFIGURED_TENANT_MASTER_HOST_KEY
public static final String CONFIGURED_TENANT_MASTER_HOST_KEY
- See Also:
- Constant Field Values
-
CONFIGURED_DOMAIN_URL_KEY
public static final String CONFIGURED_DOMAIN_URL_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getOrganizationService
public static org.exoplatform.services.organization.OrganizationService getOrganizationService()
-
getConversationRegistry
public static org.exoplatform.services.security.ConversationRegistry getConversationRegistry()
-
isUserEnabled
public static boolean isUserEnabled(String userId) throws Exception
Gets the user state enabled/disabled from ConversationRegistry, if not found, get it from OrgnizationService- Parameters:
userId- username- Returns:
- true if enabled, else false
- Throws:
Exception- if an error occured during requesting the user from OrganizationService
-
getConversationState
public static org.exoplatform.services.security.ConversationState getConversationState(String userId)
Get the last added ConversationState of a given user.- Parameters:
userId- username- Returns:
- ConversationState entity of user
-
getUser
public static org.exoplatform.services.organization.User getUser(String userId) throws Exception
Get the lastUserinstance added in ConversationState of a given user- Parameters:
userId-- Returns:
User- Throws:
Exception- thrown when an exception occurs while getting user from IDM store
-
getGroupsOfUser
public static Collection<String> getGroupsOfUser(String userId) throws Exception
Gets groups of user from ConversationRegistry, if not found, get it from OrgnizationService- Parameters:
userId- username- Returns:
- a collection of group Id of type String
- Throws:
Exception- if an error occured during requesting the user from OrganizationService
-
getService
public static <T> T getService(Class<T> clazz)
Gets the service.- Parameters:
clazz- the clazz- Returns:
- the service
-
getService
public static <T> T getService(Class<T> clazz, String containerName)
Gets the service.- Parameters:
clazz- the classcontainerName- the container's name- Returns:
- the service
-
getRestContextName
public static String getRestContextName()
-
isFeatureActive
public static boolean isFeatureActive(String featureName)
-
getCurrentDomain
public static String getCurrentDomain()
Get the current domain name by configuration- Returns:
- the current domain name.
-
getCurrentPortalOwner
public static String getCurrentPortalOwner()
Get current portal owner- Returns:
- current portal owner
-
getCurrentSite
public static org.exoplatform.portal.mop.SiteKey getCurrentSite()
GetSiteKeyof current site- Returns:
- currentSite if available or default site in otherwise
-
startRequest
public static void startRequest(Object service)
-
endRequest
public static void endRequest(Object service)
-
-