Class OptionsHelper


  • public class OptionsHelper
    extends java.lang.Object
    This is the helper class used to save the print and PDF options on the report
    Since:
    MicroStrategy Web 7.3.1 or earlier
    • Field Detail

      • PrintPropertySetName

        public static final java.lang.String PrintPropertySetName
        See Also:
        Constant Field Values
      • PDFPropertySetName

        public static final java.lang.String PDFPropertySetName
        See Also:
        Constant Field Values
      • TemplateFormattingPropertySetName

        public static final java.lang.String TemplateFormattingPropertySetName
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • ExportPropertiesPropertySetName

        public static final java.lang.String ExportPropertiesPropertySetName
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • ExportAdvancedPropertiesPropertySetName

        public static final java.lang.String ExportAdvancedPropertiesPropertySetName
        Since:
        MicroStrategy Web 8.0.1
        See Also:
        Constant Field Values
      • NumberingStartPage

        public static final java.lang.String NumberingStartPage
        See Also:
        Constant Field Values
      • ExpandPageFields

        public static final java.lang.String ExpandPageFields
        See Also:
        Constant Field Values
      • ShowPageFieldTitles

        public static final java.lang.String ShowPageFieldTitles
        See Also:
        Constant Field Values
      • RepeatRowHeaders

        public static final java.lang.String RepeatRowHeaders
        See Also:
        Constant Field Values
      • RepeatColumnHeaders

        public static final java.lang.String RepeatColumnHeaders
        See Also:
        Constant Field Values
      • CenterHorizontal

        public static final java.lang.String CenterHorizontal
        See Also:
        Constant Field Values
      • PrintCoverDetails

        public static final java.lang.String PrintCoverDetails
        See Also:
        Constant Field Values
      • ReportPDFSettingsPresent

        public static final java.lang.String ReportPDFSettingsPresent
        See Also:
        Constant Field Values
      • AdvancedSettings

        public static final java.lang.String AdvancedSettings
        See Also:
        Constant Field Values
      • ExportAdminHeader

        public static final java.lang.String ExportAdminHeader
        Since:
        MicroStrategy Web 8.0.2
        See Also:
        Constant Field Values
      • ExportAdminFooter

        public static final java.lang.String ExportAdminFooter
        Since:
        MicroStrategy Web 8.0.2
        See Also:
        Constant Field Values
      • ShowAttributeFormNames

        public static final java.lang.String ShowAttributeFormNames
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • GraphFormat

        public static final java.lang.String GraphFormat
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • EmbedFonts

        public static final java.lang.String EmbedFonts
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • AdminHeaderLeft

        public static final java.lang.String AdminHeaderLeft
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • AdminHeaderCenter

        public static final java.lang.String AdminHeaderCenter
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • AdminHeaderRight

        public static final java.lang.String AdminHeaderRight
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • AdminFooterLeft

        public static final java.lang.String AdminFooterLeft
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • AdminFooterCenter

        public static final java.lang.String AdminFooterCenter
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • AdminFooterRight

        public static final java.lang.String AdminFooterRight
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • ExpandAllPages

        public static final java.lang.String ExpandAllPages
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • UseSeparateSheets

        public static final java.lang.String UseSeparateSheets
        Since:
        MicroStrategy Web 8.0.1
        See Also:
        Constant Field Values
      • CoverPageLocation

        public static final java.lang.String CoverPageLocation
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • CoverPageDetailsContents

        public static final java.lang.String CoverPageDetailsContents
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • ReportHeader

        public static final java.lang.String ReportHeader
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • ExcelEmbedImages

        public static final java.lang.String ExcelEmbedImages
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • ExcelReportHeader

        public static final java.lang.String ExcelReportHeader
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • ExcelReportHeaderLocation

        public static final java.lang.String ExcelReportHeaderLocation
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • ExcelReportFooter

        public static final java.lang.String ExcelReportFooter
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • SettingsPresent

        public static final java.lang.String SettingsPresent
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • ExportSection

        public static final java.lang.String ExportSection
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • PlaintextDelimiter

        public static final java.lang.String PlaintextDelimiter
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • MetricValuesAsText

        public static final java.lang.String MetricValuesAsText
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • HeadersAsText

        public static final java.lang.String HeadersAsText
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • UseLiveChartGraphs

        public static final java.lang.String UseLiveChartGraphs
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • OverlapGridTitles

        public static final java.lang.String OverlapGridTitles
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • ReportOfficeRefresh

        public static final java.lang.String ReportOfficeRefresh
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • ExportReportTitle

        public static final java.lang.String ExportReportTitle
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • ExportPageByInfo

        public static final java.lang.String ExportPageByInfo
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
      • EncodeHTML

        public static final java.lang.String EncodeHTML
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
    • Constructor Detail

      • OptionsHelper

        public OptionsHelper()
    • Method Detail

      • loadPropertyValues

        public static HashList loadPropertyValues​(ReportBean rb,
                                                  java.lang.String propertySetName)
        Returns a list of the properties needed for printing/PDF (depending on the propertySetName)
        Parameters:
        rb - report bean
        propertySetName - property set name (OptionsHelper.PrintPropertySetName or OptionsHelper.ExportPDFSettings)
        Returns:
        a Hashlist with all the properties needed for printing/PDF (depending on the propertySetName)
      • loadGlobalPropertyValues

        public static HashList loadGlobalPropertyValues​(ReportBean rb,
                                                        java.lang.String propertySetName)
        Returns a list of the global properties needed for PDF
        Parameters:
        rb - report bean
        propertySetName - property set name (OptionsHelper.ExportPropertiesPropertySetName)
        Returns:
        a Hashlist with all the global properties needed for PDF
        Since:
        MicroStrategy Web 8.0.0
      • loadProjectPropertyValues

        public static HashList loadProjectPropertyValues​(AppContext ac,
                                                         java.lang.String propertySetName)
        Returns a list of the project properties needed for printing/PDF (depending on the propertySetName)
        Parameters:
        ac - The Application Context
        propertySetName - property set name (OptionsHelper.PrintPropertySetName or OptionsHelper.ExportPDFSettings)
        Returns:
        a Hashlist with all the project properties needed for printing/PDF (depending on the propertySetName)
        Since:
        MicroStrategy Web 8.0.0
      • saveProjectPropertyValues

        public static void saveProjectPropertyValues​(AppContext ac,
                                                     HashList argumentValues,
                                                     java.lang.String propertySetName)
        Saves the project properties contained in the argumentValues. Equivalent to savePropertyValues(AppContext, HashList, String, boolean) where allProjects is false.
        Parameters:
        ac - AppContext the application context
        argumentValues - HashList with all the project properties to be saved
        propertySetName - String property set name (OptionsHelper.PrintPropertySetName or OptionsHelper.ExportPDFSettings)
        Since:
        MicroStrategy Web 8.0.0
      • savePropertyValues

        public static void savePropertyValues​(AppContext ac,
                                              HashList argumentValues,
                                              java.lang.String propertySetName,
                                              boolean allProjects)
        Saves properties contained in the argumentValues.
        Parameters:
        ac - AppContext the application context
        argumentValues - HashList with all the project properties to be saved
        propertySetName - String property set name (OptionsHelper.PrintPropertySetName or OptionsHelper.ExportPDFSettings)
        allProjects - whether to apply settings to all projects or only the current project
        Since:
        MicroStrategy Web 9.0.0
      • checkPropertiesPresent

        public static boolean checkPropertiesPresent​(ReportBean rb,
                                                     java.lang.String propertySetName)
        Tells whether the print/pdf properties are present or not. it looks for property OptionsHelper.ReportPDFSettingsPresent on the property set specified
        Parameters:
        rb - report bean
        propertySetName - property set name (OptionsHelper.PrintPropertySetName or OptionsHelper.ExportPDFSettings)
        Returns:
        true if print/pdf properties are present
      • submitSetPropertyEvent

        public static void submitSetPropertyEvent​(ReportBean rb,
                                                  HashList argumentValues)
        Submits an event that saves all the properties on the list
        Parameters:
        rb - report bean
        argumentValues - hashlist with the properties to save
      • booleanPropertyPreferenceMapping

        public static java.lang.String booleanPropertyPreferenceMapping​(java.lang.String propertyValue)
        Maps the value of a report property to the preference's respective value
        Parameters:
        propertyValue - property value
        Returns:
        the preference value
      • booleanPreferencePropertyMapping

        public static java.lang.String booleanPreferencePropertyMapping​(java.lang.String preferenceValue)
        Maps the value of a preference to a report property
        Parameters:
        preferenceValue - The preference value
        Returns:
        the report property value
      • booleanPropertyPreferenceMappingGraphFormat

        public static java.lang.String booleanPropertyPreferenceMappingGraphFormat​(java.lang.String propertyValue)
        Maps the value of the Graph Format report property to the useBMPGraphs preference respective value
        Parameters:
        propertyValue - property value
        Returns:
        the preference value
        Since:
        MicroStrategy Web 8.0.0
      • booleanPreferencePropertyMappingGraphFormat

        public static java.lang.String booleanPreferencePropertyMappingGraphFormat​(java.lang.String preferenceValue)
        Maps the value of the useBMPGraphs preference to the GraphFormat report property
        Parameters:
        preferenceValue - The preference value
        Returns:
        the report property value
        Since:
        MicroStrategy Web 8.0.0
      • booleanPropertyPreferenceMappingPrintQuality

        public static java.lang.String booleanPropertyPreferenceMappingPrintQuality​(java.lang.String propertyValue)
        Maps the value of the PrintQuality report property to the draftQualityGraphs preference respective value
        Parameters:
        propertyValue - property value
        Returns:
        the preference value
        Since:
        MicroStrategy Web 8.0.0
      • booleanPreferencePropertyMappingPrintQuality

        public static java.lang.String booleanPreferencePropertyMappingPrintQuality​(java.lang.String preferenceValue)
        Maps the value of the draftQualityGraphs preference to the PrintQuality report property
        Parameters:
        preferenceValue - The preference value
        Returns:
        the report property value
        Since:
        MicroStrategy Web 8.0.0
      • booleanPropertyPreferenceRowsColsMapping

        public static java.lang.String booleanPropertyPreferenceRowsColsMapping​(java.lang.String propertyValue)
      • booleanPreferencePropertyRowsColsMapping

        public static java.lang.String booleanPreferencePropertyRowsColsMapping​(java.lang.String preferenceValue)
      • getWebPaperSize

        public static java.lang.String getWebPaperSize​(PaperSizesList paperSizesList,
                                                       java.lang.String paperType,
                                                       java.lang.String paperHeight,
                                                       java.lang.String paperWidth)
        Deprecated.
        Use getWebPaperSize(ShortcutList, String, String, String)
        Retunrs the paper size key for the specified arguments or a Custom size with the specified paperHeight and paperWidth
        Parameters:
        paperSizesList - a PaperSizesList collection with the available paper sizes
        paperType - a String that specifies the paper type
        paperHeight - a String that specifies the paper height
        paperWidth - a String that specifies the paper width
        Returns:
        a String with the key for the specified arguments
      • getWebPaperSize

        public static java.lang.String getWebPaperSize​(ShortcutList paperSizesList,
                                                       java.lang.String paperType,
                                                       java.lang.String paperHeight,
                                                       java.lang.String paperWidth)
        Retunrs the paper size key for the specified arguments or a Custom size with the specified paperHeight and paperWidth
        Parameters:
        paperSizesList - a ShortcutList collection with the available paper sizes
        paperType - a String that specifies the paper type
        paperHeight - a String that specifies the paper height
        paperWidth - a String that specifies the paper width
        Returns:
        a String with the key for the specified arguments
        Since:
        MicroStrategy Web 9.0.0
      • getDesktopPaperSize

        public static java.lang.String[] getDesktopPaperSize​(PaperSizesList paperSizesList,
                                                             java.lang.String paperSize)
        Deprecated.
        Use getDesktopPaperSize(ShortcutList, String)
        Gets the Desktop's paper size
        Parameters:
        paperSizesList - paper sizes list
        paperSize - paper size
        Returns:
        Desktop's paper size
      • getDesktopPaperSize

        public static java.lang.String[] getDesktopPaperSize​(ShortcutList paperSizesList,
                                                             java.lang.String paperSize)
        Gets the Desktop's paper size
        Parameters:
        paperSizesList - paper sizes list
        paperSize - paper size
        Returns:
        Desktop's paper size
        Since:
        MicroStrategy Web 9.0.0
      • localizeDouble

        public static java.lang.String localizeDouble​(java.lang.String doubleValue,
                                                      java.lang.String localeID)
        Converts a double to the specified locale
        Parameters:
        doubleValue - value to localize
        localeID - locale to localize to
        Returns:
        localized value
      • localizeDoubleToEnglish

        public static java.lang.String localizeDoubleToEnglish​(java.lang.String doubleValue)
        Converts a double to English locale
        Parameters:
        doubleValue - value to localize
        Returns:
        value localized
      • convertUnits

        public static java.lang.String convertUnits​(java.lang.String value,
                                                    java.util.Locale locale,
                                                    java.lang.String unitsPreference,
                                                    int dpi)
        Converts a given double String from inches to cm if the user preference indicates so. If the user preference is set to inches, the function does not do anything.
        Parameters:
        value - Double value in string format to convert.
        locale - User's locale
        unitsPreference - Preference that specifies the units to be used
        Returns:
        the converted value
        Since:
        MicroStrategy Web 8.0.0
      • convertUnitsToUS

        public static java.lang.String convertUnitsToUS​(java.lang.String value,
                                                        java.util.Locale locale,
                                                        java.lang.String unitsPreference,
                                                        int dpi)
        Converts a given double String from cm to inches if the user preference indicates so. If the user preference is set to inches, the function does not do anything.
        Parameters:
        value - Double value in string format to convert.
        locale - User's locale
        unitsPreference - Preference that specifies the units to be used
        Returns:
        the converted value
        Since:
        MicroStrategy Web 8.0.0
      • convertUnits

        public static java.lang.String convertUnits​(java.lang.String unitFrom,
                                                    java.lang.String unitTo,
                                                    java.lang.String value,
                                                    int dpi)
        Since:
        MicroStrategy Web 8.1.0
      • setPrefValue

        public static void setPrefValue​(Preferences preferences,
                                        java.lang.String name,
                                        PreferenceLevel level,
                                        java.lang.String value)
        Saves the value of a preference
        Parameters:
        preferences - Preferences object
        name - name of the preference
        level - preference level (a value from EnumPreferenceLevels)
        value - preference value
      • setPrefValueIfInRequest

        public static void setPrefValueIfInRequest​(Preferences preferences,
                                                   RequestKeys rk,
                                                   java.lang.String name,
                                                   PreferenceLevel level,
                                                   java.lang.String value)
        Saves the value of a preference if the preference is present on the request
        Parameters:
        preferences - Preferences object
        name - name of the preference
        level - preference level (a value from EnumPreferenceLevels)
        value - preference value
        Since:
        MicroStrategy Web 8.0.0
      • getOptionValue

        public static java.lang.String getOptionValue​(RequestKeys rk,
                                                      Preferences pref,
                                                      HashList propertyValues,
                                                      boolean propertiesPresent,
                                                      java.lang.String preferenceName,
                                                      java.lang.String propertyName)
      • getCheckboxOptionValue

        public static java.lang.String getCheckboxOptionValue​(RequestKeys rk,
                                                              Preferences pref,
                                                              HashList propertyValues,
                                                              boolean propertiesPresent,
                                                              java.lang.String preferenceName,
                                                              java.lang.String propertyName)
      • getCheckboxOptionValueFromRK

        public static boolean getCheckboxOptionValueFromRK​(RequestKeys rk,
                                                           java.lang.String argumentName)
        Since:
        MicroStrategy Web 7.5.0
      • truncateDecimalVaule

        public static java.lang.String truncateDecimalVaule​(java.lang.String value,
                                                            int maxLength,
                                                            java.lang.String localeID)
        Truncate a decimal vaule so the length of its string representation does not exceed 'maxLength'. In any case we can only decrease the precision but not change the vaule itself.
        Parameters:
        value - The string representation of the value, formatted with specified locale
        maxLength - The maximum length of objective string after truncation
        localeID - The ID of the locale with which the original value is localized
        Returns:
        The representation of the value after truncation
        Since:
        MicroStrategy Web 9.0.0