Class FilterImportExportService

  • All Implemented Interfaces:
    IFilterImportExportService

    @Service
    public class FilterImportExportService
    extends java.lang.Object
    implements IFilterImportExportService
    Service that provides methods for creation of filter export/import cases for users. Also provides methods to export and import filters.
    • Constructor Detail

      • FilterImportExportService

        public FilterImportExportService()
    • Method Detail

      • exportFiltersToFile

        public FileFieldValue exportFiltersToFile​(java.util.Collection<java.lang.String> filtersToExport)
                                           throws java.io.IOException
        Method which performs export of selected filters into xml file. Method finds all cases by provided ids, transform them into FilterImportExportList object and serialize them into xml file on path: storage/filterExport//filters.xml
        Specified by:
        exportFiltersToFile in interface IFilterImportExportService
        Parameters:
        filtersToExport - - set of ids of filter cases, which should be exported
        Returns:
        FileFieldValue - file field value with path to xml file of exported filters
        Throws:
        java.io.IOException - - if file which contains exported filters cannot be created
      • exportFilters

        public FilterImportExportList exportFilters​(java.util.Collection<java.lang.String> filtersToExport)
        Method which performs export of selected filters into xml file. Method finds all cases by provided ids, transform them into FilterImportExportList object
        Specified by:
        exportFilters in interface IFilterImportExportService
        Parameters:
        filtersToExport - - set of ids of filter cases, which should be exported
        Returns:
        a serializable wrapper of a list of filter objects in serializable form
      • importFilters

        public java.util.List<java.lang.String> importFilters()
                                                       throws java.io.IOException,
                                                              IllegalFilterFileException,
                                                              TransitionNotExecutableException
        Method which performs import of filters from uploaded xml file. Method firstly loads xml file from file field and validates it against xml schema for filters export located on path: filter_export_schema.xml If the file is correct, method calls performImport method which creates filter cases
        Specified by:
        importFilters in interface IFilterImportExportService
        Returns:
        List - list of task ids of imported filter cases in - import_filter transition
        Throws:
        java.io.IOException - - if imported file is not found
        IllegalFilterFileException - - if uploaded xml is not in correct xml format and invalidate against schema
        TransitionNotExecutableException
      • importFilters

        public java.util.Map<java.lang.String,​java.lang.String> importFilters​(FilterImportExportList filterList)
                                                                             throws java.io.IOException,
                                                                                    TransitionNotExecutableException
        Method which performs import of filters from already created filter import class instances passed in as parameter.
        Specified by:
        importFilters in interface IFilterImportExportService
        Parameters:
        filterList - - instance of class FilterImportExportList
        Returns:
        a mapping of original filter case ids to task ids of imported filter cases in - import_filter transition
        Throws:
        java.io.IOException - - if imported file is not found
        TransitionNotExecutableException
      • changeFilterField

        public void changeFilterField​(java.util.Collection<java.lang.String> filterFields)
        Method which provides reloading of imported filters fields, so if allowed nets are missing, htmlTextArea is shown with list of missing allowed nets, otherwise filter preview is shown.
        Specified by:
        changeFilterField in interface IFilterImportExportService
        Parameters:
        filterFields - - list of task ids of filters which value should be reloaded