Programmatic APIs
A set of supported Java APIs are available to customize elements of ContentBox.
Note: Only Dashboard Application Services Hub APIs
from the com.ibm.isc.api.contentbox package are supported
for ContentBox usage, that is, other Dashboard Application Services Hub APIs
should not be used.
com.ibm.isc.api.contentbox.session.SessionUtil
/**
* Determine whether the specified request corresponds to a user who is still logged into the console on the current server with a valid session.
* Note that this is different from whether the session is just valid or whether the user is just authenticated with the webcontainer (but not actually logged into the console)
* @param request Request from the user
* @return boolean indicating whether the user is logged into the console
*/
public static boolean isConsoleSessionValid( HttpServletRequest request )
com.ibm.isc.api.contentbox.security.SecurityUtil
/**
* Get users list for specified role (including users who have the role through their groups)
* @param roleName the name of a role
* @return users a list of users for a role
*/
public static List<String> getUsersInRole( String roleName )
/**
* Get groups list for specified role
* @param roleName the name of a role
* @return groups a list of groups for a role
*/
public static List<String> getGroupsInRole( String roleName )
com.ibm.isc.api.contentbox.persistence.PreferenceUtil
/* Constants */
public static final int PREFERENCE_TYPE_INHERIT = -1;
public static final int PREFERENCE_TYPE_USER = 0;
public static final int PREFERENCE_TYPE_EDIT = 1;
public static final int PREFERENCE_TYPE_CONFIG = 2;
/**
* This method sets preferences for the specified widget (as identified from the request and widget namespace).
*
* @return void
* @param request the HttpServletRequest from user
* @param widgetNamespace the widget namespace
* @param prefMap the data to be persisted as a collection of key-<list of values> preference.
* @param scope specifies what scope the preferences to set, such as edit default, user preference.
* @throws IllegalArgumentException
* @throws Exception
*/
public static void setPreferences(HttpServletRequest request, String widgetNamespace, Map<String, List<String>>prefMap, int scope)
/**
* This method gets the preferences for the specified widget (as identified from the request and widget namespace).
*
* @return Map<String, List<String>>. It is a collection of key-<list of values> preference
* @param request The HttpServletRequest from user
* @param widgetNamespace The widget namespace
* @param scope specifies what scope the preferences to get, such as edit default, user preference.
* @throws IllegalArgumentException
* @throws Exception
*/
public static Map<String, List<String>> getPreferences( HttpServletRequest request, String widgetNamespace, int scope )
/**
* This method gets the merged preferences for the specified widget (as identified from the request and widget namespace).
*
* @return Map<String, List<String>>. It is a collection of key-<list of value> preference
* @param request The HttpServletRequest from user
* @param widgetNamespace The widget namespace
* @throws IllegalArgumentException
* @throws Exception
*/
public static Map<String, List<String>> getPreferences( HttpServletRequest request, String widgetNamespace )
/**
* Get the current theme for the user identified by the request
* @return String Identifying the current theme, either 'oneui' or 'TIPDark'
*/
public static String getCurrentTheme( HttpServletRequest request )
Note: Example usage for some of these APIs are available
in the helloWorld.jsp file that is included in
the ContentBox template WAR.