1
|
package vldc.aswi.domain;
|
2
|
|
3
|
import lombok.Data;
|
4
|
import lombok.EqualsAndHashCode;
|
5
|
import lombok.NoArgsConstructor;
|
6
|
import vldc.aswi.domain.parameter.Parameter;
|
7
|
import vldc.aswi.domain.parameter.ParameterInConfiguration;
|
8
|
|
9
|
import javax.persistence.CascadeType;
|
10
|
import javax.persistence.Column;
|
11
|
import javax.persistence.Entity;
|
12
|
import javax.persistence.ManyToMany;
|
13
|
import java.util.List;
|
14
|
|
15
|
/**
|
16
|
* Domain entity representing Function in application.
|
17
|
*/
|
18
|
@Entity(name = "Funkce")
|
19
|
@Data
|
20
|
@EqualsAndHashCode(callSuper = true)
|
21
|
@NoArgsConstructor
|
22
|
public class Function extends EntityParent {
|
23
|
|
24
|
/** Name of function. */
|
25
|
@Column(name = "nazev")
|
26
|
private String name;
|
27
|
|
28
|
/** List of parameters, which defined that this function can be used. */
|
29
|
@ManyToMany(mappedBy = "functions", cascade = {CascadeType.ALL})
|
30
|
private List<Parameter> parameters;
|
31
|
|
32
|
/** List of parametersInConfigurations, which using this function. */
|
33
|
@ManyToMany(mappedBy = "functions", cascade = {CascadeType.ALL})
|
34
|
private List<ParameterInConfiguration> parametersInConfigurations;
|
35
|
|
36
|
/**
|
37
|
* Constructor.
|
38
|
* @param name - Name of function.
|
39
|
*/
|
40
|
public Function(String name) {
|
41
|
this.setName(name);
|
42
|
}
|
43
|
|
44
|
/**
|
45
|
* Equal method for comparing two objects.
|
46
|
* @param obj - Comparing object.
|
47
|
* @return true if objects are same.
|
48
|
*/
|
49
|
@Override
|
50
|
public boolean equals(Object obj) {
|
51
|
return super.equals(obj);
|
52
|
}
|
53
|
|
54
|
/**
|
55
|
* Overriding toString method to prevent StackOverflowError.
|
56
|
* @return Object with zero parameters.
|
57
|
*/
|
58
|
@Override
|
59
|
public String toString() {
|
60
|
return "Function[]";
|
61
|
}
|
62
|
}
|