Package com.microstrategy.web.app.utils
Class BeanHelper
- java.lang.Object
-
- com.microstrategy.web.app.utils.BeanHelper
-
public class BeanHelper extends java.lang.Object
This class contains some public utility methods that can be used for handling beans included on the application- Since:
- MicroStrategy Web 7.3.1 or earlier
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BLANK_REPORT_ID
Deprecated.Ask for theblankReportId
configuration parameter instead
-
Constructor Summary
Constructors Constructor Description BeanHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TransformInstance
addStyle(Transformable bean, java.lang.String style)
If necessary, adds a style from the style catalog to the bean.static void
checkSavePrivilege(ObjectBean bean)
Check whether current user has privileges to save the object in current folder.static void
checkSavePrivilege(ObjectBean bean, WebFolder folder)
Check whether current user has privileges to save the object in specific folder.static void
getBeanList(WebComponent root, int beanType, java.util.ArrayList componentList)
Inserts in the provided list all the beans that match the provided typestatic java.lang.String
getEventOriginalSource(RequestKeys keySet, java.lang.String eventID)
Searches a set ofRequestKeys
and returns the event source that matches the specified eventIDstatic int
getFolderObjectSubTypeCount(FolderBean fb, int objectSubType)
Given the folder bean, get the number of objects on it according to the indicated object subtypestatic int
getFolderObjectTypeCount(FolderBean fb, int objectType)
Given the folder bean, get the number of objects on it according to the indicated object typestatic int
getInboxObjectCount(InboxBean ib)
Gets the number of messages available on the Inbox bean that was specified as an argumentstatic int
getMaxSessionIdleTime(AppContext appContext, WebIServerSession session)
Returns max session idle time.static java.lang.String
getNewObjectTypeName(BeanContext beanContext, WebObjectInfo obj)
static java.lang.String
getObjectTypeName(BeanContext beanContext, int type, int subType)
static java.lang.String
getObjectTypeName(BeanContext beanContext, WebObjectInfo obj)
Returns a localized string with the object type namestatic java.lang.String
getReportPropertyValue(ReportBean rb, java.lang.String propertyName)
Gets the value of the requested property from the bean that was passed as an argumentstatic StyleRequestContext
getRequestContext(Transformable bean)
Creates and populates a new instance of a StyleRequestContext object.static WebIServerSession
getSession(Transformable bean)
Returns the current session associated with the corresponding bean.static int
getSubscriptionsCount(SubscriptionFolderBean sb)
Gets the number of subscriptions available on the Subscription Folder bean that was specified as an argumentstatic boolean
ignoreOldStyle(ReportBean rb)
Determines if the style applied to the Report should be ignored or notstatic boolean
isDossier(WebObjectInfo objInfo)
Check whether a WebObjectInfo instance is has a Dossier ViewMedia type.static boolean
isObjectOnFolder(FolderBean fb, java.lang.String objectID)
Determines if the given object id exists as adirect child of the folder bean that was passed as an argumentstatic void
saveProjectIDInBrowserSetting(AppContext appCtx)
-
-
-
Field Detail
-
BLANK_REPORT_ID
public static final java.lang.String BLANK_REPORT_ID
Deprecated.Ask for theblankReportId
configuration parameter insteadConstant that represents the object Id of the blank template report- See Also:
- Constant Field Values
-
-
Method Detail
-
addStyle
public static TransformInstance addStyle(Transformable bean, java.lang.String style)
If necessary, adds a style from the style catalog to the bean. The transform instance is given as key the same name of the style.
If the BeanContext is of type AppContext, this method also sets debug flags based on values from the request keys and masks their values based on the debugFlagsMask parameter- Parameters:
bean
-style
-
-
getRequestContext
public static StyleRequestContext getRequestContext(Transformable bean)
Creates and populates a new instance of a StyleRequestContext object.- Returns:
- A
DefaultStyleRequestContext
populated with the current iServerSession. - Since:
- MicroStrategy Web 8.0.1
-
getSession
public static WebIServerSession getSession(Transformable bean)
Returns the current session associated with the corresponding bean. If the bean is an instance of aWebBean
, then it will return theWebSessionInfo
associated with it; otherwise, it will try to retrieve the active session from theWebAppSessionManager
from the bean'sAppContext
.- Throws:
WebAppConfigurationRuntimeException
- If the session cannot be retrieved.- Since:
- MicroStrategy Web 8.0.1
-
getFolderObjectTypeCount
public static int getFolderObjectTypeCount(FolderBean fb, int objectType)
Given the folder bean, get the number of objects on it according to the indicated object type- Parameters:
fb
- FolderBean instance to search onobjectType
- object type to search for- Returns:
- the number of objects in the folder that are of the indicated object type. Zero if none found or if a problem was found when handling the folder.
-
getFolderObjectSubTypeCount
public static int getFolderObjectSubTypeCount(FolderBean fb, int objectSubType)
Given the folder bean, get the number of objects on it according to the indicated object subtype- Parameters:
fb
- FolderBean instance to search onobjectSubType
- object subtype to search for- Returns:
- the number of objects in the folder that are of the indicated object subtype. Zero if none found or if a problem was found when handling the folder.
- Since:
- MicroStrategy Web 8.0.0
-
getInboxObjectCount
public static int getInboxObjectCount(InboxBean ib)
Gets the number of messages available on the Inbox bean that was specified as an argument- Parameters:
ib
- InboxBean to search on- Returns:
- the number of messages on the bean. If an error happens while getting the count, returns zero.
-
getSubscriptionsCount
public static int getSubscriptionsCount(SubscriptionFolderBean sb)
Gets the number of subscriptions available on the Subscription Folder bean that was specified as an argument- Parameters:
sb
- SubscriptionFolderBean to search on- Returns:
- the number of subscriptions on the bean. If an error happens while getting the count, returns zero.
-
isObjectOnFolder
public static boolean isObjectOnFolder(FolderBean fb, java.lang.String objectID)
Determines if the given object id exists as adirect child of the folder bean that was passed as an argument- Parameters:
fb
- FolderBean instance to search onobjectID
- DSSID of the object to search for- Returns:
- if the indicated objectID exsists on the folder. Returns false if there was any error generated while processing the folder.
-
ignoreOldStyle
public static boolean ignoreOldStyle(ReportBean rb)
Determines if the style applied to the Report should be ignored or not- Parameters:
rb
- ReportBean instance- Returns:
True
if the style should be ignored (new reports). Otherwise returnsFalse
-
getReportPropertyValue
public static java.lang.String getReportPropertyValue(ReportBean rb, java.lang.String propertyName)
Gets the value of the requested property from the bean that was passed as an argument- Parameters:
rb
- ReportBean instancepropertyName
- Name of the property to search for- Returns:
- the value of the requested property
-
getBeanList
public static void getBeanList(WebComponent root, int beanType, java.util.ArrayList componentList)
Inserts in the provided list all the beans that match the provided type- Parameters:
root
- WebComponent root to start the search frombeanType
- Type of the bean to filtercomponentList
- ArrayList to insert the filtered components
-
getObjectTypeName
public static java.lang.String getObjectTypeName(BeanContext beanContext, WebObjectInfo obj)
Returns a localized string with the object type name- Parameters:
beanContext
- BeanContextobj
- WebObjectInfo- Returns:
- String
- Since:
- MicroStrategy Web 8.0.0
-
getObjectTypeName
public static java.lang.String getObjectTypeName(BeanContext beanContext, int type, int subType)
- Since:
- MicroStrategy Web 9.0.0
-
getNewObjectTypeName
public static java.lang.String getNewObjectTypeName(BeanContext beanContext, WebObjectInfo obj)
- Since:
- MicroStrategy Web 9.0.0
-
getEventOriginalSource
public static java.lang.String getEventOriginalSource(RequestKeys keySet, java.lang.String eventID)
Searches a set ofRequestKeys
and returns the event source that matches the specified eventID- Parameters:
keySet
-RequestKeys
to get source fromeventID
-String
containing the eventID to get the source of- Returns:
String
containing the event source (path and event)- Since:
- MicroStrategy Web 9.0.1
-
getMaxSessionIdleTime
public static int getMaxSessionIdleTime(AppContext appContext, WebIServerSession session)
Returns max session idle time.- Parameters:
appContext
-AppContext
application context objectsession
-WebIServerSession
IServer session- Returns:
- max session idle time
- Since:
- MicroStrategy Web 9.5.0
-
saveProjectIDInBrowserSetting
public static void saveProjectIDInBrowserSetting(AppContext appCtx)
-
checkSavePrivilege
public static void checkSavePrivilege(ObjectBean bean) throws WebBeanException
Check whether current user has privileges to save the object in current folder.- Parameters:
bean
-ObjectBean
The bean of object we want to save.- Throws:
WebBeanException
-
checkSavePrivilege
public static void checkSavePrivilege(ObjectBean bean, WebFolder folder) throws WebBeanException
Check whether current user has privileges to save the object in specific folder.- Parameters:
bean
-ObjectBean
The bean of object we want to save.folder
-WebFolder
The folder we want to save the object in. If it is null, it means we save in current folder.- Throws:
WebBeanException
-
isDossier
public static boolean isDossier(WebObjectInfo objInfo)
Check whether a WebObjectInfo instance is has a Dossier ViewMedia type.- Parameters:
objInfo
-WebObjectInfo
The object into instance we want to check- Returns:
- boolean tells whether the object is a Dossier.
-
-