1
|
package vldc.aswi.domain;
|
2
|
|
3
|
import lombok.Data;
|
4
|
import lombok.EqualsAndHashCode;
|
5
|
import lombok.NoArgsConstructor;
|
6
|
import vldc.aswi.domain.parameter.ParameterInConfiguration;
|
7
|
|
8
|
import javax.persistence.*;
|
9
|
import java.util.List;
|
10
|
|
11
|
/**
|
12
|
* Domain entity representing Sestava in application.
|
13
|
*/
|
14
|
@Entity(name = "Konfigurace")
|
15
|
@Data
|
16
|
@EqualsAndHashCode(callSuper = true)
|
17
|
@NoArgsConstructor
|
18
|
public class Configuration extends EntityParent {
|
19
|
|
20
|
/** Name of configuration. */
|
21
|
@Column(name = "nazev")
|
22
|
private String name;
|
23
|
|
24
|
/** Name of contingent table. */
|
25
|
@Column(name = "nazev_tabulky")
|
26
|
private String tableName;
|
27
|
|
28
|
/** Specific user, which created this configuration. */
|
29
|
@ManyToOne(fetch= FetchType.LAZY, cascade = {CascadeType.ALL})
|
30
|
@JoinColumn(name = "uzivatel_id")
|
31
|
private User user;
|
32
|
|
33
|
/** Used assembly as template in configuration. */
|
34
|
@ManyToOne(fetch= FetchType.LAZY, cascade = {CascadeType.ALL})
|
35
|
@JoinColumn(name = "sestava_id")
|
36
|
private Assembly assembly;
|
37
|
|
38
|
/** List of parametersInConfiguration, which is part of this configuration. */
|
39
|
@OneToMany(mappedBy = "configuration", cascade = {CascadeType.ALL})
|
40
|
private List<ParameterInConfiguration> parametersInConfiguration;
|
41
|
|
42
|
/**
|
43
|
* Constructor.
|
44
|
* @param name - Name of configuration.
|
45
|
* @param tableName - Name of contingent table.
|
46
|
*/
|
47
|
public Configuration(String name, String tableName) {
|
48
|
this.setName(name);
|
49
|
this.setTableName(tableName);
|
50
|
}
|
51
|
|
52
|
/**
|
53
|
* Equal method for comparing two objects.
|
54
|
* @param obj - Comparing object.
|
55
|
* @return true if objects are same.
|
56
|
*/
|
57
|
@Override
|
58
|
public boolean equals(Object obj) {
|
59
|
return super.equals(obj);
|
60
|
}
|
61
|
|
62
|
/**
|
63
|
* Overriding toString method to prevent StackOverflowError.
|
64
|
* @return Object with zero parameters.
|
65
|
*/
|
66
|
@Override
|
67
|
public String toString() {
|
68
|
return "Configuration[]";
|
69
|
}
|
70
|
}
|