1
|
package vldc.aswi.domain.parameter;
|
2
|
|
3
|
import lombok.Data;
|
4
|
import lombok.EqualsAndHashCode;
|
5
|
import lombok.NoArgsConstructor;
|
6
|
import vldc.aswi.domain.*;
|
7
|
import javax.persistence.*;
|
8
|
import java.util.List;
|
9
|
|
10
|
/**
|
11
|
* Domain entity representing Parameter in application.
|
12
|
*/
|
13
|
@Entity(name = "Parametr")
|
14
|
@Data
|
15
|
@EqualsAndHashCode(callSuper = true)
|
16
|
@NoArgsConstructor
|
17
|
public class Parameter extends EntityParent {
|
18
|
|
19
|
/** Name of parameter in SQL query. */
|
20
|
@Column(name = "nazev")
|
21
|
private String name;
|
22
|
|
23
|
/** Admin-defined name of parameter, which will be used in assembly. */
|
24
|
@Column(name = "nazev_select")
|
25
|
private String nameOfSelect;
|
26
|
|
27
|
/** Specific assembly, in which this parameter will be part of. */
|
28
|
@ManyToOne(fetch = FetchType.LAZY)
|
29
|
@JoinColumn(name = "sestava_id")
|
30
|
private Assembly assembly;
|
31
|
|
32
|
/** Default value of this parameter. */
|
33
|
@Column(name = "default_hodnota")
|
34
|
private String defaultValue;
|
35
|
|
36
|
/** Specific type of parameter, which represents type of entry. */
|
37
|
@ManyToOne(fetch=FetchType.LAZY)
|
38
|
@JoinColumn(name = "parametr_typ_id")
|
39
|
private ParameterType parameterType;
|
40
|
|
41
|
/** List of parametersInConfiguration, which using this parameter. */
|
42
|
@OneToMany(mappedBy = "parameter")
|
43
|
private List<ParameterInConfiguration> parametersInConfiguration;
|
44
|
|
45
|
/** List of parametersInConfiguration, which using this parameter. */
|
46
|
@OneToMany(mappedBy = "parameter")
|
47
|
private List<ParameterValue> parameterValues;
|
48
|
|
49
|
/**
|
50
|
* Creating new table with M:N relationship between Parameter and Location.
|
51
|
* Specify which locations can be used for parameter.
|
52
|
*/
|
53
|
@ManyToMany
|
54
|
@JoinTable(
|
55
|
name = "Parametr_ma_Umisteni",
|
56
|
joinColumns = @JoinColumn(name = "parametr_id"),
|
57
|
inverseJoinColumns = @JoinColumn(name = "umisteni_id")
|
58
|
)
|
59
|
private List<Location> locations;
|
60
|
|
61
|
/**
|
62
|
* Creating new table with M:N relationship between Parameter and Function.
|
63
|
* Specify which functions can be used for parameter.
|
64
|
*/
|
65
|
@ManyToMany
|
66
|
@JoinTable(
|
67
|
name = "Parametr_ma_Funkce",
|
68
|
joinColumns = @JoinColumn(name = "parametr_id"),
|
69
|
inverseJoinColumns = @JoinColumn(name = "funkce_id")
|
70
|
)
|
71
|
private List<Function> functions;
|
72
|
|
73
|
/**
|
74
|
* Creating new table with M:N relationship between Parameter and Operator.
|
75
|
* Specify which operators can be used for parameter.
|
76
|
*/
|
77
|
@ManyToMany
|
78
|
@JoinTable(
|
79
|
name = "Parametr_ma_Operator",
|
80
|
joinColumns = @JoinColumn(name = "parametr_id"),
|
81
|
inverseJoinColumns = @JoinColumn(name = "operator_id")
|
82
|
)
|
83
|
private List<Operator> operators;
|
84
|
|
85
|
/**
|
86
|
* Constructor.
|
87
|
* @param name - Name of parameter in SQL query.
|
88
|
* @param nameOfSelect - Admin-defined name of parameter, which will be used in assembly.
|
89
|
* @param defaultValue - Default value of this parameter.
|
90
|
*/
|
91
|
public Parameter(String name, String nameOfSelect, String defaultValue) {
|
92
|
this.setName(name);
|
93
|
this.setNameOfSelect(nameOfSelect);
|
94
|
this.setDefaultValue(defaultValue);
|
95
|
}
|
96
|
}
|