Projekt

Obecné

Profil

Stáhnout (2.76 KB) Statistiky
| Větev: | Revize:
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 ParameterInConfiguration in application.
12
 */
13
@Entity(name = "Parametr_konfigurace")
14
@Data
15
@EqualsAndHashCode(callSuper = true)
16
@NoArgsConstructor
17
public class ParameterInConfiguration extends EntityParent {
18

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

    
24
    /** Specific parameter of configuration, which is used as template. */
25
    @ManyToOne(fetch=FetchType.LAZY, cascade = {CascadeType.ALL})
26
    @JoinColumn(name = "parametr_id")
27
    private Parameter parameter;
28

    
29
    /** Value of used operator. */
30
    @Column(name = "hodnota_operatoru")
31
    private String operatorValue;
32

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

    
38
    /** User-defined name of this parameterConfiguration. */
39
    @Column(name = "nazev_sloupce")
40
    private String columnName;
41

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

    
47
    /**
48
     * Creating new table with M:N relationship between ParameterInConfiguration and Function.
49
     * On every ParameterInConfiguration can be applied 0 - every function.
50
     */
51
    @ManyToMany(cascade = {CascadeType.ALL})
52
    @JoinTable(
53
            name = "Parametr_konfigurace_ma_Funkce",
54
            joinColumns = @JoinColumn(name = "parametr_konfigurace_id"),
55
            inverseJoinColumns = @JoinColumn(name = "funkce_id")
56
    )
57
    private List<Function> functions;
58

    
59
    /**
60
     * Constructor.
61
     * @param operatorValue - Value of used operator.
62
     * @param columnName - User-defined name of this parameterConfiguration.
63
     */
64
    public ParameterInConfiguration(String operatorValue, String columnName) {
65
        this.setOperatorValue(operatorValue);
66
        this.setColumnName(columnName);
67
    }
68

    
69
    /**
70
     * Equal method for comparing two objects.
71
     * @param obj - Comparing object.
72
     * @return true if objects are same.
73
     */
74
    @Override
75
    public boolean equals(Object obj) {
76
        return super.equals(obj);
77
    }
78

    
79
    /**
80
     * Overriding toString method to prevent StackOverflowError.
81
     * @return Object with zero parameters.
82
     */
83
    @Override
84
    public String toString() {
85
        return "ParameterInConfiguration[]";
86
    }
87
}
(2-2/4)