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
|
private String name;
|
21
|
|
22
|
/** Admin-defined name of parameter, which will be used in assembly. */
|
23
|
private String nameOfSelect;
|
24
|
|
25
|
/** Specific assembly, in which this parameter will be part of. */
|
26
|
@ManyToOne(fetch = FetchType.LAZY)
|
27
|
@JoinColumn(name = "sestava_id")
|
28
|
private Assembly assembly;
|
29
|
|
30
|
/** Default value of this parameter. */
|
31
|
private String defaultValue;
|
32
|
|
33
|
/** List of parametersInConfiguration, which using this parameter. */
|
34
|
@OneToMany(mappedBy = "parameter")
|
35
|
private List<ParameterInConfiguration> parametersInConfiguration;
|
36
|
|
37
|
/** List of parametersInConfiguration, which using this parameter. */
|
38
|
@OneToMany(mappedBy = "parameter")
|
39
|
private List<ParameterValue> parameterValues;
|
40
|
|
41
|
/**
|
42
|
* Creating new table with M:N relationship between Parameter and Location.
|
43
|
* Specify which locations can be used for parameter.
|
44
|
*/
|
45
|
@ManyToMany
|
46
|
@JoinTable(
|
47
|
name = "Parametr_ma_Umisteni",
|
48
|
joinColumns = @JoinColumn(name = "parametr_id"),
|
49
|
inverseJoinColumns = @JoinColumn(name = "umisteni_id")
|
50
|
)
|
51
|
private List<Location> locations;
|
52
|
|
53
|
/**
|
54
|
* Creating new table with M:N relationship between Parameter and Function.
|
55
|
* Specify which functions can be used for parameter.
|
56
|
*/
|
57
|
@ManyToMany
|
58
|
@JoinTable(
|
59
|
name = "Parametr_ma_Funkce",
|
60
|
joinColumns = @JoinColumn(name = "parametr_id"),
|
61
|
inverseJoinColumns = @JoinColumn(name = "funkce_id")
|
62
|
)
|
63
|
private List<Function> functions;
|
64
|
|
65
|
/**
|
66
|
* Creating new table with M:N relationship between Parameter and Operator.
|
67
|
* Specify which operators can be used for parameter.
|
68
|
*/
|
69
|
@ManyToMany
|
70
|
@JoinTable(
|
71
|
name = "Parametr_ma_Operator",
|
72
|
joinColumns = @JoinColumn(name = "parametr_id"),
|
73
|
inverseJoinColumns = @JoinColumn(name = "operator_id")
|
74
|
)
|
75
|
private List<Operator> operators;
|
76
|
|
77
|
/**
|
78
|
* Constructor.
|
79
|
* @param name - Name of parameter in SQL query.
|
80
|
* @param nameOfSelect - Admin-defined name of parameter, which will be used in assembly.
|
81
|
* @param defaultValue - Default value of this parameter.
|
82
|
*/
|
83
|
public Parameter(String name, String nameOfSelect, String defaultValue) {
|
84
|
this.setName(name);
|
85
|
this.setNameOfSelect(nameOfSelect);
|
86
|
this.setDefaultValue(defaultValue);
|
87
|
}
|
88
|
}
|