source: src/main/java/com/example/model/Event.java

Last change on this file was a51a591, checked in by colovik <j.colovik@…>, 14 months ago

final

  • Property mode set to 100644
File size: 3.1 KB
Line 
1package com.example.model;
2
3import com.example.model.Enumerations.Status;
4import lombok.Getter;
5import lombok.Setter;
6
7import javax.persistence.*;
8import java.time.LocalDate;
9import java.util.List;
10
11@Getter
12@Setter
13@Entity
14@Table(name = "nastani")
15public class Event {
16
17 @Id
18 @Column(name = "nastan_id")
19 @GeneratedValue(strategy = GenerationType.IDENTITY)
20 Integer id;
21
22 @Enumerated(EnumType.STRING)
23 Status status;
24
25 @Column(name = "vreme")
26 String time;
27 @Column(name = "tip")
28 String type;
29
30 @Column(name = "datum")
31 LocalDate date;
32
33 @Column(name = "opis")
34 String description;
35
36 @ManyToOne
37 @JoinColumn(name = "adresa")
38 Location location;
39
40 @ManyToOne
41 @JoinColumn(name = "korisnik_id_admini")
42 Admin admin;
43
44 @ManyToOne
45 @JoinColumn(name = "korisnik_id_klienti")
46 Client client;
47
48 @ManyToMany
49 @JoinTable(name = "bend_sviri_nastan",
50 joinColumns = @JoinColumn(name = "nastan_id"),
51 inverseJoinColumns = @JoinColumn(name = "korisnik_id"))
52// @ToString.Exclude
53 List<Band> bandList;
54
55 @ManyToMany
56 @JoinTable(name = "fotograf_slika_nastan",
57 joinColumns = @JoinColumn(name = "nastan_id"),
58 inverseJoinColumns = @JoinColumn(name = "korisnik_id"))
59// @ToString.Exclude
60 List<Photographer> photographerList;
61
62 @ManyToMany
63 @JoinTable(name = "kelner_raboti_na_nastan",
64 joinColumns = @JoinColumn(name = "nastan_id"),
65 inverseJoinColumns = @JoinColumn(name = "korisnik_id"))
66// @ToString.Exclude
67 List<Waiter> waiterList;
68
69 @ManyToMany
70 @JoinTable(name = "ketering_rezervira_nastan",
71 joinColumns = @JoinColumn(name = "nastan_id"),
72 inverseJoinColumns = @JoinColumn(name = "korisnik_id"))
73// @ToString.Exclude
74 List<Catering> cateringList;
75
76 public Event(String time, LocalDate date, Location location, String type,
77 String description, Client client, List<Band> bandList,
78 List<Catering> cateringList,
79 List<Photographer> photographerList, Admin admin
80 ) {
81 this.time = time;
82 this.date = date;
83 this.location = location;
84 this.type = type;
85 this.description = description;
86 this.status = Status.CREATED;
87 this.client = client;
88 this.bandList = bandList;
89 this.cateringList=cateringList;
90 this.photographerList=photographerList;
91 this.admin = admin;
92 }
93
94
95
96 public Event() {
97 }
98
99 @Override
100 public String toString() {
101 return "Event{" +
102 "id=" + id +
103 ", status=" + status +
104 ", time='" + time + '\'' +
105 ", type='" + type + '\'' +
106 ", date=" + date +
107 ", description='" + description + '\'' +
108 ", location=" + location.toString() +
109 ", admin=" + admin.toString() +
110 ", client=" + client.toString() +
111 ", bandList=" + bandList +
112 ", photographerList=" + photographerList +
113 ", waiterList=" + waiterList +
114 ", cateringList=" + cateringList +
115 '}';
116 }
117}
Note: See TracBrowser for help on using the repository browser.