Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 74a73b3b

Přidáno uživatelem Vojtěch Danišík před asi 4 roky(ů)

re #7887 Deleting configurations and assemblies, Minor restructuralization.

Zobrazit rozdíly:

src/main/java/vldc/aswi/dao/AssemblyRepository.java
22 22
     * Find record with highest order.
23 23
     * @return Assembly with highest order.
24 24
     */
25
    // TODO: test it.
26 25
    Assembly findFirst1ByOrderByAssemblyOrder();
27 26
}
src/main/java/vldc/aswi/dao/ConfigurationRepository.java
2 2

  
3 3
import org.springframework.data.repository.CrudRepository;
4 4
import org.springframework.stereotype.Repository;
5
import vldc.aswi.domain.Assembly;
5 6
import vldc.aswi.domain.Configuration;
6 7

  
8
import java.util.List;
9

  
7 10
/**
8 11
 * Repository for domain Configuration.
9 12
 */
......
16 19
     * @return Configuration if ID is present in database.
17 20
     */
18 21
    Configuration getById(Long Id);
22

  
23
    /**
24
     * Get list of configurations by assembly id.
25
     * @param assemblyId - ID of assembly.
26
     * @return List of configurations.
27
     */
28
    List<Configuration> getByAssemblyId(Long assemblyId);
19 29
}
src/main/java/vldc/aswi/dao/parameter/ParameterInConfigurationRepository.java
4 4
import org.springframework.stereotype.Repository;
5 5
import vldc.aswi.domain.parameter.ParameterInConfiguration;
6 6

  
7
import java.util.List;
8

  
7 9
/**
8 10
 * Repository for domain ParameterInConfiguration.
9 11
 */
......
16 18
     * @return ParameterInConfiguration if ID is present in database.
17 19
     */
18 20
    ParameterInConfiguration getById(Long Id);
21

  
22
    /**
23
     * Get all parameters in configuration by configuration id.
24
     * @param configurationId - ID of configuration.
25
     * @return List of parameters in configuration.
26
     */
27
    List<ParameterInConfiguration> getAllByConfigurationId(Long configurationId);
28

  
29
    /**
30
     * Delete all parameters in configuration by configuration id.
31
     * @param configurationId - ID of configuration.
32
     * @return List of deleted parameter in configuration.
33
     */
34
    List<ParameterInConfiguration> deleteAllByConfigurationId(Long configurationId);
19 35
}
src/main/java/vldc/aswi/dao/parameter/ParameterRepository.java
3 3
import org.springframework.data.repository.CrudRepository;
4 4
import org.springframework.stereotype.Repository;
5 5
import vldc.aswi.domain.parameter.Parameter;
6
import vldc.aswi.domain.parameter.ParameterValue;
7

  
8
import java.util.List;
6 9

  
7 10
/**
8 11
 * Repository for domain Parameter.
......
16 19
     * @return Parameter if ID is present in database.
17 20
     */
18 21
    Parameter getById(Long Id);
22

  
23
    /**
24
     * Get all parameter values by assembly id.
25
     * @param assemblyId - ID of assembly.
26
     * @return List of parameters.
27
     */
28
    List<Parameter> getByAssemblyId(Long assemblyId);
19 29
}
src/main/java/vldc/aswi/dao/parameter/ParameterValueRepository.java
4 4
import org.springframework.stereotype.Repository;
5 5
import vldc.aswi.domain.parameter.ParameterValue;
6 6

  
7
import java.util.List;
8

  
7 9
/**
8 10
 * Repository for domain ParameterValue.
9 11
 */
......
16 18
     * @return ParameterValue if ID is present in database.
17 19
     */
18 20
    ParameterValue getById(Long Id);
21

  
22
    /**
23
     * Delete all parameter values by parameter id.
24
     * @param parameterId - ID of parameter.
25
     * @return List of deleted parameter values.
26
     */
27
    List<ParameterValue> deleteByParameterId(Long parameterId);
19 28
}
src/main/java/vldc/aswi/domain/Assembly.java
33 33
    private int isPublic;
34 34

  
35 35
    /** List of configurations, which using this assembly. */
36
    @OneToMany(mappedBy = "assembly", cascade = {CascadeType.ALL})
36
    @OneToMany(mappedBy = "assembly", cascade = CascadeType.ALL)
37 37
    private List<Configuration> configurations;
38 38

  
39 39
    /** List of parameters, which using this assembly. */
40
    @OneToMany(mappedBy = "assembly", cascade = {CascadeType.ALL})
40
    @OneToMany(mappedBy = "assembly", cascade = CascadeType.ALL)
41 41
    private List<Parameter> parameters;
42 42

  
43 43
    /**
44 44
     * Creating new table with M:N relationship between Assembly and Role.
45 45
     * Every assembly can be used by 0 - every role.
46 46
     */
47
    @ManyToMany(cascade = {CascadeType.ALL})
47
    @ManyToMany
48 48
    @JoinTable(
49 49
            name = "Sestava_ma_Role",
50 50
            joinColumns = @JoinColumn(name = "sestava_id"),
......
83 83
    public String toString() {
84 84
        return "Assembly[]";
85 85
    }
86

  
87
    /**
88
     * Remove role from assembly in 'Sestava_ma_Role' table.
89
     * @param role - Role to be removed.
90
     */
91
    public void removeRole(Role role) {
92
        roles.remove(role);
93
        role.getAssemblies().remove(this);
94
    }
86 95
}
src/main/java/vldc/aswi/domain/Configuration.java
36 36
    private Assembly assembly;
37 37

  
38 38
    /** List of parametersInConfiguration, which is part of this configuration. */
39
    @OneToMany(mappedBy = "configuration", cascade = {CascadeType.ALL})
39
    @OneToMany(mappedBy = "configuration", cascade = CascadeType.ALL)
40 40
    private List<ParameterInConfiguration> parametersInConfiguration;
41 41

  
42 42
    /**
src/main/java/vldc/aswi/domain/Function.java
26 26
    private String name;
27 27

  
28 28
    /** List of parameters, which defined that this function can be used. */
29
    @ManyToMany(mappedBy = "functions", cascade = {CascadeType.ALL})
29
    @ManyToMany(mappedBy = "functions")
30 30
    private List<Parameter> parameters;
31 31

  
32 32
    /** List of parametersInConfigurations, which using this function. */
33
    @ManyToMany(mappedBy = "functions", cascade = {CascadeType.ALL})
33
    @ManyToMany(mappedBy = "functions")
34 34
    private List<ParameterInConfiguration> parametersInConfigurations;
35 35

  
36 36
    /**
src/main/java/vldc/aswi/domain/Location.java
23 23
    private String name;
24 24

  
25 25
    /** List of parameters which allows this location. */
26
    @ManyToMany(mappedBy = "locations", cascade = {CascadeType.ALL})
26
    @ManyToMany(mappedBy = "locations")
27 27
    private List<Parameter> parameters;
28 28

  
29 29
    /** List of parametersInConfiguration which using this location. */
30
    @OneToMany(mappedBy = "location", cascade = {CascadeType.ALL})
30
    @OneToMany(mappedBy = "location")
31 31
    private List<ParameterInConfiguration> parametersInConfiguration;
32 32

  
33 33
    /**
src/main/java/vldc/aswi/domain/Operator.java
23 23
    private String name;
24 24

  
25 25
    /** List of parameters which allowing this operator to be used. */
26
    @ManyToMany(mappedBy = "operators", cascade = {CascadeType.ALL})
26
    @ManyToMany(mappedBy = "operators")
27 27
    private List<Parameter> parameters;
28 28

  
29 29
    /** List of parametersInConfiguration using this operator. */
30
    @OneToMany(mappedBy = "operator", cascade = {CascadeType.ALL})
30
    @OneToMany(mappedBy = "operator")
31 31
    private List<ParameterInConfiguration> parametersInConfiguration;
32 32

  
33 33
    /**
src/main/java/vldc/aswi/domain/Role.java
21 21
    private String name;
22 22

  
23 23
    /** List of assemblies, which using this role. */
24
    @ManyToMany(mappedBy = "roles", cascade = {CascadeType.ALL})
24
    @ManyToMany(mappedBy = "roles")
25 25
    private List<Assembly> assemblies;
26 26

  
27 27
    /** List of users with this role. */
28
    @OneToMany(mappedBy = "role", cascade = {CascadeType.ALL})
28
    @OneToMany(mappedBy = "role")
29 29
    private List<User> users;
30 30

  
31 31
    /**
src/main/java/vldc/aswi/domain/User.java
27 27
    private String password;
28 28

  
29 29
    /** Role of user. */
30
    @ManyToOne(fetch=FetchType.LAZY, cascade = {CascadeType.ALL})
30
    @ManyToOne(fetch=FetchType.LAZY)
31 31
    @JoinColumn(name = "role_id")
32 32
    private Role role;
33 33

  
34 34
    /** List of user configurations. */
35
    @OneToMany(mappedBy = "user", cascade = {CascadeType.ALL})
35
    @OneToMany(mappedBy = "user")
36 36
    private List<Configuration> configurations;
37 37

  
38 38
    /**
src/main/java/vldc/aswi/domain/parameter/Parameter.java
25 25
    private String nameOfSelect;
26 26

  
27 27
    /** Specific assembly, in which this parameter will be part of. */
28
    @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
28
    @ManyToOne(fetch = FetchType.LAZY)
29 29
    @JoinColumn(name = "sestava_id")
30 30
    private Assembly assembly;
31 31

  
32 32
    /** Specific type of parameter, which represents type of entry. */
33
    @ManyToOne(fetch=FetchType.LAZY, cascade = {CascadeType.ALL})
33
    @ManyToOne(fetch=FetchType.LAZY)
34 34
    @JoinColumn(name = "parametr_typ_id")
35 35
    private ParameterType parameterType;
36 36

  
......
39 39
    private String defaultValue;
40 40

  
41 41
    /** List of parametersInConfiguration, which using this parameter. */
42
    @OneToMany(mappedBy = "parameter", cascade = {CascadeType.ALL})
42
    @OneToMany(mappedBy = "parameter", cascade = CascadeType.ALL)
43 43
    private List<ParameterInConfiguration> parametersInConfiguration;
44 44

  
45 45
    /** List of parametersInConfiguration, which using this parameter. */
46
    @OneToMany(mappedBy = "parameter", cascade = {CascadeType.ALL})
46
    @OneToMany(mappedBy = "parameter", cascade = CascadeType.ALL)
47 47
    private List<ParameterValue> parameterValues;
48 48

  
49 49
    /**
50 50
     * Creating new table with M:N relationship between Parameter and Location.
51 51
     * Specify which locations can be used for parameter.
52 52
     */
53
    @ManyToMany(cascade = {CascadeType.ALL})
53
    @ManyToMany(cascade = CascadeType.PERSIST)
54 54
    @JoinTable(
55 55
            name = "Parametr_ma_Umisteni",
56 56
            joinColumns = @JoinColumn(name = "parametr_id"),
......
62 62
     * Creating new table with M:N relationship between Parameter and Function.
63 63
     * Specify which functions can be used for parameter.
64 64
     */
65
    @ManyToMany(cascade = {CascadeType.ALL})
65
    @ManyToMany(cascade = CascadeType.PERSIST)
66 66
    @JoinTable(
67 67
            name = "Parametr_ma_Funkce",
68 68
            joinColumns = @JoinColumn(name = "parametr_id"),
......
74 74
     * Creating new table with M:N relationship between Parameter and Operator.
75 75
     * Specify which operators can be used for parameter.
76 76
     */
77
    @ManyToMany(cascade = {CascadeType.ALL})
77
    @ManyToMany(cascade = CascadeType.PERSIST)
78 78
    @JoinTable(
79 79
            name = "Parametr_ma_Operator",
80 80
            joinColumns = @JoinColumn(name = "parametr_id"),
......
112 112
    public boolean equals(Object obj) {
113 113
        return super.equals(obj);
114 114
    }
115

  
116
    /**
117
     * Remove function from parameter in 'Parametr_ma_Funkce' table.
118
     * @param function - Function to be removed.
119
     */
120
    public void removeFunction(Function function) {
121
        functions.remove(function);
122
        function.getParameters().remove(this);
123
    }
124

  
125
    /**
126
     * Remove operator from parameter in 'Parametr_ma_Operator' table.
127
     * @param operator - Operator to be removed.
128
     */
129
    public void removeOperator(Operator operator) {
130
        operators.remove(operator);
131
        operator.getParameters().remove(this);
132
    }
133

  
134
    /**
135
     * Remove location from parameter in 'Parametr_ma_Umisteni' table.
136
     * @param location - Location to be removed.
137
     */
138
    public void removeLocation(Location location) {
139
        locations.remove(location);
140
        location.getParameters().remove(this);
141
    }
115 142
}
src/main/java/vldc/aswi/domain/parameter/ParameterInConfiguration.java
20 20
public class ParameterInConfiguration extends EntityParent {
21 21

  
22 22
    /** Specific configuration in which is this parameterConfiguration presented. */
23
    @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
23
    @ManyToOne(fetch = FetchType.LAZY)
24 24
    @JoinColumn(name = "konfigurace_id")
25 25
    private Configuration configuration;
26 26

  
......
34 34
    private String operatorValue;
35 35

  
36 36
    /** Specific location in which this parameterConfiguration will be used. */
37
    @ManyToOne(fetch=FetchType.LAZY, cascade = {CascadeType.ALL})
37
    @ManyToOne(fetch=FetchType.LAZY)
38 38
    @JoinColumn(name = "umisteni_id")
39 39
    private Location location;
40 40

  
......
43 43
    private String columnName;
44 44

  
45 45
    /** Specific operator which will be aplied onto data. */
46
    @ManyToOne(fetch=FetchType.LAZY, cascade = {CascadeType.ALL})
46
    @ManyToOne(fetch=FetchType.LAZY)
47 47
    @JoinColumn(name = "operator_id")
48 48
    private Operator operator;
49 49

  
......
51 51
     * Creating new table with M:N relationship between ParameterInConfiguration and Function.
52 52
     * On every ParameterInConfiguration can be applied 0 - every function.
53 53
     */
54
    @ManyToMany(cascade = {CascadeType.ALL})
54
    @ManyToMany(cascade = CascadeType.PERSIST)
55 55
    @JoinTable(
56 56
            name = "Parametr_konfigurace_ma_Funkce",
57 57
            joinColumns = @JoinColumn(name = "parametr_konfigurace_id"),
......
87 87
    public String toString() {
88 88
        return "ParameterInConfiguration[]";
89 89
    }
90

  
91
    /**
92
     * Remove function from parameter in 'Parametr_Konfigurace_ma_Funkce' table.
93
     * @param function - Function to be removed.
94
     */
95
    public void removeFunction(Function function) {
96
        functions.remove(function);
97
        function.getParametersInConfigurations().remove(this);
98
    }
90 99
}
src/main/java/vldc/aswi/domain/parameter/ParameterType.java
25 25
    private String name;
26 26

  
27 27
    /** List of parameterInConfigurations, which using this parameter type. */
28
    @OneToMany(mappedBy = "parameterType", cascade = {CascadeType.ALL})
28
    @OneToMany(mappedBy = "parameterType")
29 29
    private List<Parameter> parameters;
30 30

  
31 31
    /**
src/main/java/vldc/aswi/domain/parameter/ParameterValue.java
17 17
public class ParameterValue extends EntityParent {
18 18

  
19 19
    /** Specific parameter which can use this value. */
20
    @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
20
    @ManyToOne(fetch = FetchType.LAZY)
21 21
    @JoinColumn(name = "parametr_id")
22 22
    private Parameter parameter;
23 23

  
src/main/java/vldc/aswi/service/AssemblyManager.java
44 44
     * @return ID of assembly.
45 45
     */
46 46
    Long createAssembly(Assembly assemblyValues);
47

  
48
    /**
49
     * Delete assembly with ID.
50
     * @param id - ID of assembly.
51
     * @return True if delete was successful, otherwise false.
52
     */
53
    boolean deleteAssembly(Long id);
47 54
}
src/main/java/vldc/aswi/service/AssemblyManagerImpl.java
10 10
import vldc.aswi.dao.RoleRepository;
11 11
import vldc.aswi.domain.Assembly;
12 12
import vldc.aswi.domain.Role;
13
import vldc.aswi.service.parameter.ParameterManager;
13 14

  
14 15
import javax.transaction.Transactional;
16
import java.util.ArrayList;
15 17
import java.util.LinkedList;
16 18
import java.util.List;
17 19

  
......
26 28
    @Autowired
27 29
    private AssemblyRepository assemblyRepository;
28 30

  
31
    /** Autowired role repository. */
29 32
    @Autowired
30 33
    private RoleRepository roleRepository;
31 34

  
35
    /** Autowired configuration manager. */
36
    @Autowired
37
    private ConfigurationManager configurationManager;
38

  
39
    /** Autowired parameter manager. */
40
    @Autowired
41
    private ParameterManager parameterManager;
42

  
32 43
    /**
33 44
     * Initialization setup for assembly manager. Check if assembly repository contains
34 45
     * records and if not, initialize default values.
......
106 117
        Assembly assembly = getAssemblyById(id);
107 118
        List<Role> currentRoles = assembly.getRoles();
108 119

  
109
        // Find new roles.
110
        List<Role> currentRolesNew = new LinkedList<>(currentRoles);
111
        List<Role> updatedRolesNew = new LinkedList<>(updatedRoles);
112
        updatedRolesNew.removeAll(currentRolesNew);
120
        if (updatedRoles != null) {
121
            // Find new roles.
122
            List<Role> currentRolesNew = new LinkedList<>(currentRoles);
123
            List<Role> updatedRolesNew = new LinkedList<>(updatedRoles);
124
            updatedRolesNew.removeAll(currentRolesNew);
113 125

  
114
        // Find deleted roles.
115
        List<Role> currentRolesDeleted = new LinkedList<>(currentRoles);
116
        List<Role> updatedRolesDeleted = new LinkedList<>(updatedRoles);
117
        currentRolesDeleted.removeAll(updatedRolesDeleted);
126
            // Find deleted roles.
127
            List<Role> currentRolesDeleted = new LinkedList<>(currentRoles);
128
            List<Role> updatedRolesDeleted = new LinkedList<>(updatedRoles);
129
            currentRolesDeleted.removeAll(updatedRolesDeleted);
118 130

  
119
        // If no role has been deleted or added, then updating is unnecessary.
120
        if (updatedRolesNew.size() == 0 && currentRolesDeleted.size() == 0) return;
131
            // If no role has been deleted or added, then updating is unnecessary.
132
            if (updatedRolesNew.size() == 0 && currentRolesDeleted.size() == 0) return;
121 133

  
122
        // Add new roles and remove deleted roles.
123
        for (Role newRole : updatedRolesNew) {
124
            currentRoles.add(this.roleRepository.getById(newRole.getId()));
134
            // Add new roles and remove deleted roles.
135
            for (Role newRole : updatedRolesNew) {
136
                currentRoles.add(this.roleRepository.getById(newRole.getId()));
137
            }
138
            currentRoles.removeAll(currentRolesDeleted);
125 139
        }
126
        currentRoles.removeAll(currentRolesDeleted);
127 140

  
128 141
        // Save updates to database.
129 142
        this.assemblyRepository.save(assembly);
......
136 149
     */
137 150
    @Override
138 151
    public Long createAssembly(Assembly assemblyValues) {
139
        // TODO: test it.
140 152
        // Create new assembly and assign values.
141 153
        Assembly assembly = new Assembly();
142 154
        assembly.setName(assemblyValues.getName());
143 155
        assembly.setSQLQuery(assemblyValues.getSQLQuery());
144
        assembly.setAssemblyOrder(this.assemblyRepository.findFirst1ByOrderByAssemblyOrder().getAssemblyOrder() + 1);
156

  
157
        Assembly lastAssembly = this.assemblyRepository.findFirst1ByOrderByAssemblyOrder();
158
        int order = 1;
159

  
160
        if (lastAssembly != null) {
161
            order = lastAssembly.getAssemblyOrder() + 1;
162
        }
163

  
164
        assembly.setAssemblyOrder(order);
145 165
        assembly.setIsPublic(assemblyValues.getIsPublic());
146 166
        List<Role> roles = new LinkedList<>();
147 167

  
......
159 179

  
160 180
        return assembly.getId();
161 181
    }
182

  
183
    /**
184
     * Delete assembly with ID.
185
     * @param id - ID of assembly.
186
     * @return True if delete was successful, otherwise false.
187
     */
188
    @Override
189
    public boolean deleteAssembly(Long id) {
190
        try {
191
            // Delete configurations, which using current assembly.
192
            this.configurationManager.deleteConfigurations(id);
193

  
194
            // Delete parameters in current assembly.
195
            this.parameterManager.deleteParameters(id);
196

  
197
            Assembly assembly = this.assemblyRepository.getById(id);
198

  
199
            // Remove roles from 'Sestava_ma_Role' table.
200
            List<Role> roleList = new ArrayList<>(assembly.getRoles());
201
            for (Role role : roleList) {
202
                assembly.removeRole(role);
203
            }
204

  
205
            // Delete assembly.
206
            this.assemblyRepository.delete(assembly);
207
            // TODO: Send message for all users using this assembly.
208
            return true;
209
        } catch (Exception e) {
210
            return false;
211
        }
212
    }
162 213
}
src/main/java/vldc/aswi/service/ConfigurationManager.java
30 30
     * @return saved configuration
31 31
     */
32 32
    Configuration saveConfiguration(Configuration newConfiguration, String id);
33

  
34
    /**
35
     * Delete single configuration by id.
36
     * @param id - ID of configuration.
37
     * @return True if deleting was successful, false if not.
38
     */
39
    boolean deleteConfiguration(Long id);
40

  
41
    /**
42
     * Delete all configurations by assembly id.
43
     * @param assemblyId - ID of assembly.
44
     * @return True if all configurations were successfully deleted, false if not.
45
     */
46
    boolean deleteConfigurations(Long assemblyId);
33 47
}
src/main/java/vldc/aswi/service/ConfigurationManagerImpl.java
13 13
import vldc.aswi.domain.Configuration;
14 14
import vldc.aswi.domain.Function;
15 15
import vldc.aswi.domain.parameter.ParameterInConfiguration;
16
import vldc.aswi.service.parameter.ParameterInConfigurationManager;
17
import vldc.aswi.service.parameter.ParameterTypeManager;
16 18

  
17 19
import javax.transaction.Transactional;
18 20
import java.util.ArrayList;
......
43 45
    @Autowired
44 46
    private LocationRepository locationRepository;
45 47

  
46
    /** Autowired parameter type repository. */
48
    /** Autowired parameter type manager. */
47 49
    @Autowired
48
    private ParameterTypeRepository parameterTypeRepository;
50
    private ParameterTypeManager parameterTypeRepository;
49 51

  
50 52
    /** Autowired function repository. */
51 53
    @Autowired
......
55 57
    @Autowired
56 58
    private UserRepository userRepository;
57 59

  
60
    /** Autowired parameter in configuration manager. */
61
    @Autowired
62
    private ParameterInConfigurationManager parameterInConfigurationManager;
63

  
58 64
    /**
59 65
     * Initialization setup for configuration manager. Check if configuration repository contains
60 66
     * records and if not, initialize default values.
......
108 114
        }
109 115
    }
110 116

  
117
    /**
118
     * Delete single configuration by id.
119
     * @param id - ID of configuration.
120
     * @return True if deleting was successful, false if not.
121
     */
122
    @Override
123
    public boolean deleteConfiguration(Long id) {
124
        try {
125
            this.parameterInConfigurationManager.deleteParametersInConfiguration(id);
126
            this.configurationRepository.deleteById(id);
127
            return true;
128
        } catch (Exception e) {
129
            return false;
130
        }
131
    }
132

  
133
    /**
134
     * Delete all configurations by assembly id.
135
     * @param assemblyId - ID of assembly.
136
     * @return True if all configurations were successfully deleted, false if not.
137
     */
138
    @Override
139
    public boolean deleteConfigurations(Long assemblyId) {
140
        try {
141
            // Delete parameters in current configuration.
142
            List<Configuration> configurations = this.configurationRepository.getByAssemblyId(assemblyId);
143
            for (Configuration configuration : configurations) {
144
                this.parameterInConfigurationManager.deleteParametersInConfiguration(configuration.getId());
145
            }
146

  
147
            // Delete configuration.
148
            this.configurationRepository.deleteAll(configurations);
149
            return true;
150
        } catch (Exception e) {
151
            return false;
152
        }
153
    }
154

  
111 155
    /**
112 156
     * Saves new configuration into database
113 157
     * @param newConfiguration container with data for a new configuration
src/main/java/vldc/aswi/service/parameter/ParameterInConfigurationManager.java
11 11

  
12 12
    /**
13 13
     * Get all parameter in configuration from database.
14
     * @return List of parameter in configuration.
14
     * @return List of parameters in configuration.
15 15
     */
16 16
    List<ParameterInConfiguration> getAllParameterInConfiguration();
17

  
18
    /**
19
     * Delete all parameters in configuration by configuration id.
20
     * @param configurationID - ID of configuration.
21
     * @return True if all parameters in configuration was deleted, false if not.
22
     */
23
    boolean deleteParametersInConfiguration(Long configurationID);
17 24
}
src/main/java/vldc/aswi/service/parameter/ParameterInConfigurationManagerImpl.java
7 7
import org.springframework.core.annotation.Order;
8 8
import org.springframework.stereotype.Service;
9 9
import vldc.aswi.dao.parameter.ParameterInConfigurationRepository;
10
import vldc.aswi.domain.Function;
10 11
import vldc.aswi.domain.parameter.ParameterInConfiguration;
11 12

  
12 13
import javax.transaction.Transactional;
14
import java.util.ArrayList;
13 15
import java.util.LinkedList;
14 16
import java.util.List;
15 17

  
......
50 52
        this.parameterInConfigurationRepository.findAll().forEach(retVal::add);
51 53
        return retVal;
52 54
    }
55

  
56
    /**
57
     * Delete all parameters in configuration by configuration id.
58
     * @param configurationID - ID of configuration.
59
     * @return List of deleted parameters in configuration.
60
     */
61
    public boolean deleteParametersInConfiguration(Long configurationID) {
62
        try {
63
            List<ParameterInConfiguration> parameterInConfigurations = this.parameterInConfigurationRepository.getAllByConfigurationId(configurationID);
64
            for (ParameterInConfiguration parameterInConfiguration : parameterInConfigurations) {
65

  
66
                // Delete all functions used in current parameter in table 'Parametr_Konfigurace_ma_Funkce'.
67
                List<Function> functionList = new ArrayList<>(parameterInConfiguration.getFunctions());
68
                for (Function function : functionList) {
69
                    parameterInConfiguration.removeFunction(function);
70
                }
71
            }
72

  
73
            // Delete all parameters in configuration.
74
            this.parameterInConfigurationRepository.deleteAll(parameterInConfigurations);
75
            return true;
76
        } catch (Exception e) {
77
            return  false;
78
        }
79
    }
53 80
}
src/main/java/vldc/aswi/service/parameter/ParameterManager.java
28 28
     * @param newAssemblyParameters - List of parameters.
29 29
     */
30 30
    void updateParameters(Long assemblyId, List<Parameter> newAssemblyParameters);
31

  
32
    /**
33
     * Delete parameters by assembly id.
34
     * @param assemblyId - ID of assembly.
35
     * @return true if all parameters was successfully deleted, false if not.
36
     */
37
    boolean deleteParameters(Long assemblyId);
31 38
}
src/main/java/vldc/aswi/service/parameter/ParameterManagerImpl.java
18 18
import vldc.aswi.domain.parameter.ParameterValue;
19 19

  
20 20
import javax.transaction.Transactional;
21
import java.util.ArrayList;
21 22
import java.util.LinkedList;
22 23
import java.util.List;
23 24

  
......
157 158
        Assembly assembly = this.assemblyRepository.getById(assemblyId);
158 159
        List<Parameter> currentAssemblyParameters = assembly.getParameters();
159 160

  
160
        // Find new parameters.
161
        List<Parameter> currentAssemblyParametersNew = new LinkedList<>(currentAssemblyParameters);
162
        List<Parameter> newAssemblyParametersNew = new LinkedList<>(newAssemblyParameters);
163
        newAssemblyParametersNew.removeAll(currentAssemblyParametersNew);
164

  
165
        // Find deleted parameters.
166
        List<Parameter> currentAssemblyParametersDeleted = new LinkedList<>(currentAssemblyParameters);
167
        List<Parameter> newAssemblyParametersDeleted = new LinkedList<>(newAssemblyParameters);
168
        currentAssemblyParametersDeleted.removeAll(newAssemblyParametersDeleted);
169

  
170
        // Find duplicate elements - for updating.
171
        List<Parameter> currentAssemblyParametersUpdated = new LinkedList<>(currentAssemblyParameters);
172
        List<Parameter> newAssemblyParametersUpdated = new LinkedList<>(newAssemblyParameters);
173
        newAssemblyParametersUpdated.retainAll(currentAssemblyParametersUpdated);
174

  
175
        // If no parameter has been deleted or added, then updating is unnecessary.
176
        if (newAssemblyParametersNew.size() == 0 && currentAssemblyParametersDeleted.size() == 0 && newAssemblyParametersUpdated.size() == 0) return;
177

  
178
        // Remove deleted parameters.
179
        for (Parameter parameter : currentAssemblyParametersDeleted) {
180
            for (ParameterValue parameterValue : parameter.getParameterValues()) {
181
                // Remove parameters values.
182
                this.parameterValueRepository.delete(parameterValue);
183
            }
161
        if (newAssemblyParameters != null) {
162
            // Find new parameters.
163
            List<Parameter> currentAssemblyParametersNew = new LinkedList<>(currentAssemblyParameters);
164
            List<Parameter> newAssemblyParametersNew = new LinkedList<>(newAssemblyParameters);
165
            newAssemblyParametersNew.removeAll(currentAssemblyParametersNew);
166

  
167
            // Find deleted parameters.
168
            List<Parameter> currentAssemblyParametersDeleted = new LinkedList<>(currentAssemblyParameters);
169
            List<Parameter> newAssemblyParametersDeleted = new LinkedList<>(newAssemblyParameters);
170
            currentAssemblyParametersDeleted.removeAll(newAssemblyParametersDeleted);
171

  
172
            // Find duplicate elements - for updating.
173
            List<Parameter> currentAssemblyParametersUpdated = new LinkedList<>(currentAssemblyParameters);
174
            List<Parameter> newAssemblyParametersUpdated = new LinkedList<>(newAssemblyParameters);
175
            newAssemblyParametersUpdated.retainAll(currentAssemblyParametersUpdated);
176

  
177
            // If no parameter has been deleted or added, then updating is unnecessary.
178
            if (newAssemblyParametersNew.size() == 0 && currentAssemblyParametersDeleted.size() == 0 && newAssemblyParametersUpdated.size() == 0)
179
                return;
180

  
181
            // Remove deleted parameters.
182
            for (Parameter parameter : currentAssemblyParametersDeleted) {
183
                for (ParameterValue parameterValue : parameter.getParameterValues()) {
184
                    // Remove parameters values.
185
                    this.parameterValueRepository.delete(parameterValue);
186
                }
184 187

  
185
            // Remove parameter.
186
            this.parameterRepository.delete(parameter);
187
        }
188
                // Remove parameter.
189
                this.parameterRepository.delete(parameter);
190
            }
188 191

  
189
        // Update rest parameters.
190
        updateParameters(newAssemblyParametersUpdated);
192
            // Update rest parameters.
193
            updateParameters(newAssemblyParametersUpdated);
191 194

  
192
        // Add new parameters
193
        addParameters(assemblyId, newAssemblyParametersNew);
195
            // Add new parameters
196
            addParameters(assemblyId, newAssemblyParametersNew);
197
        }
194 198
    }
195 199

  
196 200
    /**
......
391 395
            this.parameterValueRepository.save(parameterValue);
392 396
        }
393 397
    }
394
}
398

  
399
    /**
400
     * Delete parameters by assembly id.
401
     * @param assemblyId - ID of assembly.
402
     */
403
    @Override
404
    public boolean deleteParameters(Long assemblyId) {
405
        try {
406
            List<Parameter> parameters = this.parameterRepository.getByAssemblyId(assemblyId);
407

  
408
            for (Parameter parameter : parameters) {
409
                // Delete all functions from parameter in table 'Parametr_ma_Funkce'.
410
                List<Function> functionList = new ArrayList<>(parameter.getFunctions());
411
                for (Function function : functionList) {
412
                    parameter.removeFunction(function);
413
                }
414

  
415
                // Delete all operators from parameter in table 'Parametr_ma_Operator'.
416
                List<Operator> operatorList = new ArrayList<>(parameter.getOperators());
417
                for (Operator operator : operatorList) {
418
                    parameter.removeOperator(operator);
419
                }
420

  
421
                // Delete all locations from parameter in table 'Parametr_ma_Umisteni'.
422
                List<Location> locationList = new ArrayList<>(parameter.getLocations());
423
                for (Location location : locationList) {
424
                    parameter.removeLocation(location);
425
                }
426
            }
427

  
428
            // Delete all parameters.
429
            this.parameterRepository.deleteAll(parameters);
430
            return true;
431
        } catch (Exception e) {
432
            return false;
433
        }
434
    }
435
}
src/main/java/vldc/aswi/utils/Utils.java
1
package vldc.aswi.utils;
2

  
3
/**
4
 * Class for utilites.
5
 */
6
public class Utils {
7

  
8
    /**
9
     * Try to parse Long from String.
10
     * @param number - Number in string.
11
     * @return Long value if parsing was successful, null in case of error.
12
     */
13
    public static Long tryParseLong(String number) {
14
        try {
15
            return Long.parseLong(number);
16
        } catch (Exception e) {
17
            return null;
18
        }
19
    }
20
}
src/main/java/vldc/aswi/web/controller/AssemblyController.java
22 22
import vldc.aswi.service.parameter.ParameterManager;
23 23
import vldc.aswi.service.parameter.ParameterTypeManager;
24 24
import vldc.aswi.validators.AssemblyValidator;
25
import vldc.aswi.utils.Utils;
25 26

  
26 27
import javax.validation.Valid;
27 28
import java.util.ArrayList;
......
68 69
    @Autowired
69 70
    private AssemblyValidator assemblyValidator;
70 71

  
71
    @Autowired
72
    private ConfigurationManager configurationManager;
73

  
74 72
    /** Name of thymeleaf parameter, which will contain text in assembly form. */
75 73
    private String assemblyTitleName = "title";
76 74

  
......
92 90
        binder.addValidators(this.assemblyValidator);
93 91
    }
94 92

  
93
    /**
94
     * Get method for form, where configuration is created from assembly.
95
     * @param id - ID of assembly.
96
     * @return ModelAndView for assembly.
97
     */
95 98
    @GetMapping("/assembly")
96
    public ModelAndView assemblyIndex(@Valid @ModelAttribute("assemblyID") String id) {
99
    public ModelAndView assemblyGet(@Valid @ModelAttribute("assemblyID") String id) {
97 100
        ModelAndView modelAndView = new ModelAndView("assembly");
98 101

  
99 102
        ModelMap modelMap = modelAndView.getModelMap();
......
119 122
        return modelAndView;
120 123
    }
121 124

  
122
    /**
123
     * Opens an configuration page after configuration name was clicked
124
     * @param id ID of configuration
125
     * @return modelAndView of page to be shown
126
     */
127
    @GetMapping("/configuration")
128
    public ModelAndView configurationIndex(@Valid @ModelAttribute("configurationID") String id) {
129
        ModelAndView modelAndView = new ModelAndView("assembly");
130

  
131
        ModelMap modelMap = modelAndView.getModelMap();
132

  
133
        Configuration configuration = configurationManager.getConfigurationById(Long.parseLong(id));
134

  
135
        initializeFields(configuration);
136

  
137
        modelMap.addAttribute("configuration", configuration);
138
        modelMap.addAttribute("isAssembly", "0");
139

  
140
        return modelAndView;
141
    }
142 125

  
143 126
    /**
144
     * Saves or edits configuration and redirects to the page with configuration
145
     * @param newConfiguration contained with configuration data
146
     * @param id ID of configuration, if empty new configuration is created
147
     * @param bindingResult binding result
148
     * @return modelAndView with redirection
127
     * Post method for form, where configuration is created from assembly.
128
     * @param assembly - Assembly values.
129
     * @param bindingResult - Error results from assembly validators.
130
     * @param atts - Redirect attributes.
131
     * @return ModelAndView for assembly.
149 132
     */
150
    @PostMapping("/configuration")
151
    public ModelAndView saveConfiguration(@Valid Configuration newConfiguration, BindingResult bindingResult,
152
                                          @RequestParam("configurationID") String id) {
153
        ModelAndView modelAndView = new ModelAndView();
154

  
155
        if (bindingResult.hasErrors()) {
156
            modelAndView.setViewName("redirect:/");
157

  
158
            return modelAndView;
159
        }
160

  
161
        Configuration configuration = configurationManager.saveConfiguration(newConfiguration, id);
162

  
163
        initializeFields(configuration);
164

  
165
        modelAndView.setViewName("redirect:/configuration?configurationID=" + configuration.getId());
166

  
167
        return modelAndView;
168
    }
169

  
170 133
    @PostMapping("/assembly")
171
    public ModelAndView indexPost(@Valid Assembly assembly, BindingResult bindingResult, RedirectAttributes atts) {
134
    public ModelAndView assemblyPost(@Valid Assembly assembly, BindingResult bindingResult, RedirectAttributes atts) {
172 135
        ModelAndView modelAndView = new ModelAndView();
173 136

  
174 137
        ModelMap modelMap = modelAndView.getModelMap();
......
185 148
        return modelAndView;
186 149
    }
187 150

  
151
    /**
152
     * Get method for assembly delete.
153
     * @param id - ID of assembly.
154
     * @return ModelAndView for index.
155
     */
156
    @GetMapping("/assembly_delete")
157
    public ModelAndView assemblyDeleteGet(@RequestParam("assemblyID") String id) {
158
        ModelAndView modelAndView = new ModelAndView("redirect:/");
159

  
160
        Long assemblyId = Utils.tryParseLong(id);
161

  
162
        if (assemblyId == null) {
163
            // TODO: print error in index.
164
        }
165
        boolean success = this.assemblyManager.deleteAssembly(assemblyId);
166
        // TODO: check success.
167

  
168
        return modelAndView;
169
    }
170

  
188 171
    /**
189 172
     * Get method for assembly edit.
190 173
     * @param id - Id of assembly.
191 174
     * @return ModelAndView for assembly edit.
192 175
     */
193 176
    @GetMapping("/assembly_edit")
194
    public ModelAndView assemblyEditIndex(@Valid @ModelAttribute("assemblyID") String id) {
177
    public ModelAndView assemblyEditGet(@Valid @ModelAttribute("assemblyID") String id) {
195 178
        ModelAndView modelAndView = new ModelAndView("assembly_manage");
196 179

  
197 180
        ModelMap modelMap = modelAndView.getModelMap();
......
219 202
     * @return ModelAndView for assembly edit.
220 203
     */
221 204
    @PostMapping("/assembly_edit")
222
    public ModelAndView assemblyEditPostIndex(@Valid @ModelAttribute("assembly") Assembly assembly, BindingResult result,
205
    public ModelAndView assemblyEditPost(@Valid @ModelAttribute("assembly") Assembly assembly, BindingResult result,
223 206
                                              @Valid @ModelAttribute("checkboxPublic") String assemblyIsPublic) {
224 207

  
225 208
        ModelAndView modelAndView = new ModelAndView("assembly_manage");
......
258 241
     * @return ModelAndView for new assembly.
259 242
     */
260 243
    @GetMapping("/assembly_new")
261
    public ModelAndView assemblyNewIndex() {
244
    public ModelAndView assemblyNewGet() {
262 245
        ModelAndView modelAndView = new ModelAndView("assembly_manage");
263 246

  
264 247
        ModelMap modelMap = modelAndView.getModelMap();
......
283 266
     * @return
284 267
     */
285 268
    @PostMapping("/assembly_new")
286
    public ModelAndView assemblyNewIndexPost(@Valid @ModelAttribute("assembly") Assembly assembly, BindingResult result) {
269
    public ModelAndView assemblyNewPost(@Valid @ModelAttribute("assembly") Assembly assembly, BindingResult result) {
287 270
        ModelAndView modelAndView = new ModelAndView();
271
        ModelMap modelMap = modelAndView.getModelMap();
288 272

  
289 273
        if (result.hasErrors()) {
290
            ModelMap modelMap = modelAndView.getModelMap();
291 274
            modelAndView.setViewName("assembly_manage");
292

  
293 275
            modelMap.addAttribute("assembly", assembly);
294 276

  
295
            modelMap.addAttribute(assemblyTitleName, assemblyNewTitleText);
296 277
            modelMap.addAttribute(assemblyErrorName, getFullErrorMessage(result));
297

  
298
            modelMap.addAttribute("allRoles", this.roleManager.getRoles());
299
            modelMap.addAttribute("allParameterTypes", this.parameterTypeManager.getParameterTypes());
300
            modelMap.addAttribute("allFunctions", this.functionManager.getFunctions());
301
            modelMap.addAttribute("allOperators", this.operatorManager.getOperators());
302
            modelMap.addAttribute("allLocations", this.locationManager.getLocations());
278
            modelMap.addAttribute(assemblyTitleName, assemblyNewTitleText);
303 279
        }
280
        else {
281
            // TODO: chybí získání default value.
282
            Long assemblyId = this.assemblyManager.createAssembly(assembly);
283
            this.parameterManager.addParameters(assemblyId, assembly.getParameters());
304 284

  
305
        ModelMap modelMap = modelAndView.getModelMap();
306

  
307
        // TODO: chybí získání default value.
308
        Long assemblyId = this.assemblyManager.createAssembly(assembly);
309
        this.parameterManager.addParameters(assemblyId, assembly.getParameters());
310

  
311
        modelAndView.setViewName("redirect:/assembly_edit?assemblyID=" + assemblyId);
285
            modelAndView.setViewName("redirect:/assembly_edit?assemblyID=" + assemblyId);
286
        }
312 287

  
313 288
        return modelAndView;
314 289
    }
315

  
316
    /**
317
     * Initializes fields of a given configuration
318
     * @param configuration configuration which fields should be initialized
319
     */
320
    private void initializeFields(Configuration configuration) {
321
        for(ParameterInConfiguration parameterInConfiguration : configuration.getParametersInConfiguration()) {
322
            if(parameterInConfiguration.getLocation() == null) {
323
                parameterInConfiguration.setLocation(new Location());
324
            }
325
            if(parameterInConfiguration.getOperator() == null) {
326
                parameterInConfiguration.setOperator(new Operator());
327
            }
328
            if(parameterInConfiguration.getFunctions() == null) {
329
                parameterInConfiguration.setFunctions(new ArrayList<>());
330
            }
331
        }
332
    }
333 290
}
src/main/java/vldc/aswi/web/controller/BasicController.java
20 20
            if (object instanceof FieldError) {
21 21
                FieldError fieldError = (FieldError) object;
22 22

  
23
                message += fieldError.getDefaultMessage() + ", ";
23
                if (fieldError.getCode() == null) message += fieldError.getDefaultMessage() + ", ";
24
                else message += fieldError.getCode() + ", ";
24 25
                continue;
25 26
            }
26 27

  
27 28
            if (object instanceof ObjectError) {
28 29
                ObjectError objectError = (ObjectError) object;
29 30

  
30
                message += objectError.getDefaultMessage()  + ", ";
31
                if (objectError.getCode() == null) message += objectError.getDefaultMessage() + ", ";
32
                else message += objectError.getCode() + ", ";
31 33
                continue;
32 34
            }
33 35
        }
src/main/java/vldc/aswi/web/controller/ConfigurationController.java
1
package vldc.aswi.web.controller;
2

  
3
import org.springframework.beans.factory.annotation.Autowired;
4
import org.springframework.stereotype.Controller;
5
import org.springframework.ui.ModelMap;
6
import org.springframework.validation.BindingResult;
7
import org.springframework.web.bind.annotation.GetMapping;
8
import org.springframework.web.bind.annotation.ModelAttribute;
9
import org.springframework.web.bind.annotation.PostMapping;
10
import org.springframework.web.bind.annotation.RequestParam;
11
import org.springframework.web.servlet.ModelAndView;
12
import vldc.aswi.domain.Configuration;
13
import vldc.aswi.domain.Location;
14
import vldc.aswi.domain.Operator;
15
import vldc.aswi.domain.parameter.ParameterInConfiguration;
16
import vldc.aswi.service.ConfigurationManager;
17
import vldc.aswi.utils.Utils;
18

  
19
import javax.validation.Valid;
20
import java.util.ArrayList;
21

  
22
/**
23
 * Manager for configuration.
24
 */
25
@Controller
26
public class ConfigurationController extends BasicController{
27

  
28
    /** Autowired configuration manager */
29
    @Autowired
30
    private ConfigurationManager configurationManager;
31

  
32
    /**
33
     * Opens an configuration page after configuration name was clicked
34
     * @param id ID of configuration
35
     * @return modelAndView of page to be shown
36
     */
37
    @GetMapping("/configuration")
38
    public ModelAndView configurationGet(@Valid @ModelAttribute("configurationID") String id) {
39
        ModelAndView modelAndView = new ModelAndView("assembly");
40

  
41
        ModelMap modelMap = modelAndView.getModelMap();
42

  
43
        Configuration configuration = configurationManager.getConfigurationById(Long.parseLong(id));
44

  
45
        initializeFields(configuration);
46

  
47
        modelMap.addAttribute("configuration", configuration);
48
        modelMap.addAttribute("isAssembly", "0");
49

  
50
        return modelAndView;
51
    }
52

  
53
    /**
54
     * Saves or edits configuration and redirects to the page with configuration
55
     * @param newConfiguration contained with configuration data
56
     * @param id ID of configuration, if empty new configuration is created
57
     * @param bindingResult binding result
58
     * @return modelAndView with redirection
59
     */
60
    @PostMapping("/configuration")
61
    public ModelAndView configurationPost(@Valid Configuration newConfiguration, BindingResult bindingResult,
62
                                          @RequestParam("configurationID") String id) {
63
        ModelAndView modelAndView = new ModelAndView();
64

  
65
        if (bindingResult.hasErrors()) {
66
            modelAndView.setViewName("redirect:/");
67

  
68
            return modelAndView;
69
        }
70

  
71
        Configuration configuration = configurationManager.saveConfiguration(newConfiguration, id);
72

  
73
        initializeFields(configuration);
74

  
75
        modelAndView.setViewName("redirect:/configuration?configurationID=" + configuration.getId());
76

  
77
        return modelAndView;
78
    }
79

  
80
    /**
81
     * Get method for configuration delete.
82
     * @param id - ID of configuration.
83
     * @return ModelAndView for index.
84
     */
85
    @GetMapping("/configuration_delete")
86
    public ModelAndView configurationDeleteGet(@RequestParam("configurationID") String id) {
87
        ModelAndView modelAndView = new ModelAndView("redirect:/");
88

  
89
        Long configurationId = Utils.tryParseLong(id);
90

  
91
        if (configurationId == null) {
92
            // TODO: print error in index.
93
        }
94

  
95
        boolean success = this.configurationManager.deleteConfiguration(configurationId);
96
        // TODO: check success.
97

  
98
        return modelAndView;
99
    }
100

  
101
    /**
102
     * Initializes fields of a given configuration
103
     * @param configuration configuration which fields should be initialized
104
     */
105
    private void initializeFields(Configuration configuration) {
106
        for(ParameterInConfiguration parameterInConfiguration : configuration.getParametersInConfiguration()) {
107
            if(parameterInConfiguration.getLocation() == null) {
108
                parameterInConfiguration.setLocation(new Location());
109
            }
110
            if(parameterInConfiguration.getOperator() == null) {
111
                parameterInConfiguration.setOperator(new Operator());
112
            }
113
            if(parameterInConfiguration.getFunctions() == null) {
114
                parameterInConfiguration.setFunctions(new ArrayList<>());
115
            }
116
        }
117
    }
118
}
src/main/webapp/WEB-INF/templates/assembly_manage.html
169 169
    </div>
170 170
    <div th:each="roleWithAccess, i : ${assembly.roles}" class="input-action-box input-border-bottom">
171 171
      <input type="hidden" th:field="${assembly.roles[__${i.index}__].id}" th:value="${roleWithAccess.id}">
172
      <input type="text" readonly class="form-control-plaintext" th:field="${assembly.roles[__${i.index}__].name}" th:id="selectedRole + ${roleWithAccess.name}" th:value="${roleWithAccess.name}">
172
      <input type="text" readonly class="form-control-plaintext" th:field="${assembly.roles[__${i.index}__].name}" th:id="${roleWithAccess.name}" th:value="${roleWithAccess.name}">
173 173

  
174 174
      <span class="action-padding input-action-margin sort-icon">
175 175
      <i class="fas fa-sort"></i>
src/main/webapp/WEB-INF/templates/index.html
42 42
						<td><a th:href="@{/configuration(configurationID=${iconfiguration.id})}"><span th:text="${iconfiguration.name}"></span></a></td>
43 43
						<td class="center-cell">
44 44
				  <span class="action-button">
45
					<a href=# class="action-link far fa-trash-alt"></a>
45
					<a th:href="@{/configuration_delete(configurationID=${iconfiguration.id})}" class="action-link far fa-trash-alt"></a>
46 46
				  </span>
47 47
						</td>
48 48
					</tr>
......
80 80
									  <a th:href="@{/assembly_edit(assemblyID=${iassembly.id})}" class="action-link far fa-edit"></a>
81 81
									</span>
82 82
									<span class="action-button">
83
									  <a href=# class="action-link far fa-trash-alt"></a>
83
									  <a th:href="@{/assembly_delete(assemblyID=${iassembly.id})}" class="action-link far fa-trash-alt"></a>
84 84
									</span>
85 85

  
86 86
									<i class="fas fa-sort"></i>

Také k dispozici: Unified diff