Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.netgrif.application.engine.auth.domain.IUser;
import com.netgrif.application.engine.auth.service.interfaces.IUserService;
import com.netgrif.application.engine.configuration.properties.FilterProperties;
import com.netgrif.application.engine.petrinet.domain.throwable.TransitionNotExecutableException;
import com.netgrif.application.engine.workflow.domain.filter.FilterImportExport;
import com.netgrif.application.engine.workflow.domain.filter.FilterImportExportList;
import com.netgrif.application.engine.petrinet.domain.I18nString;
Expand Down Expand Up @@ -161,7 +162,7 @@ public FilterImportExportList exportFilters(Collection<String> filtersToExport)
* @throws IllegalFilterFileException - if uploaded xml is not in correct xml format and invalidate against schema
*/
@Override
public List<String> importFilters() throws IOException, IllegalFilterFileException {
public List<String> importFilters() throws IOException, IllegalFilterFileException, TransitionNotExecutableException {
log.info("Importing filters");
FilterImportExportList filterList = loadFromXML();
return new ArrayList<>(performImport(filterList).values());
Expand All @@ -175,12 +176,12 @@ public List<String> importFilters() throws IOException, IllegalFilterFileExcepti
* @throws IOException - if imported file is not found
*/
@Override
public Map<String, String> importFilters (FilterImportExportList filterList) throws IOException {
public Map<String, String> importFilters (FilterImportExportList filterList) throws IOException, TransitionNotExecutableException {
log.info("Importing filters from imported menu");
return performImport(filterList);
}

protected Map<String, String> performImport (FilterImportExportList filterList) throws IOException {
protected Map<String, String> performImport (FilterImportExportList filterList) throws IOException, TransitionNotExecutableException {
Map<String, String> oldToNewFilterId = new HashMap<>();
Map<String, String> importedFilterTaskIds = new HashMap<>();

Expand Down Expand Up @@ -240,6 +241,7 @@ protected Map<String, String> performImport (FilterImportExportList filterList)
filterCase.get().getDataSet().get(FIELD_FILTER).addBehavior(IMPORT_FILTER_TRANSITION, Collections.singleton(FieldBehavior.VISIBLE));
workflowService.save(filterCase.get());
});
taskService.assignTasks(taskService.findAllById(new ArrayList<>(importedFilterTaskIds.values())), userService.getLoggedUser());
changeFilterField(importedFilterTaskIds.values());
return importedFilterTaskIds;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public FileFieldValue exportMenu(EnumerationMapField menusForExport, String grou
* @throws IllegalMenuFileException - if uploaded xml is not in correct xml format and invalidate against schema
*/
@Override
public List<String> importMenu(List<Case> menuItemCases, FileFieldValue ffv, String parentId) throws IOException, IllegalMenuFileException {
public List<String> importMenu(List<Case> menuItemCases, FileFieldValue ffv, String parentId) throws IOException, IllegalMenuFileException, TransitionNotExecutableException {
StringBuilder resultMessage = new StringBuilder("");

List<String> importedEntryAndFilterCaseIds = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.netgrif.application.engine.workflow.service.interfaces;

import com.netgrif.application.engine.auth.domain.IUser;
import com.netgrif.application.engine.petrinet.domain.throwable.TransitionNotExecutableException;
import com.netgrif.application.engine.workflow.domain.filter.FilterImportExportList;
import com.netgrif.application.engine.petrinet.domain.dataset.FileFieldValue;
import com.netgrif.application.engine.workflow.domain.IllegalFilterFileException;
Expand All @@ -21,9 +22,9 @@ public interface IFilterImportExportService {

FilterImportExportList exportFilters(Collection<String> filtersToExport);

List<String> importFilters() throws IOException, IllegalFilterFileException;
List<String> importFilters() throws IOException, IllegalFilterFileException, TransitionNotExecutableException;

Map<String, String> importFilters(FilterImportExportList filters) throws IOException;
Map<String, String> importFilters(FilterImportExportList filters) throws IOException, TransitionNotExecutableException;

void createFilterImport(IUser author);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.netgrif.application.engine.petrinet.domain.dataset.FileField;
import com.netgrif.application.engine.petrinet.domain.dataset.FileFieldValue;
import com.netgrif.application.engine.petrinet.domain.dataset.MultichoiceMapField;
import com.netgrif.application.engine.petrinet.domain.throwable.TransitionNotExecutableException;
import com.netgrif.application.engine.workflow.domain.Case;
import com.netgrif.application.engine.workflow.domain.IllegalMenuFileException;
import com.netgrif.application.engine.workflow.domain.menu.MenuEntry;
Expand All @@ -23,6 +24,6 @@ public interface IMenuImportExportService {
Map<String, I18nString> createAvailableEntriesChoices(List<Case> menuItemCases);
Map<String, I18nString> addSelectedEntriesToExport(MultichoiceMapField availableEntries, EnumerationMapField menusForExport, String menuidentifier);
FileFieldValue exportMenu(EnumerationMapField menusForExport, String groupId, FileField fileField) throws IOException;
List<String> importMenu(List<Case> menuItemCases, FileFieldValue ffv, String groupCaseId) throws IOException, IllegalMenuFileException;
List<String> importMenu(List<Case> menuItemCases, FileFieldValue ffv, String groupCaseId) throws IOException, IllegalMenuFileException, TransitionNotExecutableException;
String createMenuItemCase(StringBuilder resultMessage, MenuEntry item, String menuIdentifier, String groupCaseId, String filterCaseId);
}