Richard Allred
2019-05-23 497620c4d1bcb410267c56351432f87fb3aee5a4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package com.redhat.training.example.buildsformanagers.entity;
 
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
 
@Entity
@NamedQueries({
        @NamedQuery(name = "build.findAll",
        query = "SELECT b from Build b order by b.developersName")
})
public class Build implements Serializable, Comparable<Build>{
 
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private String developersName;
    private Date date;
    private String project;
    private String gitUrl;
 
 
    public Long getId() {
        return id;
    }
 
    public void setId(Long id) {
        this.id = id;
    }
 
    public String getDevelopersName() {
        return developersName;
    }
 
    public void setDevelopersName(String name) {
        this.developersName = name;
    }
 
    public Date getDate() {
        return date;
    }
 
    public void setDate(Date date) {
        this.date = date;
    }
 
    public String getProject() {
        return project;
    }
 
    public void setProject(String project) {
        this.project = project;
    }
 
    public String getGitUrl() {
        return gitUrl;
    }
 
    public void setGitUrl(String gitUrl) {
        this.gitUrl = gitUrl;
    }
 
    @Override
    public int compareTo(Build o) {
        return this.getDevelopersName().toLowerCase().compareTo(o.getDevelopersName().toLowerCase());
    }
 
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Build)) return false;
 
        Build build = (Build) o;
 
        if (!getDevelopersName().equals(build.getDevelopersName())) return false;
        return getDate().equals(build.getDate());
    }
 
    @Override
    public int hashCode() {
        int result = getDevelopersName().hashCode();
        result = 31 * result + getDate().hashCode();
        return result;
    }
}