Class 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 Detail

      • BLANK_REPORT_ID

        public static final java.lang.String BLANK_REPORT_ID
        Deprecated.
        Ask for the blankReportId configuration parameter instead
        Constant that represents the object Id of the blank template report
        See Also:
        Constant Field Values
    • Constructor Detail

      • BeanHelper

        public BeanHelper()
    • 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 -
      • getSession

        public static WebIServerSession getSession​(Transformable bean)
        Returns the current session associated with the corresponding bean. If the bean is an instance of a WebBean, then it will return the WebSessionInfo associated with it; otherwise, it will try to retrieve the active session from the WebAppSessionManager from the bean's AppContext.
        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 on
        objectType - 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 on
        objectSubType - 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 on
        objectID - 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 returns False
      • 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 instance
        propertyName - 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 from
        beanType - Type of the bean to filter
        componentList - 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 - BeanContext
        obj - 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 of RequestKeys and returns the event source that matches the specified eventID
        Parameters:
        keySet - RequestKeys to get source from
        eventID - 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 object
        session - 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.