Class FilterImportExportService
- java.lang.Object
-
- com.netgrif.application.engine.workflow.service.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 Summary
Constructors Constructor Description FilterImportExportService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.protected FilterImportExport
createExportClass(Case filter)
void
createFilterExport(IUser author)
void
createFilterImport(IUser author)
protected FileFieldValue
createXML(FilterImportExportList filters)
FilterImportExportList
exportFilters(java.util.Collection<java.lang.String> filtersToExport)
Method which performs export of selected filters into xml file.FileFieldValue
exportFiltersToFile(java.util.Collection<java.lang.String> filtersToExport)
Method which performs export of selected filters into xml file.java.util.List<java.lang.String>
importFilters()
Method which performs import of filters from uploaded xml file.java.util.Map<java.lang.String,java.lang.String>
importFilters(FilterImportExportList filterList)
Method which performs import of filters from already created filter import class instances passed in as parameter.protected FilterImportExportList
loadFromXML()
protected java.util.Map<java.lang.String,java.lang.String>
performImport(FilterImportExportList filterList)
-
-
-
Method Detail
-
createFilterImport
public void createFilterImport(IUser author)
- Specified by:
createFilterImport
in interfaceIFilterImportExportService
-
createFilterExport
public void createFilterExport(IUser author)
- Specified by:
createFilterExport
in interfaceIFilterImportExportService
-
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 interfaceIFilterImportExportService
- 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 interfaceIFilterImportExportService
- 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 interfaceIFilterImportExportService
- Returns:
- List
- list of task ids of imported filter cases in - import_filter transition - Throws:
java.io.IOException
- - if imported file is not foundIllegalFilterFileException
- - if uploaded xml is not in correct xml format and invalidate against schemaTransitionNotExecutableException
-
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 interfaceIFilterImportExportService
- 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 foundTransitionNotExecutableException
-
performImport
protected java.util.Map<java.lang.String,java.lang.String> performImport(FilterImportExportList filterList) throws java.io.IOException, TransitionNotExecutableException
- Throws:
java.io.IOException
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 interfaceIFilterImportExportService
- Parameters:
filterFields
- - list of task ids of filters which value should be reloaded
-
loadFromXML
@Transactional protected FilterImportExportList loadFromXML() throws java.io.IOException, IllegalFilterFileException
- Throws:
java.io.IOException
IllegalFilterFileException
-
createXML
@Transactional protected FileFieldValue createXML(FilterImportExportList filters) throws java.io.IOException
- Throws:
java.io.IOException
-
createExportClass
protected FilterImportExport createExportClass(Case filter)
-
-