Class ExportRequestUtils


  • public class ExportRequestUtils
    extends Object
    Utility methods for the creation of DEE orders.
    • Constructor Detail

      • ExportRequestUtils

        public ExportRequestUtils()
    • Method Detail

      • fillTemplate

        public static StringWriter fillTemplate​(String templateFileName,
                                                Object filler)
        Returns a string writer containing the template filled in with the contents of the filler object.
        Parameters:
        templateFileName - The file name of the template, which will be retrieved from the project resources.
        filler - The filler object.
        Returns:
        The string writer.
      • filtersListToMap

        public static Map<String,​List<String>> filtersListToMap​(List<List<String>> filters,
                                                                      Function<String,​String> hierarchyNameConverter)
        Creates a map out of a flat list of sign-off filters. Only supports inclusive filters (And(Equals)).
        Parameters:
        filters - The filters.
        hierarchyNameConverter - A function that converts a hierarchy name into an appropriate key for the filters map.
        Returns:
        The filters map.
      • createMDXFiltersFromFilters

        public static List<ICubeFilterDefinition> createMDXFiltersFromFilters​(List<List<String>> inputFilters,
                                                                              com.quartetfs.biz.pivot.IMultiVersionActivePivot pivot)
        Creates a list of MDX filters out of a list of sign-off filters.
        Parameters:
        inputFilters - The filters.
        pivot - The ActivePivot object.
        Returns:
        The list of filters.
      • fillHeadersMap

        public static void fillHeadersMap​(Map<String,​String> headersMap,
                                          String headersString,
                                          String defaultHeaders)
        Fills a map of measures to headers based on a property string or a default.
        Parameters:
        headersMap - The map to be filled in.
        headersString - The property string, of the format measure1::header1;measure2::header2.
        defaultHeaders - The default headers string to be parsed.
      • addFormatter

        public static void addFormatter​(Class clazz,
                                        String formatter,
                                        String pattern)
        Adds a formatter for a given object class to the map.
        Parameters:
        clazz - The class for which the formatter applies.
        formatter - The formatter object to use.
        pattern - The pattern for the formatter.
      • injectFormatters

        public static void injectFormatters​(Map<Class,​String[]> formatters)
        Adds formatters to be used in the export process.
        Parameters:
        formatters - The formatters.
      • getFormatters

        public static Map<Class,​String[]> getFormatters()
        Retrieves formatters used in the export process.
        Returns:
        The formatters.
      • getFieldsFromPivot

        public static List<IDatastoreFieldDefinition> getFieldsFromPivot​(com.quartetfs.biz.pivot.IMultiVersionActivePivot pivot,
                                                                         Map<String,​String> fieldHeaders)
        Creates a list of datastore field definitions from the levels available in the cube.
        Parameters:
        pivot - The ActivePivot object.
        fieldHeaders - A map containing the headers to use for a given field.
        Returns:
        The list of datastore field definitions.
      • getLevelsFromPivot

        public static List<ICubeLevelDefinition> getLevelsFromPivot​(com.quartetfs.biz.pivot.IMultiVersionActivePivot pivot,
                                                                    Map<String,​String> levelHeaders,
                                                                    Boolean listAllLevels,
                                                                    Set<String> hierarchiesToSkip)
        Creates a list of cube level definitions from the levels available in the cube.
        Parameters:
        pivot - The ActivePivot object.
        levelHeaders - A map containing the headers to use for a given level.
        listAllLevels - Determines whether the entire list of levels are returned, or just the lowest level of each hierarchy.
        hierarchiesToSkip - A set of hierarchies that should be skipped.
        Returns:
        The list of cube level definitions.
      • getMeasuresFromPivot

        public static Set<Object> getMeasuresFromPivot​(String type,
                                                       List<String> measures,
                                                       com.quartetfs.biz.pivot.IMultiVersionActivePivot pivot,
                                                       Map<String,​String> measureHeaders)
        Creates a set of datastore field definitions related to the sign-off task measures.
        Parameters:
        type - The type of the definitions objects (field/cube).
        measures - The measures in the sign-off task.
        pivot - The ActivePivot object.
        measureHeaders - A map containing the headers to use for a given field.
        Returns:
        The set of datastore field definitions.
      • getPostProDescriptions

        public static Map<String,​com.quartetfs.biz.pivot.definitions.IPostProcessorDescription> getPostProDescriptions​(com.quartetfs.biz.pivot.IMultiVersionActivePivot pivot)
        Retrieves a map of all postprocessor descriptions in the cube, keyed by their name.
        Parameters:
        pivot - The ActivePivot object.
        Returns:
        The map of postprocessor descriptions in the cube.
      • createFilename

        public static String createFilename​(com.activeviam.signoff.core.model.dto.SignOffProcessInstanceExportDTO dto,
                                            String exportType)
        Creates a filename for a DEE export. Pattern is: Domain_Key_ExportType_Timestamp.csv
        Parameters:
        dto - The export request DTO.
        exportType - The type of export being performed.
        Returns:
        The formatted, sanitised filename.
      • sanitiseForFilename

        public static String sanitiseForFilename​(String toSanitise)
        Sanitises a string for inclusion in a Windows filename.
        Parameters:
        toSanitise - The string to sanitise.
        Returns:
        The result.
      • parseSkippedHierarchies

        public static Map<String,​Set<String>> parseSkippedHierarchies​(String skippedHierarchies)
        Parses a property string for skipped hierarchies and creates a map by domain. The string should contain entries separated by a comma, with the pattern "Domain::Hierarchy". One or more domains or hierarchies can be grouped together, separated by ";".
        Parameters:
        skippedHierarchies - The skipped hierarchies property string.
        Returns:
        The map of skipped hierarchies.
      • parseDateHierarchies

        public static Map<String,​ICubeLevelDefinition> parseDateHierarchies​(String dateHierarchies)
        Parses a property string into a map of domain to date hierarchy.

        The string should contain entries separated by a comma, with the pattern "Domain::Level@Hierarchy@Dimension". One or more domains can be grouped together, separated by ";".

        Parameters:
        dateHierarchies - The date hierarchies property string.
        Returns:
        The map of date hierarchies.
      • getFieldForLevel

        public static String getFieldForLevel​(ICubeLevelDefinition levelDefinition,
                                              com.quartetfs.biz.pivot.IMultiVersionActivePivot pivot)
        Retrieves the datastore field for a given level definition.
        Parameters:
        levelDefinition - The level for which the datastore field is required.
        pivot - The ActivePivot object.
        Returns:
        The datastore field from which the hierarchy is fed.
      • getFirstLevel

        public static com.quartetfs.biz.pivot.cube.hierarchy.ILevel getFirstLevel​(String hierarchy,
                                                                                  com.quartetfs.biz.pivot.IMultiVersionActivePivot pivot)
        Retrieves the first level in a given hierarchy.
        Parameters:
        hierarchy - The hierarchy.
        pivot - The ActivePivot object.
        Returns:
        The level.
      • getFirstLevelField

        public static String getFirstLevelField​(String hierarchy,
                                                com.quartetfs.biz.pivot.IMultiVersionActivePivot pivot)
        Retrieves the datastore field for the first level in a given hierarchy.
        Parameters:
        hierarchy - The hierarchy.
        pivot - The ActivePivot object.
        Returns:
        The datastore field for the level.
      • getHierarchies

        public static Map<String,​com.quartetfs.biz.pivot.cube.hierarchy.IHierarchy> getHierarchies​(com.quartetfs.biz.pivot.IMultiVersionActivePivot pivot)
        Retrieves a map of all hierarchies in a given pivot.
        Parameters:
        pivot - The ActivePivot object.
        Returns:
        The map of hierarchies.
      • formatForExport

        public static String formatForExport​(Object value)
        Returns a formatted version of a value for inclusion in the export file.
        Parameters:
        value - The value to format.
        Returns:
        The formatted value.