commit 6af5c07d670cc4d262f088fd7255c1bdf89fdbe4
Author: Vojtěch Danišík <32537562+danisik@users.noreply.github.com>
Date:   Wed Sep 9 20:54:46 2020 +0200

    final commit

diff --git a/src/main/java/vldc/aswi/configuration/AppConfig.java b/src/main/java/vldc/aswi/configuration/AppConfig.java
index 07c9136b..9c343211 100644
--- a/src/main/java/vldc/aswi/configuration/AppConfig.java
+++ b/src/main/java/vldc/aswi/configuration/AppConfig.java
@@ -81,7 +81,7 @@ public class AppConfig extends WebSecurityConfigurerAdapter implements WebMvcCon
 
 	@Override
 	protected void configure(HttpSecurity http) throws Exception {
-		// TODO: 04.05.2020 Error pages
+		// Access rights for authorities + set default login / logout page.
 		http
 		.authorizeRequests()
 			.mvcMatchers("/login").permitAll()
@@ -112,6 +112,7 @@ public class AppConfig extends WebSecurityConfigurerAdapter implements WebMvcCon
 
 	@Override
 	public void addResourceHandlers(ResourceHandlerRegistry registry) {
+		// Resource handlers for css / js / webfont files.
 		registry
 		.addResourceHandler("/css/**")
 		.addResourceLocations("/css/");
diff --git a/src/main/java/vldc/aswi/database/DatabaseInterface.java b/src/main/java/vldc/aswi/database/DatabaseInterface.java
index fcd376aa..795a9e0d 100644
--- a/src/main/java/vldc/aswi/database/DatabaseInterface.java
+++ b/src/main/java/vldc/aswi/database/DatabaseInterface.java
@@ -47,6 +47,7 @@ public class DatabaseInterface {
                     public List<String> extractData(ResultSet resultSet) throws SQLException {
                         List<String> tableColumnNames = new ArrayList<>();
 
+                        // Get metadata from database result set.
                         ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
                         int columnCount = resultSetMetaData.getColumnCount();
 
diff --git a/src/main/java/vldc/aswi/domain/parameter/ParameterInConfiguration.java b/src/main/java/vldc/aswi/domain/parameter/ParameterInConfiguration.java
index a129a478..1447d7bc 100644
--- a/src/main/java/vldc/aswi/domain/parameter/ParameterInConfiguration.java
+++ b/src/main/java/vldc/aswi/domain/parameter/ParameterInConfiguration.java
@@ -50,6 +50,18 @@ public class ParameterInConfiguration extends EntityParent implements Comparable
     @JoinColumn(name = "operator_id")
     private Operator operator;
 
+    /**
+     * Creating new table with M:N relationship between Parameter_Hodnota and Parametr_Konfigurace.
+     * Specify which functions can be used for parameter.
+     */
+    @ManyToMany
+    @JoinTable(
+            name = "P_konfigurace_ma_Hodnoty",
+            joinColumns = @JoinColumn(name = "parametr_konfigurace_id"),
+            inverseJoinColumns = @JoinColumn(name = "parametr_hodnota_id")
+    )
+    private List<ParameterValue> selectedParameterValues;
+
     /**
      * Creating new table with M:N relationship between ParameterInConfiguration and Function.
      * On every ParameterInConfiguration can be applied 0 - every function.
diff --git a/src/main/java/vldc/aswi/domain/parameter/ParameterValue.java b/src/main/java/vldc/aswi/domain/parameter/ParameterValue.java
index d7ecb820..3d9c0e60 100644
--- a/src/main/java/vldc/aswi/domain/parameter/ParameterValue.java
+++ b/src/main/java/vldc/aswi/domain/parameter/ParameterValue.java
@@ -6,6 +6,7 @@ import lombok.NoArgsConstructor;
 import vldc.aswi.domain.EntityParent;
 
 import javax.persistence.*;
+import java.util.List;
 
 /**
  * Domain entity representing Parameter in application.
@@ -25,6 +26,10 @@ public class ParameterValue extends EntityParent {
     @Column(name = "hodnota")
     private String value;
 
+    /** List of parametersInConfigurations, which using this function. */
+    @ManyToMany(mappedBy = "selectedParameterValues")
+    private List<ParameterInConfiguration> parametersInConfigurations;
+
     /**
      * Constructor.
      * @param value - Value that can be used in specific parameter.
diff --git a/src/main/java/vldc/aswi/service/ConfigurationManagerImpl.java b/src/main/java/vldc/aswi/service/ConfigurationManagerImpl.java
index ec6c9e1a..76bb0cb3 100644
--- a/src/main/java/vldc/aswi/service/ConfigurationManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/ConfigurationManagerImpl.java
@@ -25,39 +25,57 @@ import java.util.List;
 @Slf4j
 public class ConfigurationManagerImpl implements ConfigurationManager {
 
-    /** Autowired configuration repository. */
+    /**
+     * Autowired configuration repository.
+     */
     @Autowired
     private ConfigurationRepository configurationRepository;
 
-    /** Autowired assembly repository. */
+    /**
+     * Autowired assembly repository.
+     */
     @Autowired
     private AssemblyRepository assemblyRepository;
 
-    /** Autowired parameterInConfiguration repository. */
+    /**
+     * Autowired parameterInConfiguration repository.
+     */
     @Autowired
     private ParameterInConfigurationRepository parameterInConfigurationRepository;
 
-    /** Autowired operator repository. */
+    /**
+     * Autowired operator repository.
+     */
     @Autowired
     private OperatorRepository operatorRepository;
 
-    /** Autowired location repository. */
+    /**
+     * Autowired location repository.
+     */
     @Autowired
     private LocationRepository locationRepository;
 
-    /** Autowired parameter type manager. */
+    /**
+     * Autowired parameter type manager.
+     */
     @Autowired
     private ParameterTypeManager parameterTypeRepository;
 
-    /** Autowired function repository. */
+    /**
+     * Autowired function repository.
+     */
     @Autowired
     private FunctionRepository functionRepository;
 
-    /** Autowired user repository. */
+    /**
+     * Autowired user repository.
+     */
     @Autowired
     private UserRepository userRepository;
 
-    /** Autowired parameter in configuration manager. */
+    /**
+     * Autowired parameter in configuration manager.
+     */
     @Autowired
     private ParameterInConfigurationManager parameterInConfigurationManager;
 
@@ -79,8 +97,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
             if (this.configurationRepository.count() == 0) {
                 // Just checking if table exists.
             }
-        }
-        catch (InvalidDataAccessResourceUsageException e) {
+        } catch (InvalidDataAccessResourceUsageException e) {
             log.error("Table \"Konfigurace\" did not exists in database!");
             System.exit(1);
         }
@@ -88,6 +105,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
 
     /**
      * Get all configurations from database.
+     *
      * @return List of configurations.
      */
     @Override
@@ -104,6 +122,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
 
     /**
      * Gets configuration according to its ID
+     *
      * @param id ID of configuration
      * @return configuration by ID
      */
@@ -117,22 +136,23 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
 
     /**
      * Saves configuration and its contents into database
+     *
      * @param newConfiguration configuration to save
-     * @param id id of configuration, if not empty configuration is updated
+     * @param id               id of configuration, if not empty configuration is updated
      * @return saved configuration
      */
     @Override
     public Configuration saveConfiguration(Configuration newConfiguration, String id) {
         if (id.equals("")) {
             return addConfiguration(newConfiguration);
-        }
-        else {
+        } else {
             return editConfiguration(newConfiguration, Long.valueOf(id));
         }
     }
 
     /**
      * Delete single configuration by id.
+     *
      * @param id - ID of configuration.
      * @return True if deleting was successful, false if not.
      */
@@ -149,6 +169,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
 
     /**
      * Delete all configurations by assembly id.
+     *
      * @param assemblyId - ID of assembly.
      * @return True if all configurations were successfully deleted, false if not.
      */
@@ -172,6 +193,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
 
     /**
      * Saves new configuration into database
+     *
      * @param newConfiguration container with data for a new configuration
      * @return saved configuration
      */
@@ -229,8 +251,9 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
 
     /**
      * Saves edited configuration with given ID
+     *
      * @param newConfiguration container with data for edited configuration
-     * @param id ID of edited configuration
+     * @param id               ID of edited configuration
      * @return saved configuration
      */
     private Configuration editConfiguration(Configuration newConfiguration, Long id) {
@@ -238,26 +261,25 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
         configuration.setName(newConfiguration.getName());
         configuration.setTableName(newConfiguration.getTableName());
 
-        for(int i = 0; i < configuration.getParametersInConfiguration().size(); i++) {
+        for (int i = 0; i < configuration.getParametersInConfiguration().size(); i++) {
             ParameterInConfiguration parameterInConfiguration = configuration.getParametersInConfiguration().get(i);
             parameterInConfiguration.setParameterOrder(newConfiguration.getParametersInConfiguration().get(i).getParameterOrder());
             parameterInConfiguration.setOperatorValue(newConfiguration.getParametersInConfiguration().get(i).getOperatorValue());
-            if(newConfiguration.getParametersInConfiguration().get(i).getColumnName() != null &&
+            if (newConfiguration.getParametersInConfiguration().get(i).getColumnName() != null &&
                     !newConfiguration.getParametersInConfiguration().get(i).getColumnName().equals("")) {
                 parameterInConfiguration.setColumnName(newConfiguration.getParametersInConfiguration().get(i).getColumnName());
             }
-            if(newConfiguration.getParametersInConfiguration().get(i).getLocation() != null) {
+            if (newConfiguration.getParametersInConfiguration().get(i).getLocation() != null) {
                 parameterInConfiguration.setLocation(locationRepository.getById(
                         newConfiguration.getParametersInConfiguration().get(i).getLocation().getId()));
-            }
-            else {
+            } else {
                 parameterInConfiguration.setLocation(null);
             }
-            if(newConfiguration.getParametersInConfiguration().get(i).getOperator() != null) {
+            if (newConfiguration.getParametersInConfiguration().get(i).getOperator() != null) {
                 parameterInConfiguration.setOperator(operatorRepository.getByName(
                         newConfiguration.getParametersInConfiguration().get(i).getOperator().getName()));
             }
-            if(newConfiguration.getParametersInConfiguration().get(i).getFunctions() != null) {
+            if (newConfiguration.getParametersInConfiguration().get(i).getFunctions() != null) {
                 parameterInConfiguration.setFunctions(new ArrayList<>());
                 for (Function function : newConfiguration.getParametersInConfiguration().get(i).getFunctions()) {
                     parameterInConfiguration.getFunctions().add(functionRepository.getByName(function.getName()));
diff --git a/src/main/java/vldc/aswi/service/ExportManagerImpl.java b/src/main/java/vldc/aswi/service/ExportManagerImpl.java
index 83839852..933460ba 100644
--- a/src/main/java/vldc/aswi/service/ExportManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/ExportManagerImpl.java
@@ -94,6 +94,7 @@ public class ExportManagerImpl implements ExportManager {
 
         } catch (Exception e) {
             System.out.println("pdf export FAILED 1");
+            e.printStackTrace();
             // TODO: print error message - file not created.
         }
     }
diff --git a/src/main/java/vldc/aswi/service/RoleManager.java b/src/main/java/vldc/aswi/service/RoleManager.java
index 18de5b98..53029032 100644
--- a/src/main/java/vldc/aswi/service/RoleManager.java
+++ b/src/main/java/vldc/aswi/service/RoleManager.java
@@ -26,5 +26,5 @@ public interface RoleManager {
      * @param name name of the role
      * @return List of roles.
      */
-    public Role getRole(String name);
+    Role getRole(String name);
 }
diff --git a/src/main/java/vldc/aswi/service/SqlQueryManagerImpl.java b/src/main/java/vldc/aswi/service/SqlQueryManagerImpl.java
index c17c00ba..229361d2 100644
--- a/src/main/java/vldc/aswi/service/SqlQueryManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/SqlQueryManagerImpl.java
@@ -103,8 +103,14 @@ public class SqlQueryManagerImpl implements SqlQueryManager {
      */
     private void initializeContingencyTableDataLists(List<NameUserName> rowNames, List<NameUserName> columnNames,
                                                      List<ValueFunction> valueFunctions, List<ParameterInConfiguration> parametersInConfiguration) {
+
+        // Iterate through every parameterInConfiguration.
         for (ParameterInConfiguration parameterInConfiguration : parametersInConfiguration) {
+
+            // If parameterInConfiguration is located as ROW.
             if (parameterInConfiguration.getLocation().getName() != null && parameterInConfiguration.getLocation().getName().equals("Řádek")) {
+
+                // Set column name.
                 if (parameterInConfiguration.getColumnName() != null && !parameterInConfiguration.getColumnName().equals("")) {
                     rowNames.add(new NameUserName(parameterInConfiguration.getParameter().getNameOfSelect().toUpperCase(),
                             parameterInConfiguration.getColumnName()));
@@ -113,7 +119,11 @@ public class SqlQueryManagerImpl implements SqlQueryManager {
                     rowNames.add(new NameUserName(parameterInConfiguration.getParameter().getNameOfSelect().toUpperCase(),
                             parameterInConfiguration.getParameter().getName()));
                 }
+
+                // If parameterInConfiguration is located as COLUMN.
             } else if (parameterInConfiguration.getLocation().getName() != null && parameterInConfiguration.getLocation().getName().equals("Sloupec")) {
+
+                // Set column name.
                 if (parameterInConfiguration.getColumnName() != null && !parameterInConfiguration.getColumnName().equals("")) {
                     columnNames.add(new NameUserName(parameterInConfiguration.getParameter().getNameOfSelect().toUpperCase(),
                             parameterInConfiguration.getColumnName()));
@@ -122,12 +132,17 @@ public class SqlQueryManagerImpl implements SqlQueryManager {
                     columnNames.add(new NameUserName(parameterInConfiguration.getParameter().getNameOfSelect().toUpperCase(),
                             parameterInConfiguration.getParameter().getName()));
                 }
+
+                // If parameterInConfiguration is located as VALUE.
             } else if (parameterInConfiguration.getLocation().getName() != null && parameterInConfiguration.getLocation().getName().equals("Hodnota")) {
+
+                // Iterate through all functions in parameterInConfiguration and add it to the list.
                 for (Function function : parameterInConfiguration.getFunctions()) {
                     valueFunctions.add(new ValueFunction(parameterInConfiguration.getParameter().getNameOfSelect().toUpperCase(),
                             parameterInConfiguration.getParameter().getName(), function.getName().toUpperCase(),
                             parameterInConfiguration.getParameter().getParameterType().getName()));
                 }
+
                 if (valueFunctions.size() == 0) {
                     valueFunctions.add(new ValueFunction(parameterInConfiguration.getParameter().getNameOfSelect().toUpperCase(),
                             parameterInConfiguration.getParameter().getName(), "",
diff --git a/src/main/java/vldc/aswi/service/UserManager.java b/src/main/java/vldc/aswi/service/UserManager.java
index b4c9aa5c..cd4e456c 100644
--- a/src/main/java/vldc/aswi/service/UserManager.java
+++ b/src/main/java/vldc/aswi/service/UserManager.java
@@ -19,6 +19,7 @@ public interface UserManager {
      * Add new user into database.
      * @param username - login username for user.
      * @param password - password for user.
+     * @param roleId - Role ID.
      * @return ID of newly created user.
      */
     Long addUser(String username, String password, Long roleId);
diff --git a/src/main/java/vldc/aswi/service/parameter/ParameterInConfigurationManagerImpl.java b/src/main/java/vldc/aswi/service/parameter/ParameterInConfigurationManagerImpl.java
index 6d174b01..19481291 100644
--- a/src/main/java/vldc/aswi/service/parameter/ParameterInConfigurationManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/parameter/ParameterInConfigurationManagerImpl.java
@@ -126,6 +126,11 @@ public class ParameterInConfigurationManagerImpl implements ParameterInConfigura
         }
     }
 
+    /**
+     * Delete parameterInConfiguration from configuration.
+     * @param parameterInConfiguration - Parameter in configuration.
+     * @return True if parameter was deleted successfully, false if not.
+     */
     private boolean deleteParameterInConfiguration(ParameterInConfiguration parameterInConfiguration) {
         try {
 
diff --git a/src/main/java/vldc/aswi/service/parameter/ParameterManagerImpl.java b/src/main/java/vldc/aswi/service/parameter/ParameterManagerImpl.java
index 3bb6e295..05fb0c6c 100644
--- a/src/main/java/vldc/aswi/service/parameter/ParameterManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/parameter/ParameterManagerImpl.java
@@ -11,13 +11,11 @@ import vldc.aswi.dao.AssemblyRepository;
 import vldc.aswi.dao.FunctionRepository;
 import vldc.aswi.dao.LocationRepository;
 import vldc.aswi.dao.OperatorRepository;
-import vldc.aswi.dao.parameter.ParameterInConfigurationRepository;
 import vldc.aswi.dao.parameter.ParameterRepository;
 import vldc.aswi.dao.parameter.ParameterTypeRepository;
 import vldc.aswi.dao.parameter.ParameterValueRepository;
 import vldc.aswi.domain.*;
 import vldc.aswi.domain.parameter.Parameter;
-import vldc.aswi.domain.parameter.ParameterInConfiguration;
 import vldc.aswi.domain.parameter.ParameterValue;
 
 import javax.transaction.Transactional;
diff --git a/src/main/java/vldc/aswi/service/parameter/ParameterValueManagerImpl.java b/src/main/java/vldc/aswi/service/parameter/ParameterValueManagerImpl.java
index 45f64e7b..21a1b582 100644
--- a/src/main/java/vldc/aswi/service/parameter/ParameterValueManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/parameter/ParameterValueManagerImpl.java
@@ -9,7 +9,6 @@ import org.springframework.dao.InvalidDataAccessResourceUsageException;
 import org.springframework.stereotype.Service;
 import vldc.aswi.dao.parameter.ParameterRepository;
 import vldc.aswi.dao.parameter.ParameterValueRepository;
-import vldc.aswi.domain.parameter.Parameter;
 import vldc.aswi.domain.parameter.ParameterValue;
 
 import javax.transaction.Transactional;
diff --git a/src/main/java/vldc/aswi/utils/AuthControl.java b/src/main/java/vldc/aswi/utils/AuthControl.java
index 3994cc40..f9747d26 100644
--- a/src/main/java/vldc/aswi/utils/AuthControl.java
+++ b/src/main/java/vldc/aswi/utils/AuthControl.java
@@ -25,7 +25,6 @@ public class AuthControl {
                     .map(GrantedAuthority::getAuthority).collect(Collectors.toSet());
             return roles.iterator().next().replace("ROLE_", "");
         } else {
-            // TODO: 04.05.2020 error message, user not authenticated
             return null;
         }
     }
@@ -39,7 +38,6 @@ public class AuthControl {
         if (!(authentication instanceof AnonymousAuthenticationToken)) {
             return authentication.getName();
         } else {
-            // TODO: 04.05.2020 error message, user not authenticated
             return null;
         }
     }
diff --git a/src/main/java/vldc/aswi/utils/Converter.java b/src/main/java/vldc/aswi/utils/Converter.java
index dd3be9d5..5a338014 100644
--- a/src/main/java/vldc/aswi/utils/Converter.java
+++ b/src/main/java/vldc/aswi/utils/Converter.java
@@ -85,11 +85,14 @@ public class Converter {
         long startTime1 = System.nanoTime();
         columnNodes = new ArrayList<>();
         List<List<String>> values = new ArrayList<>();
+
+        // Add column names into temp list with contingency table.
         for(NameUserName nameUserName : columnNames) {
             TableColumn column = tableColumns.get(nameUserName.getName());
             values.add(getOriginalValuesFromList(column.getValues()));
         }
 
+        // Generate columns.
         Node startNode = new Node();
         generateColumns(0, values, columnNodes, startNode);
 
diff --git a/src/main/java/vldc/aswi/utils/ExporterPDF.java b/src/main/java/vldc/aswi/utils/ExporterPDF.java
index 9a408330..ae30915e 100644
--- a/src/main/java/vldc/aswi/utils/ExporterPDF.java
+++ b/src/main/java/vldc/aswi/utils/ExporterPDF.java
@@ -1,17 +1,13 @@
 package vldc.aswi.utils;
 
-import be.quodlibet.boxable.BaseTable;
 import com.lowagie.text.*;
 import com.lowagie.text.Font;
 import com.lowagie.text.alignment.HorizontalAlignment;
 import com.lowagie.text.alignment.VerticalAlignment;
 import com.lowagie.text.pdf.PdfWriter;
-import org.apache.pdfbox.pdmodel.PDPage;
-import org.apache.pdfbox.pdmodel.font.PDType1Font;
 import vldc.aswi.model.table.contingencyTable.ContingencyTableRow;
 import vldc.aswi.model.table.contingencyTable.ContingencyTableRowCell;
 
-import java.awt.*;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.util.List;
@@ -69,6 +65,7 @@ public class ExporterPDF {
             doc.close();
         } catch (Exception e) {
 
+            System.out.println("PDF export failed.");
         }
     }
 
@@ -159,44 +156,4 @@ public class ExporterPDF {
 
         return columnCount;
     }
-
-
-    public static void exportt(File tmpFile, List<ContingencyTableRow> contingencyTableRows) {
-        /*
-        //Dummy Table
-        float margin = 50;
-
-        // starting y position is whole page height subtracted by top and bottom margin
-        float yStartNewPage = myPage.getMediaBox().getHeight() - (2 * margin);
-
-        // we want table across whole page width (subtracted by left and right margin ofcourse)
-        float tableWidth = myPage.getMediaBox().getWidth() - (2 * margin);
-
-        boolean drawContent = true;
-        float yStart = yStartNewPage;
-        float bottomMargin = 70;
-        // y position is your coordinate of top left corner of the table
-        float yPosition = 550;
-
-        BaseTable table = new BaseTable(yPosition, yStartNewPage, bottomMargin, tableWidth, margin, mainDocument, myPage, true, drawContent);
-
-
-        Row<PDPage> headerRow = table.createRow(15f);
-        Cell<PDPage> cell = headerRow.createCell(100, "Header");
-        table.addHeaderRow(headerRow);
-
-
-        Row<PDPage> row = table.createRow(12);
-        cell = row.createCell(30, "Data 1");
-        cell = row.createCell(70, "Some value");
-
-        table.draw();
-
-
-        contentStream.close();
-        mainDocument.addPage(myPage);
-        mainDocument.save("testfile.pdf");
-        mainDocument.close();
-         */
-    }
 }
diff --git a/src/main/java/vldc/aswi/web/controller/AssemblyController.java b/src/main/java/vldc/aswi/web/controller/AssemblyController.java
index f6289338..178be008 100644
--- a/src/main/java/vldc/aswi/web/controller/AssemblyController.java
+++ b/src/main/java/vldc/aswi/web/controller/AssemblyController.java
@@ -12,6 +12,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 import vldc.aswi.domain.*;
 import vldc.aswi.domain.parameter.Parameter;
 import vldc.aswi.domain.parameter.ParameterInConfiguration;
+import vldc.aswi.domain.parameter.ParameterType;
 import vldc.aswi.model.ExportType;
 import vldc.aswi.model.table.contingencyTable.ContingencyTableRow;
 import vldc.aswi.service.*;
@@ -130,8 +131,9 @@ public class AssemblyController extends BasicController {
             return new ModelAndView("redirect:/");
         }
 
-        Configuration configuration = new Configuration();
+        List<Operator> operatorList = operatorManager.getOperators();
 
+        Configuration configuration = new Configuration();
         configuration.setAssembly(assembly);
         configuration.setTableName(assembly.getName());
         configuration.setParametersInConfiguration(new ArrayList<>());
@@ -139,7 +141,19 @@ public class AssemblyController extends BasicController {
             ParameterInConfiguration parameterInConfiguration = new ParameterInConfiguration();
             parameterInConfiguration.setParameter(parameter);
             parameterInConfiguration.setConfiguration(configuration);
-            parameterInConfiguration.setOperator(new Operator());
+
+            if (parameter.getParameterType().getName().toLowerCase().equals("výčet")) {
+
+                for (Operator operator : operatorList) {
+
+                    if (operator.getName().toLowerCase().equals("in")) {
+                        parameterInConfiguration.setOperator(operator);
+                    }
+                }
+
+            } else {
+                parameterInConfiguration.setOperator(new Operator());
+            }
             parameterInConfiguration.setLocation(new Location());
             parameterInConfiguration.setParameterOrder(parameter.getParameterOrder());
             configuration.getParametersInConfiguration().add(parameterInConfiguration);
diff --git a/src/main/java/vldc/aswi/web/controller/BasicController.java b/src/main/java/vldc/aswi/web/controller/BasicController.java
index c6493403..68c9f29d 100644
--- a/src/main/java/vldc/aswi/web/controller/BasicController.java
+++ b/src/main/java/vldc/aswi/web/controller/BasicController.java
@@ -22,7 +22,10 @@ public class BasicController {
     protected String getFullErrorMessage(BindingResult result) {
         String message = "";
 
+        // Iterate through all errors from validating.
         for (Object object : result.getAllErrors()) {
+
+            // If error is type "FieldError".
             if (object instanceof FieldError) {
                 FieldError fieldError = (FieldError) object;
 
@@ -35,6 +38,7 @@ public class BasicController {
                 continue;
             }
 
+            // If error is type "ObjectError".
             if (object instanceof ObjectError) {
                 ObjectError objectError = (ObjectError) object;
 
diff --git a/src/main/java/vldc/aswi/web/controller/ConfigurationController.java b/src/main/java/vldc/aswi/web/controller/ConfigurationController.java
index 6f4128c9..e0ecb11e 100644
--- a/src/main/java/vldc/aswi/web/controller/ConfigurationController.java
+++ b/src/main/java/vldc/aswi/web/controller/ConfigurationController.java
@@ -8,11 +8,10 @@ import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
-import vldc.aswi.domain.Assembly;
-import vldc.aswi.domain.Configuration;
-import vldc.aswi.domain.Location;
-import vldc.aswi.domain.Operator;
+import vldc.aswi.domain.*;
+import vldc.aswi.domain.parameter.Parameter;
 import vldc.aswi.domain.parameter.ParameterInConfiguration;
+import vldc.aswi.domain.parameter.ParameterValue;
 import vldc.aswi.model.ExportType;
 import vldc.aswi.model.table.contingencyTable.ContingencyTableRow;
 import vldc.aswi.service.*;
@@ -25,9 +24,7 @@ import javax.servlet.http.HttpServletResponse;
 import vldc.aswi.validators.ConfigurationValidator;
 
 import javax.validation.Valid;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
+import java.util.*;
 
 /**
  * Manager for configuration.
@@ -102,7 +99,6 @@ public class ConfigurationController extends BasicController{
         configuration.setParametersInConfiguration(parametersInConfiguration);
 
         initializeFields(configuration);
-
         modelMap.addAttribute("configuration", configuration);
         modelMap.addAttribute("formAction", "/configuration?configurationID=" + configuration.getId());
 
@@ -124,7 +120,6 @@ public class ConfigurationController extends BasicController{
      * @param redirectAttributes Attributes.
      * @param saveConfiguration String used to check if save configuration button was clicked.
      * @param response HTTP servlet response.
-     * @param request HTTP servlet request.
      * @return ModelAndView for assembly.
      */
     @PostMapping("/configuration")
@@ -137,7 +132,6 @@ public class ConfigurationController extends BasicController{
                                            @RequestParam(required=false, value="exportPdf") String exportPdf,
                                            @RequestParam(required=false, value="saveConfiguration") String saveConfiguration,
                                             RedirectAttributes redirectAttributes,
-                                            HttpServletRequest request,
                                             HttpServletResponse response
                                           )
     {
diff --git a/src/main/webapp/WEB-INF/templates/assembly.html b/src/main/webapp/WEB-INF/templates/assembly.html
index 5fea3997..0bfa628f 100644
--- a/src/main/webapp/WEB-INF/templates/assembly.html
+++ b/src/main/webapp/WEB-INF/templates/assembly.html
@@ -86,8 +86,8 @@
 
                                     </div>
                                     <div th:if="${configuration.parametersInConfiguration[__${itemStat.index}__].parameter.parameterType.name.equals('Výčet')}" class="col select-filter">
-                                        <select class="mbSelect selectpicker assembly-enum-picker" multiple data-live-search="true" title="Nic nevybráno" >
-                                            <option th:each="parameterValue : ${configuration.parametersInConfiguration[__${itemStat.index}__].parameter.parameterValues}" th:value="${parameterValue.id}" th:text="${parameterValue.value}">Hodnota 1</option>
+                                        <select th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].selectedParameterValues}" class="mbSelect selectpicker assembly-enum-picker" multiple data-live-search="true" title="Nic nevybráno">
+                                            <option th:each="parameterValue : ${configuration.parametersInConfiguration[__${itemStat.index}__].parameter.parameterValues}" th:value="${parameterValue.id}" th:text="${parameterValue.value}"></option>
                                         </select>
                                     </div>
                                 </td>
