[24c39f9] | 1 | package mk.ukim.finki.busngo.model;
|
---|
| 2 |
|
---|
| 3 | import jakarta.persistence.*;
|
---|
| 4 |
|
---|
| 5 | import java.sql.Timestamp;
|
---|
| 6 | import java.util.Collection;
|
---|
| 7 | import java.util.Objects;
|
---|
| 8 |
|
---|
| 9 | @Entity
|
---|
| 10 | public class Kontroli {
|
---|
| 11 | private Long kontrolaId;
|
---|
| 12 | private Timestamp kontrolaDatum;
|
---|
| 13 | private Long kondukterKId;
|
---|
| 14 | private Long inlId;
|
---|
| 15 | private Korisnik korisnikByKondukterKId;
|
---|
| 16 | private Instancanalinija instancanalinijaByInlId;
|
---|
| 17 | private Collection<Kazna> kaznasByKontrolaId;
|
---|
| 18 |
|
---|
| 19 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
| 20 | @Id
|
---|
| 21 | @Column(name = "kontrola_id", nullable = false)
|
---|
| 22 | public Long getKontrolaId() {
|
---|
| 23 | return kontrolaId;
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | public void setKontrolaId(Long kontrolaId) {
|
---|
| 27 | this.kontrolaId = kontrolaId;
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | @Basic
|
---|
| 31 | @Column(name = "kontrola_datum", nullable = false)
|
---|
| 32 | public Timestamp getKontrolaDatum() {
|
---|
| 33 | return kontrolaDatum;
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | public void setKontrolaDatum(Timestamp kontrolaDatum) {
|
---|
| 37 | this.kontrolaDatum = kontrolaDatum;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | @Basic
|
---|
| 41 | @Column(name = "kondukter_k_id", nullable = true)
|
---|
| 42 | public Long getKondukterKId() {
|
---|
| 43 | return kondukterKId;
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | public void setKondukterKId(Long kondukterKId) {
|
---|
| 47 | this.kondukterKId = kondukterKId;
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | @Basic
|
---|
| 51 | @Column(name = "inl_id", nullable = true)
|
---|
| 52 | public Long getInlId() {
|
---|
| 53 | return inlId;
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | public void setInlId(Long inlId) {
|
---|
| 57 | this.inlId = inlId;
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | @Override
|
---|
| 61 | public boolean equals(Object o) {
|
---|
| 62 | if (this == o) return true;
|
---|
| 63 | if (o == null || getClass() != o.getClass()) return false;
|
---|
| 64 | Kontroli kontroli = (Kontroli) o;
|
---|
| 65 | return Objects.equals(kontrolaId, kontroli.kontrolaId) && Objects.equals(kontrolaDatum, kontroli.kontrolaDatum) && Objects.equals(kondukterKId, kontroli.kondukterKId) && Objects.equals(inlId, kontroli.inlId);
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | @Override
|
---|
| 69 | public int hashCode() {
|
---|
| 70 | return Objects.hash(kontrolaId, kontrolaDatum, kondukterKId, inlId);
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | @ManyToOne
|
---|
| 74 | @JoinColumn(name = "kondukter_k_id", referencedColumnName = "k_id")
|
---|
| 75 | public Korisnik getKorisnikByKondukterKId() {
|
---|
| 76 | return korisnikByKondukterKId;
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 | public void setKorisnikByKondukterKId(Korisnik korisnikByKondukterKId) {
|
---|
| 80 | this.korisnikByKondukterKId = korisnikByKondukterKId;
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 83 | @ManyToOne
|
---|
| 84 | @JoinColumn(name = "inl_id", referencedColumnName = "inl_id")
|
---|
| 85 | public Instancanalinija getInstancanalinijaByInlId() {
|
---|
| 86 | return instancanalinijaByInlId;
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | public void setInstancanalinijaByInlId(Instancanalinija instancanalinijaByInlId) {
|
---|
| 90 | this.instancanalinijaByInlId = instancanalinijaByInlId;
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 | @OneToMany(mappedBy = "kontroliByKontrolaId")
|
---|
| 94 | public Collection<Kazna> getKaznasByKontrolaId() {
|
---|
| 95 | return kaznasByKontrolaId;
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | public void setKaznasByKontrolaId(Collection<Kazna> kaznasByKontrolaId) {
|
---|
| 99 | this.kaznasByKontrolaId = kaznasByKontrolaId;
|
---|
| 100 | }
|
---|
| 101 | }
|
---|