source: phonelux-backend/src/main/java/finki/it/phoneluxbackend/entities/PhoneOffer.java

Last change on this file was ffd50db, checked in by Marko <Marko@…>, 2 years ago

Added few methods in PhoneOffer service

  • Property mode set to 100644
File size: 6.0 KB
Line 
1package finki.it.phoneluxbackend.entities;
2
3import com.fasterxml.jackson.annotation.JsonIgnore;
4import lombok.*;
5
6import javax.persistence.*;
7import java.util.ArrayList;
8import java.util.Date;
9import java.util.List;
10
11@AllArgsConstructor
12@NoArgsConstructor
13@Getter
14@Setter
15@ToString
16@EqualsAndHashCode
17@Entity(name = "PhoneOffer")
18@Table(name = "phone_offers")
19public class PhoneOffer {
20 @Id
21 @Column(name = "offer_id")
22 @GeneratedValue(strategy=GenerationType.IDENTITY)
23 private Long id;
24
25 @Column(name = "offer_shop")
26 private String offer_shop;
27
28 @Column(name = "offer_name")
29 private String offer_name;
30
31 @Column(name = "price")
32 private Integer price;
33
34 @Column(name = "ram_memory")
35 private String ram_memory;
36
37 @Column(name = "rom_memory")
38 private String rom_memory;
39
40 @Column(name = "color")
41 private String color;
42
43 @Column(name = "front_camera")
44 private String front_camera;
45
46 @Column(name = "back_camera")
47 private String back_camera;
48
49 @Column(name = "chipset")
50 private String chipset;
51
52 @Column(name = "battery")
53 private String battery;
54
55 @Column(name = "operating_system")
56 private String operating_system;
57
58 @Column(name = "cpu")
59 private String cpu;
60
61 @Column(name = "image_url")
62 private String image_url;
63
64 @Column(name = "offer_url")
65 private String offer_url;
66
67 @Column(name = "last_updated")
68 private Date last_updated;
69
70 @Column(name = "is_validated")
71 private Boolean is_validated;
72
73 @Column(name = "offer_description")
74 private String offer_description;
75
76 @Column(name = "offer_shop_code")
77 private String offer_shop_code;
78
79 @ManyToMany(mappedBy = "favouriteOffers")
80 @JsonIgnore
81 private List<User> users = new ArrayList<User>();
82
83 @ManyToOne(fetch = FetchType.LAZY)
84 @JoinColumn(name = "phone_id", referencedColumnName = "id")
85 @JsonIgnore
86 private Phone phone;
87
88 public PhoneOffer(String offer_shop, String offer_name,
89 Integer price, String ram_memory,
90 String rom_memory, String color,
91 String front_camera, String back_camera,
92 String chipset, String battery,
93 String operating_system, String cpu,
94 String image_url, String offer_url,
95 Date last_updated, Boolean is_validated,
96 String offer_description, String offer_shop_code, Phone phone) {
97 this.offer_shop = offer_shop;
98 this.offer_name = offer_name;
99 this.price = price;
100 this.ram_memory = ram_memory;
101 this.rom_memory = rom_memory;
102 this.color = color;
103 this.front_camera = front_camera;
104 this.back_camera = back_camera;
105 this.chipset = chipset;
106 this.battery = battery;
107 this.operating_system = operating_system;
108 this.cpu = cpu;
109 this.image_url = image_url;
110 this.offer_url = offer_url;
111 this.last_updated = last_updated;
112 this.is_validated = is_validated;
113 this.offer_description = offer_description;
114 this.offer_shop_code = offer_shop_code;
115 this.phone = phone;
116 }
117
118 public PhoneOffer(String offer_shop,
119 String offer_name,
120 Integer price,
121 String ram_memory,
122 String rom_memory,
123 String color,
124 String front_camera,
125 String back_camera,
126 String chipset,
127 String battery,
128 String operating_system,
129 String cpu,
130 String image_url,
131 String offer_url,
132 Date last_updated,
133 Boolean is_validated,
134 String offer_description,
135 String offer_shop_code) {
136 this.offer_shop = offer_shop;
137 this.offer_name = offer_name;
138 this.price = price;
139 this.ram_memory = ram_memory;
140 this.rom_memory = rom_memory;
141 this.color = color;
142 this.front_camera = front_camera;
143 this.back_camera = back_camera;
144 this.chipset = chipset;
145 this.battery = battery;
146 this.operating_system = operating_system;
147 this.cpu = cpu;
148 this.image_url = image_url;
149 this.offer_url = offer_url;
150 this.last_updated = last_updated;
151 this.is_validated = is_validated;
152 this.offer_description = offer_description;
153 this.offer_shop_code = offer_shop_code;
154 }
155
156 public PhoneOffer(Long id,
157 String offer_shop,
158 String offer_name,
159 Integer price,
160 String ram_memory,
161 String rom_memory,
162 String color,
163 String front_camera,
164 String back_camera,
165 String chipset,
166 String battery,
167 String operating_system,
168 String cpu,
169 String image_url,
170 String offer_url,
171 Date last_updated,
172 Boolean is_validated,
173 String offer_description,
174 String offer_shop_code) {
175 this.id = id;
176 this.offer_shop = offer_shop;
177 this.offer_name = offer_name;
178 this.price = price;
179 this.ram_memory = ram_memory;
180 this.rom_memory = rom_memory;
181 this.color = color;
182 this.front_camera = front_camera;
183 this.back_camera = back_camera;
184 this.chipset = chipset;
185 this.battery = battery;
186 this.operating_system = operating_system;
187 this.cpu = cpu;
188 this.image_url = image_url;
189 this.offer_url = offer_url;
190 this.last_updated = last_updated;
191 this.is_validated = is_validated;
192 this.offer_description = offer_description;
193 this.offer_shop_code = offer_shop_code;
194 }
195}
Note: See TracBrowser for help on using the repository browser.