Projekt

Obecné

Profil

Stáhnout (1.48 KB) Statistiky
| Větev: | Revize:
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.*;
10
import java.util.List;
11

    
12
/**
13
 * Domain entity representing Location in application.
14
 */
15
@Entity(name = "Umisteni")
16
@Data
17
@EqualsAndHashCode(callSuper = true)
18
@NoArgsConstructor
19
public class Location extends EntityParent {
20

    
21
    /** Name of location. */
22
    @Column(name = "nazev")
23
    private String name;
24

    
25
    /** List of parameters which allows this location. */
26
    @ManyToMany(mappedBy = "locations", cascade = {CascadeType.ALL})
27
    private List<Parameter> parameters;
28

    
29
    /** List of parametersInConfiguration which using this location. */
30
    @OneToMany(mappedBy = "location", cascade = {CascadeType.ALL})
31
    private List<ParameterInConfiguration> parametersInConfiguration;
32

    
33
    /**
34
     * Constructor.
35
     * @param name - Name of location.
36
     */
37
    public Location(String name) {
38
        this.setName(name);
39
    }
40

    
41
    /**
42
     * Equal method for comparing two objects.
43
     * @param obj - Comparing object.
44
     * @return true if objects are same.
45
     */
46
    @Override
47
    public boolean equals(Object obj) {
48
        return super.equals(obj);
49
    }
50

    
51
    /**
52
     * Overriding toString method to prevent StackOverflowError.
53
     * @return Object with zero parameters.
54
     */
55
    @Override
56
    public String toString() {
57
        return "Location[]";
58
    }
59
}
(5-5/8)