Class VisualizationsHelper


  • public class VisualizationsHelper
    extends java.lang.Object
    This is a helper class with methods to validate WebVisualizationSettings from different type of beans.
    Since:
    MicroStrategy Web 8.0.2
    • Field Detail

      • VISUALIZATIONS_REPORT_RESULT_FLAGS

        public static final int VISUALIZATIONS_REPORT_RESULT_FLAGS
        These are the report result flags that are necessary to generate the XML necessary for visualizations (8790560) Note: also set on the pageConfig.xml
        Since:
        MicroStrategy Web 8.1.0
        See Also:
        Constant Field Values
      • PROPERTY_COLUMN_GROUPING

        public static final java.lang.String PROPERTY_COLUMN_GROUPING
        See Also:
        Constant Field Values
    • Method Detail

      • isValidVisualizationMode

        public static boolean isValidVisualizationMode​(int visMode,
                                                       AppContext appContext)
        Returns whether the view mode is valid. If visMode is 0, then this method returns true as all "normal" view modes are valid, if it's not 0, then it returns true only if the visualizationMode is defined in the visualizations list (that is, in the visualizations configuration file).
      • isValidVisualization

        public static boolean isValidVisualization​(int visMode,
                                                   java.lang.String visName,
                                                   AppContext appContext,
                                                   int scope)
        Returns whether the visualization is defined for the current visualization mode, scope and project. if the visualization mode is 0 it returns false as 0 refers to normal view modes; if it's not 0 it checks first if the visualization mode is defined at all, and if so, it returns true only if the visualization is defined for that view mode and scope.
      • getVisualizationSettings

        public static WebVisualizationSettings getVisualizationSettings​(ReportBean rb)
        Returns the WebVisualizationSettings for the given ReportBean.
      • getVisualizationSettings

        public static WebVisualizationSettings getVisualizationSettings​(RWBean rwb)
        Returns the WebVisualizationSettings for the given RWBean.
      • getVisualizationSettings

        public static WebVisualizationSettings getVisualizationSettings​(ViewBean vb)
        Returns the WebVisualizationSettings for the given ViewBean.
      • checkForGroupByAll

        public static void checkForGroupByAll​(RWBean rwb,
                                              AppContext appContext)
                                       throws WebAppRuntimeException
        Checks whether the current groupby selection is supported for visualizations.
        Throws WebAppRuntimeException if not supported.
        We do not support "All"
        Parameters:
        rwb - The RWBean
        appContext - The application context
        Throws:
        WebAppRuntimeException - if the current groupby selection is not supported for visualizations
      • isGroupBySupported

        public static boolean isGroupBySupported​(RWBean rwb)
        Whether the current groupby selection is supported for visualizations.
        We do not support "All"
        Parameters:
        rwb - The RWBean
        Returns:
        Whether the current groupby selection is supported for visualizations
      • checkVisualizationSettings

        public static void checkVisualizationSettings​(int visMode,
                                                      WebVisualizationSettings settings,
                                                      AppContext appContext,
                                                      int scope)
        Checks the visualization settings are correct and throws a WebAppRuntimeException if it finds any of the settings are incorrect. This method will throw an Exception if:
        1. Visualization settings have not been enabled or are null.
        2. The visualization mode (visMode) is not defined in the visualizations configuration file.
        3. The visualization has not been defined in the visualizations configuration file.
      • getResourceBundleURL

        public static java.lang.String getResourceBundleURL​(java.lang.String dashboardBundleFilePrefix,
                                                            ContainerServices cs,
                                                            int localeID)
        Since:
        MicroStrategy Web 9.0.0
      • getBaseURL

        public static ParameterBuilder getBaseURL​(boolean useAbsoluteURL,
                                                  AppContext appContext,
                                                  WebBean bean,
                                                  boolean addSessionState)
        Returns a ParameterBuilder object that contains a base URL.
        This object is initialized with the TargetBase, TargetPrefix and contains the session manager state which is used in URLs as argument EnumWebParameters.WebSessionManagerState to restore the session.
        Parameters:
        useAbsoluteURL - whether to use an absolute URL
        appContext - The AppContext object
        bean - The bean being transformed
        addSessionState - whether to add the session state to the URL. Only relevant if useAbsoluteURL is true as with relative paths, the session state info is not necessary
        Returns:
        a ParameterBuilder object that contains a base URL.
        Since:
        MicroStrategy Web 8.1.1
      • getTaskBaseURL

        public static ParameterBuilder getTaskBaseURL​(boolean useAbsoluteURL,
                                                      AppContext appContext,
                                                      java.lang.String taskProcessorName)
        Returns a ParameterBuilder object that contains a base URL which can be used to invoke a Task on the Tasks infrastructure.
        This object is initialized with the TargetBase, TargetPrefix and contains the session manager state which is used in URLs as argument EnumWebParameters.WebSessionManagerState to restore the session.
        Parameters:
        useAbsoluteURL - wether to use an absolute URL
        appContext - The AppContext object
        taskProcessorName - The task processor name
        Returns:
        a ParameterBuilder object that contains a base URL which can be used to invoke a Task on the Tasks infrastructure.
        Since:
        MicroStrategy Web 8.1.1
      • getTaskBaseURL

        public static ParameterBuilder getTaskBaseURL​(boolean useAbsoluteURL,
                                                      AppContext appContext,
                                                      java.lang.String taskProcessorName,
                                                      java.lang.String contentType)
        Returns a ParameterBuilder object that contains a base URL which can be used to invoke a Task on the Tasks infrastructure.
        This object is initialized with the TargetBase, TargetPrefix and contains the session manager state which is used in URLs as argument EnumWebParameters.WebSessionManagerState to restore the session.
        Parameters:
        useAbsoluteURL - wether to use an absolute URL
        appContext - The AppContext object
        taskProcessorName - The task processor name
        contentType - the type of data expected (xml, json, html)
        Returns:
        a ParameterBuilder object that contains a base URL which can be used to invoke a Task on the Tasks infrastructure.
        Since:
        MicroStrategy Web 8.1.1
      • addCommonFlashVars

        public static void addCommonFlashVars​(HashList flashVars,
                                              AppContext appContext,
                                              WebBean bean)
        Adds flash vars that are common
        Parameters:
        flashVars - the flashvars collection
        appContext - the application context
        bean - The bean being transformed
        Since:
        MicroStrategy Web 8.1.1
      • toFlashVarsStr

        public static java.lang.String toFlashVarsStr​(HashList flashVarsList)
      • findGridGraphObject

        public static RWGridGraphObject findGridGraphObject​(RWUnit unit,
                                                            java.lang.String key)
        Find the GridGraphObject within the tree.
        Parameters:
        unit - The unit to start with.
        key - The node key to search.
        Returns:
        The GridGraphObject if found. It returns null otherwise.
      • isDocInVisualizationMode

        public static boolean isDocInVisualizationMode​(RWBean rwb)
      • generateVisPropsList

        public static HashList<java.lang.String,​java.lang.String> generateVisPropsList​(java.lang.String visPropsString)
        Helper method that returns a list that contains the key/value pairs of visualization properties
        Parameters:
        visPropsString - the VisProps String (XML format)
        Returns:
        a list that contains the key/value pairs of visualization properties
      • createVisPropsBlock

        public static Block createVisPropsBlock​(ViewBean vb)
                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • createVisPropsBlock

        public static Block createVisPropsBlock​(HashList<java.lang.String,​java.lang.String> visProps,
                                                ViewBean viewBean)
      • getGrids

        public static HashList<java.lang.String,​HashList<java.lang.String,​java.lang.String>> getGrids​(java.lang.String propVal)
      • getMapCoordsFromFile

        public static Block getMapCoordsFromFile​(java.lang.String relFilePath,
                                                 ContainerServices containerServices)
                                          throws java.lang.Exception
        Throws:
        java.lang.Exception