Project

General

Profile

Download (2.31 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 * Copyright (C) 2009 EDIT
3
 * European Distributed Institute of Taxonomy
4
 * http://www.e-taxonomy.eu
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7
 * See LICENSE.TXT at the top of this package for the full license terms.
8
 */
9
package eu.etaxonomy.cdm.persistence.validation;
10

    
11
import java.util.List;
12

    
13
import javax.validation.Valid;
14

    
15
import eu.etaxonomy.cdm.model.common.CdmBase;
16
import eu.etaxonomy.cdm.validation.Level2;
17
import eu.etaxonomy.cdm.validation.Level3;
18

    
19
/**
20
 * A Mock class for testing entity validation tasks. DO NOT MODIFY UNLESS YOU
21
 * ALSO MODIFY THE UNIT TESTS MAKING USE OF THIS CLASS!
22
 *
23
 * @author ayco_holleman
24
 *
25
 */
26
@SuppressWarnings("serial")
27
public class Employee extends CdmBase {
28

    
29
    @CheckCase(value = CaseMode.UPPER, groups = { Level2.class })
30
    private String givenName;
31
    @CheckCase(value = CaseMode.UPPER, groups = { Level3.class })
32
    private String familyName;
33
    @Valid
34
    private Company company;
35
    @Valid
36
    private List<Address> addresses;
37

    
38
    public Employee() {
39
    }
40

    
41
    public String getGivenName() {
42
        return givenName;
43
    }
44

    
45
    public void setGivenName(String givenName) {
46
        this.givenName = givenName;
47
    }
48

    
49
    public String getFamilyName() {
50
        return familyName;
51
    }
52

    
53
    public void setFamilyName(String familyName) {
54
        this.familyName = familyName;
55
    }
56

    
57
    public Company getCompany() {
58
        return company;
59
    }
60

    
61
    public void setCompany(Company company) {
62
        this.company = company;
63
    }
64

    
65
    public List<Address> getAddresses() {
66
        return addresses;
67
    }
68

    
69
    public void setAddresses(List<Address> addresses) {
70
        this.addresses = addresses;
71
    }
72

    
73
    @Override
74
    public boolean equals(Object obj) {
75
        if (this == obj) {
76
            return true;
77
        }
78
        if (obj == null) {
79
            return false;
80
        }
81
        Employee emp = (Employee) obj;
82
        return givenName.equals(emp.givenName) && familyName.equals(emp.familyName);
83
    }
84

    
85
    @Override
86
    public int hashCode() {
87
        int hash = 17;
88
        hash = (hash * 31) + (givenName == null ? 0 : givenName.hashCode());
89
        hash = (hash * 31) + (familyName == null ? 0 : familyName.hashCode());
90
        return hash;
91
    }
92

    
93
}
(6-6/12)